@agentuity/cli 0.1.9 → 0.1.10

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 (311) 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/create.d.ts.map +1 -1
  129. package/dist/cmd/cloud/sandbox/snapshot/create.js +5 -3
  130. package/dist/cmd/cloud/sandbox/snapshot/create.js.map +1 -1
  131. package/dist/cmd/cloud/sandbox/snapshot/delete.js +4 -4
  132. package/dist/cmd/cloud/sandbox/snapshot/delete.js.map +1 -1
  133. package/dist/cmd/cloud/sandbox/snapshot/get.js +4 -4
  134. package/dist/cmd/cloud/sandbox/snapshot/get.js.map +1 -1
  135. package/dist/cmd/cloud/sandbox/snapshot/index.js +1 -1
  136. package/dist/cmd/cloud/sandbox/snapshot/index.js.map +1 -1
  137. package/dist/cmd/cloud/sandbox/snapshot/list.js +4 -4
  138. package/dist/cmd/cloud/sandbox/snapshot/list.js.map +1 -1
  139. package/dist/cmd/cloud/sandbox/snapshot/tag.d.ts.map +1 -1
  140. package/dist/cmd/cloud/sandbox/snapshot/tag.js +4 -4
  141. package/dist/cmd/cloud/sandbox/snapshot/tag.js.map +1 -1
  142. package/dist/cmd/cloud/sandbox/upload.d.ts.map +1 -1
  143. package/dist/cmd/cloud/sandbox/upload.js +4 -3
  144. package/dist/cmd/cloud/sandbox/upload.js.map +1 -1
  145. package/dist/cmd/cloud/sandbox/util.d.ts +13 -0
  146. package/dist/cmd/cloud/sandbox/util.d.ts.map +1 -1
  147. package/dist/cmd/cloud/sandbox/util.js +40 -1
  148. package/dist/cmd/cloud/sandbox/util.js.map +1 -1
  149. package/dist/cmd/cloud/scp/download.d.ts.map +1 -1
  150. package/dist/cmd/cloud/scp/download.js +6 -2
  151. package/dist/cmd/cloud/scp/download.js.map +1 -1
  152. package/dist/cmd/cloud/scp/upload.d.ts.map +1 -1
  153. package/dist/cmd/cloud/scp/upload.js +6 -2
  154. package/dist/cmd/cloud/scp/upload.js.map +1 -1
  155. package/dist/cmd/cloud/session/get.js +4 -4
  156. package/dist/cmd/cloud/session/get.js.map +1 -1
  157. package/dist/cmd/cloud/session/list.js +4 -4
  158. package/dist/cmd/cloud/session/list.js.map +1 -1
  159. package/dist/cmd/cloud/ssh.d.ts.map +1 -1
  160. package/dist/cmd/cloud/ssh.js +7 -2
  161. package/dist/cmd/cloud/ssh.js.map +1 -1
  162. package/dist/cmd/cloud/storage/delete.d.ts.map +1 -1
  163. package/dist/cmd/cloud/storage/delete.js +46 -10
  164. package/dist/cmd/cloud/storage/delete.js.map +1 -1
  165. package/dist/cmd/cloud/storage/download.d.ts.map +1 -1
  166. package/dist/cmd/cloud/storage/download.js +19 -6
  167. package/dist/cmd/cloud/storage/download.js.map +1 -1
  168. package/dist/cmd/cloud/storage/get.d.ts.map +1 -1
  169. package/dist/cmd/cloud/storage/get.js +19 -6
  170. package/dist/cmd/cloud/storage/get.js.map +1 -1
  171. package/dist/cmd/cloud/storage/list.d.ts.map +1 -1
  172. package/dist/cmd/cloud/storage/list.js +17 -7
  173. package/dist/cmd/cloud/storage/list.js.map +1 -1
  174. package/dist/cmd/cloud/storage/upload.d.ts.map +1 -1
  175. package/dist/cmd/cloud/storage/upload.js +19 -6
  176. package/dist/cmd/cloud/storage/upload.js.map +1 -1
  177. package/dist/cmd/cloud/thread/delete.js +4 -4
  178. package/dist/cmd/cloud/thread/delete.js.map +1 -1
  179. package/dist/cmd/cloud/thread/get.js +4 -4
  180. package/dist/cmd/cloud/thread/get.js.map +1 -1
  181. package/dist/cmd/cloud/thread/list.js +4 -4
  182. package/dist/cmd/cloud/thread/list.js.map +1 -1
  183. package/dist/cmd/project/auth/init.d.ts.map +1 -1
  184. package/dist/cmd/project/auth/init.js +6 -3
  185. package/dist/cmd/project/auth/init.js.map +1 -1
  186. package/dist/cmd/project/auth/shared.d.ts +6 -2
  187. package/dist/cmd/project/auth/shared.d.ts.map +1 -1
  188. package/dist/cmd/project/auth/shared.js +40 -12
  189. package/dist/cmd/project/auth/shared.js.map +1 -1
  190. package/dist/config.d.ts +37 -0
  191. package/dist/config.d.ts.map +1 -1
  192. package/dist/config.js +51 -8
  193. package/dist/config.js.map +1 -1
  194. package/dist/env-util.d.ts +25 -2
  195. package/dist/env-util.d.ts.map +1 -1
  196. package/dist/env-util.js +44 -4
  197. package/dist/env-util.js.map +1 -1
  198. package/dist/utils/apt-validator.d.ts +20 -0
  199. package/dist/utils/apt-validator.d.ts.map +1 -0
  200. package/dist/utils/apt-validator.js +157 -0
  201. package/dist/utils/apt-validator.js.map +1 -0
  202. package/package.json +6 -6
  203. package/src/cache/index.ts +11 -0
  204. package/src/cache/resource-region.ts +183 -0
  205. package/src/cli.ts +47 -38
  206. package/src/cmd/ai/capabilities/show.ts +12 -15
  207. package/src/cmd/ai/prompt/llm.ts +5 -5
  208. package/src/cmd/auth/logout.ts +5 -2
  209. package/src/cmd/build/ast.ts +160 -1
  210. package/src/cmd/build/vite/vite-asset-server-config.ts +7 -3
  211. package/src/cmd/build/vite/vite-asset-server.ts +6 -3
  212. package/src/cmd/cloud/db/delete.ts +83 -11
  213. package/src/cmd/cloud/db/get.ts +29 -7
  214. package/src/cmd/cloud/db/list.ts +16 -7
  215. package/src/cmd/cloud/db/logs.ts +33 -4
  216. package/src/cmd/cloud/deploy.ts +49 -0
  217. package/src/cmd/cloud/env/delete.ts +36 -12
  218. package/src/cmd/cloud/env/get.ts +28 -27
  219. package/src/cmd/cloud/env/import.ts +43 -56
  220. package/src/cmd/cloud/env/index.ts +6 -2
  221. package/src/cmd/cloud/env/list.ts +57 -30
  222. package/src/cmd/cloud/env/pull.ts +9 -3
  223. package/src/cmd/cloud/env/push.ts +44 -11
  224. package/src/cmd/cloud/env/set.ts +49 -30
  225. package/src/cmd/cloud/index.ts +0 -2
  226. package/src/cmd/cloud/region-lookup.ts +89 -0
  227. package/src/cmd/cloud/sandbox/cp.ts +5 -3
  228. package/src/cmd/cloud/sandbox/create.ts +50 -6
  229. package/src/cmd/cloud/sandbox/delete.ts +6 -3
  230. package/src/cmd/cloud/sandbox/download.ts +4 -3
  231. package/src/cmd/cloud/sandbox/env.ts +4 -3
  232. package/src/cmd/cloud/sandbox/exec.ts +4 -3
  233. package/src/cmd/cloud/sandbox/execution/get.ts +4 -4
  234. package/src/cmd/cloud/sandbox/execution/index.ts +1 -1
  235. package/src/cmd/cloud/sandbox/execution/list.ts +4 -3
  236. package/src/cmd/cloud/sandbox/get.ts +10 -4
  237. package/src/cmd/cloud/sandbox/index.ts +1 -1
  238. package/src/cmd/cloud/sandbox/list.ts +4 -4
  239. package/src/cmd/cloud/sandbox/ls.ts +4 -3
  240. package/src/cmd/cloud/sandbox/mkdir.ts +4 -3
  241. package/src/cmd/cloud/sandbox/rm.ts +4 -3
  242. package/src/cmd/cloud/sandbox/rmdir.ts +4 -3
  243. package/src/cmd/cloud/sandbox/run.ts +51 -6
  244. package/src/cmd/cloud/sandbox/runtime/index.ts +1 -1
  245. package/src/cmd/cloud/sandbox/runtime/list.ts +4 -4
  246. package/src/cmd/cloud/sandbox/snapshot/create.ts +11 -5
  247. package/src/cmd/cloud/sandbox/snapshot/delete.ts +4 -4
  248. package/src/cmd/cloud/sandbox/snapshot/get.ts +4 -4
  249. package/src/cmd/cloud/sandbox/snapshot/index.ts +1 -1
  250. package/src/cmd/cloud/sandbox/snapshot/list.ts +4 -4
  251. package/src/cmd/cloud/sandbox/snapshot/tag.ts +7 -5
  252. package/src/cmd/cloud/sandbox/upload.ts +4 -3
  253. package/src/cmd/cloud/sandbox/util.ts +60 -1
  254. package/src/cmd/cloud/scp/download.ts +14 -2
  255. package/src/cmd/cloud/scp/upload.ts +14 -2
  256. package/src/cmd/cloud/session/get.ts +4 -4
  257. package/src/cmd/cloud/session/list.ts +4 -4
  258. package/src/cmd/cloud/ssh.ts +15 -2
  259. package/src/cmd/cloud/storage/delete.ts +61 -10
  260. package/src/cmd/cloud/storage/download.ts +31 -6
  261. package/src/cmd/cloud/storage/get.ts +31 -6
  262. package/src/cmd/cloud/storage/list.ts +18 -7
  263. package/src/cmd/cloud/storage/upload.ts +31 -6
  264. package/src/cmd/cloud/thread/delete.ts +4 -4
  265. package/src/cmd/cloud/thread/get.ts +4 -4
  266. package/src/cmd/cloud/thread/list.ts +4 -4
  267. package/src/cmd/project/auth/init.ts +7 -3
  268. package/src/cmd/project/auth/shared.ts +52 -13
  269. package/src/config.ts +64 -8
  270. package/src/env-util.ts +50 -5
  271. package/src/utils/apt-validator.ts +215 -0
  272. package/dist/cmd/cloud/secret/delete.d.ts +0 -2
  273. package/dist/cmd/cloud/secret/delete.d.ts.map +0 -1
  274. package/dist/cmd/cloud/secret/delete.js +0 -53
  275. package/dist/cmd/cloud/secret/delete.js.map +0 -1
  276. package/dist/cmd/cloud/secret/get.d.ts +0 -2
  277. package/dist/cmd/cloud/secret/get.d.ts.map +0 -1
  278. package/dist/cmd/cloud/secret/get.js +0 -73
  279. package/dist/cmd/cloud/secret/get.js.map +0 -1
  280. package/dist/cmd/cloud/secret/import.d.ts +0 -2
  281. package/dist/cmd/cloud/secret/import.d.ts.map +0 -1
  282. package/dist/cmd/cloud/secret/import.js +0 -91
  283. package/dist/cmd/cloud/secret/import.js.map +0 -1
  284. package/dist/cmd/cloud/secret/index.d.ts +0 -3
  285. package/dist/cmd/cloud/secret/index.d.ts.map +0 -1
  286. package/dist/cmd/cloud/secret/index.js +0 -33
  287. package/dist/cmd/cloud/secret/index.js.map +0 -1
  288. package/dist/cmd/cloud/secret/list.d.ts +0 -2
  289. package/dist/cmd/cloud/secret/list.d.ts.map +0 -1
  290. package/dist/cmd/cloud/secret/list.js +0 -65
  291. package/dist/cmd/cloud/secret/list.js.map +0 -1
  292. package/dist/cmd/cloud/secret/pull.d.ts +0 -2
  293. package/dist/cmd/cloud/secret/pull.d.ts.map +0 -1
  294. package/dist/cmd/cloud/secret/pull.js +0 -82
  295. package/dist/cmd/cloud/secret/pull.js.map +0 -1
  296. package/dist/cmd/cloud/secret/push.d.ts +0 -2
  297. package/dist/cmd/cloud/secret/push.d.ts.map +0 -1
  298. package/dist/cmd/cloud/secret/push.js +0 -61
  299. package/dist/cmd/cloud/secret/push.js.map +0 -1
  300. package/dist/cmd/cloud/secret/set.d.ts +0 -2
  301. package/dist/cmd/cloud/secret/set.d.ts.map +0 -1
  302. package/dist/cmd/cloud/secret/set.js +0 -63
  303. package/dist/cmd/cloud/secret/set.js.map +0 -1
  304. package/src/cmd/cloud/secret/delete.ts +0 -65
  305. package/src/cmd/cloud/secret/get.ts +0 -77
  306. package/src/cmd/cloud/secret/import.ts +0 -110
  307. package/src/cmd/cloud/secret/index.ts +0 -33
  308. package/src/cmd/cloud/secret/list.ts +0 -70
  309. package/src/cmd/cloud/secret/pull.ts +0 -92
  310. package/src/cmd/cloud/secret/push.ts +0 -69
  311. package/src/cmd/cloud/secret/set.ts +0 -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.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
 
