@agentuity/cli 0.1.9 → 0.1.11

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 (323) hide show
  1. package/README.md +2 -2
  2. package/bin/cli.ts +8 -0
  3. package/dist/cache/index.d.ts +2 -0
  4. package/dist/cache/index.d.ts.map +1 -0
  5. package/dist/cache/index.js +2 -0
  6. package/dist/cache/index.js.map +1 -0
  7. package/dist/cache/resource-region.d.ts +46 -0
  8. package/dist/cache/resource-region.d.ts.map +1 -0
  9. package/dist/cache/resource-region.js +115 -0
  10. package/dist/cache/resource-region.js.map +1 -0
  11. package/dist/cli.d.ts.map +1 -1
  12. package/dist/cli.js +44 -32
  13. package/dist/cli.js.map +1 -1
  14. package/dist/cmd/ai/capabilities/show.d.ts.map +1 -1
  15. package/dist/cmd/ai/capabilities/show.js +12 -15
  16. package/dist/cmd/ai/capabilities/show.js.map +1 -1
  17. package/dist/cmd/ai/prompt/llm.js +5 -5
  18. package/dist/cmd/ai/prompt/llm.js.map +1 -1
  19. package/dist/cmd/auth/logout.d.ts.map +1 -1
  20. package/dist/cmd/auth/logout.js +5 -2
  21. package/dist/cmd/auth/logout.js.map +1 -1
  22. package/dist/cmd/build/ast.d.ts.map +1 -1
  23. package/dist/cmd/build/ast.js +87 -1
  24. package/dist/cmd/build/ast.js.map +1 -1
  25. package/dist/cmd/build/vite/vite-asset-server-config.d.ts.map +1 -1
  26. package/dist/cmd/build/vite/vite-asset-server-config.js +8 -3
  27. package/dist/cmd/build/vite/vite-asset-server-config.js.map +1 -1
  28. package/dist/cmd/build/vite/vite-asset-server.d.ts.map +1 -1
  29. package/dist/cmd/build/vite/vite-asset-server.js +5 -3
  30. package/dist/cmd/build/vite/vite-asset-server.js.map +1 -1
  31. package/dist/cmd/cloud/db/delete.d.ts.map +1 -1
  32. package/dist/cmd/cloud/db/delete.js +69 -11
  33. package/dist/cmd/cloud/db/delete.js.map +1 -1
  34. package/dist/cmd/cloud/db/get.d.ts.map +1 -1
  35. package/dist/cmd/cloud/db/get.js +23 -7
  36. package/dist/cmd/cloud/db/get.js.map +1 -1
  37. package/dist/cmd/cloud/db/list.d.ts.map +1 -1
  38. package/dist/cmd/cloud/db/list.js +15 -7
  39. package/dist/cmd/cloud/db/list.js.map +1 -1
  40. package/dist/cmd/cloud/db/logs.d.ts.map +1 -1
  41. package/dist/cmd/cloud/db/logs.js +24 -4
  42. package/dist/cmd/cloud/db/logs.js.map +1 -1
  43. package/dist/cmd/cloud/deploy.d.ts.map +1 -1
  44. package/dist/cmd/cloud/deploy.js +38 -0
  45. package/dist/cmd/cloud/deploy.js.map +1 -1
  46. package/dist/cmd/cloud/env/delete.d.ts.map +1 -1
  47. package/dist/cmd/cloud/env/delete.js +30 -13
  48. package/dist/cmd/cloud/env/delete.js.map +1 -1
  49. package/dist/cmd/cloud/env/get.d.ts.map +1 -1
  50. package/dist/cmd/cloud/env/get.js +27 -30
  51. package/dist/cmd/cloud/env/get.js.map +1 -1
  52. package/dist/cmd/cloud/env/import.d.ts.map +1 -1
  53. package/dist/cmd/cloud/env/import.js +41 -48
  54. package/dist/cmd/cloud/env/import.js.map +1 -1
  55. package/dist/cmd/cloud/env/index.d.ts.map +1 -1
  56. package/dist/cmd/cloud/env/index.js +6 -2
  57. package/dist/cmd/cloud/env/index.js.map +1 -1
  58. package/dist/cmd/cloud/env/list.d.ts.map +1 -1
  59. package/dist/cmd/cloud/env/list.js +51 -28
  60. package/dist/cmd/cloud/env/list.js.map +1 -1
  61. package/dist/cmd/cloud/env/pull.d.ts.map +1 -1
  62. package/dist/cmd/cloud/env/pull.js +3 -3
  63. package/dist/cmd/cloud/env/pull.js.map +1 -1
  64. package/dist/cmd/cloud/env/push.d.ts.map +1 -1
  65. package/dist/cmd/cloud/env/push.js +31 -11
  66. package/dist/cmd/cloud/env/push.js.map +1 -1
  67. package/dist/cmd/cloud/env/set.d.ts.map +1 -1
  68. package/dist/cmd/cloud/env/set.js +41 -26
  69. package/dist/cmd/cloud/env/set.js.map +1 -1
  70. package/dist/cmd/cloud/index.d.ts.map +1 -1
  71. package/dist/cmd/cloud/index.js +0 -2
  72. package/dist/cmd/cloud/index.js.map +1 -1
  73. package/dist/cmd/cloud/region-lookup.d.ts +18 -0
  74. package/dist/cmd/cloud/region-lookup.d.ts.map +1 -0
  75. package/dist/cmd/cloud/region-lookup.js +64 -0
  76. package/dist/cmd/cloud/region-lookup.js.map +1 -0
  77. package/dist/cmd/cloud/sandbox/cp.d.ts.map +1 -1
  78. package/dist/cmd/cloud/sandbox/cp.js +5 -3
  79. package/dist/cmd/cloud/sandbox/cp.js.map +1 -1
  80. package/dist/cmd/cloud/sandbox/create.d.ts.map +1 -1
  81. package/dist/cmd/cloud/sandbox/create.js +43 -6
  82. package/dist/cmd/cloud/sandbox/create.js.map +1 -1
  83. package/dist/cmd/cloud/sandbox/delete.d.ts.map +1 -1
  84. package/dist/cmd/cloud/sandbox/delete.js +5 -3
  85. package/dist/cmd/cloud/sandbox/delete.js.map +1 -1
  86. package/dist/cmd/cloud/sandbox/download.d.ts.map +1 -1
  87. package/dist/cmd/cloud/sandbox/download.js +4 -3
  88. package/dist/cmd/cloud/sandbox/download.js.map +1 -1
  89. package/dist/cmd/cloud/sandbox/env.d.ts.map +1 -1
  90. package/dist/cmd/cloud/sandbox/env.js +4 -3
  91. package/dist/cmd/cloud/sandbox/env.js.map +1 -1
  92. package/dist/cmd/cloud/sandbox/exec.d.ts.map +1 -1
  93. package/dist/cmd/cloud/sandbox/exec.js +4 -3
  94. package/dist/cmd/cloud/sandbox/exec.js.map +1 -1
  95. package/dist/cmd/cloud/sandbox/execution/get.js +4 -4
  96. package/dist/cmd/cloud/sandbox/execution/get.js.map +1 -1
  97. package/dist/cmd/cloud/sandbox/execution/index.js +1 -1
  98. package/dist/cmd/cloud/sandbox/execution/index.js.map +1 -1
  99. package/dist/cmd/cloud/sandbox/execution/list.d.ts.map +1 -1
  100. package/dist/cmd/cloud/sandbox/execution/list.js +4 -3
  101. package/dist/cmd/cloud/sandbox/execution/list.js.map +1 -1
  102. package/dist/cmd/cloud/sandbox/get.d.ts.map +1 -1
  103. package/dist/cmd/cloud/sandbox/get.js +9 -4
  104. package/dist/cmd/cloud/sandbox/get.js.map +1 -1
  105. package/dist/cmd/cloud/sandbox/index.js +1 -1
  106. package/dist/cmd/cloud/sandbox/index.js.map +1 -1
  107. package/dist/cmd/cloud/sandbox/list.js +4 -4
  108. package/dist/cmd/cloud/sandbox/list.js.map +1 -1
  109. package/dist/cmd/cloud/sandbox/ls.d.ts.map +1 -1
  110. package/dist/cmd/cloud/sandbox/ls.js +4 -3
  111. package/dist/cmd/cloud/sandbox/ls.js.map +1 -1
  112. package/dist/cmd/cloud/sandbox/mkdir.d.ts.map +1 -1
  113. package/dist/cmd/cloud/sandbox/mkdir.js +4 -3
  114. package/dist/cmd/cloud/sandbox/mkdir.js.map +1 -1
  115. package/dist/cmd/cloud/sandbox/rm.d.ts.map +1 -1
  116. package/dist/cmd/cloud/sandbox/rm.js +4 -3
  117. package/dist/cmd/cloud/sandbox/rm.js.map +1 -1
  118. package/dist/cmd/cloud/sandbox/rmdir.d.ts.map +1 -1
  119. package/dist/cmd/cloud/sandbox/rmdir.js +4 -3
  120. package/dist/cmd/cloud/sandbox/rmdir.js.map +1 -1
  121. package/dist/cmd/cloud/sandbox/run.d.ts.map +1 -1
  122. package/dist/cmd/cloud/sandbox/run.js +44 -6
  123. package/dist/cmd/cloud/sandbox/run.js.map +1 -1
  124. package/dist/cmd/cloud/sandbox/runtime/index.js +1 -1
  125. package/dist/cmd/cloud/sandbox/runtime/index.js.map +1 -1
  126. package/dist/cmd/cloud/sandbox/runtime/list.js +4 -4
  127. package/dist/cmd/cloud/sandbox/runtime/list.js.map +1 -1
  128. package/dist/cmd/cloud/sandbox/snapshot/build.d.ts +5 -0
  129. package/dist/cmd/cloud/sandbox/snapshot/build.d.ts.map +1 -0
  130. package/dist/cmd/cloud/sandbox/snapshot/build.js +574 -0
  131. package/dist/cmd/cloud/sandbox/snapshot/build.js.map +1 -0
  132. package/dist/cmd/cloud/sandbox/snapshot/create.d.ts.map +1 -1
  133. package/dist/cmd/cloud/sandbox/snapshot/create.js +5 -3
  134. package/dist/cmd/cloud/sandbox/snapshot/create.js.map +1 -1
  135. package/dist/cmd/cloud/sandbox/snapshot/delete.js +4 -4
  136. package/dist/cmd/cloud/sandbox/snapshot/delete.js.map +1 -1
  137. package/dist/cmd/cloud/sandbox/snapshot/generate.d.ts +3 -0
  138. package/dist/cmd/cloud/sandbox/snapshot/generate.d.ts.map +1 -0
  139. package/dist/cmd/cloud/sandbox/snapshot/generate.js +127 -0
  140. package/dist/cmd/cloud/sandbox/snapshot/generate.js.map +1 -0
  141. package/dist/cmd/cloud/sandbox/snapshot/get.d.ts.map +1 -1
  142. package/dist/cmd/cloud/sandbox/snapshot/get.js +20 -4
  143. package/dist/cmd/cloud/sandbox/snapshot/get.js.map +1 -1
  144. package/dist/cmd/cloud/sandbox/snapshot/index.d.ts.map +1 -1
  145. package/dist/cmd/cloud/sandbox/snapshot/index.js +20 -2
  146. package/dist/cmd/cloud/sandbox/snapshot/index.js.map +1 -1
  147. package/dist/cmd/cloud/sandbox/snapshot/list.js +4 -4
  148. package/dist/cmd/cloud/sandbox/snapshot/list.js.map +1 -1
  149. package/dist/cmd/cloud/sandbox/snapshot/tag.d.ts.map +1 -1
  150. package/dist/cmd/cloud/sandbox/snapshot/tag.js +4 -4
  151. package/dist/cmd/cloud/sandbox/snapshot/tag.js.map +1 -1
  152. package/dist/cmd/cloud/sandbox/upload.d.ts.map +1 -1
  153. package/dist/cmd/cloud/sandbox/upload.js +4 -3
  154. package/dist/cmd/cloud/sandbox/upload.js.map +1 -1
  155. package/dist/cmd/cloud/sandbox/util.d.ts +13 -0
  156. package/dist/cmd/cloud/sandbox/util.d.ts.map +1 -1
  157. package/dist/cmd/cloud/sandbox/util.js +40 -1
  158. package/dist/cmd/cloud/sandbox/util.js.map +1 -1
  159. package/dist/cmd/cloud/scp/download.d.ts.map +1 -1
  160. package/dist/cmd/cloud/scp/download.js +6 -2
  161. package/dist/cmd/cloud/scp/download.js.map +1 -1
  162. package/dist/cmd/cloud/scp/upload.d.ts.map +1 -1
  163. package/dist/cmd/cloud/scp/upload.js +6 -2
  164. package/dist/cmd/cloud/scp/upload.js.map +1 -1
  165. package/dist/cmd/cloud/session/get.js +4 -4
  166. package/dist/cmd/cloud/session/get.js.map +1 -1
  167. package/dist/cmd/cloud/session/list.js +4 -4
  168. package/dist/cmd/cloud/session/list.js.map +1 -1
  169. package/dist/cmd/cloud/ssh.d.ts.map +1 -1
  170. package/dist/cmd/cloud/ssh.js +7 -2
  171. package/dist/cmd/cloud/ssh.js.map +1 -1
  172. package/dist/cmd/cloud/storage/delete.d.ts.map +1 -1
  173. package/dist/cmd/cloud/storage/delete.js +46 -10
  174. package/dist/cmd/cloud/storage/delete.js.map +1 -1
  175. package/dist/cmd/cloud/storage/download.d.ts.map +1 -1
  176. package/dist/cmd/cloud/storage/download.js +19 -6
  177. package/dist/cmd/cloud/storage/download.js.map +1 -1
  178. package/dist/cmd/cloud/storage/get.d.ts.map +1 -1
  179. package/dist/cmd/cloud/storage/get.js +19 -6
  180. package/dist/cmd/cloud/storage/get.js.map +1 -1
  181. package/dist/cmd/cloud/storage/list.d.ts.map +1 -1
  182. package/dist/cmd/cloud/storage/list.js +17 -7
  183. package/dist/cmd/cloud/storage/list.js.map +1 -1
  184. package/dist/cmd/cloud/storage/upload.d.ts.map +1 -1
  185. package/dist/cmd/cloud/storage/upload.js +19 -6
  186. package/dist/cmd/cloud/storage/upload.js.map +1 -1
  187. package/dist/cmd/cloud/thread/delete.js +4 -4
  188. package/dist/cmd/cloud/thread/delete.js.map +1 -1
  189. package/dist/cmd/cloud/thread/get.js +4 -4
  190. package/dist/cmd/cloud/thread/get.js.map +1 -1
  191. package/dist/cmd/cloud/thread/list.js +4 -4
  192. package/dist/cmd/cloud/thread/list.js.map +1 -1
  193. package/dist/cmd/project/auth/init.d.ts.map +1 -1
  194. package/dist/cmd/project/auth/init.js +6 -3
  195. package/dist/cmd/project/auth/init.js.map +1 -1
  196. package/dist/cmd/project/auth/shared.d.ts +6 -2
  197. package/dist/cmd/project/auth/shared.d.ts.map +1 -1
  198. package/dist/cmd/project/auth/shared.js +41 -13
  199. package/dist/cmd/project/auth/shared.js.map +1 -1
  200. package/dist/config.d.ts +37 -0
  201. package/dist/config.d.ts.map +1 -1
  202. package/dist/config.js +55 -8
  203. package/dist/config.js.map +1 -1
  204. package/dist/env-util.d.ts +25 -2
  205. package/dist/env-util.d.ts.map +1 -1
  206. package/dist/env-util.js +44 -4
  207. package/dist/env-util.js.map +1 -1
  208. package/dist/utils/apt-validator.d.ts +20 -0
  209. package/dist/utils/apt-validator.d.ts.map +1 -0
  210. package/dist/utils/apt-validator.js +157 -0
  211. package/dist/utils/apt-validator.js.map +1 -0
  212. package/package.json +6 -6
  213. package/src/cache/index.ts +11 -0
  214. package/src/cache/resource-region.ts +183 -0
  215. package/src/cli.ts +47 -38
  216. package/src/cmd/ai/capabilities/show.ts +12 -15
  217. package/src/cmd/ai/prompt/llm.ts +5 -5
  218. package/src/cmd/auth/logout.ts +5 -2
  219. package/src/cmd/build/ast.ts +160 -1
  220. package/src/cmd/build/vite/vite-asset-server-config.ts +7 -3
  221. package/src/cmd/build/vite/vite-asset-server.ts +6 -3
  222. package/src/cmd/cloud/db/delete.ts +83 -11
  223. package/src/cmd/cloud/db/get.ts +29 -7
  224. package/src/cmd/cloud/db/list.ts +16 -7
  225. package/src/cmd/cloud/db/logs.ts +33 -4
  226. package/src/cmd/cloud/deploy.ts +49 -0
  227. package/src/cmd/cloud/env/delete.ts +36 -12
  228. package/src/cmd/cloud/env/get.ts +28 -27
  229. package/src/cmd/cloud/env/import.ts +43 -56
  230. package/src/cmd/cloud/env/index.ts +6 -2
  231. package/src/cmd/cloud/env/list.ts +57 -30
  232. package/src/cmd/cloud/env/pull.ts +9 -3
  233. package/src/cmd/cloud/env/push.ts +44 -11
  234. package/src/cmd/cloud/env/set.ts +49 -30
  235. package/src/cmd/cloud/index.ts +0 -2
  236. package/src/cmd/cloud/region-lookup.ts +89 -0
  237. package/src/cmd/cloud/sandbox/cp.ts +5 -3
  238. package/src/cmd/cloud/sandbox/create.ts +50 -6
  239. package/src/cmd/cloud/sandbox/delete.ts +6 -3
  240. package/src/cmd/cloud/sandbox/download.ts +4 -3
  241. package/src/cmd/cloud/sandbox/env.ts +4 -3
  242. package/src/cmd/cloud/sandbox/exec.ts +4 -3
  243. package/src/cmd/cloud/sandbox/execution/get.ts +4 -4
  244. package/src/cmd/cloud/sandbox/execution/index.ts +1 -1
  245. package/src/cmd/cloud/sandbox/execution/list.ts +4 -3
  246. package/src/cmd/cloud/sandbox/get.ts +10 -4
  247. package/src/cmd/cloud/sandbox/index.ts +1 -1
  248. package/src/cmd/cloud/sandbox/list.ts +4 -4
  249. package/src/cmd/cloud/sandbox/ls.ts +4 -3
  250. package/src/cmd/cloud/sandbox/mkdir.ts +4 -3
  251. package/src/cmd/cloud/sandbox/rm.ts +4 -3
  252. package/src/cmd/cloud/sandbox/rmdir.ts +4 -3
  253. package/src/cmd/cloud/sandbox/run.ts +51 -6
  254. package/src/cmd/cloud/sandbox/runtime/index.ts +1 -1
  255. package/src/cmd/cloud/sandbox/runtime/list.ts +4 -4
  256. package/src/cmd/cloud/sandbox/snapshot/build.ts +696 -0
  257. package/src/cmd/cloud/sandbox/snapshot/create.ts +11 -5
  258. package/src/cmd/cloud/sandbox/snapshot/delete.ts +4 -4
  259. package/src/cmd/cloud/sandbox/snapshot/generate.ts +134 -0
  260. package/src/cmd/cloud/sandbox/snapshot/get.ts +23 -4
  261. package/src/cmd/cloud/sandbox/snapshot/index.ts +20 -2
  262. package/src/cmd/cloud/sandbox/snapshot/list.ts +4 -4
  263. package/src/cmd/cloud/sandbox/snapshot/tag.ts +7 -5
  264. package/src/cmd/cloud/sandbox/upload.ts +4 -3
  265. package/src/cmd/cloud/sandbox/util.ts +60 -1
  266. package/src/cmd/cloud/scp/download.ts +14 -2
  267. package/src/cmd/cloud/scp/upload.ts +14 -2
  268. package/src/cmd/cloud/session/get.ts +4 -4
  269. package/src/cmd/cloud/session/list.ts +4 -4
  270. package/src/cmd/cloud/ssh.ts +15 -2
  271. package/src/cmd/cloud/storage/delete.ts +61 -10
  272. package/src/cmd/cloud/storage/download.ts +31 -6
  273. package/src/cmd/cloud/storage/get.ts +31 -6
  274. package/src/cmd/cloud/storage/list.ts +18 -7
  275. package/src/cmd/cloud/storage/upload.ts +31 -6
  276. package/src/cmd/cloud/thread/delete.ts +4 -4
  277. package/src/cmd/cloud/thread/get.ts +4 -4
  278. package/src/cmd/cloud/thread/list.ts +4 -4
  279. package/src/cmd/project/auth/init.ts +7 -3
  280. package/src/cmd/project/auth/shared.ts +53 -14
  281. package/src/config.ts +69 -8
  282. package/src/env-util.ts +50 -5
  283. package/src/utils/apt-validator.ts +215 -0
  284. package/dist/cmd/cloud/secret/delete.d.ts +0 -2
  285. package/dist/cmd/cloud/secret/delete.d.ts.map +0 -1
  286. package/dist/cmd/cloud/secret/delete.js +0 -53
  287. package/dist/cmd/cloud/secret/delete.js.map +0 -1
  288. package/dist/cmd/cloud/secret/get.d.ts +0 -2
  289. package/dist/cmd/cloud/secret/get.d.ts.map +0 -1
  290. package/dist/cmd/cloud/secret/get.js +0 -73
  291. package/dist/cmd/cloud/secret/get.js.map +0 -1
  292. package/dist/cmd/cloud/secret/import.d.ts +0 -2
  293. package/dist/cmd/cloud/secret/import.d.ts.map +0 -1
  294. package/dist/cmd/cloud/secret/import.js +0 -91
  295. package/dist/cmd/cloud/secret/import.js.map +0 -1
  296. package/dist/cmd/cloud/secret/index.d.ts +0 -3
  297. package/dist/cmd/cloud/secret/index.d.ts.map +0 -1
  298. package/dist/cmd/cloud/secret/index.js +0 -33
  299. package/dist/cmd/cloud/secret/index.js.map +0 -1
  300. package/dist/cmd/cloud/secret/list.d.ts +0 -2
  301. package/dist/cmd/cloud/secret/list.d.ts.map +0 -1
  302. package/dist/cmd/cloud/secret/list.js +0 -65
  303. package/dist/cmd/cloud/secret/list.js.map +0 -1
  304. package/dist/cmd/cloud/secret/pull.d.ts +0 -2
  305. package/dist/cmd/cloud/secret/pull.d.ts.map +0 -1
  306. package/dist/cmd/cloud/secret/pull.js +0 -82
  307. package/dist/cmd/cloud/secret/pull.js.map +0 -1
  308. package/dist/cmd/cloud/secret/push.d.ts +0 -2
  309. package/dist/cmd/cloud/secret/push.d.ts.map +0 -1
  310. package/dist/cmd/cloud/secret/push.js +0 -61
  311. package/dist/cmd/cloud/secret/push.js.map +0 -1
  312. package/dist/cmd/cloud/secret/set.d.ts +0 -2
  313. package/dist/cmd/cloud/secret/set.d.ts.map +0 -1
  314. package/dist/cmd/cloud/secret/set.js +0 -63
  315. package/dist/cmd/cloud/secret/set.js.map +0 -1
  316. package/src/cmd/cloud/secret/delete.ts +0 -65
  317. package/src/cmd/cloud/secret/get.ts +0 -77
  318. package/src/cmd/cloud/secret/import.ts +0 -110
  319. package/src/cmd/cloud/secret/index.ts +0 -33
  320. package/src/cmd/cloud/secret/list.ts +0 -70
  321. package/src/cmd/cloud/secret/pull.ts +0 -92
  322. package/src/cmd/cloud/secret/push.ts +0 -69
  323. package/src/cmd/cloud/secret/set.ts +0 -76
