@agentuity/cli 1.0.23 → 1.0.24

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 (266) hide show
  1. package/dist/cmd/cloud/db/index.d.ts.map +1 -1
  2. package/dist/cmd/cloud/db/index.js +2 -0
  3. package/dist/cmd/cloud/db/index.js.map +1 -1
  4. package/dist/cmd/cloud/db/stats.d.ts +3 -0
  5. package/dist/cmd/cloud/db/stats.d.ts.map +1 -0
  6. package/dist/cmd/cloud/db/stats.js +66 -0
  7. package/dist/cmd/cloud/db/stats.js.map +1 -0
  8. package/dist/cmd/cloud/email/create.d.ts.map +1 -1
  9. package/dist/cmd/cloud/email/create.js +14 -6
  10. package/dist/cmd/cloud/email/create.js.map +1 -1
  11. package/dist/cmd/cloud/email/delete.js +1 -1
  12. package/dist/cmd/cloud/email/delete.js.map +1 -1
  13. package/dist/cmd/cloud/email/destination/delete.js +1 -1
  14. package/dist/cmd/cloud/email/destination/delete.js.map +1 -1
  15. package/dist/cmd/cloud/email/destination/list.js +1 -1
  16. package/dist/cmd/cloud/email/destination/list.js.map +1 -1
  17. package/dist/cmd/cloud/email/destination/url.d.ts.map +1 -1
  18. package/dist/cmd/cloud/email/destination/url.js +5 -4
  19. package/dist/cmd/cloud/email/destination/url.js.map +1 -1
  20. package/dist/cmd/cloud/email/get.js +1 -1
  21. package/dist/cmd/cloud/email/get.js.map +1 -1
  22. package/dist/cmd/cloud/email/inbound/get.d.ts.map +1 -1
  23. package/dist/cmd/cloud/email/inbound/get.js +2 -3
  24. package/dist/cmd/cloud/email/inbound/get.js.map +1 -1
  25. package/dist/cmd/cloud/email/inbound/list.d.ts.map +1 -1
  26. package/dist/cmd/cloud/email/inbound/list.js +1 -3
  27. package/dist/cmd/cloud/email/inbound/list.js.map +1 -1
  28. package/dist/cmd/cloud/email/inbound/schemas.d.ts +3 -1
  29. package/dist/cmd/cloud/email/inbound/schemas.d.ts.map +1 -1
  30. package/dist/cmd/cloud/email/inbound/schemas.js +3 -1
  31. package/dist/cmd/cloud/email/inbound/schemas.js.map +1 -1
  32. package/dist/cmd/cloud/email/index.d.ts.map +1 -1
  33. package/dist/cmd/cloud/email/index.js +2 -0
  34. package/dist/cmd/cloud/email/index.js.map +1 -1
  35. package/dist/cmd/cloud/email/list.d.ts.map +1 -1
  36. package/dist/cmd/cloud/email/list.js +9 -2
  37. package/dist/cmd/cloud/email/list.js.map +1 -1
  38. package/dist/cmd/cloud/email/outbound/get.js +4 -4
  39. package/dist/cmd/cloud/email/outbound/get.js.map +1 -1
  40. package/dist/cmd/cloud/email/outbound/list.js +3 -3
  41. package/dist/cmd/cloud/email/outbound/list.js.map +1 -1
  42. package/dist/cmd/cloud/email/outbound/schemas.d.ts +2 -2
  43. package/dist/cmd/cloud/email/outbound/schemas.js +2 -2
  44. package/dist/cmd/cloud/email/outbound/schemas.js.map +1 -1
  45. package/dist/cmd/cloud/email/send.d.ts.map +1 -1
  46. package/dist/cmd/cloud/email/send.js +8 -10
  47. package/dist/cmd/cloud/email/send.js.map +1 -1
  48. package/dist/cmd/cloud/email/stats.d.ts +3 -0
  49. package/dist/cmd/cloud/email/stats.d.ts.map +1 -0
  50. package/dist/cmd/cloud/email/stats.js +65 -0
  51. package/dist/cmd/cloud/email/stats.js.map +1 -0
  52. package/dist/cmd/cloud/email/util.d.ts +4 -7
  53. package/dist/cmd/cloud/email/util.d.ts.map +1 -1
  54. package/dist/cmd/cloud/email/util.js +8 -23
  55. package/dist/cmd/cloud/email/util.js.map +1 -1
  56. package/dist/cmd/cloud/index.d.ts.map +1 -1
  57. package/dist/cmd/cloud/index.js +2 -0
  58. package/dist/cmd/cloud/index.js.map +1 -1
  59. package/dist/cmd/cloud/queue/get.js +4 -4
  60. package/dist/cmd/cloud/queue/get.js.map +1 -1
  61. package/dist/cmd/cloud/queue/receive.d.ts.map +1 -1
  62. package/dist/cmd/cloud/queue/receive.js +11 -7
  63. package/dist/cmd/cloud/queue/receive.js.map +1 -1
  64. package/dist/cmd/cloud/queue/stats.js +3 -3
  65. package/dist/cmd/cloud/queue/stats.js.map +1 -1
  66. package/dist/cmd/cloud/sandbox/checkpoint/create.d.ts +3 -0
  67. package/dist/cmd/cloud/sandbox/checkpoint/create.d.ts.map +1 -0
  68. package/dist/cmd/cloud/sandbox/checkpoint/create.js +71 -0
  69. package/dist/cmd/cloud/sandbox/checkpoint/create.js.map +1 -0
  70. package/dist/cmd/cloud/sandbox/checkpoint/delete.d.ts +3 -0
  71. package/dist/cmd/cloud/sandbox/checkpoint/delete.d.ts.map +1 -0
  72. package/dist/cmd/cloud/sandbox/checkpoint/delete.js +78 -0
  73. package/dist/cmd/cloud/sandbox/checkpoint/delete.js.map +1 -0
  74. package/dist/cmd/cloud/sandbox/checkpoint/index.d.ts +2 -0
  75. package/dist/cmd/cloud/sandbox/checkpoint/index.d.ts.map +1 -0
  76. package/dist/cmd/cloud/sandbox/checkpoint/index.js +33 -0
  77. package/dist/cmd/cloud/sandbox/checkpoint/index.js.map +1 -0
  78. package/dist/cmd/cloud/sandbox/checkpoint/list.d.ts +3 -0
  79. package/dist/cmd/cloud/sandbox/checkpoint/list.d.ts.map +1 -0
  80. package/dist/cmd/cloud/sandbox/checkpoint/list.js +72 -0
  81. package/dist/cmd/cloud/sandbox/checkpoint/list.js.map +1 -0
  82. package/dist/cmd/cloud/sandbox/checkpoint/restore.d.ts +3 -0
  83. package/dist/cmd/cloud/sandbox/checkpoint/restore.d.ts.map +1 -0
  84. package/dist/cmd/cloud/sandbox/checkpoint/restore.js +61 -0
  85. package/dist/cmd/cloud/sandbox/checkpoint/restore.js.map +1 -0
  86. package/dist/cmd/cloud/sandbox/get.d.ts.map +1 -1
  87. package/dist/cmd/cloud/sandbox/get.js +5 -3
  88. package/dist/cmd/cloud/sandbox/get.js.map +1 -1
  89. package/dist/cmd/cloud/sandbox/index.d.ts.map +1 -1
  90. package/dist/cmd/cloud/sandbox/index.js +4 -0
  91. package/dist/cmd/cloud/sandbox/index.js.map +1 -1
  92. package/dist/cmd/cloud/sandbox/snapshot/build.js +9 -9
  93. package/dist/cmd/cloud/sandbox/snapshot/build.js.map +1 -1
  94. package/dist/cmd/cloud/sandbox/snapshot/get.js +3 -3
  95. package/dist/cmd/cloud/sandbox/snapshot/get.js.map +1 -1
  96. package/dist/cmd/cloud/sandbox/stats.d.ts +3 -0
  97. package/dist/cmd/cloud/sandbox/stats.d.ts.map +1 -0
  98. package/dist/cmd/cloud/sandbox/stats.js +72 -0
  99. package/dist/cmd/cloud/sandbox/stats.js.map +1 -0
  100. package/dist/cmd/cloud/schedule/create.d.ts.map +1 -1
  101. package/dist/cmd/cloud/schedule/create.js +3 -4
  102. package/dist/cmd/cloud/schedule/create.js.map +1 -1
  103. package/dist/cmd/cloud/schedule/delete.d.ts.map +1 -1
  104. package/dist/cmd/cloud/schedule/delete.js +2 -3
  105. package/dist/cmd/cloud/schedule/delete.js.map +1 -1
  106. package/dist/cmd/cloud/schedule/delivery/get.d.ts.map +1 -1
  107. package/dist/cmd/cloud/schedule/delivery/get.js +3 -4
  108. package/dist/cmd/cloud/schedule/delivery/get.js.map +1 -1
  109. package/dist/cmd/cloud/schedule/delivery/list.d.ts.map +1 -1
  110. package/dist/cmd/cloud/schedule/delivery/list.js +2 -3
  111. package/dist/cmd/cloud/schedule/delivery/list.js.map +1 -1
  112. package/dist/cmd/cloud/schedule/destination/create.d.ts.map +1 -1
  113. package/dist/cmd/cloud/schedule/destination/create.js +7 -4
  114. package/dist/cmd/cloud/schedule/destination/create.js.map +1 -1
  115. package/dist/cmd/cloud/schedule/destination/delete.d.ts.map +1 -1
  116. package/dist/cmd/cloud/schedule/destination/delete.js +2 -3
  117. package/dist/cmd/cloud/schedule/destination/delete.js.map +1 -1
  118. package/dist/cmd/cloud/schedule/destination/get.js +15 -13
  119. package/dist/cmd/cloud/schedule/destination/get.js.map +1 -1
  120. package/dist/cmd/cloud/schedule/destination/list.d.ts.map +1 -1
  121. package/dist/cmd/cloud/schedule/destination/list.js +13 -9
  122. package/dist/cmd/cloud/schedule/destination/list.js.map +1 -1
  123. package/dist/cmd/cloud/schedule/get.d.ts.map +1 -1
  124. package/dist/cmd/cloud/schedule/get.js +15 -11
  125. package/dist/cmd/cloud/schedule/get.js.map +1 -1
  126. package/dist/cmd/cloud/schedule/index.d.ts.map +1 -1
  127. package/dist/cmd/cloud/schedule/index.js +2 -0
  128. package/dist/cmd/cloud/schedule/index.js.map +1 -1
  129. package/dist/cmd/cloud/schedule/list.d.ts.map +1 -1
  130. package/dist/cmd/cloud/schedule/list.js +2 -3
  131. package/dist/cmd/cloud/schedule/list.js.map +1 -1
  132. package/dist/cmd/cloud/schedule/stats.d.ts +3 -0
  133. package/dist/cmd/cloud/schedule/stats.d.ts.map +1 -0
  134. package/dist/cmd/cloud/schedule/stats.js +64 -0
  135. package/dist/cmd/cloud/schedule/stats.js.map +1 -0
  136. package/dist/cmd/cloud/schedule/update.js +5 -5
  137. package/dist/cmd/cloud/schedule/update.js.map +1 -1
  138. package/dist/cmd/cloud/schedule/util.d.ts +4 -5
  139. package/dist/cmd/cloud/schedule/util.d.ts.map +1 -1
  140. package/dist/cmd/cloud/schedule/util.js +6 -6
  141. package/dist/cmd/cloud/schedule/util.js.map +1 -1
  142. package/dist/cmd/cloud/services/index.d.ts +3 -0
  143. package/dist/cmd/cloud/services/index.d.ts.map +1 -0
  144. package/dist/cmd/cloud/services/index.js +10 -0
  145. package/dist/cmd/cloud/services/index.js.map +1 -0
  146. package/dist/cmd/cloud/services/stats.d.ts +3 -0
  147. package/dist/cmd/cloud/services/stats.d.ts.map +1 -0
  148. package/dist/cmd/cloud/services/stats.js +153 -0
  149. package/dist/cmd/cloud/services/stats.js.map +1 -0
  150. package/dist/cmd/cloud/stream/index.d.ts.map +1 -1
  151. package/dist/cmd/cloud/stream/index.js +2 -1
  152. package/dist/cmd/cloud/stream/index.js.map +1 -1
  153. package/dist/cmd/cloud/stream/stats.d.ts +3 -0
  154. package/dist/cmd/cloud/stream/stats.d.ts.map +1 -0
  155. package/dist/cmd/cloud/stream/stats.js +64 -0
  156. package/dist/cmd/cloud/stream/stats.js.map +1 -0
  157. package/dist/cmd/cloud/task/create.d.ts.map +1 -1
  158. package/dist/cmd/cloud/task/create.js +0 -1
  159. package/dist/cmd/cloud/task/create.js.map +1 -1
  160. package/dist/cmd/cloud/task/get.d.ts.map +1 -1
  161. package/dist/cmd/cloud/task/get.js +4 -3
  162. package/dist/cmd/cloud/task/get.js.map +1 -1
  163. package/dist/cmd/cloud/task/index.d.ts.map +1 -1
  164. package/dist/cmd/cloud/task/index.js +2 -1
  165. package/dist/cmd/cloud/task/index.js.map +1 -1
  166. package/dist/cmd/cloud/task/list.d.ts.map +1 -1
  167. package/dist/cmd/cloud/task/list.js +1 -2
  168. package/dist/cmd/cloud/task/list.js.map +1 -1
  169. package/dist/cmd/cloud/task/stats.d.ts +3 -0
  170. package/dist/cmd/cloud/task/stats.d.ts.map +1 -0
  171. package/dist/cmd/cloud/task/stats.js +66 -0
  172. package/dist/cmd/cloud/task/stats.js.map +1 -0
  173. package/dist/cmd/cloud/task/update.d.ts.map +1 -1
  174. package/dist/cmd/cloud/task/update.js +0 -1
  175. package/dist/cmd/cloud/task/update.js.map +1 -1
  176. package/dist/cmd/cloud/task/util.d.ts +4 -7
  177. package/dist/cmd/cloud/task/util.d.ts.map +1 -1
  178. package/dist/cmd/cloud/task/util.js +6 -10
  179. package/dist/cmd/cloud/task/util.js.map +1 -1
  180. package/dist/cmd/cloud/vector/get.d.ts.map +1 -1
  181. package/dist/cmd/cloud/vector/get.js +17 -12
  182. package/dist/cmd/cloud/vector/get.js.map +1 -1
  183. package/dist/cmd/cloud/vector/stats.d.ts.map +1 -1
  184. package/dist/cmd/cloud/vector/stats.js +10 -7
  185. package/dist/cmd/cloud/vector/stats.js.map +1 -1
  186. package/dist/cmd/cloud/webhook/deliveries.d.ts.map +1 -1
  187. package/dist/cmd/cloud/webhook/deliveries.js +9 -3
  188. package/dist/cmd/cloud/webhook/deliveries.js.map +1 -1
  189. package/dist/cmd/cloud/webhook/destinations.d.ts.map +1 -1
  190. package/dist/cmd/cloud/webhook/destinations.js +20 -9
  191. package/dist/cmd/cloud/webhook/destinations.js.map +1 -1
  192. package/dist/cmd/cloud/webhook/get.js +2 -2
  193. package/dist/cmd/cloud/webhook/get.js.map +1 -1
  194. package/dist/cmd/cloud/webhook/receipts.d.ts.map +1 -1
  195. package/dist/cmd/cloud/webhook/receipts.js +19 -3
  196. package/dist/cmd/cloud/webhook/receipts.js.map +1 -1
  197. package/dist/tui.d.ts +4 -0
  198. package/dist/tui.d.ts.map +1 -1
  199. package/dist/tui.js +8 -0
  200. package/dist/tui.js.map +1 -1
  201. package/package.json +6 -6
  202. package/src/cmd/cloud/db/index.ts +2 -0
  203. package/src/cmd/cloud/db/stats.ts +80 -0
  204. package/src/cmd/cloud/email/create.ts +16 -6
  205. package/src/cmd/cloud/email/delete.ts +1 -1
  206. package/src/cmd/cloud/email/destination/delete.ts +1 -1
  207. package/src/cmd/cloud/email/destination/list.ts +1 -1
  208. package/src/cmd/cloud/email/destination/url.ts +5 -4
  209. package/src/cmd/cloud/email/get.ts +1 -1
  210. package/src/cmd/cloud/email/inbound/get.ts +2 -3
  211. package/src/cmd/cloud/email/inbound/list.ts +1 -3
  212. package/src/cmd/cloud/email/inbound/schemas.ts +3 -1
  213. package/src/cmd/cloud/email/index.ts +2 -0
  214. package/src/cmd/cloud/email/list.ts +9 -2
  215. package/src/cmd/cloud/email/outbound/get.ts +4 -4
  216. package/src/cmd/cloud/email/outbound/list.ts +3 -3
  217. package/src/cmd/cloud/email/outbound/schemas.ts +2 -2
  218. package/src/cmd/cloud/email/send.ts +8 -10
  219. package/src/cmd/cloud/email/stats.ts +77 -0
  220. package/src/cmd/cloud/email/util.ts +10 -29
  221. package/src/cmd/cloud/index.ts +2 -0
  222. package/src/cmd/cloud/queue/get.ts +4 -4
  223. package/src/cmd/cloud/queue/receive.ts +15 -7
  224. package/src/cmd/cloud/queue/stats.ts +3 -3
  225. package/src/cmd/cloud/sandbox/checkpoint/create.ts +85 -0
  226. package/src/cmd/cloud/sandbox/checkpoint/delete.ts +93 -0
  227. package/src/cmd/cloud/sandbox/checkpoint/index.ts +33 -0
  228. package/src/cmd/cloud/sandbox/checkpoint/list.ts +83 -0
  229. package/src/cmd/cloud/sandbox/checkpoint/restore.ts +72 -0
  230. package/src/cmd/cloud/sandbox/get.ts +6 -3
  231. package/src/cmd/cloud/sandbox/index.ts +4 -0
  232. package/src/cmd/cloud/sandbox/snapshot/build.ts +9 -9
  233. package/src/cmd/cloud/sandbox/snapshot/get.ts +3 -3
  234. package/src/cmd/cloud/sandbox/stats.ts +86 -0
  235. package/src/cmd/cloud/schedule/create.ts +3 -4
  236. package/src/cmd/cloud/schedule/delete.ts +2 -3
  237. package/src/cmd/cloud/schedule/delivery/get.ts +3 -4
  238. package/src/cmd/cloud/schedule/delivery/list.ts +2 -3
  239. package/src/cmd/cloud/schedule/destination/create.ts +8 -4
  240. package/src/cmd/cloud/schedule/destination/delete.ts +2 -3
  241. package/src/cmd/cloud/schedule/destination/get.ts +17 -17
  242. package/src/cmd/cloud/schedule/destination/list.ts +15 -10
  243. package/src/cmd/cloud/schedule/get.ts +17 -12
  244. package/src/cmd/cloud/schedule/index.ts +2 -0
  245. package/src/cmd/cloud/schedule/list.ts +2 -3
  246. package/src/cmd/cloud/schedule/stats.ts +74 -0
  247. package/src/cmd/cloud/schedule/update.ts +5 -5
  248. package/src/cmd/cloud/schedule/util.ts +13 -18
  249. package/src/cmd/cloud/services/index.ts +11 -0
  250. package/src/cmd/cloud/services/stats.ts +225 -0
  251. package/src/cmd/cloud/stream/index.ts +2 -1
  252. package/src/cmd/cloud/stream/stats.ts +74 -0
  253. package/src/cmd/cloud/task/create.ts +0 -1
  254. package/src/cmd/cloud/task/get.ts +5 -4
  255. package/src/cmd/cloud/task/index.ts +2 -1
  256. package/src/cmd/cloud/task/list.ts +1 -2
  257. package/src/cmd/cloud/task/stats.ts +74 -0
  258. package/src/cmd/cloud/task/update.ts +0 -1
  259. package/src/cmd/cloud/task/util.ts +12 -24
  260. package/src/cmd/cloud/vector/get.ts +16 -11
  261. package/src/cmd/cloud/vector/stats.ts +10 -8
  262. package/src/cmd/cloud/webhook/deliveries.ts +16 -3
  263. package/src/cmd/cloud/webhook/destinations.ts +22 -9
  264. package/src/cmd/cloud/webhook/get.ts +2 -2
  265. package/src/cmd/cloud/webhook/receipts.ts +16 -3
  266. package/src/tui.ts +9 -0
