@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
@@ -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 { snapshotCreate } from '@agentuity/server';
7
7
 
@@ -23,7 +23,7 @@ export const createSubcommand = createCommand({
23
23
  name: 'create',
24
24
  description: 'Create a snapshot from a 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 snapshot create sbx_abc123'),
@@ -34,7 +34,9 @@ export const createSubcommand = createCommand({
34
34
  description: 'Create a tagged snapshot',
35
35
  },
36
36
  {
37
- command: getCommand('cloud sandbox snapshot create sbx_abc123 --name "My Snapshot" --description "Initial setup"'),
37
+ command: getCommand(
38
+ 'cloud sandbox snapshot create sbx_abc123 --name "My Snapshot" --description "Initial setup"'
39
+ ),
38
40
  description: 'Create a named snapshot with description',
39
41
  },
40
42
  ],
@@ -54,7 +56,7 @@ export const createSubcommand = createCommand({
54
56
  },
55
57
 
56
58
  async handler(ctx) {
57
- const { args, opts, options, auth, region, logger, orgId } = ctx;
59
+ const { args, opts, options, auth, logger, orgId, config } = ctx;
58
60
 
59
61
  if (opts.name && !SNAPSHOT_NAME_REGEX.test(opts.name)) {
60
62
  logger.fatal(
@@ -64,7 +66,9 @@ export const createSubcommand = createCommand({
64
66
 
65
67
  if (opts.tag) {
66
68
  if (opts.tag.length > MAX_SNAPSHOT_TAG_LENGTH) {
67
- logger.fatal(`Invalid snapshot tag: must be at most ${MAX_SNAPSHOT_TAG_LENGTH} characters`);
69
+ logger.fatal(
70
+ `Invalid snapshot tag: must be at most ${MAX_SNAPSHOT_TAG_LENGTH} characters`
71
+ );
68
72
  }
69
73
  if (!SNAPSHOT_TAG_REGEX.test(opts.tag)) {
70
74
  logger.fatal(
@@ -73,6 +77,8 @@ export const createSubcommand = createCommand({
73
77
  }
74
78
  }
75
79
 
80
+ const profileName = config?.name;
81
+ const region = await getSandboxRegion(logger, auth, profileName, args.sandboxId, orgId);
76
82
  const client = createSandboxClient(logger, auth, region);
77
83
 
78
84
  const snapshot = await snapshotCreate(client, {
@@ -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 { snapshotDelete } from '@agentuity/server';
6
+ import { getGlobalCatalystAPIClient } from '../../../../config';
7
7
 
8
8
  const SnapshotDeleteResponseSchema = z.object({
9
9
  success: z.boolean().describe('Whether the operation succeeded'),
@@ -16,7 +16,7 @@ export const deleteSubcommand = createCommand({
16
16
  aliases: ['del', 'rm', 'remove'],
17
17
  description: 'Delete a snapshot',
18
18
  tags: ['destructive', 'deletes-resource', 'slow', 'requires-auth'],
19
- requires: { auth: true, region: true, org: true },
19
+ requires: { auth: true, org: true },
20
20
  idempotent: true,
21
21
  examples: [
22
22
  {
@@ -39,7 +39,7 @@ export const deleteSubcommand = createCommand({
39
39
  },
40
40
 
41
41
  async handler(ctx) {
42
- const { args, options, opts, auth, region, logger, orgId } = ctx;
42
+ const { args, options, opts, auth, logger, orgId, config } = ctx;
43
43
 
44
44
  if (!opts.confirm) {
45
45
  const confirmed = await tui.confirm(`Delete snapshot "${args.snapshotId}"?`, false);
@@ -53,7 +53,7 @@ export const deleteSubcommand = createCommand({
53
53
  }
54
54
  }
55
55
 
56
- const client = createSandboxClient(logger, auth, region);
56
+ const client = await getGlobalCatalystAPIClient(logger, auth, config?.name);
57
57
 
58
58
  await snapshotDelete(client, {
59
59
  snapshotId: args.snapshotId,
@@ -0,0 +1,134 @@
1
+ import { z } from 'zod';
2
+ import { createCommand } from '../../../../types';
3
+ import { getCommand } from '../../../../command-prefix';
4
+
5
+ const TEMPLATE_YAML = `# yaml-language-server: $schema=https://agentuity.dev/schema/cli/v1/agentuity-snapshot.json
6
+ #
7
+ # Agentuity Snapshot Build File
8
+ # =============================
9
+ # This file defines a reproducible sandbox environment.
10
+ # Build with: agentuity cloud sandbox snapshot build <directory>
11
+ #
12
+ # For documentation, see: https://agentuity.dev/Services/Sandbox
13
+
14
+ # Required: Schema version (must be 1)
15
+ version: 1
16
+
17
+ # Required: Runtime environment
18
+ # Format: name:tag (e.g., bun:1, node:20, python:3.12)
19
+ # Run 'agentuity cloud sandbox runtime list' to see available runtimes
20
+ runtime: bun:1
21
+
22
+ # Optional: Snapshot name (alphanumeric, underscores, dashes only)
23
+ # If not provided, a unique name will be auto-generated
24
+ # name: my-snapshot
25
+
26
+ # Optional: Human-readable description
27
+ # Can be overridden with --description flag
28
+ description: My sandbox snapshot
29
+
30
+ # Optional: Apt packages to install
31
+ # Packages are validated against Debian stable repositories
32
+ # Supports version pinning: package=version or package=version* (prefix match)
33
+ # dependencies:
34
+ # - curl
35
+ # - ffmpeg
36
+ # - imagemagick=8:6.9*
37
+
38
+ # Optional: Files to include from the build context directory
39
+ # Supports glob patterns and negative patterns (prefix with !)
40
+ # Files are placed in /home/agentuity/ in the sandbox
41
+ # files:
42
+ # - "*.js" # All JS files in root
43
+ # - src/** # All files in src/ recursively
44
+ # - config/*.json # All JSON files in config/
45
+ # - "!**/*.test.js" # Exclude test files
46
+ # - "!node_modules/**" # Exclude node_modules
47
+
48
+ # Optional: Environment variables
49
+ # Use \${VAR} syntax for build-time substitution via --env flag
50
+ # env:
51
+ # NODE_ENV: production
52
+ # API_URL: https://api.example.com
53
+ # SECRET_KEY: \${SECRET_KEY} # Substituted from: --env SECRET_KEY=value
54
+
55
+ # Optional: Custom metadata
56
+ # Use \${VAR} syntax for build-time substitution via --metadata flag
57
+ # Stored with the snapshot for reference
58
+ # metadata:
59
+ # version: \${VERSION} # Substituted from: --metadata VERSION=1.0.0
60
+ # author: team-name
61
+ # build_date: \${BUILD_DATE}
62
+ `;
63
+
64
+ const TEMPLATE_JSON = {
65
+ $schema: 'https://agentuity.dev/schema/cli/v1/agentuity-snapshot.json',
66
+ version: 1,
67
+ runtime: 'bun:1',
68
+ name: 'my-snapshot',
69
+ description: 'My sandbox snapshot',
70
+ dependencies: ['curl'],
71
+ files: ['src/**', '*.js', '!**/*.test.js'],
72
+ env: {
73
+ NODE_ENV: 'production',
74
+ },
75
+ metadata: {
76
+ version: '1.0.0',
77
+ },
78
+ };
79
+
80
+ const GenerateResponseSchema = z.object({
81
+ format: z.enum(['yaml', 'json']).describe('Output format'),
82
+ content: z.string().describe('Generated template content'),
83
+ });
84
+
85
+ export const generateSubcommand = createCommand({
86
+ name: 'generate',
87
+ aliases: ['gen', 'init'],
88
+ description: 'Generate a template snapshot build file',
89
+ tags: [],
90
+ requires: {},
91
+ examples: [
92
+ {
93
+ command: getCommand('cloud sandbox snapshot generate'),
94
+ description: 'Generate a YAML template (default)',
95
+ },
96
+ {
97
+ command: getCommand('cloud sandbox snapshot generate --format json'),
98
+ description: 'Generate a JSON template',
99
+ },
100
+ {
101
+ command: getCommand('cloud sandbox snapshot generate > agentuity-snapshot.yaml'),
102
+ description: 'Save template to a file',
103
+ },
104
+ ],
105
+ schema: {
106
+ options: z.object({
107
+ format: z.enum(['yaml', 'json']).default('yaml').describe('Output format (yaml or json)'),
108
+ }),
109
+ response: GenerateResponseSchema,
110
+ },
111
+
112
+ async handler(ctx) {
113
+ const { opts, options } = ctx;
114
+ const format = opts.format;
115
+
116
+ let content: string;
117
+ if (format === 'json') {
118
+ content = JSON.stringify(TEMPLATE_JSON, null, 2);
119
+ } else {
120
+ content = TEMPLATE_YAML;
121
+ }
122
+
123
+ if (!options.json) {
124
+ console.log(content);
125
+ }
126
+
127
+ return {
128
+ format,
129
+ content,
130
+ };
131
+ },
132
+ });
133
+
134
+ export default generateSubcommand;
@@ -1,11 +1,11 @@
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 { snapshotGet, sandboxList } from '@agentuity/server';
7
6
  import type { SnapshotFileInfo } from '@agentuity/server';
8
7
  import type { SandboxInfo } from '@agentuity/core';
8
+ import { getGlobalCatalystAPIClient } from '../../../../config';
9
9
 
10
10
  const SnapshotFileSchema = z.object({
11
11
  path: z.string(),
@@ -21,6 +21,7 @@ const SandboxInfoSchema = z.object({
21
21
 
22
22
  const SnapshotGetResponseSchema = z.object({
23
23
  snapshotId: z.string().describe('Snapshot ID'),
24
+ name: z.string().describe('Snapshot name'),
24
25
  tag: z.string().nullable().optional().describe('Snapshot tag'),
25
26
  sizeBytes: z.number().describe('Snapshot size in bytes'),
26
27
  fileCount: z.number().describe('Number of files'),
@@ -28,6 +29,11 @@ const SnapshotGetResponseSchema = z.object({
28
29
  createdAt: z.string().describe('Creation timestamp'),
29
30
  downloadUrl: z.string().optional().describe('Presigned download URL'),
30
31
  files: z.array(SnapshotFileSchema).nullable().optional().describe('Files in snapshot'),
32
+ userMetadata: z
33
+ .record(z.string(), z.string())
34
+ .nullable()
35
+ .optional()
36
+ .describe('User-defined metadata'),
31
37
  sandboxes: z
32
38
  .array(SandboxInfoSchema)
33
39
  .optional()
@@ -39,7 +45,7 @@ export const getSubcommand = createCommand({
39
45
  aliases: ['info', 'show'],
40
46
  description: 'Get snapshot details',
41
47
  tags: ['slow', 'requires-auth'],
42
- requires: { auth: true, region: true, org: true },
48
+ requires: { auth: true, org: true },
43
49
  examples: [
44
50
  {
45
51
  command: getCommand('cloud sandbox snapshot get snp_abc123'),
@@ -54,8 +60,8 @@ export const getSubcommand = createCommand({
54
60
  },
55
61
 
56
62
  async handler(ctx) {
57
- const { args, options, auth, region, logger, orgId } = ctx;
58
- const client = createSandboxClient(logger, auth, region);
63
+ const { args, options, auth, logger, orgId, config } = ctx;
64
+ const client = await getGlobalCatalystAPIClient(logger, auth, config?.name);
59
65
 
60
66
  const snapshot = await snapshotGet(client, {
61
67
  snapshotId: args.snapshotId,
@@ -73,6 +79,7 @@ export const getSubcommand = createCommand({
73
79
 
74
80
  if (!options.json) {
75
81
  tui.info(`Snapshot: ${tui.bold(snapshot.snapshotId)}`);
82
+ console.log(` ${tui.muted('Name:')} ${snapshot.name}`);
76
83
  if (snapshot.tag) {
77
84
  console.log(` ${tui.muted('Tag:')} ${snapshot.tag}`);
78
85
  }
@@ -83,6 +90,18 @@ export const getSubcommand = createCommand({
83
90
  console.log(` ${tui.muted('Parent:')} ${snapshot.parentSnapshotId}`);
84
91
  }
85
92
 
93
+ if (
94
+ snapshot.userMetadata &&
95
+ typeof snapshot.userMetadata === 'object' &&
96
+ Object.keys(snapshot.userMetadata).length > 0
97
+ ) {
98
+ console.log('');
99
+ tui.info('Metadata:');
100
+ for (const [key, value] of Object.entries(snapshot.userMetadata)) {
101
+ console.log(` ${tui.muted('•')} ${key}=${value}`);
102
+ }
103
+ }
104
+
86
105
  if (snapshot.files && snapshot.files.length > 0) {
87
106
  console.log('');
88
107
  tui.info('Files:');
@@ -4,6 +4,8 @@ import { listSubcommand } from './list';
4
4
  import { getSubcommand } from './get';
5
5
  import { deleteSubcommand } from './delete';
6
6
  import { tagSubcommand } from './tag';
7
+ import { buildSubcommand } from './build';
8
+ import { generateSubcommand } from './generate';
7
9
  import { getCommand } from '../../../../command-prefix';
8
10
 
9
11
  export const snapshotCommand = createCommand({
@@ -20,9 +22,25 @@ export const snapshotCommand = createCommand({
20
22
  command: getCommand('cloud sandbox snapshot list'),
21
23
  description: 'List all snapshots',
22
24
  },
25
+ {
26
+ command: getCommand('cloud sandbox snapshot build .'),
27
+ description: 'Build a snapshot from a declarative file',
28
+ },
29
+ {
30
+ command: getCommand('cloud sandbox snapshot generate > agentuity-snapshot.yaml'),
31
+ description: 'Generate a template build file',
32
+ },
33
+ ],
34
+ subcommands: [
35
+ createSubcommand,
36
+ listSubcommand,
37
+ getSubcommand,
38
+ deleteSubcommand,
39
+ tagSubcommand,
40
+ buildSubcommand,
41
+ generateSubcommand,
23
42
  ],
24
- subcommands: [createSubcommand, listSubcommand, getSubcommand, deleteSubcommand, tagSubcommand],
25
- requires: { auth: true, region: true, org: true },
43
+ requires: { auth: true, org: true },
26
44
  });
27
45
 
28
46
  export default snapshotCommand;
@@ -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 { snapshotList } from '@agentuity/server';
6
+ import { getGlobalCatalystAPIClient } from '../../../../config';
7
7
 
8
8
  const SnapshotInfoSchema = z.object({
9
9
  snapshotId: z.string(),
@@ -26,7 +26,7 @@ export const listSubcommand = createCommand({
26
26
  aliases: ['ls'],
27
27
  description: 'List snapshots',
28
28
  tags: ['slow', 'requires-auth'],
29
- requires: { auth: true, region: true, org: true },
29
+ requires: { auth: true, org: true },
30
30
  examples: [
31
31
  {
32
32
  command: getCommand('cloud sandbox snapshot list'),
@@ -47,8 +47,8 @@ export const listSubcommand = createCommand({
47
47
  },
48
48
 
49
49
  async handler(ctx) {
50
- const { opts, options, auth, region, logger, orgId } = ctx;
51
- const client = createSandboxClient(logger, auth, region);
50
+ const { opts, options, auth, logger, orgId, config } = ctx;
51
+ const client = await getGlobalCatalystAPIClient(logger, auth, config?.name);
52
52
 
53
53
  const result = await snapshotList(client, {
54
54
  sandboxId: opts.sandbox,
@@ -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 { snapshotTag } from '@agentuity/server';
6
+ import { getGlobalCatalystAPIClient } from '../../../../config';
7
7
 
8
8
  const SNAPSHOT_TAG_REGEX = /^[a-zA-Z0-9_][a-zA-Z0-9._-]*$/;
9
9
  const MAX_SNAPSHOT_TAG_LENGTH = 128;
@@ -17,7 +17,7 @@ export const tagSubcommand = createCommand({
17
17
  name: 'tag',
18
18
  description: 'Add or update a tag on a snapshot',
19
19
  tags: ['slow', 'requires-auth'],
20
- requires: { auth: true, region: true, org: true },
20
+ requires: { auth: true, org: true },
21
21
  examples: [
22
22
  {
23
23
  command: getCommand('cloud sandbox snapshot tag snp_abc123 latest'),
@@ -40,8 +40,8 @@ export const tagSubcommand = createCommand({
40
40
  },
41
41
 
42
42
  async handler(ctx) {
43
- const { args, opts, options, auth, region, logger, orgId } = ctx;
44
- const client = createSandboxClient(logger, auth, region);
43
+ const { args, opts, options, auth, logger, orgId, config } = ctx;
44
+ const client = await getGlobalCatalystAPIClient(logger, auth, config?.name);
45
45
 
46
46
  if (!args.tag && !opts.clear) {
47
47
  throw new Error('Either provide a tag name or use --clear to remove the tag');
@@ -49,7 +49,9 @@ export const tagSubcommand = createCommand({
49
49
 
50
50
  if (args.tag) {
51
51
  if (args.tag.length > MAX_SNAPSHOT_TAG_LENGTH) {
52
- logger.fatal(`Invalid snapshot tag: must be at most ${MAX_SNAPSHOT_TAG_LENGTH} characters`);
52
+ logger.fatal(
53
+ `Invalid snapshot tag: must be at most ${MAX_SNAPSHOT_TAG_LENGTH} characters`
54
+ );
53
55
  }
54
56
  if (!SNAPSHOT_TAG_REGEX.test(args.tag)) {
55
57
  logger.fatal(
@@ -2,7 +2,7 @@ import { z } from 'zod';
2
2
  import { readFileSync, statSync } 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 { sandboxUploadArchive } from '@agentuity/server';
8
8
 
@@ -11,7 +11,7 @@ export const uploadSubcommand = createCommand({
11
11
  aliases: ['ul'],
12
12
  description: 'Upload a compressed archive to a sandbox and extract it',
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 upload sbx_abc123 ./archive.tar.gz'),
@@ -45,8 +45,9 @@ export const uploadSubcommand = createCommand({
45
45
  },
46
46
 
47
47
  async handler(ctx) {
48
- const { args, opts, options, auth, region, logger, orgId } = ctx;
48
+ const { args, opts, options, auth, logger, orgId, config } = ctx;
49
49
 
50
+ const region = await getSandboxRegion(logger, auth, config?.name, args.sandboxId, orgId);
50
51
  const client = createSandboxClient(logger, auth, region);
51
52
 
52
53
  const stat = statSync(args.archive);
@@ -1,14 +1,73 @@
1
1
  import { existsSync, readFileSync } from 'node:fs';
2
2
  import { resolve } from 'node:path';
3
3
  import type { Logger, FileToWrite } from '@agentuity/core';
4
- import { APIClient, getServiceUrls } from '@agentuity/server';
4
+ import { APIClient, getServiceUrls, sandboxGet } from '@agentuity/server';
5
5
  import type { AuthData } from '../../../types';
6
+ import { getGlobalCatalystAPIClient } from '../../../config';
7
+ import { getResourceRegion, setResourceRegion, deleteResourceRegion } from '../../../cache';
8
+ import * as tui from '../../../tui';
9
+ import { ErrorCode } from '../../../errors';
6
10
 
7
11
  export function createSandboxClient(logger: Logger, auth: AuthData, region: string): APIClient {
8
12
  const urls = getServiceUrls(region);
9
13
  return new APIClient(urls.catalyst, logger, auth.apiKey);
10
14
  }
11
15
 
16
+ /**
17
+ * Look up the region for a sandbox, using cache-first strategy.
18
+ * Falls back to API lookup if not in cache.
19
+ */
20
+ export async function getSandboxRegion(
21
+ logger: Logger,
22
+ auth: AuthData,
23
+ profileName = 'production',
24
+ sandboxId: string,
25
+ orgId: string
26
+ ): Promise<string> {
27
+ // Check cache first
28
+ const cachedRegion = await getResourceRegion('sandbox', profileName, sandboxId);
29
+ if (cachedRegion) {
30
+ logger.trace(`[sandbox] Found cached region for ${sandboxId}: ${cachedRegion}`);
31
+ return cachedRegion;
32
+ }
33
+
34
+ // Fallback to API lookup using global client
35
+ logger.trace(`[sandbox] Cache miss for ${sandboxId}, fetching from API`);
36
+ const globalClient = await getGlobalCatalystAPIClient(logger, auth, profileName);
37
+
38
+ const sandbox = await sandboxGet(globalClient, { sandboxId, orgId });
39
+ if (!sandbox.region) {
40
+ tui.fatal(`Sandbox '${sandboxId}' has no region information`, ErrorCode.RESOURCE_NOT_FOUND);
41
+ }
42
+
43
+ // Cache the result
44
+ await setResourceRegion('sandbox', profileName, sandboxId, sandbox.region);
45
+ logger.trace(`[sandbox] Cached region for ${sandboxId}: ${sandbox.region}`);
46
+
47
+ return sandbox.region;
48
+ }
49
+
50
+ /**
51
+ * Cache the region for a sandbox after create/run operations
52
+ */
53
+ export async function cacheSandboxRegion(
54
+ profileName = 'production',
55
+ sandboxId: string,
56
+ region: string
57
+ ): Promise<void> {
58
+ await setResourceRegion('sandbox', profileName, sandboxId, region);
59
+ }
60
+
61
+ /**
62
+ * Clear cached region for a sandbox after delete
63
+ */
64
+ export async function clearSandboxRegionCache(
65
+ profileName = 'production',
66
+ sandboxId: string
67
+ ): Promise<void> {
68
+ await deleteResourceRegion('sandbox', profileName, sandboxId);
69
+ }
70
+
12
71
  /**
13
72
  * Parse --file arguments and read file contents.
14
73
  *
@@ -3,6 +3,7 @@ import { createSubcommand } from '../../../types';
3
3
  import * as tui from '../../../tui';
4
4
  import { getIONHost } from '../../../config';
5
5
  import { getCommand } from '../../../command-prefix';
6
+ import { getIdentifierRegion } from '../region-lookup';
6
7
  const args = z.object({
7
8
  source: z.string().describe('the source file'),
8
9
  destination: z.string().optional().describe('the destination file'),
@@ -36,7 +37,7 @@ export const downloadCommand = createSubcommand({
36
37
  description: 'Download multiple files',
37
38
  },
38
39
  ],
39
- requires: { apiClient: true, auth: true, region: true },
40
+ requires: { apiClient: true, auth: true },
40
41
  optional: { project: true },
41
42
  prerequisites: ['cloud deploy'],
42
43
  schema: {
@@ -51,7 +52,7 @@ export const downloadCommand = createSubcommand({
51
52
  },
52
53
 
53
54
  async handler(ctx) {
54
- const { apiClient, args, opts, project, projectDir, config, region } = ctx;
55
+ const { apiClient, args, opts, project, projectDir, config, logger, auth, orgId } = ctx;
55
56
 
56
57
  let identifier = opts?.identifier ?? project?.projectId;
57
58
 
@@ -59,6 +60,17 @@ export const downloadCommand = createSubcommand({
59
60
  identifier = await tui.showProjectList(apiClient, true);
60
61
  }
61
62
 
63
+ // Look up region from identifier (project/deployment)
64
+ const profileName = config?.name;
65
+ const region = await getIdentifierRegion(
66
+ logger,
67
+ auth,
68
+ apiClient,
69
+ profileName,
70
+ identifier,
71
+ orgId
72
+ );
73
+
62
74
  const hostname = getIONHost(config, region);
63
75
  const destination = args.destination ?? projectDir;
64
76
 
@@ -3,6 +3,7 @@ import { createSubcommand } from '../../../types';
3
3
  import * as tui from '../../../tui';
4
4
  import { getIONHost } from '../../../config';
5
5
  import { getCommand } from '../../../command-prefix';
6
+ import { getIdentifierRegion } from '../region-lookup';
6
7
  const args = z.object({
7
8
  source: z.string().describe('the source file'),
8
9
  destination: z
@@ -39,7 +40,7 @@ export const uploadCommand = createSubcommand({
39
40
  description: 'Upload multiple files',
40
41
  },
41
42
  ],
42
- requires: { apiClient: true, auth: true, region: true },
43
+ requires: { apiClient: true, auth: true },
43
44
  schema: {
44
45
  args,
45
46
  options,
@@ -54,7 +55,7 @@ export const uploadCommand = createSubcommand({
54
55
  prerequisites: ['cloud deploy'],
55
56
 
56
57
  async handler(ctx) {
57
- const { apiClient, args, opts, project, projectDir, config, region } = ctx;
58
+ const { apiClient, args, opts, project, projectDir, config, logger, auth, orgId } = ctx;
58
59
 
59
60
  let identifier = opts?.identifier ?? project?.projectId;
60
61
 
@@ -62,6 +63,17 @@ export const uploadCommand = createSubcommand({
62
63
  identifier = await tui.showProjectList(apiClient, true);
63
64
  }
64
65
 
66
+ // Look up region from identifier (project/deployment)
67
+ const profileName = config?.name;
68
+ const region = await getIdentifierRegion(
69
+ logger,
70
+ auth,
71
+ apiClient,
72
+ profileName,
73
+ identifier,
74
+ orgId
75
+ );
76
+
65
77
  const hostname = getIONHost(config, region);
66
78
  const destination = args.destination ?? '.';
67
79
 
@@ -10,7 +10,7 @@ import {
10
10
  } from '@agentuity/server';
11
11
  import { getCommand } from '../../../command-prefix';
12
12
  import { ErrorCode } from '../../../errors';
13
- import { getCatalystAPIClient } from '../../../config';
13
+ import { getGlobalCatalystAPIClient } from '../../../config';
14
14
 
15
15
  const SpanNodeSchema: z.ZodType<SpanNode> = z.lazy(() =>
16
16
  z.object({
@@ -116,7 +116,7 @@ export const getSubcommand = createSubcommand({
116
116
  description: 'Get a session by ID',
117
117
  },
118
118
  ],
119
- requires: { auth: true, region: true },
119
+ requires: { auth: true },
120
120
  idempotent: true,
121
121
  schema: {
122
122
  args: z.object({
@@ -125,8 +125,8 @@ export const getSubcommand = createSubcommand({
125
125
  response: SessionGetResponseSchema,
126
126
  },
127
127
  async handler(ctx) {
128
- const { logger, auth, args, options, region } = ctx;
129
- const catalystClient = getCatalystAPIClient(logger, auth, region);
128
+ const { logger, auth, args, options, config } = ctx;
129
+ const catalystClient = await getGlobalCatalystAPIClient(logger, auth, config?.name);
130
130
 
131
131
  try {
132
132
  const enriched = await sessionGet(catalystClient, { id: args.session_id });
@@ -4,7 +4,7 @@ import * as tui from '../../../tui';
4
4
  import { sessionList } from '@agentuity/server';
5
5
  import { getCommand } from '../../../command-prefix';
6
6
  import { ErrorCode } from '../../../errors';
7
- import { getCatalystAPIClient } from '../../../config';
7
+ import { getGlobalCatalystAPIClient } from '../../../config';
8
8
 
9
9
  const SessionListResponseSchema = z.array(
10
10
  z.object({
@@ -55,7 +55,7 @@ export const listSubcommand = createSubcommand({
55
55
  },
56
56
  ],
57
57
  aliases: ['ls'],
58
- requires: { auth: true, region: true },
58
+ requires: { auth: true },
59
59
  optional: { project: true },
60
60
  idempotent: true,
61
61
  pagination: {
@@ -93,8 +93,8 @@ export const listSubcommand = createSubcommand({
93
93
  return projectId ? `/projects/${encodeURIComponent(projectId)}/sessions` : undefined;
94
94
  },
95
95
  async handler(ctx) {
96
- const { logger, auth, project, opts, options, region } = ctx;
97
- const catalystClient = getCatalystAPIClient(logger, auth, region);
96
+ const { logger, auth, project, opts, options, config } = ctx;
97
+ const catalystClient = await getGlobalCatalystAPIClient(logger, auth, config?.name);
98
98
 
99
99
  const projectId = opts.projectId || project?.projectId;
100
100