@@ -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
  identifier: z.string().optional().describe('The project, deployment, or sandbox id to use'),
8
9
  command: z.string().optional().describe('The command to run'),
@@ -39,13 +40,13 @@ export const sshSubcommand = createSubcommand({
39
40
  },
40
41
  ],
41
42
  toplevel: true,
42
- requires: { auth: true, apiClient: true, region: true },
43
+ requires: { auth: true, apiClient: true },
43
44
  optional: { project: true },
44
45
  prerequisites: ['cloud deploy'],
45
46
  schema: { args, options },
46
47
 
47
48
  async handler(ctx) {
48
- const { apiClient, project, projectDir, args, config, opts, region } = ctx;
49
+ const { apiClient, project, projectDir, args, config, opts, logger, auth, orgId } = ctx;
49
50
 
50
51
  let projectId = project?.projectId;
51
52
  let identifier = args?.identifier;
@@ -66,6 +67,18 @@ export const sshSubcommand = createSubcommand({
66
67
  projectId = await tui.showProjectList(apiClient, true);
67
68
  }
68
69
 
70
+ // Look up region from identifier (project/deployment/sandbox)
71
+ const profileName = config?.name;
72
+ const targetIdentifier = identifier ?? projectId!;
73
+ const region = await getIdentifierRegion(
74
+ logger,
75
+ auth,
76
+ apiClient,
77
+ profileName,
78
+ targetIdentifier,
79
+ orgId
80
+ );
81
+
69
82
  const hostname = getIONHost(config, region);
70
83
 
71
84
  const cmd = ['ssh', `${identifier ?? projectId}@${hostname}`, command].filter(
@@ -1,14 +1,15 @@
1
1
  import { z } from 'zod';
2
- import { listResources, deleteResources } from '@agentuity/server';
2
+ import { listOrgResources, deleteResources } from '@agentuity/server';
3
3
  import enquirer from 'enquirer';
4
4
  import { createSubcommand } from '../../../types';
5
5
  import * as tui from '../../../tui';
6
- import { getCatalystAPIClient } from '../../../config';
6
+ import { getGlobalCatalystAPIClient, getCatalystAPIClient } from '../../../config';
7
7
  import { getCommand } from '../../../command-prefix';
8
8
  import { isDryRunMode, outputDryRun } from '../../../explain';
9
9
  import { ErrorCode } from '../../../errors';
10
10
  import { createS3Client } from './utils';
11
11
  import { removeResourceEnvVars } from '../../../env-util';
12
+ import { getResourceInfo, setResourceInfo, deleteResourceRegion } from '../../../cache';
12
13
 
13
14
  export const deleteSubcommand = createSubcommand({
14
15
  name: 'delete',
@@ -16,7 +17,8 @@ export const deleteSubcommand = createSubcommand({
16
17
  description: 'Delete a storage resource or file',
17
18
  tags: ['destructive', 'deletes-resource', 'slow', 'requires-auth', 'requires-deployment'],
18
19
  idempotent: false,
19
- requires: { auth: true, org: true, region: true },
20
+ requires: { auth: true },
21
+ optional: { org: true },
20
22
  examples: [
21
23
  {
22
24
  command: getCommand('cloud storage delete my-bucket'),
@@ -50,19 +52,50 @@ export const deleteSubcommand = createSubcommand({
50
52
  },
51
53
 
52
54
  async handler(ctx) {
53
- const { logger, args, opts, orgId, region, auth, options } = ctx;
55
+ const { logger, args, opts, auth, options, config } = ctx;
54
56
 
55
- const catalystClient = getCatalystAPIClient(logger, auth, region);
57
+ const profileName = config?.name ?? 'production';
58
+ const catalystClient = await getGlobalCatalystAPIClient(logger, auth, profileName);
59
+
60
+ let bucketName = args.name;
61
+
62
+ // If bucket name provided, try cache first for orgId
63
+ let orgId = ctx.orgId;
64
+ if (bucketName && !orgId) {
65
+ const cachedInfo = await getResourceInfo('bucket', profileName, bucketName);
66
+ orgId = cachedInfo?.orgId;
67
+ }
68
+
69
+ // For interactive selection (no bucket name), we need orgId
70
+ if (!bucketName && !orgId) {
71
+ tui.fatal(
72
+ 'Organization required for interactive bucket selection. Specify --org-id or provide bucket name.',
73
+ ErrorCode.INVALID_ARGUMENT
74
+ );
75
+ }
76
+
77
+ // If we still don't have orgId and have a bucket name, error out
78
+ if (!orgId) {
79
+ tui.fatal(
80
+ `Organization not found for bucket '${bucketName}'. Run 'agentuity cloud storage list' first or specify --org-id.`,
81
+ ErrorCode.INVALID_ARGUMENT
82
+ );
83
+ }
56
84
 
57
85
  const resources = await tui.spinner({
58
- message: `Fetching storage for ${orgId} in ${region}`,
86
+ message: `Fetching storage for ${orgId}`,
59
87
  clearOnSuccess: true,
60
88
  callback: async () => {
61
- return listResources(catalystClient, orgId, region!);
89
+ return listOrgResources(catalystClient, { type: 's3', orgId });
62
90
  },
63
91
  });
64
92
 
65
- let bucketName = args.name;
93
+ // Cache all fetched buckets
94
+ for (const s3 of resources.s3) {
95
+ if (s3.cloud_region) {
96
+ await setResourceInfo('bucket', profileName, s3.bucket_name, s3.cloud_region, orgId);
97
+ }
98
+ }
66
99
 
67
100
  if (!bucketName) {
68
101
  if (resources.s3.length === 0) {
@@ -155,9 +188,22 @@ export const deleteSubcommand = createSubcommand({
155
188
  }
156
189
 
157
190
  // Otherwise, delete the bucket
191
+ // Find the bucket to get its region
192
+ const bucketToDelete = resources.s3.find((s3) => s3.bucket_name === bucketName);
193
+ if (!bucketToDelete) {
194
+ tui.fatal(`Storage bucket '${bucketName}' not found`, ErrorCode.RESOURCE_NOT_FOUND);
195
+ }
196
+ if (!bucketToDelete.cloud_region) {
197
+ tui.fatal(
198
+ `Storage bucket '${bucketName}' is missing region information`,
199
+ ErrorCode.RESOURCE_NOT_FOUND
200
+ );
201
+ }
202
+ const region = bucketToDelete.cloud_region;
203
+
158
204
  // Handle dry-run mode
159
205
  if (isDryRunMode(options)) {
160
- outputDryRun(`Would delete storage bucket: ${bucketName}`, options);
206
+ outputDryRun(`Would delete storage bucket: ${bucketName} (region: ${region})`, options);
161
207
  if (!options.json) {
162
208
  tui.newline();
163
209
  tui.info('[DRY RUN] Storage bucket deletion skipped');
@@ -184,11 +230,13 @@ export const deleteSubcommand = createSubcommand({
184
230
  }
185
231
  }
186
232
 
233
+ // Use regional client for the delete operation
234
+ const regionalClient = getCatalystAPIClient(logger, auth, region);
187
235
  const deleted = await tui.spinner({
188
236
  message: `Deleting storage bucket ${bucketName}`,
189
237
  clearOnSuccess: true,
190
238
  callback: async () => {
191
- return deleteResources(catalystClient, orgId, region!, [
239
+ return deleteResources(regionalClient, orgId, region, [
192
240
  { type: 's3', name: bucketName },
193
241
  ]);
194
242
  },
@@ -197,6 +245,9 @@ export const deleteSubcommand = createSubcommand({
197
245
  if (deleted.length > 0) {
198
246
  const resource = deleted[0];
199
247
 
248
+ // Clear cache entry for deleted bucket
249
+ await deleteResourceRegion('bucket', profileName, resource.name);
250
+
200
251
  // Remove env vars from .env if running inside a project
201
252
  if (ctx.projectDir && resource.env_keys.length > 0) {
202
253
  await removeResourceEnvVars(ctx.projectDir, resource.env_keys);
@@ -1,17 +1,19 @@
1
1
  import { z } from 'zod';
2
- import { listResources } from '@agentuity/server';
2
+ import { listOrgResources } from '@agentuity/server';
3
3
  import { createSubcommand } from '../../../types';
4
4
  import * as tui from '../../../tui';
5
- import { getCatalystAPIClient } from '../../../config';
5
+ import { getGlobalCatalystAPIClient } from '../../../config';
6
6
  import { getCommand } from '../../../command-prefix';
7
7
  import { ErrorCode } from '../../../errors';
8
8
  import { createS3Client } from './utils';
9
+ import { getResourceInfo, setResourceInfo } from '../../../cache';
9
10
 
10
11
  export const downloadSubcommand = createSubcommand({
11
12
  name: 'download',
12
13
  description: 'Download a file from storage bucket',
13
14
  tags: ['read-only', 'requires-auth'],
14
- requires: { auth: true, org: true, region: true },
15
+ requires: { auth: true },
16
+ optional: { org: true },
15
17
  idempotent: true,
16
18
  examples: [
17
19
  {
@@ -51,21 +53,44 @@ export const downloadSubcommand = createSubcommand({
51
53
  },
52
54
 
53
55
  async handler(ctx) {
54
- const { logger, args, opts, options, orgId, region, auth } = ctx;
56
+ const { logger, args, opts, options, auth, config } = ctx;
55
57
 
56
- const catalystClient = getCatalystAPIClient(logger, auth, region);
58
+ const profileName = config?.name ?? 'production';
59
+ const catalystClient = await getGlobalCatalystAPIClient(logger, auth, profileName);
60
+
61
+ // Check cache first for orgId
62
+ const cachedInfo = await getResourceInfo('bucket', profileName, args.name);
63
+ const orgId = ctx.orgId ?? cachedInfo?.orgId;
64
+
65
+ if (!orgId) {
66
+ tui.fatal(
67
+ `Organization not found for bucket '${args.name}'. Run 'agentuity cloud storage list' first or specify --org-id.`,
68
+ ErrorCode.INVALID_ARGUMENT
69
+ );
70
+ }
57
71
 
58
72
  // Fetch bucket credentials
59
73
  const resources = await tui.spinner({
60
74
  message: `Fetching credentials for ${args.name}`,
61
75
  clearOnSuccess: true,
62
76
  callback: async () => {
63
- return listResources(catalystClient, orgId, region);
77
+ return listOrgResources(catalystClient, { type: 's3', orgId });
64
78
  },
65
79
  });
66
80
 
67
81
  const bucket = resources.s3.find((s3) => s3.bucket_name === args.name);
68
82
 
83
+ // Cache the bucket info for future lookups
84
+ if (bucket?.cloud_region) {
85
+ await setResourceInfo(
86
+ 'bucket',
87
+ profileName,
88
+ bucket.bucket_name,
89
+ bucket.cloud_region,
90
+ orgId
91
+ );
92
+ }
93
+
69
94
  if (!bucket) {
70
95
  tui.fatal(`Storage bucket '${args.name}' not found`, ErrorCode.RESOURCE_NOT_FOUND);
71
96
  }
@@ -1,10 +1,11 @@
1
1
  import { z } from 'zod';
2
- import { listResources } from '@agentuity/server';
2
+ import { listOrgResources } from '@agentuity/server';
3
3
  import { createSubcommand } from '../../../types';
4
4
  import * as tui from '../../../tui';
5
- import { getCatalystAPIClient } from '../../../config';
5
+ import { getGlobalCatalystAPIClient } from '../../../config';
6
6
  import { getCommand } from '../../../command-prefix';
7
7
  import { ErrorCode } from '../../../errors';
8
+ import { getResourceInfo, setResourceInfo } from '../../../cache';
8
9
 
9
10
  const StorageGetResponseSchema = z.object({
10
11
  bucket_name: z.string().describe('Storage bucket name'),
@@ -19,7 +20,8 @@ export const getSubcommand = createSubcommand({
19
20
  aliases: ['show'],
20
21
  description: 'Show details about a specific storage bucket',
21
22
  tags: ['read-only', 'fast', 'requires-auth'],
22
- requires: { auth: true, org: true, region: true },
23
+ requires: { auth: true },
24
+ optional: { org: true },
23
25
  idempotent: true,
24
26
  examples: [
25
27
  {
@@ -52,20 +54,43 @@ export const getSubcommand = createSubcommand({
52
54
  webUrl: (ctx) => `/services/storage/${encodeURIComponent(ctx.args.name)}`,
53
55
 
54
56
  async handler(ctx) {
55
- const { logger, args, opts, options, orgId, region, auth } = ctx;
57
+ const { logger, args, opts, options, auth, config } = ctx;
56
58
 
57
- const catalystClient = getCatalystAPIClient(logger, auth, region);
59
+ const profileName = config?.name ?? 'production';
60
+ const catalystClient = await getGlobalCatalystAPIClient(logger, auth, profileName);
61
+
62
+ // Check cache first for orgId
63
+ const cachedInfo = await getResourceInfo('bucket', profileName, args.name);
64
+ const orgId = ctx.orgId ?? cachedInfo?.orgId;
65
+
66
+ if (!orgId) {
67
+ tui.fatal(
68
+ `Organization not found for bucket '${args.name}'. Run 'agentuity cloud storage list' first or specify --org-id.`,
69
+ ErrorCode.INVALID_ARGUMENT
70
+ );
71
+ }
58
72
 
59
73
  const resources = await tui.spinner({
60
74
  message: `Fetching storage bucket ${args.name}`,
61
75
  clearOnSuccess: true,
62
76
  callback: async () => {
63
- return listResources(catalystClient, orgId, region);
77
+ return listOrgResources(catalystClient, { type: 's3', orgId });
64
78
  },
65
79
  });
66
80
 
67
81
  const bucket = resources.s3.find((s3) => s3.bucket_name === args.name);
68
82
 
83
+ // Cache the bucket info for future lookups
84
+ if (bucket?.cloud_region) {
85
+ await setResourceInfo(
86
+ 'bucket',
87
+ profileName,
88
+ bucket.bucket_name,
89
+ bucket.cloud_region,
90
+ orgId
91
+ );
92
+ }
93
+
69
94
  if (!bucket) {
70
95
  tui.fatal(`Storage bucket '${args.name}' not found`, ErrorCode.RESOURCE_NOT_FOUND);
71
96
  }
@@ -1,11 +1,12 @@
1
1
  import { z } from 'zod';
2
- import { listResources } from '@agentuity/server';
2
+ import { listOrgResources } from '@agentuity/server';
3
3
  import { createSubcommand } from '../../../types';
4
4
  import * as tui from '../../../tui';
5
- import { getCatalystAPIClient } from '../../../config';
5
+ import { getGlobalCatalystAPIClient } from '../../../config';
6
6
  import { getCommand } from '../../../command-prefix';
7
7
  import { ErrorCode } from '../../../errors';
8
8
  import { createS3Client } from './utils';
9
+ import { setResourceInfo } from '../../../cache';
9
10
 
10
11
  const StorageListResponseSchema = z.object({
11
12
  buckets: z
@@ -16,6 +17,7 @@ const StorageListResponseSchema = z.object({
16
17
  secret_key: z.string().optional().describe('S3 secret key'),
17
18
  region: z.string().optional().describe('S3 region'),
18
19
  endpoint: z.string().optional().describe('S3 endpoint URL'),
20
+ cloud_region: z.string().optional().describe('Cloud region where bucket is hosted'),
19
21
  })
20
22
  )
21
23
  .optional()
@@ -37,7 +39,7 @@ export const listSubcommand = createSubcommand({
37
39
  aliases: ['ls'],
38
40
  description: 'List storage resources or files in a bucket',
39
41
  tags: ['read-only', 'fast', 'requires-auth'],
40
- requires: { auth: true, org: true, region: true },
42
+ requires: { auth: true, org: true },
41
43
  idempotent: true,
42
44
  examples: [
43
45
  { command: getCommand('cloud storage list'), description: 'List items' },
@@ -78,18 +80,26 @@ export const listSubcommand = createSubcommand({
78
80
  : '/services/storage',
79
81
 
80
82
  async handler(ctx) {
81
- const { logger, args, opts, options, orgId, region, auth } = ctx;
83
+ const { logger, args, opts, options, orgId, auth, config } = ctx;
82
84
 
83
- const catalystClient = getCatalystAPIClient(logger, auth, region);
85
+ const catalystClient = await getGlobalCatalystAPIClient(logger, auth, config?.name);
84
86
 
87
+ const profileName = config?.name ?? 'production';
85
88
  const resources = await tui.spinner({
86
- message: `Fetching storage for ${orgId} in ${region}`,
89
+ message: `Fetching storage for ${orgId}`,
87
90
  clearOnSuccess: true,
88
91
  callback: async () => {
89
- return listResources(catalystClient, orgId, region);
92
+ return listOrgResources(catalystClient, { type: 's3', orgId });
90
93
  },
91
94
  });
92
95
 
96
+ // Cache each bucket with its region and orgId for future lookups
97
+ for (const s3 of resources.s3) {
98
+ if (s3.cloud_region) {
99
+ await setResourceInfo('bucket', profileName, s3.bucket_name, s3.cloud_region, orgId);
100
+ }
101
+ }
102
+
93
103
  // If bucket name is provided, list files in the bucket
94
104
  if (args.name) {
95
105
  const bucket = resources.s3.find((s3) => s3.bucket_name === args.name);
@@ -219,6 +229,7 @@ export const listSubcommand = createSubcommand({
219
229
  secret_key: s3.secret_key ?? undefined,
220
230
  region: s3.region ?? undefined,
221
231
  endpoint: s3.endpoint ?? undefined,
232
+ cloud_region: s3.cloud_region,
222
233
  })),
223
234
  };
224
235
  },
@@ -1,19 +1,21 @@
1
1
  import { z } from 'zod';
2
2
  import { basename } from 'path';
3
- import { listResources } from '@agentuity/server';
3
+ import { listOrgResources } from '@agentuity/server';
4
4
  import { createSubcommand } from '../../../types';
5
5
  import * as tui from '../../../tui';
6
- import { getCatalystAPIClient } from '../../../config';
6
+ import { getGlobalCatalystAPIClient } from '../../../config';
7
7
  import { getCommand } from '../../../command-prefix';
8
8
  import { ErrorCode } from '../../../errors';
9
9
  import { createS3Client } from './utils';
10
+ import { getResourceInfo, setResourceInfo } from '../../../cache';
10
11
 
11
12
  export const uploadSubcommand = createSubcommand({
12
13
  name: 'upload',
13
14
  aliases: ['put'],
14
15
  description: 'Upload a file to storage bucket',
15
16
  tags: ['write', 'requires-auth'],
16
- requires: { auth: true, org: true, region: true },
17
+ requires: { auth: true },
18
+ optional: { org: true },
17
19
  idempotent: false,
18
20
  examples: [
19
21
  {
@@ -61,21 +63,44 @@ export const uploadSubcommand = createSubcommand({
61
63
  },
62
64
 
63
65
  async handler(ctx) {
64
- const { logger, args, opts, options, orgId, region, auth } = ctx;
66
+ const { logger, args, opts, options, auth, config } = ctx;
65
67
 
66
- const catalystClient = getCatalystAPIClient(logger, auth, region);
68
+ const profileName = config?.name ?? 'production';
69
+ const catalystClient = await getGlobalCatalystAPIClient(logger, auth, profileName);
70
+
71
+ // Check cache first for orgId
72
+ const cachedInfo = await getResourceInfo('bucket', profileName, args.name);
73
+ const orgId = ctx.orgId ?? cachedInfo?.orgId;
74
+
75
+ if (!orgId) {
76
+ tui.fatal(
77
+ `Organization not found for bucket '${args.name}'. Run 'agentuity cloud storage list' first or specify --org-id.`,
78
+ ErrorCode.INVALID_ARGUMENT
79
+ );
80
+ }
67
81
 
68
82
  // Fetch bucket credentials
69
83
  const resources = await tui.spinner({
70
84
  message: `Fetching credentials for ${args.name}`,
71
85
  clearOnSuccess: true,
72
86
  callback: async () => {
73
- return listResources(catalystClient, orgId, region);
87
+ return listOrgResources(catalystClient, { type: 's3', orgId });
74
88
  },
75
89
  });
76
90
 
77
91
  const bucket = resources.s3.find((s3) => s3.bucket_name === args.name);
78
92
 
93
+ // Cache the bucket info for future lookups
94
+ if (bucket?.cloud_region) {
95
+ await setResourceInfo(
96
+ 'bucket',
97
+ profileName,
98
+ bucket.bucket_name,
99
+ bucket.cloud_region,
100
+ orgId
101
+ );
102
+ }
103
+
79
104
  if (!bucket) {
80
105
  tui.fatal(`Storage bucket '${args.name}' not found`, ErrorCode.RESOURCE_NOT_FOUND);
81
106
  }
@@ -4,7 +4,7 @@ import * as tui from '../../../tui';
4
4
  import { threadDelete, APIError } 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
  export const deleteSubcommand = createSubcommand({
10
10
  name: 'delete',
@@ -17,15 +17,15 @@ export const deleteSubcommand = createSubcommand({
17
17
  },
18
18
  ],
19
19
  aliases: ['rm'],
20
- requires: { auth: true, region: true },
20
+ requires: { auth: true },
21
21
  schema: {
22
22
  args: z.object({
23
23
  thread_id: z.string().describe('Thread ID'),
24
24
  }),
25
25
  },
26
26
  async handler(ctx) {
27
- const { logger, auth, args, region } = ctx;
28
- const catalystClient = getCatalystAPIClient(logger, auth, region);
27
+ const { logger, auth, args, config } = ctx;
28
+ const catalystClient = await getGlobalCatalystAPIClient(logger, auth, config?.name);
29
29
 
30
30
  try {
31
31
  await threadDelete(catalystClient, { id: args.thread_id });
@@ -4,7 +4,7 @@ import * as tui from '../../../tui';
4
4
  import { threadGet, APIError } 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 ThreadGetResponseSchema = z.object({
10
10
  id: z.string().describe('Thread ID'),
@@ -28,7 +28,7 @@ export const getSubcommand = createSubcommand({
28
28
  description: 'Get a thread by ID',
29
29
  },
30
30
  ],
31
- requires: { auth: true, region: true },
31
+ requires: { auth: true },
32
32
  idempotent: true,
33
33
  schema: {
34
34
  args: z.object({
@@ -37,8 +37,8 @@ export const getSubcommand = createSubcommand({
37
37
  response: ThreadGetResponseSchema,
38
38
  },
39
39
  async handler(ctx) {
40
- const { logger, auth, args, options, region } = ctx;
41
- const catalystClient = getCatalystAPIClient(logger, auth, region);
40
+ const { logger, auth, args, options, config } = ctx;
41
+ const catalystClient = await getGlobalCatalystAPIClient(logger, auth, config?.name);
42
42
 
43
43
  try {
44
44
  const thread = await threadGet(catalystClient, { id: args.thread_id });