@@ -0,0 +1,72 @@
1
+ import { z } from 'zod';
2
+ import { createCommand } from '../../../../types';
3
+ import * as tui from '../../../../tui';
4
+ import { createSandboxClient } from '../util';
5
+ import { getCommand } from '../../../../command-prefix';
6
+ import { sandboxResolve, diskCheckpointRestore } from '@agentuity/server';
7
+
8
+ const CheckpointRestoreResponseSchema = z.object({
9
+ success: z.boolean().describe('Whether the operation succeeded'),
10
+ sandboxId: z.string().describe('Sandbox ID'),
11
+ checkpointId: z.string().describe('Restored checkpoint ID'),
12
+ durationMs: z.number().describe('Operation duration in milliseconds'),
13
+ });
14
+
15
+ export const restoreSubcommand = createCommand({
16
+ name: 'restore',
17
+ description: 'Restore a sandbox to a disk checkpoint',
18
+ tags: ['slow', 'requires-auth'],
19
+ requires: { auth: true, apiClient: true },
20
+ idempotent: false,
21
+ examples: [
22
+ {
23
+ command: getCommand('cloud sandbox checkpoint restore sbx_abc123 ckpt_def456'),
24
+ description: 'Restore a sandbox to a checkpoint by ID',
25
+ },
26
+ {
27
+ command: getCommand('cloud sandbox checkpoint restore sbx_abc123 my-checkpoint'),
28
+ description: 'Restore a sandbox to a checkpoint by name',
29
+ },
30
+ ],
31
+ schema: {
32
+ args: z.object({
33
+ sandboxId: z.string().describe('Sandbox ID'),
34
+ checkpointId: z.string().describe('Checkpoint ID or name'),
35
+ }),
36
+ options: z.object({}),
37
+ response: CheckpointRestoreResponseSchema,
38
+ },
39
+
40
+ async handler(ctx) {
41
+ const { args, options, auth, logger, apiClient } = ctx;
42
+
43
+ const started = Date.now();
44
+
45
+ // Resolve sandbox to get region and orgId using CLI API
46
+ const sandboxInfo = await sandboxResolve(apiClient, args.sandboxId);
47
+
48
+ const client = createSandboxClient(logger, auth, sandboxInfo.region);
49
+
50
+ await diskCheckpointRestore(client, {
51
+ sandboxId: args.sandboxId,
52
+ checkpointId: args.checkpointId,
53
+ orgId: sandboxInfo.orgId,
54
+ });
55
+ const durationMs = Date.now() - started;
56
+
57
+ if (!options.json) {
58
+ tui.success(
59
+ `restored sandbox ${tui.bold(args.sandboxId)} to checkpoint ${tui.bold(args.checkpointId)} in ${durationMs}ms`
60
+ );
61
+ }
62
+
63
+ return {
64
+ success: true,
65
+ sandboxId: args.sandboxId,
66
+ checkpointId: args.checkpointId,
67
+ durationMs,
68
+ };
69
+ },
70
+ });
71
+
72
+ export default restoreSubcommand;
@@ -147,14 +147,17 @@ export const getSubcommand = createCommand({
147
147
  if (resourceParts.length > 0) {
148
148
  tableData['Resources'] = resourceParts.join(', ');
149
149
  }
150
- if (result.metadata && Object.keys(result.metadata).length > 0) {
151
- tableData['Metadata'] = JSON.stringify(result.metadata);
152
- }
153
150
  if (result.url) {
154
151
  tableData['URL'] = tui.link(result.url);
155
152
  }
156
153
 
157
154
  tui.table([tableData], Object.keys(tableData), { layout: 'vertical', padStart: ' ' });
155
+
156
+ if (result.metadata && Object.keys(result.metadata).length > 0) {
157
+ tui.newline();
158
+ tui.header('Metadata');
159
+ tui.json(result.metadata);
160
+ }
158
161
  }
159
162
 
160
163
  return {
@@ -18,6 +18,8 @@ import { uploadSubcommand } from './upload';
18
18
  import { envSubcommand } from './env';
19
19
  import { pauseSubcommand } from './pause';
20
20
  import { resumeSubcommand } from './resume';
21
+ import { checkpointCommand } from './checkpoint';
22
+ import { statsSubcommand } from './stats';
21
23
  import { getCommand } from '../../../command-prefix';
22
24
 
23
25
  export const command = createCommand({
@@ -59,6 +61,8 @@ export const command = createCommand({
59
61
  envSubcommand,
60
62
  pauseSubcommand,
61
63
  resumeSubcommand,
64
+ checkpointCommand,
65
+ statsSubcommand,
62
66
  ],
63
67
  requires: { auth: true, org: true },
64
68
  });
@@ -676,7 +676,7 @@ export const buildSubcommand = createCommand({
676
676
 
677
677
  if (buildConfig.dependencies && buildConfig.dependencies.length > 0) {
678
678
  console.log('');
679
- tui.info('Dependencies:');
679
+ tui.header('Dependencies');
680
680
  for (const dep of buildConfig.dependencies) {
681
681
  console.log(` ${tui.muted('•')} ${dep}`);
682
682
  }
@@ -684,7 +684,7 @@ export const buildSubcommand = createCommand({
684
684
 
685
685
  if (buildConfig.packages && buildConfig.packages.length > 0) {
686
686
  console.log('');
687
- tui.info('Packages (npm/bun):');
687
+ tui.header('Packages (npm/bun)');
688
688
  for (const pkg of buildConfig.packages) {
689
689
  console.log(` ${tui.muted('•')} ${pkg}`);
690
690
  }
@@ -692,7 +692,7 @@ export const buildSubcommand = createCommand({
692
692
 
693
693
  if (finalEnv && Object.keys(finalEnv).length > 0) {
694
694
  console.log('');
695
- tui.info('Environment:');
695
+ tui.header('Environment');
696
696
  for (const [envKey, envValue] of Object.entries(finalEnv)) {
697
697
  console.log(` ${tui.muted('•')} ${envKey}=${tui.maskSecret(envValue)}`);
698
698
  }
@@ -700,7 +700,7 @@ export const buildSubcommand = createCommand({
700
700
 
701
701
  if (fileList.length > 0) {
702
702
  console.log('');
703
- tui.info('Files:');
703
+ tui.header('Files');
704
704
  printFileTree(fileList);
705
705
  }
706
706
  }
@@ -980,7 +980,7 @@ export const buildSubcommand = createCommand({
980
980
 
981
981
  if (buildConfig.dependencies && buildConfig.dependencies.length > 0) {
982
982
  console.log('');
983
- tui.info('Dependencies:');
983
+ tui.header('Dependencies');
984
984
  for (const dep of buildConfig.dependencies) {
985
985
  console.log(` ${tui.muted('•')} ${dep}`);
986
986
  }
@@ -988,7 +988,7 @@ export const buildSubcommand = createCommand({
988
988
 
989
989
  if (buildConfig.packages && buildConfig.packages.length > 0) {
990
990
  console.log('');
991
- tui.info('Packages (npm/bun):');
991
+ tui.header('Packages (npm/bun)');
992
992
  for (const pkg of buildConfig.packages) {
993
993
  console.log(` ${tui.muted('•')} ${pkg}`);
994
994
  }
@@ -996,7 +996,7 @@ export const buildSubcommand = createCommand({
996
996
 
997
997
  if (finalEnv && Object.keys(finalEnv).length > 0) {
998
998
  console.log('');
999
- tui.info('Environment:');
999
+ tui.header('Environment');
1000
1000
  for (const [envKey, envValue] of Object.entries(finalEnv)) {
1001
1001
  console.log(` ${tui.muted('•')} ${envKey}=${tui.maskSecret(envValue)}`);
1002
1002
  }
@@ -1004,7 +1004,7 @@ export const buildSubcommand = createCommand({
1004
1004
 
1005
1005
  if (finalMetadata && Object.keys(finalMetadata).length > 0) {
1006
1006
  console.log('');
1007
- tui.info('Metadata:');
1007
+ tui.header('Metadata');
1008
1008
  for (const key of Object.keys(finalMetadata)) {
1009
1009
  console.log(` ${tui.muted('•')} ${key}=${finalMetadata[key]}`);
1010
1010
  }
@@ -1012,7 +1012,7 @@ export const buildSubcommand = createCommand({
1012
1012
 
1013
1013
  if (snapshot.files && snapshot.files.length > 0) {
1014
1014
  console.log('');
1015
- tui.info('Files:');
1015
+ tui.header('Files');
1016
1016
  printFileTree(snapshot.files);
1017
1017
  }
1018
1018
  }
@@ -138,7 +138,7 @@ export const getSubcommand = createCommand({
138
138
  Object.keys(snapshot.userMetadata).length > 0
139
139
  ) {
140
140
  console.log('');
141
- tui.info('Metadata:');
141
+ tui.header('Metadata');
142
142
  for (const [key, value] of Object.entries(snapshot.userMetadata)) {
143
143
  console.log(` ${tui.muted('•')} ${key}=${value}`);
144
144
  }
@@ -146,13 +146,13 @@ export const getSubcommand = createCommand({
146
146
 
147
147
  if (snapshot.files && snapshot.files.length > 0) {
148
148
  console.log('');
149
- tui.info('Files:');
149
+ tui.header('Files');
150
150
  printFileTree(snapshot.files);
151
151
  }
152
152
 
153
153
  if (activeSandboxes.length > 0) {
154
154
  console.log('');
155
- tui.info(`Attached Sandboxes (${activeSandboxes.length}):`);
155
+ tui.header(`Attached Sandboxes (${activeSandboxes.length}):`);
156
156
  printSandboxTree(activeSandboxes);
157
157
  }
158
158
  }
@@ -0,0 +1,86 @@
1
+ import { z } from 'zod';
2
+ import { createCommand } from '../../../types';
3
+ import * as tui from '../../../tui';
4
+ import { getGlobalCatalystAPIClient } from '../../../config';
5
+ import { getCommand } from '../../../command-prefix';
6
+ import { getServiceStats, type ServiceStatsData } from '@agentuity/server';
7
+
8
+ function formatNumber(n: number): string {
9
+ if (n >= 1_000_000) return `${(n / 1_000_000).toFixed(1)}M`;
10
+ if (n >= 1_000) return `${(n / 1_000).toFixed(1)}K`;
11
+ return String(n);
12
+ }
13
+
14
+ function formatLatency(ms: number): string {
15
+ if (ms >= 1000) return `${(ms / 1000).toFixed(1)}s`;
16
+ return `${Math.round(ms)}ms`;
17
+ }
18
+
19
+ function displayStats(data: ServiceStatsData): void {
20
+ const svc = data.services.sandbox;
21
+ if (!svc) {
22
+ tui.info('No sandbox data found.');
23
+ return;
24
+ }
25
+ tui.header('Sandbox Statistics');
26
+ tui.newline();
27
+ console.log(
28
+ ` ${tui.muted('Active:')} ${formatNumber(svc.totalActive)} (${svc.running} running, ${svc.idle} idle, ${svc.creating} creating)`
29
+ );
30
+ console.log(
31
+ ` ${tui.muted('Executions:')} ${formatNumber(svc.totalExecutions)}`
32
+ );
33
+ console.log(` ${tui.muted('CPU Time:')} ${formatLatency(svc.totalCpuTimeMs)}`);
34
+ console.log(
35
+ ` ${tui.muted('Memory:')} ${tui.formatBytes(svc.totalMemoryByteSec)}`
36
+ );
37
+ console.log(
38
+ ` ${tui.muted('Network Out:')} ${tui.formatBytes(svc.totalNetworkEgressBytes)}`
39
+ );
40
+ }
41
+
42
+ export const statsSubcommand = createCommand({
43
+ name: 'stats',
44
+ description: 'View sandbox statistics',
45
+ tags: ['read-only', 'requires-auth'],
46
+ requires: { auth: true, org: true },
47
+ examples: [
48
+ {
49
+ command: getCommand('cloud sandbox stats'),
50
+ description: 'View sandbox statistics',
51
+ },
52
+ ],
53
+ schema: {
54
+ options: z.object({
55
+ start: z.string().optional().describe('Start time (ISO 8601)'),
56
+ end: z.string().optional().describe('End time (ISO 8601)'),
57
+ }),
58
+ },
59
+ idempotent: true,
60
+
61
+ async handler(ctx) {
62
+ const { opts, options } = ctx;
63
+ const client = await getGlobalCatalystAPIClient(ctx.logger, ctx.auth, ctx.config?.name);
64
+ const orgId = ctx.orgId ?? ctx.options.orgId ?? ctx.config?.preferences?.orgId;
65
+
66
+ if (!orgId) {
67
+ ctx.logger.fatal('Organization ID is required. Use --org-id or set a preferred org.');
68
+ return;
69
+ }
70
+
71
+ const data = await getServiceStats(client, orgId, {
72
+ service: 'sandbox',
73
+ start: opts.start,
74
+ end: opts.end,
75
+ orgIdHeader: orgId,
76
+ });
77
+
78
+ if (!options.json) {
79
+ displayStats(data);
80
+ }
81
+
82
+ return data;
83
+ },
84
+ });
85
+
86
+ export default statsSubcommand;
@@ -32,8 +32,7 @@ export const createSubcommand = createCommand({
32
32
  name: 'create',
33
33
  description: 'Create a schedule',
34
34
  tags: ['mutating', 'creates-resource', 'requires-auth'],
35
- requires: { auth: true, region: true },
36
- optional: { project: true },
35
+ requires: { auth: true },
37
36
  examples: [
38
37
  {
39
38
  command: getCommand("cloud schedule create --name nightly --expression '0 0 * * *'"),
@@ -51,7 +50,7 @@ export const createSubcommand = createCommand({
51
50
 
52
51
  async handler(ctx) {
53
52
  const { opts, options } = ctx;
54
- const schedule = createScheduleAdapter(ctx);
53
+ const schedule = await createScheduleAdapter(ctx);
55
54
  const result = await schedule.create({
56
55
  name: opts.name,
57
56
  expression: opts.expression,
@@ -66,7 +65,7 @@ export const createSubcommand = createCommand({
66
65
  Name: result.schedule.name,
67
66
  ID: result.schedule.id,
68
67
  Expression: result.schedule.expression,
69
- Description: result.schedule.description ?? '-',
68
+ Description: result.schedule.description || '-',
70
69
  'Next Due': result.schedule.due_date,
71
70
  Created: new Date(result.schedule.created_at).toLocaleString(),
72
71
  },
@@ -14,8 +14,7 @@ export const deleteSubcommand = createCommand({
14
14
  aliases: ['rm'],
15
15
  description: 'Delete a schedule',
16
16
  tags: ['destructive', 'deletes-resource', 'slow', 'requires-auth'],
17
- requires: { auth: true, region: true },
18
- optional: { project: true },
17
+ requires: { auth: true },
19
18
  idempotent: true,
20
19
  examples: [
21
20
  { command: getCommand('cloud schedule delete sched_abc123'), description: 'Delete a schedule' },
@@ -29,7 +28,7 @@ export const deleteSubcommand = createCommand({
29
28
 
30
29
  async handler(ctx) {
31
30
  const { args, options } = ctx;
32
- const schedule = createScheduleAdapter(ctx);
31
+ const schedule = await createScheduleAdapter(ctx);
33
32
  await schedule.delete(args.schedule_id);
34
33
 
35
34
  if (!options.json) {
@@ -21,8 +21,7 @@ export const getSubcommand = createCommand({
21
21
  name: 'get',
22
22
  description: 'Get delivery details',
23
23
  tags: ['read-only', 'fast', 'requires-auth'],
24
- requires: { auth: true, region: true },
25
- optional: { project: true },
24
+ requires: { auth: true },
26
25
  idempotent: true,
27
26
  examples: [
28
27
  {
@@ -52,7 +51,7 @@ export const getSubcommand = createCommand({
52
51
 
53
52
  async handler(ctx) {
54
53
  const { args, opts, options } = ctx;
55
- const schedule = createScheduleAdapter(ctx);
54
+ const schedule = await createScheduleAdapter(ctx);
56
55
  const delivery = await schedule.getDelivery(args.schedule_id, args.delivery_id, {
57
56
  limit: opts.limit,
58
57
  offset: opts.offset,
@@ -73,7 +72,7 @@ export const getSubcommand = createCommand({
73
72
 
74
73
  if (delivery.response) {
75
74
  tui.newline();
76
- tui.info('Response');
75
+ tui.header('Response');
77
76
  tui.json(delivery.response);
78
77
  }
79
78
  }
@@ -24,8 +24,7 @@ export const listSubcommand = createCommand({
24
24
  aliases: ['ls'],
25
25
  description: 'List deliveries for a schedule',
26
26
  tags: ['read-only', 'fast', 'requires-auth'],
27
- requires: { auth: true, region: true },
28
- optional: { project: true },
27
+ requires: { auth: true },
29
28
  idempotent: true,
30
29
  examples: [
31
30
  {
@@ -46,7 +45,7 @@ export const listSubcommand = createCommand({
46
45
 
47
46
  async handler(ctx) {
48
47
  const { args, opts, options } = ctx;
49
- const schedule = createScheduleAdapter(ctx);
48
+ const schedule = await createScheduleAdapter(ctx);
50
49
  const result = await schedule.listDeliveries(args.schedule_id, {
51
50
  limit: opts.limit,
52
51
  offset: opts.offset,
@@ -20,8 +20,7 @@ export const createSubcommand = createCommand({
20
20
  name: 'create',
21
21
  description: 'Create destination for a schedule',
22
22
  tags: ['mutating', 'creates-resource', 'requires-auth'],
23
- requires: { auth: true, region: true },
24
- optional: { project: true },
23
+ requires: { auth: true },
25
24
  examples: [
26
25
  {
27
26
  command: getCommand('cloud schedule destination create url sched_abc123 https://example.com'),
@@ -48,7 +47,7 @@ export const createSubcommand = createCommand({
48
47
 
49
48
  async handler(ctx) {
50
49
  const { args, opts, options } = ctx;
51
- const schedule = createScheduleAdapter(ctx);
50
+ const schedule = await createScheduleAdapter(ctx);
52
51
 
53
52
  if (args.type === 'sandbox' && !args.target.startsWith('sbx_')) {
54
53
  tui.fatal('Sandbox target must start with "sbx_"');
@@ -95,12 +94,17 @@ export const createSubcommand = createCommand({
95
94
  {
96
95
  ID: result.destination.id,
97
96
  Type: result.destination.type,
98
- Config: JSON.stringify(result.destination.config),
99
97
  },
100
98
  ],
101
99
  undefined,
102
100
  { layout: 'vertical' }
103
101
  );
102
+
103
+ if (result.destination.config && Object.keys(result.destination.config).length > 0) {
104
+ tui.newline();
105
+ tui.header('Config');
106
+ tui.json(result.destination.config);
107
+ }
104
108
  }
105
109
 
106
110
  return result;
@@ -14,8 +14,7 @@ export const deleteSubcommand = createCommand({
14
14
  aliases: ['rm'],
15
15
  description: 'Delete a destination',
16
16
  tags: ['destructive', 'deletes-resource', 'slow', 'requires-auth'],
17
- requires: { auth: true, region: true },
18
- optional: { project: true },
17
+ requires: { auth: true },
19
18
  idempotent: true,
20
19
  examples: [
21
20
  {
@@ -32,7 +31,7 @@ export const deleteSubcommand = createCommand({
32
31
 
33
32
  async handler(ctx) {
34
33
  const { args, options } = ctx;
35
- const schedule = createScheduleAdapter(ctx);
34
+ const schedule = await createScheduleAdapter(ctx);
36
35
  await schedule.deleteDestination(args.destination_id);
37
36
 
38
37
  if (!options.json) {
@@ -20,8 +20,7 @@ export const getSubcommand = createCommand({
20
20
  name: 'get',
21
21
  description: 'Get destination details',
22
22
  tags: ['read-only', 'fast', 'requires-auth'],
23
- requires: { auth: true, region: true },
24
- optional: { project: true },
23
+ requires: { auth: true },
25
24
  idempotent: true,
26
25
  examples: [
27
26
  {
@@ -39,24 +38,25 @@ export const getSubcommand = createCommand({
39
38
 
40
39
  async handler(ctx) {
41
40
  const { args, options } = ctx;
42
- const schedule = createScheduleAdapter(ctx);
41
+ const schedule = await createScheduleAdapter(ctx);
43
42
  const destination = await schedule.getDestination(args.schedule_id, args.destination_id);
44
43
 
45
44
  if (!options.json) {
46
- tui.table(
47
- [
48
- {
49
- ID: destination.id,
50
- 'Schedule ID': destination.schedule_id,
51
- Type: destination.type,
52
- Config: JSON.stringify(destination.config),
53
- Created: new Date(destination.created_at).toLocaleString(),
54
- Updated: new Date(destination.updated_at).toLocaleString(),
55
- },
56
- ],
57
- undefined,
58
- { layout: 'vertical' }
59
- );
45
+ const details: Record<string, unknown> = {
46
+ ID: destination.id,
47
+ 'Schedule ID': destination.schedule_id,
48
+ Type: destination.type,
49
+ Created: new Date(destination.created_at).toLocaleString(),
50
+ Updated: new Date(destination.updated_at).toLocaleString(),
51
+ };
52
+
53
+ tui.table([details], undefined, { layout: 'vertical' });
54
+
55
+ if (destination.config && Object.keys(destination.config).length > 0) {
56
+ tui.newline();
57
+ tui.header('Config');
58
+ tui.json(destination.config);
59
+ }
60
60
  }
61
61
 
62
62
  return { destination };
@@ -23,8 +23,7 @@ export const listSubcommand = createCommand({
23
23
  aliases: ['ls'],
24
24
  description: 'List destinations for a schedule',
25
25
  tags: ['read-only', 'fast', 'requires-auth'],
26
- requires: { auth: true, region: true },
27
- optional: { project: true },
26
+ requires: { auth: true },
28
27
  idempotent: true,
29
28
  examples: [
30
29
  {
@@ -41,7 +40,7 @@ export const listSubcommand = createCommand({
41
40
 
42
41
  async handler(ctx) {
43
42
  const { args, options } = ctx;
44
- const schedule = createScheduleAdapter(ctx);
43
+ const schedule = await createScheduleAdapter(ctx);
45
44
  const result = await schedule.get(args.schedule_id);
46
45
 
47
46
  if (!options.json) {
@@ -54,13 +53,19 @@ export const listSubcommand = createCommand({
54
53
  type: 'url' | 'sandbox';
55
54
  config: Record<string, unknown>;
56
55
  created_at: string;
57
- }) => ({
58
- ID: destination.id,
59
- Type: destination.type,
60
- Config: JSON.stringify(destination.config),
61
- Created: new Date(destination.created_at).toLocaleString(),
62
- })),
63
- ['ID', 'Type', 'Config', 'Created']
56
+ }) => {
57
+ const configDisplay =
58
+ destination.type === 'url' && destination.config?.url
59
+ ? String(destination.config.url)
60
+ : JSON.stringify(destination.config);
61
+ return {
62
+ ID: destination.id,
63
+ Type: destination.type,
64
+ URL: configDisplay,
65
+ Created: new Date(destination.created_at).toLocaleString(),
66
+ };
67
+ }),
68
+ ['ID', 'Type', 'URL', 'Created']
64
69
  );
65
70
  }
66
71
  }
@@ -32,8 +32,7 @@ export const getSubcommand = createCommand({
32
32
  name: 'get',
33
33
  description: 'Get schedule details',
34
34
  tags: ['read-only', 'fast', 'requires-auth'],
35
- requires: { auth: true, region: true },
36
- optional: { project: true },
35
+ requires: { auth: true },
37
36
  idempotent: true,
38
37
  examples: [
39
38
  { command: getCommand('cloud schedule get sched_abc123'), description: 'Get schedule details' },
@@ -47,7 +46,7 @@ export const getSubcommand = createCommand({
47
46
 
48
47
  async handler(ctx) {
49
48
  const { args, options } = ctx;
50
- const schedule = createScheduleAdapter(ctx);
49
+ const schedule = await createScheduleAdapter(ctx);
51
50
  const result = await schedule.get(args.schedule_id);
52
51
 
53
52
  if (!options.json) {
@@ -55,7 +54,7 @@ export const getSubcommand = createCommand({
55
54
  Name: result.schedule.name,
56
55
  ID: result.schedule.id,
57
56
  Expression: result.schedule.expression,
58
- Description: result.schedule.description ?? '-',
57
+ Description: result.schedule.description || '-',
59
58
  'Next Due': result.schedule.due_date,
60
59
  Created: new Date(result.schedule.created_at).toLocaleString(),
61
60
  Updated: new Date(result.schedule.updated_at).toLocaleString(),
@@ -64,7 +63,7 @@ export const getSubcommand = createCommand({
64
63
  tui.table([details], undefined, { layout: 'vertical', padStart: ' ' });
65
64
 
66
65
  tui.newline();
67
- tui.info('Destinations');
66
+ tui.header('Destinations');
68
67
  if (result.destinations.length === 0) {
69
68
  tui.info('No destinations configured');
70
69
  } else {
@@ -74,13 +73,19 @@ export const getSubcommand = createCommand({
74
73
  type: 'url' | 'sandbox';
75
74
  config: Record<string, unknown>;
76
75
  created_at: string;
77
- }) => ({
78
- ID: destination.id,
79
- Type: destination.type,
80
- Config: JSON.stringify(destination.config),
81
- Created: new Date(destination.created_at).toLocaleString(),
82
- })),
83
- ['ID', 'Type', 'Config', 'Created']
76
+ }) => {
77
+ const configDisplay =
78
+ destination.type === 'url' && destination.config?.url
79
+ ? String(destination.config.url)
80
+ : JSON.stringify(destination.config);
81
+ return {
82
+ ID: destination.id,
83
+ Type: destination.type,
84
+ URL: configDisplay,
85
+ Created: new Date(destination.created_at).toLocaleString(),
86
+ };
87
+ }),
88
+ ['ID', 'Type', 'URL', 'Created']
84
89
  );
85
90
  }
86
91
  }
@@ -6,6 +6,7 @@ import { deleteSubcommand } from './delete';
6
6
  import { updateSubcommand } from './update';
7
7
  import destinationSubcommand from './destination';
8
8
  import deliverySubcommand from './delivery';
9
+ import { statsSubcommand } from './stats';
9
10
  import { getCommand } from '../../../command-prefix';
10
11
 
11
12
  export const command = createCommand({
@@ -22,6 +23,7 @@ export const command = createCommand({
22
23
  updateSubcommand,
23
24
  destinationSubcommand,
24
25
  deliverySubcommand,
26
+ statsSubcommand,
25
27
  ],
26
28
  examples: [
27
29
  { command: getCommand('cloud schedule list'), description: 'List schedules' },
@@ -25,8 +25,7 @@ export const listSubcommand = createCommand({
25
25
  aliases: ['ls'],
26
26
  description: 'List schedules',
27
27
  tags: ['read-only', 'fast', 'requires-auth'],
28
- requires: { auth: true, region: true },
29
- optional: { project: true },
28
+ requires: { auth: true },
30
29
  idempotent: true,
31
30
  examples: [
32
31
  { command: getCommand('cloud schedule list'), description: 'List schedules' },
@@ -42,7 +41,7 @@ export const listSubcommand = createCommand({
42
41
 
43
42
  async handler(ctx) {
44
43
  const { opts, options } = ctx;
45
- const schedule = createScheduleAdapter(ctx);
44
+ const schedule = await createScheduleAdapter(ctx);
46
45
  const result = await schedule.list({ limit: opts.limit, offset: opts.offset });
47
46
 
48
47
  if (!options.json) {