@@ -2,18 +2,26 @@ import { z } from 'zod';
2
2
  import { createSubcommand } from '../../../types';
3
3
  import * as tui from '../../../tui';
4
4
  import { projectEnvUpdate } from '@agentuity/server';
5
- import { findExistingEnvFile, readEnvFile, filterAgentuitySdkKeys } from '../../../env-util';
5
+ import {
6
+ findExistingEnvFile,
7
+ readEnvFile,
8
+ filterAgentuitySdkKeys,
9
+ splitEnvAndSecrets,
10
+ validateNoPublicSecrets,
11
+ } from '../../../env-util';
6
12
  import { getCommand } from '../../../command-prefix';
7
13
 
8
14
  const EnvPushResponseSchema = z.object({
9
15
  success: z.boolean().describe('Whether push succeeded'),
10
16
  pushed: z.number().describe('Number of items pushed'),
17
+ envCount: z.number().describe('Number of env vars pushed'),
18
+ secretCount: z.number().describe('Number of secrets pushed'),
11
19
  source: z.string().describe('Source file path'),
12
20
  });
13
21
 
14
22
  export const pushSubcommand = createSubcommand({
15
23
  name: 'push',
16
- description: 'Push environment variables from local .env file to cloud',
24
+ description: 'Push environment variables and secrets from local .env file to cloud',
17
25
  tags: [
18
26
  'mutating',
19
27
  'updates-resource',
@@ -23,7 +31,7 @@ export const pushSubcommand = createSubcommand({
23
31
  'requires-project',
24
32
  ],
25
33
  idempotent: true,
26
- examples: [{ command: getCommand('env push'), description: 'Run push command' }],
34
+ examples: [{ command: getCommand('env push'), description: 'Push all variables to cloud' }],
27
35
  requires: { auth: true, project: true, apiClient: true },
28
36
  prerequisites: ['env set'],
29
37
  schema: {
@@ -33,36 +41,61 @@ export const pushSubcommand = createSubcommand({
33
41
  async handler(ctx) {
34
42
  const { apiClient, project, projectDir } = ctx;
35
43
 
36
- // Read local env file (prefer .env)
44
+ // Read local env file
37
45
  const envFilePath = await findExistingEnvFile(projectDir);
38
46
  const localEnv = await readEnvFile(envFilePath);
39
47
 
40
- // Filter out AGENTUITY_ prefixed keys (don't push SDK keys)
48
+ // Filter out reserved AGENTUITY_ prefixed keys
41
49
  const filteredEnv = filterAgentuitySdkKeys(localEnv);
42
50
 
43
51
  if (Object.keys(filteredEnv).length === 0) {
44
- tui.warning('No environment variables to push');
52
+ tui.warning('No variables to push');
45
53
  return {
46
54
  success: false,
47
55
  pushed: 0,
56
+ envCount: 0,
57
+ secretCount: 0,
48
58
  source: envFilePath,
49
59
  };
50
60
  }
51
61
 
62
+ // Split into env and secrets based on key naming conventions
63
+ const { env, secrets } = splitEnvAndSecrets(filteredEnv);
64
+
65
+ // Check for any public vars that would have been treated as secrets
66
+ const publicSecretKeys = validateNoPublicSecrets(secrets);
67
+ if (publicSecretKeys.length > 0) {
68
+ tui.warning(
69
+ `Moving public variables to env: ${publicSecretKeys.join(', ')} (these are exposed to the frontend)`
70
+ );
71
+ for (const key of publicSecretKeys) {
72
+ delete secrets[key];
73
+ env[key] = filteredEnv[key];
74
+ }
75
+ }
76
+
52
77
  // Push to cloud
53
- await tui.spinner('Pushing environment variables to cloud', () => {
78
+ await tui.spinner('Pushing variables to cloud', () => {
54
79
  return projectEnvUpdate(apiClient, {
55
80
  id: project.projectId,
56
- env: filteredEnv,
81
+ env,
82
+ secrets,
57
83
  });
58
84
  });
59
85
 
60
- const count = Object.keys(filteredEnv).length;
61
- tui.success(`Pushed ${count} environment variable${count !== 1 ? 's' : ''} to cloud`);
86
+ const envCount = Object.keys(env).length;
87
+ const secretCount = Object.keys(secrets).length;
88
+ const totalCount = envCount + secretCount;
89
+
90
+ tui.success(
91
+ `Pushed ${totalCount} variable${totalCount !== 1 ? 's' : ''} to cloud (${envCount} env, ${secretCount} secret${secretCount !== 1 ? 's' : ''})`
92
+ );
62
93
 
63
94
  return {
64
95
  success: true,
65
- pushed: count,
96
+ pushed: totalCount,
97
+ envCount,
98
+ secretCount,
66
99
  source: envFilePath,
67
100
  };
68
101
  },
@@ -8,6 +8,9 @@ import {
8
8
  writeEnvFile,
9
9
  filterAgentuitySdkKeys,
10
10
  looksLikeSecret,
11
+ isReservedAgentuityKey,
12
+ isPublicVarKey,
13
+ PUBLIC_VAR_PREFIXES,
11
14
  } from '../../../env-util';
12
15
  import { getCommand } from '../../../command-prefix';
13
16
 
@@ -15,64 +18,77 @@ const EnvSetResponseSchema = z.object({
15
18
  success: z.boolean().describe('Whether the operation succeeded'),
16
19
  key: z.string().describe('Environment variable key'),
17
20
  path: z.string().describe('Local file path where env var was saved'),
21
+ secret: z.boolean().describe('Whether the value was stored as a secret'),
18
22
  });
19
23
 
20
24
  export const setSubcommand = createSubcommand({
21
25
  name: 'set',
22
- description: 'Set an environment variable',
26
+ description: 'Set an environment variable or secret',
23
27
  tags: ['mutating', 'updates-resource', 'slow', 'requires-auth', 'requires-project'],
24
28
  idempotent: true,
25
29
  requires: { auth: true, project: true, apiClient: true },
26
30
  examples: [
27
- { command: getCommand('env set NODE_ENV production'), description: 'Run production command' },
28
- { command: getCommand('env set PORT 3000'), description: 'Run 3000 command' },
29
- { command: getCommand('env set LOG_LEVEL debug'), description: 'Run debug command' },
31
+ {
32
+ command: getCommand('env set NODE_ENV production'),
33
+ description: 'Set environment variable',
34
+ },
35
+ { command: getCommand('env set PORT 3000'), description: 'Set port number' },
36
+ {
37
+ command: getCommand('env set API_KEY "sk_..." --secret'),
38
+ description: 'Set a secret value',
39
+ },
30
40
  ],
31
41
  schema: {
32
42
  args: z.object({
33
43
  key: z.string().describe('the environment variable key'),
34
44
  value: z.string().describe('the environment variable value'),
35
45
  }),
46
+ options: z.object({
47
+ secret: z
48
+ .boolean()
49
+ .default(false)
50
+ .describe('store as a secret (encrypted and masked in UI)'),
51
+ }),
36
52
  response: EnvSetResponseSchema,
37
53
  },
38
54
 
39
55
  async handler(ctx) {
40
- const { args, apiClient, project, projectDir } = ctx;
56
+ const { args, opts, apiClient, project, projectDir } = ctx;
57
+ let isSecret = opts?.secret ?? false;
58
+ const isPublic = isPublicVarKey(args.key);
41
59
 
42
- // Validate key doesn't start with AGENTUITY_
43
- if (args.key.startsWith('AGENTUITY_')) {
60
+ // Validate key doesn't start with reserved AGENTUITY_ prefix (except AGENTUITY_PUBLIC_)
61
+ if (isReservedAgentuityKey(args.key)) {
44
62
  tui.fatal('Cannot set AGENTUITY_ prefixed variables. These are reserved for system use.');
45
63
  }
46
64
 
47
- // Detect if this looks like a secret
48
- if (looksLikeSecret(args.key, args.value)) {
65
+ // Validate public vars cannot be secrets
66
+ if (isSecret && isPublic) {
67
+ tui.fatal(
68
+ `Cannot set public variables as secrets. Keys with prefixes (${PUBLIC_VAR_PREFIXES.join(', ')}) are exposed to the frontend.`
69
+ );
70
+ }
71
+
72
+ // Auto-detect if this looks like a secret and offer to store as secret
73
+ // Skip auto-detect for public vars since they can never be secrets
74
+ if (!isSecret && !isPublic && looksLikeSecret(args.key, args.value)) {
49
75
  tui.warning(`The variable '${args.key}' looks like it should be a secret.`);
50
- tui.info(`Secrets should be stored using: ${getCommand('secret set <key> <value>')}`);
51
- tui.info('This keeps them more secure and properly masked in the cloud.');
52
76
 
53
- const response = await tui.confirm(
54
- 'Do you still want to store this as a regular environment variable?',
55
- false
56
- );
77
+ const storeAsSecret = await tui.confirm('Store as a secret instead?', true);
57
78
 
58
- if (!response) {
59
- tui.info(
60
- `Cancelled. Use "${getCommand('secret set')}" to store this as a secret instead.`
61
- );
62
- return {
63
- success: false,
64
- key: args.key,
65
- path: '',
66
- };
79
+ if (storeAsSecret) {
80
+ isSecret = true;
67
81
  }
68
82
  }
69
83
 
70
84
  // Set in cloud
71
- await tui.spinner('Setting environment variable in cloud', () => {
72
- return projectEnvUpdate(apiClient, {
73
- id: project.projectId,
74
- env: { [args.key]: args.value },
75
- });
85
+ const updatePayload = isSecret
86
+ ? { id: project.projectId, secrets: { [args.key]: args.value } }
87
+ : { id: project.projectId, env: { [args.key]: args.value } };
88
+
89
+ const label = isSecret ? 'secret' : 'environment variable';
90
+ await tui.spinner(`Setting ${label} in cloud`, () => {
91
+ return projectEnvUpdate(apiClient, updatePayload);
76
92
  });
77
93
 
78
94
  // Update local .env file
@@ -84,12 +100,15 @@ export const setSubcommand = createSubcommand({
84
100
  const filteredEnv = filterAgentuitySdkKeys(currentEnv);
85
101
  await writeEnvFile(envFilePath, filteredEnv);
86
102
 
87
- tui.success(`Environment variable '${args.key}' set successfully (cloud + ${envFilePath})`);
103
+ tui.success(
104
+ `${isSecret ? 'Secret' : 'Environment variable'} '${args.key}' set successfully (cloud + ${envFilePath})`
105
+ );
88
106
 
89
107
  return {
90
108
  success: true,
91
109
  key: args.key,
92
110
  path: envFilePath,
111
+ secret: isSecret,
93
112
  };
94
113
  },
95
114
  });
@@ -11,7 +11,6 @@ import { deploymentCommand } from './deployment';
11
11
  import keyvalueCommand from './keyvalue';
12
12
  import { agentCommand } from './agent';
13
13
  import envCommand from './env';
14
- import secretCommand from './secret';
15
14
  import apikeyCommand from './apikey';
16
15
  import streamCommand from './stream';
17
16
  import vectorCommand from './vector';
@@ -34,7 +33,6 @@ export const command = createCommand({
34
33
  vectorCommand,
35
34
  sandboxCommand,
36
35
  envCommand,
37
- secretCommand,
38
36
  deploySubcommand,
39
37
  dbCommand,
40
38
  redisCommand,
@@ -0,0 +1,89 @@
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';
5
+ import type { AuthData } from '../../types';
6
+ import * as tui from '../../tui';
7
+ import { ErrorCode } from '../../errors';
8
+
9
+ export type IdentifierType = 'project' | 'deployment' | 'sandbox';
10
+
11
+ /**
12
+ * Determine the type of identifier based on its prefix
13
+ */
14
+ export function getIdentifierType(identifier: string): IdentifierType {
15
+ if (identifier.startsWith('proj_')) {
16
+ return 'project';
17
+ }
18
+ if (identifier.startsWith('deploy_')) {
19
+ return 'deployment';
20
+ }
21
+ if (identifier.startsWith('sbx_')) {
22
+ return 'sandbox';
23
+ }
24
+ // Default to project for unknown prefixes
25
+ return 'project';
26
+ }
27
+
28
+ /**
29
+ * Look up the region for a project, deployment, or sandbox identifier.
30
+ * Uses cache-first strategy with API fallback.
31
+ */
32
+ export async function getIdentifierRegion(
33
+ logger: Logger,
34
+ auth: AuthData,
35
+ apiClient: APIClient,
36
+ profileName = 'production',
37
+ identifier: string,
38
+ orgId?: string
39
+ ): Promise<string> {
40
+ const identifierType = getIdentifierType(identifier);
41
+
42
+ // For project, deployment, and sandbox, check cache first
43
+ const cachedRegion = await getResourceRegion(identifierType, profileName, identifier);
44
+ if (cachedRegion) {
45
+ logger.trace(`[region-lookup] Found cached region for ${identifier}: ${cachedRegion}`);
46
+ return cachedRegion;
47
+ }
48
+
49
+ logger.trace(`[region-lookup] Cache miss for ${identifier}, fetching from API`);
50
+
51
+ let region: string | null = null;
52
+
53
+ if (identifierType === 'project') {
54
+ const project = await projectGet(apiClient, { id: identifier, mask: true, keys: false });
55
+ region = project.cloudRegion ?? null;
56
+ } else if (identifierType === 'deployment') {
57
+ const deployment = await deploymentGet(apiClient, identifier);
58
+ region = deployment.cloudRegion ?? null;
59
+ } else {
60
+ // sandbox
61
+ const globalClient = await getGlobalCatalystAPIClient(logger, auth, profileName);
62
+ const sandbox = await sandboxGet(globalClient, { sandboxId: identifier, orgId });
63
+ region = sandbox.region ?? null;
64
+ }
65
+
66
+ if (!region) {
67
+ tui.fatal(
68
+ `Could not determine region for ${identifierType} '${identifier}'. Use --region flag to specify.`,
69
+ ErrorCode.RESOURCE_NOT_FOUND
70
+ );
71
+ }
72
+
73
+ // Cache the result
74
+ await setResourceRegion(identifierType, profileName, identifier, region);
75
+ logger.trace(`[region-lookup] Cached region for ${identifier}: ${region}`);
76
+
77
+ return region;
78
+ }
79
+
80
+ /**
81
+ * Cache the region for a project after creation
82
+ */
83
+ export async function cacheProjectRegion(
84
+ profileName = 'production',
85
+ projectId: string,
86
+ region: string
87
+ ): Promise<void> {
88
+ await setResourceRegion('project', profileName, projectId, region);
89
+ }
@@ -3,7 +3,7 @@ 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 { createSandboxClient } from './util';
6
+ import { getSandboxRegion, createSandboxClient } from './util';
7
7
  import { getCommand } from '../../../command-prefix';
8
8
  import {
9
9
  sandboxWriteFiles,
@@ -47,7 +47,7 @@ export const cpSubcommand = createCommand({
47
47
  aliases: ['copy'],
48
48
  description: 'Copy files or directories to or from a sandbox',
49
49
  tags: ['slow', 'requires-auth'],
50
- requires: { auth: true, region: true, org: true },
50
+ requires: { auth: true, org: true },
51
51
  examples: [
52
52
  {
53
53
  command: getCommand('cloud sandbox cp ./local-file.txt snbx_abc123:/path/to/file.txt'),
@@ -84,7 +84,7 @@ export const cpSubcommand = createCommand({
84
84
  },
85
85
 
86
86
  async handler(ctx) {
87
- const { args, opts, options, auth, region, logger, orgId } = ctx;
87
+ const { args, opts, options, auth, logger, orgId, config } = ctx;
88
88
 
89
89
  const source = parsePath(args.source);
90
90
  const destination = parsePath(args.destination);
@@ -101,6 +101,8 @@ export const cpSubcommand = createCommand({
101
101
  );
102
102
  }
103
103
 
104
+ const sandboxId = source.sandboxId ?? destination.sandboxId!;
105
+ const region = await getSandboxRegion(logger, auth, config?.name, sandboxId, orgId);
104
106
  const client = createSandboxClient(logger, auth, region);
105
107
  const recursive = opts.recursive ?? false;
106
108
 
@@ -1,10 +1,12 @@
1
1
  import { z } from 'zod';
2
2
  import { createCommand } from '../../../types';
3
3
  import * as tui from '../../../tui';
4
- import { createSandboxClient, parseFileArgs } from './util';
4
+ import { createSandboxClient, parseFileArgs, cacheSandboxRegion } from './util';
5
5
  import { getCommand } from '../../../command-prefix';
6
6
  import { sandboxCreate } from '@agentuity/server';
7
7
  import { StructuredError } from '@agentuity/core';
8
+ import { validateAptDependencies } from '../../../utils/apt-validator';
9
+ import { ErrorCode } from '../../../errors';
8
10
 
9
11
  const InvalidMetadataError = StructuredError(
10
12
  'InvalidMetadataError',
@@ -47,10 +49,7 @@ export const createSubcommand = createCommand({
47
49
  ],
48
50
  schema: {
49
51
  options: z.object({
50
- runtime: z
51
- .string()
52
- .optional()
53
- .describe('Runtime name (e.g., "bun:1", "python:3.14")'),
52
+ runtime: z.string().optional().describe('Runtime name (e.g., "bun:1", "python:3.14")'),
54
53
  runtimeId: z.string().optional().describe('Runtime ID (e.g., "srt_xxx")'),
55
54
  name: z.string().optional().describe('Sandbox name'),
56
55
  description: z.string().optional().describe('Sandbox description'),
@@ -78,10 +77,52 @@ export const createSubcommand = createCommand({
78
77
  },
79
78
 
80
79
  async handler(ctx) {
81
- const { opts, options, auth, region, logger, orgId } = ctx;
80
+ const { opts, options, auth, region, config, logger, orgId } = ctx;
82
81
  const client = createSandboxClient(logger, auth, region);
83
82
  const started = Date.now();
84
83
 
84
+ // Validate apt dependencies before creating sandbox
85
+ if (opts.dependency && opts.dependency.length > 0) {
86
+ const aptValidation = await tui.spinner({
87
+ message: 'Validating apt dependencies...',
88
+ type: 'simple',
89
+ callback: async () => {
90
+ return await validateAptDependencies(opts.dependency!, region, config, logger);
91
+ },
92
+ });
93
+
94
+ if (aptValidation.invalid.length > 0) {
95
+ if (options.json) {
96
+ return {
97
+ sandboxId: '',
98
+ status: 'failed',
99
+ errors: aptValidation.invalid.map((pkg) => ({
100
+ type: 'invalid-apt-dependency',
101
+ package: pkg.package,
102
+ error: pkg.error,
103
+ searchUrl: pkg.searchUrl,
104
+ availableVersions: pkg.availableVersions,
105
+ })),
106
+ } as never;
107
+ }
108
+
109
+ tui.error('Invalid apt dependencies:');
110
+ tui.newline();
111
+ for (const pkg of aptValidation.invalid) {
112
+ tui.bullet(`${tui.bold(pkg.package)}: ${pkg.error}`);
113
+ if (pkg.availableVersions && pkg.availableVersions.length > 0) {
114
+ tui.muted(` Available versions: ${pkg.availableVersions.join(', ')}`);
115
+ }
116
+ tui.muted(` Search: ${tui.link(pkg.searchUrl)}`);
117
+ }
118
+ tui.newline();
119
+ tui.fatal(
120
+ 'Fix the apt dependencies and try again. Search for valid packages at: https://packages.debian.org/stable/',
121
+ ErrorCode.CONFIG_INVALID
122
+ );
123
+ }
124
+ }
125
+
85
126
  const envMap: Record<string, string> = {};
86
127
  if (opts.env) {
87
128
  for (const e of opts.env) {
@@ -134,6 +175,9 @@ export const createSubcommand = createCommand({
134
175
  orgId,
135
176
  });
136
177
 
178
+ // Cache the region for future lookups
179
+ await cacheSandboxRegion(config?.name, result.sandboxId, region);
180
+
137
181
  if (!options.json) {
138
182
  const duration = Date.now() - started;
139
183
  tui.success(`created sandbox ${tui.bold(result.sandboxId)} in ${duration}ms`);
@@ -1,7 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  import { createCommand } from '../../../types';
3
3
  import * as tui from '../../../tui';
4
- import { createSandboxClient } from './util';
4
+ import { getSandboxRegion, createSandboxClient, clearSandboxRegionCache } from './util';
5
5
  import { getCommand } from '../../../command-prefix';
6
6
  import { sandboxDestroy } from '@agentuity/server';
7
7
 
@@ -17,7 +17,7 @@ export const deleteSubcommand = createCommand({
17
17
  aliases: ['del', 'remove', 'destroy'],
18
18
  description: 'Delete a sandbox',
19
19
  tags: ['destructive', 'deletes-resource', 'slow', 'requires-auth'],
20
- requires: { auth: true, region: true, org: true },
20
+ requires: { auth: true, org: true },
21
21
  idempotent: true,
22
22
  examples: [
23
23
  {
@@ -40,7 +40,7 @@ export const deleteSubcommand = createCommand({
40
40
  },
41
41
 
42
42
  async handler(ctx) {
43
- const { args, options, opts, auth, region, logger, orgId } = ctx;
43
+ const { args, options, opts, auth, config, logger, orgId } = ctx;
44
44
 
45
45
  if (!opts.confirm) {
46
46
  const confirmed = await tui.confirm(`Delete sandbox "${args.sandboxId}"?`, false);
@@ -56,11 +56,14 @@ export const deleteSubcommand = createCommand({
56
56
  }
57
57
 
58
58
  const started = Date.now();
59
+ const region = await getSandboxRegion(logger, auth, config?.name, args.sandboxId, orgId);
59
60
  const client = createSandboxClient(logger, auth, region);
60
61
 
61
62
  await sandboxDestroy(client, { sandboxId: args.sandboxId, orgId });
62
63
  const durationMs = Date.now() - started;
63
64
 
65
+ await clearSandboxRegionCache(config?.name, args.sandboxId);
66
+
64
67
  if (!options.json) {
65
68
  tui.success(`deleted sandbox ${tui.bold(args.sandboxId)} in ${durationMs}ms`);
66
69
  }
@@ -2,7 +2,7 @@ import { z } from 'zod';
2
2
  import { writeFileSync } from 'node:fs';
3
3
  import { createCommand } from '../../../types';
4
4
  import * as tui from '../../../tui';
5
- import { createSandboxClient } from './util';
5
+ import { createSandboxClient, getSandboxRegion } from './util';
6
6
  import { getCommand } from '../../../command-prefix';
7
7
  import { sandboxDownloadArchive } from '@agentuity/server';
8
8
 
@@ -11,7 +11,7 @@ export const downloadSubcommand = createCommand({
11
11
  aliases: ['dl'],
12
12
  description: 'Download files from a sandbox as a compressed archive',
13
13
  tags: ['slow', 'requires-auth'],
14
- requires: { auth: true, region: true, org: true },
14
+ requires: { auth: true, org: true },
15
15
  examples: [
16
16
  {
17
17
  command: getCommand('cloud sandbox download sbx_abc123 ./backup.tar.gz'),
@@ -47,8 +47,9 @@ export const downloadSubcommand = createCommand({
47
47
  },
48
48
 
49
49
  async handler(ctx) {
50
- const { args, opts, options, auth, region, logger, orgId } = ctx;
50
+ const { args, opts, options, auth, logger, orgId, config } = ctx;
51
51
 
52
+ const region = await getSandboxRegion(logger, auth, config?.name, args.sandboxId, orgId);
52
53
  const client = createSandboxClient(logger, auth, region);
53
54
  const format = opts.format || 'tar.gz';
54
55
 
@@ -1,7 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  import { createCommand } from '../../../types';
3
3
  import * as tui from '../../../tui';
4
- import { createSandboxClient } from './util';
4
+ import { getSandboxRegion, createSandboxClient } from './util';
5
5
  import { getCommand } from '../../../command-prefix';
6
6
  import { sandboxSetEnv } from '@agentuity/server';
7
7
 
@@ -9,7 +9,7 @@ export const envSubcommand = createCommand({
9
9
  name: 'env',
10
10
  description: 'Set or delete environment variables on a sandbox',
11
11
  tags: ['slow', 'requires-auth'],
12
- requires: { auth: true, region: true, org: true },
12
+ requires: { auth: true, org: true },
13
13
  examples: [
14
14
  {
15
15
  command: getCommand('cloud sandbox env sbx_abc123 MY_VAR=value'),
@@ -42,8 +42,9 @@ export const envSubcommand = createCommand({
42
42
  },
43
43
 
44
44
  async handler(ctx) {
45
- const { args, opts, options, auth, region, logger, orgId } = ctx;
45
+ const { args, opts, options, auth, config, logger, orgId } = ctx;
46
46
 
47
+ const region = await getSandboxRegion(logger, auth, config?.name, args.sandboxId, orgId);
47
48
  const client = createSandboxClient(logger, auth, region);
48
49
 
49
50
  const envMap: Record<string, string | null> = {};
@@ -2,7 +2,7 @@ import { z } from 'zod';
2
2
  import { Writable } from 'node:stream';
3
3
  import { createCommand } from '../../../types';
4
4
  import * as tui from '../../../tui';
5
- import { createSandboxClient } from './util';
5
+ import { getSandboxRegion, createSandboxClient } from './util';
6
6
  import { getCommand } from '../../../command-prefix';
7
7
  import { sandboxExecute, executionGet, writeAndDrain } from '@agentuity/server';
8
8
  import type { Logger } from '@agentuity/core';
@@ -23,7 +23,7 @@ export const execSubcommand = createCommand({
23
23
  aliases: ['execute'],
24
24
  description: 'Execute a command in a running sandbox',
25
25
  tags: ['slow', 'requires-auth'],
26
- requires: { auth: true, region: true, org: true },
26
+ requires: { auth: true, org: true },
27
27
  examples: [
28
28
  {
29
29
  command: getCommand('cloud sandbox exec abc123 -- echo "hello"'),
@@ -51,7 +51,8 @@ export const execSubcommand = createCommand({
51
51
  },
52
52
 
53
53
  async handler(ctx) {
54
- const { args, opts, options, auth, region, logger, orgId } = ctx;
54
+ const { args, opts, options, auth, config, logger, orgId } = ctx;
55
+ const region = await getSandboxRegion(logger, auth, config?.name, args.sandboxId, orgId);
55
56
  const client = createSandboxClient(logger, auth, region);
56
57
  const started = Date.now();
57
58
 
@@ -1,9 +1,9 @@
1
1
  import { z } from 'zod';
2
2
  import { createCommand } from '../../../../types';
3
3
  import * as tui from '../../../../tui';
4
- import { createSandboxClient } from '../util';
5
4
  import { getCommand } from '../../../../command-prefix';
6
5
  import { executionGet } from '@agentuity/server';
6
+ import { getGlobalCatalystAPIClient } from '../../../../config';
7
7
 
8
8
  const ExecutionGetResponseSchema = z.object({
9
9
  executionId: z.string().describe('Execution ID'),
@@ -24,7 +24,7 @@ export const getSubcommand = createCommand({
24
24
  aliases: ['info', 'show'],
25
25
  description: 'Get information about a specific execution',
26
26
  tags: ['read-only', 'fast', 'requires-auth'],
27
- requires: { auth: true, region: true, org: true },
27
+ requires: { auth: true, org: true },
28
28
  idempotent: true,
29
29
  examples: [
30
30
  {
@@ -40,8 +40,8 @@ export const getSubcommand = createCommand({
40
40
  },
41
41
 
42
42
  async handler(ctx) {
43
- const { args, options, auth, region, logger, orgId } = ctx;
44
- const client = createSandboxClient(logger, auth, region);
43
+ const { args, options, auth, logger, orgId, config } = ctx;
44
+ const client = await getGlobalCatalystAPIClient(logger, auth, config?.name);
45
45
 
46
46
  const result = await executionGet(client, { executionId: args.executionId, orgId });
47
47
 
@@ -19,7 +19,7 @@ export const command = createCommand({
19
19
  },
20
20
  ],
21
21
  subcommands: [getSubcommand, listSubcommand],
22
- requires: { auth: true, region: true, org: true },
22
+ requires: { auth: true, org: true },
23
23
  });
24
24
 
25
25
  export default command;
@@ -1,7 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  import { createCommand } from '../../../../types';
3
3
  import * as tui from '../../../../tui';
4
- import { createSandboxClient } from '../util';
4
+ import { getSandboxRegion, createSandboxClient } from '../util';
5
5
  import { getCommand } from '../../../../command-prefix';
6
6
  import { executionList } from '@agentuity/server';
7
7
 
@@ -25,7 +25,7 @@ export const listSubcommand = createCommand({
25
25
  aliases: ['ls'],
26
26
  description: 'List executions for a sandbox',
27
27
  tags: ['read-only', 'fast', 'requires-auth'],
28
- requires: { auth: true, region: true, org: true },
28
+ requires: { auth: true, org: true },
29
29
  idempotent: true,
30
30
  examples: [
31
31
  {
@@ -48,7 +48,8 @@ export const listSubcommand = createCommand({
48
48
  },
49
49
 
50
50
  async handler(ctx) {
51
- const { args, opts, options, auth, region, logger, orgId } = ctx;
51
+ const { args, opts, options, auth, logger, orgId, config } = ctx;
52
+ const region = await getSandboxRegion(logger, auth, config?.name, args.sandboxId, orgId);
52
53
  const client = createSandboxClient(logger, auth, region);
53
54
 
54
55
  const result = await executionList(client, {