@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.
- package/dist/cmd/cloud/db/index.d.ts.map +1 -1
- package/dist/cmd/cloud/db/index.js +2 -0
- package/dist/cmd/cloud/db/index.js.map +1 -1
- package/dist/cmd/cloud/db/stats.d.ts +3 -0
- package/dist/cmd/cloud/db/stats.d.ts.map +1 -0
- package/dist/cmd/cloud/db/stats.js +66 -0
- package/dist/cmd/cloud/db/stats.js.map +1 -0
- package/dist/cmd/cloud/email/create.d.ts.map +1 -1
- package/dist/cmd/cloud/email/create.js +14 -6
- package/dist/cmd/cloud/email/create.js.map +1 -1
- package/dist/cmd/cloud/email/delete.js +1 -1
- package/dist/cmd/cloud/email/delete.js.map +1 -1
- package/dist/cmd/cloud/email/destination/delete.js +1 -1
- package/dist/cmd/cloud/email/destination/delete.js.map +1 -1
- package/dist/cmd/cloud/email/destination/list.js +1 -1
- package/dist/cmd/cloud/email/destination/list.js.map +1 -1
- package/dist/cmd/cloud/email/destination/url.d.ts.map +1 -1
- package/dist/cmd/cloud/email/destination/url.js +5 -4
- package/dist/cmd/cloud/email/destination/url.js.map +1 -1
- package/dist/cmd/cloud/email/get.js +1 -1
- package/dist/cmd/cloud/email/get.js.map +1 -1
- package/dist/cmd/cloud/email/inbound/get.d.ts.map +1 -1
- package/dist/cmd/cloud/email/inbound/get.js +2 -3
- package/dist/cmd/cloud/email/inbound/get.js.map +1 -1
- package/dist/cmd/cloud/email/inbound/list.d.ts.map +1 -1
- package/dist/cmd/cloud/email/inbound/list.js +1 -3
- package/dist/cmd/cloud/email/inbound/list.js.map +1 -1
- package/dist/cmd/cloud/email/inbound/schemas.d.ts +3 -1
- package/dist/cmd/cloud/email/inbound/schemas.d.ts.map +1 -1
- package/dist/cmd/cloud/email/inbound/schemas.js +3 -1
- package/dist/cmd/cloud/email/inbound/schemas.js.map +1 -1
- package/dist/cmd/cloud/email/index.d.ts.map +1 -1
- package/dist/cmd/cloud/email/index.js +2 -0
- package/dist/cmd/cloud/email/index.js.map +1 -1
- package/dist/cmd/cloud/email/list.d.ts.map +1 -1
- package/dist/cmd/cloud/email/list.js +9 -2
- package/dist/cmd/cloud/email/list.js.map +1 -1
- package/dist/cmd/cloud/email/outbound/get.js +4 -4
- package/dist/cmd/cloud/email/outbound/get.js.map +1 -1
- package/dist/cmd/cloud/email/outbound/list.js +3 -3
- package/dist/cmd/cloud/email/outbound/list.js.map +1 -1
- package/dist/cmd/cloud/email/outbound/schemas.d.ts +2 -2
- package/dist/cmd/cloud/email/outbound/schemas.js +2 -2
- package/dist/cmd/cloud/email/outbound/schemas.js.map +1 -1
- package/dist/cmd/cloud/email/send.d.ts.map +1 -1
- package/dist/cmd/cloud/email/send.js +8 -10
- package/dist/cmd/cloud/email/send.js.map +1 -1
- package/dist/cmd/cloud/email/stats.d.ts +3 -0
- package/dist/cmd/cloud/email/stats.d.ts.map +1 -0
- package/dist/cmd/cloud/email/stats.js +65 -0
- package/dist/cmd/cloud/email/stats.js.map +1 -0
- package/dist/cmd/cloud/email/util.d.ts +4 -7
- package/dist/cmd/cloud/email/util.d.ts.map +1 -1
- package/dist/cmd/cloud/email/util.js +8 -23
- package/dist/cmd/cloud/email/util.js.map +1 -1
- package/dist/cmd/cloud/index.d.ts.map +1 -1
- package/dist/cmd/cloud/index.js +2 -0
- package/dist/cmd/cloud/index.js.map +1 -1
- package/dist/cmd/cloud/queue/get.js +4 -4
- package/dist/cmd/cloud/queue/get.js.map +1 -1
- package/dist/cmd/cloud/queue/receive.d.ts.map +1 -1
- package/dist/cmd/cloud/queue/receive.js +11 -7
- package/dist/cmd/cloud/queue/receive.js.map +1 -1
- package/dist/cmd/cloud/queue/stats.js +3 -3
- package/dist/cmd/cloud/queue/stats.js.map +1 -1
- package/dist/cmd/cloud/sandbox/checkpoint/create.d.ts +3 -0
- package/dist/cmd/cloud/sandbox/checkpoint/create.d.ts.map +1 -0
- package/dist/cmd/cloud/sandbox/checkpoint/create.js +71 -0
- package/dist/cmd/cloud/sandbox/checkpoint/create.js.map +1 -0
- package/dist/cmd/cloud/sandbox/checkpoint/delete.d.ts +3 -0
- package/dist/cmd/cloud/sandbox/checkpoint/delete.d.ts.map +1 -0
- package/dist/cmd/cloud/sandbox/checkpoint/delete.js +78 -0
- package/dist/cmd/cloud/sandbox/checkpoint/delete.js.map +1 -0
- package/dist/cmd/cloud/sandbox/checkpoint/index.d.ts +2 -0
- package/dist/cmd/cloud/sandbox/checkpoint/index.d.ts.map +1 -0
- package/dist/cmd/cloud/sandbox/checkpoint/index.js +33 -0
- package/dist/cmd/cloud/sandbox/checkpoint/index.js.map +1 -0
- package/dist/cmd/cloud/sandbox/checkpoint/list.d.ts +3 -0
- package/dist/cmd/cloud/sandbox/checkpoint/list.d.ts.map +1 -0
- package/dist/cmd/cloud/sandbox/checkpoint/list.js +72 -0
- package/dist/cmd/cloud/sandbox/checkpoint/list.js.map +1 -0
- package/dist/cmd/cloud/sandbox/checkpoint/restore.d.ts +3 -0
- package/dist/cmd/cloud/sandbox/checkpoint/restore.d.ts.map +1 -0
- package/dist/cmd/cloud/sandbox/checkpoint/restore.js +61 -0
- package/dist/cmd/cloud/sandbox/checkpoint/restore.js.map +1 -0
- package/dist/cmd/cloud/sandbox/get.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/get.js +5 -3
- package/dist/cmd/cloud/sandbox/get.js.map +1 -1
- package/dist/cmd/cloud/sandbox/index.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/index.js +4 -0
- package/dist/cmd/cloud/sandbox/index.js.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/build.js +9 -9
- package/dist/cmd/cloud/sandbox/snapshot/build.js.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/get.js +3 -3
- package/dist/cmd/cloud/sandbox/snapshot/get.js.map +1 -1
- package/dist/cmd/cloud/sandbox/stats.d.ts +3 -0
- package/dist/cmd/cloud/sandbox/stats.d.ts.map +1 -0
- package/dist/cmd/cloud/sandbox/stats.js +72 -0
- package/dist/cmd/cloud/sandbox/stats.js.map +1 -0
- package/dist/cmd/cloud/schedule/create.d.ts.map +1 -1
- package/dist/cmd/cloud/schedule/create.js +3 -4
- package/dist/cmd/cloud/schedule/create.js.map +1 -1
- package/dist/cmd/cloud/schedule/delete.d.ts.map +1 -1
- package/dist/cmd/cloud/schedule/delete.js +2 -3
- package/dist/cmd/cloud/schedule/delete.js.map +1 -1
- package/dist/cmd/cloud/schedule/delivery/get.d.ts.map +1 -1
- package/dist/cmd/cloud/schedule/delivery/get.js +3 -4
- package/dist/cmd/cloud/schedule/delivery/get.js.map +1 -1
- package/dist/cmd/cloud/schedule/delivery/list.d.ts.map +1 -1
- package/dist/cmd/cloud/schedule/delivery/list.js +2 -3
- package/dist/cmd/cloud/schedule/delivery/list.js.map +1 -1
- package/dist/cmd/cloud/schedule/destination/create.d.ts.map +1 -1
- package/dist/cmd/cloud/schedule/destination/create.js +7 -4
- package/dist/cmd/cloud/schedule/destination/create.js.map +1 -1
- package/dist/cmd/cloud/schedule/destination/delete.d.ts.map +1 -1
- package/dist/cmd/cloud/schedule/destination/delete.js +2 -3
- package/dist/cmd/cloud/schedule/destination/delete.js.map +1 -1
- package/dist/cmd/cloud/schedule/destination/get.js +15 -13
- package/dist/cmd/cloud/schedule/destination/get.js.map +1 -1
- package/dist/cmd/cloud/schedule/destination/list.d.ts.map +1 -1
- package/dist/cmd/cloud/schedule/destination/list.js +13 -9
- package/dist/cmd/cloud/schedule/destination/list.js.map +1 -1
- package/dist/cmd/cloud/schedule/get.d.ts.map +1 -1
- package/dist/cmd/cloud/schedule/get.js +15 -11
- package/dist/cmd/cloud/schedule/get.js.map +1 -1
- package/dist/cmd/cloud/schedule/index.d.ts.map +1 -1
- package/dist/cmd/cloud/schedule/index.js +2 -0
- package/dist/cmd/cloud/schedule/index.js.map +1 -1
- package/dist/cmd/cloud/schedule/list.d.ts.map +1 -1
- package/dist/cmd/cloud/schedule/list.js +2 -3
- package/dist/cmd/cloud/schedule/list.js.map +1 -1
- package/dist/cmd/cloud/schedule/stats.d.ts +3 -0
- package/dist/cmd/cloud/schedule/stats.d.ts.map +1 -0
- package/dist/cmd/cloud/schedule/stats.js +64 -0
- package/dist/cmd/cloud/schedule/stats.js.map +1 -0
- package/dist/cmd/cloud/schedule/update.js +5 -5
- package/dist/cmd/cloud/schedule/update.js.map +1 -1
- package/dist/cmd/cloud/schedule/util.d.ts +4 -5
- package/dist/cmd/cloud/schedule/util.d.ts.map +1 -1
- package/dist/cmd/cloud/schedule/util.js +6 -6
- package/dist/cmd/cloud/schedule/util.js.map +1 -1
- package/dist/cmd/cloud/services/index.d.ts +3 -0
- package/dist/cmd/cloud/services/index.d.ts.map +1 -0
- package/dist/cmd/cloud/services/index.js +10 -0
- package/dist/cmd/cloud/services/index.js.map +1 -0
- package/dist/cmd/cloud/services/stats.d.ts +3 -0
- package/dist/cmd/cloud/services/stats.d.ts.map +1 -0
- package/dist/cmd/cloud/services/stats.js +153 -0
- package/dist/cmd/cloud/services/stats.js.map +1 -0
- package/dist/cmd/cloud/stream/index.d.ts.map +1 -1
- package/dist/cmd/cloud/stream/index.js +2 -1
- package/dist/cmd/cloud/stream/index.js.map +1 -1
- package/dist/cmd/cloud/stream/stats.d.ts +3 -0
- package/dist/cmd/cloud/stream/stats.d.ts.map +1 -0
- package/dist/cmd/cloud/stream/stats.js +64 -0
- package/dist/cmd/cloud/stream/stats.js.map +1 -0
- package/dist/cmd/cloud/task/create.d.ts.map +1 -1
- package/dist/cmd/cloud/task/create.js +0 -1
- package/dist/cmd/cloud/task/create.js.map +1 -1
- package/dist/cmd/cloud/task/get.d.ts.map +1 -1
- package/dist/cmd/cloud/task/get.js +4 -3
- package/dist/cmd/cloud/task/get.js.map +1 -1
- package/dist/cmd/cloud/task/index.d.ts.map +1 -1
- package/dist/cmd/cloud/task/index.js +2 -1
- package/dist/cmd/cloud/task/index.js.map +1 -1
- package/dist/cmd/cloud/task/list.d.ts.map +1 -1
- package/dist/cmd/cloud/task/list.js +1 -2
- package/dist/cmd/cloud/task/list.js.map +1 -1
- package/dist/cmd/cloud/task/stats.d.ts +3 -0
- package/dist/cmd/cloud/task/stats.d.ts.map +1 -0
- package/dist/cmd/cloud/task/stats.js +66 -0
- package/dist/cmd/cloud/task/stats.js.map +1 -0
- package/dist/cmd/cloud/task/update.d.ts.map +1 -1
- package/dist/cmd/cloud/task/update.js +0 -1
- package/dist/cmd/cloud/task/update.js.map +1 -1
- package/dist/cmd/cloud/task/util.d.ts +4 -7
- package/dist/cmd/cloud/task/util.d.ts.map +1 -1
- package/dist/cmd/cloud/task/util.js +6 -10
- package/dist/cmd/cloud/task/util.js.map +1 -1
- package/dist/cmd/cloud/vector/get.d.ts.map +1 -1
- package/dist/cmd/cloud/vector/get.js +17 -12
- package/dist/cmd/cloud/vector/get.js.map +1 -1
- package/dist/cmd/cloud/vector/stats.d.ts.map +1 -1
- package/dist/cmd/cloud/vector/stats.js +10 -7
- package/dist/cmd/cloud/vector/stats.js.map +1 -1
- package/dist/cmd/cloud/webhook/deliveries.d.ts.map +1 -1
- package/dist/cmd/cloud/webhook/deliveries.js +9 -3
- package/dist/cmd/cloud/webhook/deliveries.js.map +1 -1
- package/dist/cmd/cloud/webhook/destinations.d.ts.map +1 -1
- package/dist/cmd/cloud/webhook/destinations.js +20 -9
- package/dist/cmd/cloud/webhook/destinations.js.map +1 -1
- package/dist/cmd/cloud/webhook/get.js +2 -2
- package/dist/cmd/cloud/webhook/get.js.map +1 -1
- package/dist/cmd/cloud/webhook/receipts.d.ts.map +1 -1
- package/dist/cmd/cloud/webhook/receipts.js +19 -3
- package/dist/cmd/cloud/webhook/receipts.js.map +1 -1
- package/dist/tui.d.ts +4 -0
- package/dist/tui.d.ts.map +1 -1
- package/dist/tui.js +8 -0
- package/dist/tui.js.map +1 -1
- package/package.json +6 -6
- package/src/cmd/cloud/db/index.ts +2 -0
- package/src/cmd/cloud/db/stats.ts +80 -0
- package/src/cmd/cloud/email/create.ts +16 -6
- package/src/cmd/cloud/email/delete.ts +1 -1
- package/src/cmd/cloud/email/destination/delete.ts +1 -1
- package/src/cmd/cloud/email/destination/list.ts +1 -1
- package/src/cmd/cloud/email/destination/url.ts +5 -4
- package/src/cmd/cloud/email/get.ts +1 -1
- package/src/cmd/cloud/email/inbound/get.ts +2 -3
- package/src/cmd/cloud/email/inbound/list.ts +1 -3
- package/src/cmd/cloud/email/inbound/schemas.ts +3 -1
- package/src/cmd/cloud/email/index.ts +2 -0
- package/src/cmd/cloud/email/list.ts +9 -2
- package/src/cmd/cloud/email/outbound/get.ts +4 -4
- package/src/cmd/cloud/email/outbound/list.ts +3 -3
- package/src/cmd/cloud/email/outbound/schemas.ts +2 -2
- package/src/cmd/cloud/email/send.ts +8 -10
- package/src/cmd/cloud/email/stats.ts +77 -0
- package/src/cmd/cloud/email/util.ts +10 -29
- package/src/cmd/cloud/index.ts +2 -0
- package/src/cmd/cloud/queue/get.ts +4 -4
- package/src/cmd/cloud/queue/receive.ts +15 -7
- package/src/cmd/cloud/queue/stats.ts +3 -3
- package/src/cmd/cloud/sandbox/checkpoint/create.ts +85 -0
- package/src/cmd/cloud/sandbox/checkpoint/delete.ts +93 -0
- package/src/cmd/cloud/sandbox/checkpoint/index.ts +33 -0
- package/src/cmd/cloud/sandbox/checkpoint/list.ts +83 -0
- package/src/cmd/cloud/sandbox/checkpoint/restore.ts +72 -0
- package/src/cmd/cloud/sandbox/get.ts +6 -3
- package/src/cmd/cloud/sandbox/index.ts +4 -0
- package/src/cmd/cloud/sandbox/snapshot/build.ts +9 -9
- package/src/cmd/cloud/sandbox/snapshot/get.ts +3 -3
- package/src/cmd/cloud/sandbox/stats.ts +86 -0
- package/src/cmd/cloud/schedule/create.ts +3 -4
- package/src/cmd/cloud/schedule/delete.ts +2 -3
- package/src/cmd/cloud/schedule/delivery/get.ts +3 -4
- package/src/cmd/cloud/schedule/delivery/list.ts +2 -3
- package/src/cmd/cloud/schedule/destination/create.ts +8 -4
- package/src/cmd/cloud/schedule/destination/delete.ts +2 -3
- package/src/cmd/cloud/schedule/destination/get.ts +17 -17
- package/src/cmd/cloud/schedule/destination/list.ts +15 -10
- package/src/cmd/cloud/schedule/get.ts +17 -12
- package/src/cmd/cloud/schedule/index.ts +2 -0
- package/src/cmd/cloud/schedule/list.ts +2 -3
- package/src/cmd/cloud/schedule/stats.ts +74 -0
- package/src/cmd/cloud/schedule/update.ts +5 -5
- package/src/cmd/cloud/schedule/util.ts +13 -18
- package/src/cmd/cloud/services/index.ts +11 -0
- package/src/cmd/cloud/services/stats.ts +225 -0
- package/src/cmd/cloud/stream/index.ts +2 -1
- package/src/cmd/cloud/stream/stats.ts +74 -0
- package/src/cmd/cloud/task/create.ts +0 -1
- package/src/cmd/cloud/task/get.ts +5 -4
- package/src/cmd/cloud/task/index.ts +2 -1
- package/src/cmd/cloud/task/list.ts +1 -2
- package/src/cmd/cloud/task/stats.ts +74 -0
- package/src/cmd/cloud/task/update.ts +0 -1
- package/src/cmd/cloud/task/util.ts +12 -24
- package/src/cmd/cloud/vector/get.ts +16 -11
- package/src/cmd/cloud/vector/stats.ts +10 -8
- package/src/cmd/cloud/webhook/deliveries.ts +16 -3
- package/src/cmd/cloud/webhook/destinations.ts +22 -9
- package/src/cmd/cloud/webhook/get.ts +2 -2
- package/src/cmd/cloud/webhook/receipts.ts +16 -3
- package/src/tui.ts +9 -0
|
@@ -19,7 +19,7 @@ export const listSubcommand = createCommand({
|
|
|
19
19
|
|
|
20
20
|
async handler(ctx) {
|
|
21
21
|
const { opts, options } = ctx;
|
|
22
|
-
const email = createEmailAdapter(ctx);
|
|
22
|
+
const email = await createEmailAdapter(ctx);
|
|
23
23
|
const outbound = await email.listOutbound(opts.addressId);
|
|
24
24
|
|
|
25
25
|
if (!options.json) {
|
|
@@ -30,7 +30,7 @@ export const listSubcommand = createCommand({
|
|
|
30
30
|
To: item.to,
|
|
31
31
|
Subject: item.subject ?? '-',
|
|
32
32
|
Status: item.status ?? '-',
|
|
33
|
-
|
|
33
|
+
Created: item.created_at ? new Date(item.created_at).toLocaleString() : '-',
|
|
34
34
|
})),
|
|
35
35
|
[
|
|
36
36
|
{ name: 'ID', alignment: 'left' },
|
|
@@ -38,7 +38,7 @@ export const listSubcommand = createCommand({
|
|
|
38
38
|
{ name: 'To', alignment: 'left' },
|
|
39
39
|
{ name: 'Subject', alignment: 'left' },
|
|
40
40
|
{ name: 'Status', alignment: 'left' },
|
|
41
|
-
{ name: '
|
|
41
|
+
{ name: 'Created', alignment: 'left' },
|
|
42
42
|
]
|
|
43
43
|
);
|
|
44
44
|
}
|
|
@@ -9,7 +9,7 @@ export const EmailOutboundSchema = z.object({
|
|
|
9
9
|
html: z.string().optional(),
|
|
10
10
|
status: z.string().optional(),
|
|
11
11
|
error: z.string().optional(),
|
|
12
|
-
sent_at: z.string().optional(),
|
|
13
12
|
created_at: z.string().optional(),
|
|
14
|
-
|
|
13
|
+
headers: z.record(z.string(), z.unknown()).optional(),
|
|
14
|
+
attachments: z.array(z.unknown()).optional(),
|
|
15
15
|
});
|
|
@@ -53,7 +53,7 @@ export const sendSubcommand = createCommand({
|
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
const email = createEmailAdapter(ctx);
|
|
56
|
+
const email = await createEmailAdapter(ctx);
|
|
57
57
|
const outbound = await email.send({
|
|
58
58
|
to: [args.to],
|
|
59
59
|
from: opts.from,
|
|
@@ -69,17 +69,15 @@ export const sendSubcommand = createCommand({
|
|
|
69
69
|
[
|
|
70
70
|
{
|
|
71
71
|
ID: outbound.id,
|
|
72
|
-
From: outbound.from,
|
|
73
|
-
To: outbound.to,
|
|
74
|
-
Subject: outbound.subject ??
|
|
75
|
-
Text: truncate(outbound.text),
|
|
76
|
-
Status: outbound.status ?? '
|
|
77
|
-
|
|
78
|
-
? new Date(outbound.sent_at).toLocaleString()
|
|
79
|
-
: '-',
|
|
72
|
+
From: outbound.from || opts.from,
|
|
73
|
+
To: outbound.to || args.to,
|
|
74
|
+
Subject: outbound.subject ?? opts.subject,
|
|
75
|
+
Text: truncate(outbound.text ?? opts.text),
|
|
76
|
+
Status: outbound.status ?? 'pending',
|
|
77
|
+
Attachments: attachments.length > 0 ? attachments.length.toString() : '-',
|
|
80
78
|
},
|
|
81
79
|
],
|
|
82
|
-
['ID', 'From', 'To', 'Subject', 'Text', 'Status', '
|
|
80
|
+
['ID', 'From', 'To', 'Subject', 'Text', 'Status', 'Attachments'],
|
|
83
81
|
{ layout: 'vertical', padStart: ' ' }
|
|
84
82
|
);
|
|
85
83
|
}
|
|
@@ -0,0 +1,77 @@
|
|
|
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 displayStats(data: ServiceStatsData): void {
|
|
15
|
+
const svc = data.services.email;
|
|
16
|
+
if (!svc) {
|
|
17
|
+
tui.info('No email data found.');
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
tui.header('Email Statistics');
|
|
21
|
+
tui.newline();
|
|
22
|
+
console.log(
|
|
23
|
+
` ${tui.muted('Addresses:')} ${formatNumber(svc.addressCount)}`
|
|
24
|
+
);
|
|
25
|
+
console.log(
|
|
26
|
+
` ${tui.muted('Inbound:')} ${formatNumber(svc.inboundCount)}`
|
|
27
|
+
);
|
|
28
|
+
console.log(
|
|
29
|
+
` ${tui.muted('Outbound:')} ${formatNumber(svc.outboundCount)} (${svc.outboundSuccess} ok, ${svc.outboundFailed} failed)`
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export const statsSubcommand = createCommand({
|
|
34
|
+
name: 'stats',
|
|
35
|
+
description: 'View email statistics',
|
|
36
|
+
tags: ['read-only', 'requires-auth'],
|
|
37
|
+
requires: { auth: true, org: true },
|
|
38
|
+
examples: [
|
|
39
|
+
{
|
|
40
|
+
command: getCommand('cloud email stats'),
|
|
41
|
+
description: 'View email statistics',
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
schema: {
|
|
45
|
+
options: z.object({
|
|
46
|
+
start: z.string().optional().describe('Start time (ISO 8601)'),
|
|
47
|
+
end: z.string().optional().describe('End time (ISO 8601)'),
|
|
48
|
+
}),
|
|
49
|
+
},
|
|
50
|
+
idempotent: true,
|
|
51
|
+
|
|
52
|
+
async handler(ctx) {
|
|
53
|
+
const { opts, options } = ctx;
|
|
54
|
+
const client = await getGlobalCatalystAPIClient(ctx.logger, ctx.auth, ctx.config?.name);
|
|
55
|
+
const orgId = ctx.orgId ?? ctx.options.orgId ?? ctx.config?.preferences?.orgId;
|
|
56
|
+
|
|
57
|
+
if (!orgId) {
|
|
58
|
+
ctx.logger.fatal('Organization ID is required. Use --org-id or set a preferred org.');
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const data = await getServiceStats(client, orgId, {
|
|
63
|
+
service: 'email',
|
|
64
|
+
start: opts.start,
|
|
65
|
+
end: opts.end,
|
|
66
|
+
orgIdHeader: orgId,
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
if (!options.json) {
|
|
70
|
+
displayStats(data);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return data;
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
export default statsSubcommand;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { EmailStorageService, type Logger } from '@agentuity/core';
|
|
3
3
|
import { createServerFetchAdapter } from '@agentuity/server';
|
|
4
|
-
import type { AuthData, Config, GlobalOptions
|
|
4
|
+
import type { AuthData, Config, GlobalOptions } from '../../../types';
|
|
5
5
|
import { getCatalystUrl } from '../../../catalyst';
|
|
6
|
+
import { defaultProfileName, getDefaultRegion } from '../../../config';
|
|
6
7
|
import * as tui from '../../../tui';
|
|
7
8
|
|
|
8
9
|
export type {
|
|
@@ -14,47 +15,25 @@ export type {
|
|
|
14
15
|
EmailSendParams,
|
|
15
16
|
} from '@agentuity/core';
|
|
16
17
|
|
|
17
|
-
interface EmailContext {
|
|
18
|
+
export interface EmailContext {
|
|
18
19
|
logger: Logger;
|
|
19
20
|
auth: AuthData;
|
|
20
|
-
region?: string;
|
|
21
|
-
project?: ProjectConfig;
|
|
22
21
|
config: Config | null;
|
|
23
22
|
options: GlobalOptions;
|
|
24
23
|
}
|
|
25
24
|
|
|
26
|
-
export function resolveEmailOrgId(ctx: EmailContext
|
|
25
|
+
export function resolveEmailOrgId(ctx: EmailContext): string {
|
|
27
26
|
const orgId =
|
|
28
|
-
explicitOrgId ??
|
|
29
|
-
ctx.project?.orgId ??
|
|
30
27
|
ctx.options.orgId ??
|
|
31
28
|
(process.env.AGENTUITY_CLOUD_ORG_ID || ctx.config?.preferences?.orgId);
|
|
32
29
|
|
|
33
30
|
if (!orgId) {
|
|
34
|
-
tui.fatal(
|
|
35
|
-
'Organization ID is required. Either run from a project directory or use --org-id flag.'
|
|
36
|
-
);
|
|
31
|
+
tui.fatal('Organization ID is required. Use --org-id flag or set AGENTUITY_CLOUD_ORG_ID.');
|
|
37
32
|
}
|
|
38
33
|
|
|
39
34
|
return orgId;
|
|
40
35
|
}
|
|
41
36
|
|
|
42
|
-
export function resolveEmailRegion(ctx: EmailContext): string {
|
|
43
|
-
if (ctx.region) {
|
|
44
|
-
return ctx.region;
|
|
45
|
-
}
|
|
46
|
-
if (process.env.AGENTUITY_REGION) {
|
|
47
|
-
return process.env.AGENTUITY_REGION;
|
|
48
|
-
}
|
|
49
|
-
if (ctx.config?.name === 'local') {
|
|
50
|
-
return 'local';
|
|
51
|
-
}
|
|
52
|
-
if (ctx.config?.preferences?.region) {
|
|
53
|
-
return ctx.config.preferences.region;
|
|
54
|
-
}
|
|
55
|
-
return 'usc';
|
|
56
|
-
}
|
|
57
|
-
|
|
58
37
|
export const EmailAddressSchema = z.object({
|
|
59
38
|
id: z.string(),
|
|
60
39
|
email: z.string(),
|
|
@@ -72,8 +51,8 @@ export function truncate(value: string | undefined, length = 200): string {
|
|
|
72
51
|
return value.length > length ? `${value.slice(0, length - 3)}...` : value;
|
|
73
52
|
}
|
|
74
53
|
|
|
75
|
-
export function createEmailAdapter(ctx: EmailContext,
|
|
76
|
-
const orgId = resolveEmailOrgId(ctx
|
|
54
|
+
export async function createEmailAdapter(ctx: EmailContext, region?: string) {
|
|
55
|
+
const orgId = resolveEmailOrgId(ctx);
|
|
77
56
|
const adapter = createServerFetchAdapter(
|
|
78
57
|
{
|
|
79
58
|
headers: {
|
|
@@ -84,6 +63,8 @@ export function createEmailAdapter(ctx: EmailContext, explicitOrgId?: string) {
|
|
|
84
63
|
ctx.logger
|
|
85
64
|
);
|
|
86
65
|
|
|
87
|
-
const
|
|
66
|
+
const resolvedRegion =
|
|
67
|
+
region ?? (await getDefaultRegion(ctx.config?.name ?? defaultProfileName, ctx.config));
|
|
68
|
+
const baseUrl = getCatalystUrl(resolvedRegion);
|
|
88
69
|
return new EmailStorageService(baseUrl, adapter);
|
|
89
70
|
}
|
package/src/cmd/cloud/index.ts
CHANGED
|
@@ -20,6 +20,7 @@ import { emailCommand } from './email';
|
|
|
20
20
|
import taskCommand from './task';
|
|
21
21
|
import sandboxCommand from './sandbox';
|
|
22
22
|
import scheduleCommand from './schedule';
|
|
23
|
+
import servicesCommand from './services';
|
|
23
24
|
import { regionSubcommand } from './region';
|
|
24
25
|
import { machineCommand } from './machine';
|
|
25
26
|
import { evalCommand } from './eval';
|
|
@@ -54,6 +55,7 @@ export const command = createCommand({
|
|
|
54
55
|
dbCommand,
|
|
55
56
|
redisCommand,
|
|
56
57
|
storageCommand,
|
|
58
|
+
servicesCommand,
|
|
57
59
|
sessionCommand,
|
|
58
60
|
threadCommand,
|
|
59
61
|
sshSubcommand,
|
|
@@ -42,12 +42,12 @@ function displayMessage(message: Message): void {
|
|
|
42
42
|
tui.table([details], undefined, { layout: 'vertical' });
|
|
43
43
|
|
|
44
44
|
tui.newline();
|
|
45
|
-
tui.
|
|
45
|
+
tui.header('Payload');
|
|
46
46
|
tui.json(message.payload);
|
|
47
47
|
|
|
48
48
|
if (message.metadata && Object.keys(message.metadata).length > 0) {
|
|
49
49
|
tui.newline();
|
|
50
|
-
tui.
|
|
50
|
+
tui.header('Metadata');
|
|
51
51
|
tui.json(message.metadata);
|
|
52
52
|
}
|
|
53
53
|
}
|
|
@@ -119,7 +119,7 @@ export const getSubcommand = createCommand({
|
|
|
119
119
|
queue.next_offset !== undefined
|
|
120
120
|
) {
|
|
121
121
|
tui.newline();
|
|
122
|
-
tui.
|
|
122
|
+
tui.header('Stats');
|
|
123
123
|
tui.table(
|
|
124
124
|
[
|
|
125
125
|
{
|
|
@@ -135,7 +135,7 @@ export const getSubcommand = createCommand({
|
|
|
135
135
|
|
|
136
136
|
if (queue.default_visibility_timeout_seconds !== undefined) {
|
|
137
137
|
tui.newline();
|
|
138
|
-
tui.
|
|
138
|
+
tui.header('Settings');
|
|
139
139
|
const settings: Record<string, unknown> = {};
|
|
140
140
|
if (queue.default_ttl_seconds != null) {
|
|
141
141
|
settings['Default TTL'] = `${queue.default_ttl_seconds}s`;
|
|
@@ -55,15 +55,23 @@ export const receiveSubcommand = createCommand({
|
|
|
55
55
|
tui.info('No messages available');
|
|
56
56
|
} else {
|
|
57
57
|
tui.success(`Received message: ${message.id}`);
|
|
58
|
-
tui.
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
58
|
+
tui.table(
|
|
59
|
+
[
|
|
60
|
+
{
|
|
61
|
+
Offset: message.offset,
|
|
62
|
+
State: message.state,
|
|
63
|
+
'Delivery Attempts': message.delivery_attempts,
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
undefined,
|
|
67
|
+
{ layout: 'vertical' }
|
|
68
|
+
);
|
|
69
|
+
tui.newline();
|
|
70
|
+
tui.header('Payload');
|
|
63
71
|
tui.json(message.payload);
|
|
64
72
|
if (message.metadata) {
|
|
65
|
-
tui.
|
|
66
|
-
tui.
|
|
73
|
+
tui.newline();
|
|
74
|
+
tui.header('Metadata');
|
|
67
75
|
tui.json(message.metadata);
|
|
68
76
|
}
|
|
69
77
|
}
|
|
@@ -45,7 +45,7 @@ function formatDuration(start: string, end: string): string {
|
|
|
45
45
|
function displayOrgAnalytics(analytics: OrgAnalytics): void {
|
|
46
46
|
const { summary, queues, period } = analytics;
|
|
47
47
|
|
|
48
|
-
tui.
|
|
48
|
+
tui.header(`Organization Analytics (${formatDuration(period.start, period.end)})`);
|
|
49
49
|
tui.newline();
|
|
50
50
|
console.log(tui.colorPrimary('Summary:'));
|
|
51
51
|
console.log(` ${tui.muted('Total Queues:')} ${summary.total_queues}`);
|
|
@@ -84,7 +84,7 @@ function displayQueueAnalytics(analytics: QueueAnalytics): void {
|
|
|
84
84
|
const { queue_name, queue_type, period, current, period_stats, latency, consumer_latency } =
|
|
85
85
|
analytics;
|
|
86
86
|
|
|
87
|
-
tui.
|
|
87
|
+
tui.header(`Queue: ${queue_name} (${queue_type})`);
|
|
88
88
|
console.log(tui.colorWarning(`Period: ${formatDuration(period.start, period.end)}`));
|
|
89
89
|
tui.newline();
|
|
90
90
|
|
|
@@ -146,7 +146,7 @@ function displayQueueAnalytics(analytics: QueueAnalytics): void {
|
|
|
146
146
|
|
|
147
147
|
if (analytics.destinations && analytics.destinations.length > 0) {
|
|
148
148
|
tui.newline();
|
|
149
|
-
tui.
|
|
149
|
+
tui.header('Destinations');
|
|
150
150
|
const destData = analytics.destinations.map((d) => {
|
|
151
151
|
const total = d.success_count + d.failure_count;
|
|
152
152
|
const errorRate = total > 0 ? (d.failure_count / total) * 100 : 0;
|
|
@@ -0,0 +1,85 @@
|
|
|
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, diskCheckpointCreate } from '@agentuity/server';
|
|
7
|
+
|
|
8
|
+
const CheckpointCreateResponseSchema = z.object({
|
|
9
|
+
success: z.boolean().describe('Whether the operation succeeded'),
|
|
10
|
+
sandboxId: z.string().describe('Sandbox ID'),
|
|
11
|
+
checkpointId: z.string().describe('Created checkpoint ID'),
|
|
12
|
+
name: z.string().describe('Checkpoint name'),
|
|
13
|
+
createdAt: z.string().describe('Checkpoint creation timestamp'),
|
|
14
|
+
parent: z.string().describe('Parent checkpoint name'),
|
|
15
|
+
durationMs: z.number().describe('Operation duration in milliseconds'),
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export const createSubcommand = createCommand({
|
|
19
|
+
name: 'create',
|
|
20
|
+
description: 'Create a disk checkpoint of the sandbox filesystem',
|
|
21
|
+
tags: ['slow', 'requires-auth'],
|
|
22
|
+
requires: { auth: true, apiClient: true },
|
|
23
|
+
idempotent: false,
|
|
24
|
+
examples: [
|
|
25
|
+
{
|
|
26
|
+
command: getCommand('cloud sandbox checkpoint create sbx_abc123 my-checkpoint'),
|
|
27
|
+
description: 'Create a disk checkpoint',
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
schema: {
|
|
31
|
+
args: z.object({
|
|
32
|
+
sandboxId: z.string().describe('Sandbox ID'),
|
|
33
|
+
name: z.string().describe('Checkpoint name'),
|
|
34
|
+
}),
|
|
35
|
+
options: z.object({}),
|
|
36
|
+
response: CheckpointCreateResponseSchema,
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
async handler(ctx) {
|
|
40
|
+
const { args, options, auth, logger, apiClient } = ctx;
|
|
41
|
+
|
|
42
|
+
const started = Date.now();
|
|
43
|
+
|
|
44
|
+
// Resolve sandbox to get region and orgId using CLI API
|
|
45
|
+
const sandboxInfo = await sandboxResolve(apiClient, args.sandboxId);
|
|
46
|
+
|
|
47
|
+
const client = createSandboxClient(logger, auth, sandboxInfo.region);
|
|
48
|
+
|
|
49
|
+
const checkpoint = await diskCheckpointCreate(client, {
|
|
50
|
+
sandboxId: args.sandboxId,
|
|
51
|
+
name: args.name,
|
|
52
|
+
orgId: sandboxInfo.orgId,
|
|
53
|
+
});
|
|
54
|
+
const durationMs = Date.now() - started;
|
|
55
|
+
|
|
56
|
+
if (!options.json) {
|
|
57
|
+
tui.success(`created disk checkpoint ${tui.bold(checkpoint.id)} in ${durationMs}ms`);
|
|
58
|
+
|
|
59
|
+
tui.table(
|
|
60
|
+
[
|
|
61
|
+
{
|
|
62
|
+
ID: checkpoint.id,
|
|
63
|
+
Name: checkpoint.name,
|
|
64
|
+
'Created At': checkpoint.createdAt,
|
|
65
|
+
Parent: checkpoint.parent || '-',
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
['ID', 'Name', 'Created At', 'Parent'],
|
|
69
|
+
{ layout: 'vertical', padStart: ' ' }
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return {
|
|
74
|
+
success: true,
|
|
75
|
+
sandboxId: args.sandboxId,
|
|
76
|
+
checkpointId: checkpoint.id,
|
|
77
|
+
name: checkpoint.name,
|
|
78
|
+
createdAt: checkpoint.createdAt,
|
|
79
|
+
parent: checkpoint.parent,
|
|
80
|
+
durationMs,
|
|
81
|
+
};
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
export default createSubcommand;
|
|
@@ -0,0 +1,93 @@
|
|
|
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, diskCheckpointDelete } from '@agentuity/server';
|
|
7
|
+
|
|
8
|
+
const CheckpointDeleteResponseSchema = z.object({
|
|
9
|
+
success: z.boolean().describe('Whether the operation succeeded'),
|
|
10
|
+
sandboxId: z.string().describe('Sandbox ID'),
|
|
11
|
+
checkpointId: z.string().describe('Deleted checkpoint ID'),
|
|
12
|
+
durationMs: z.number().describe('Operation duration in milliseconds'),
|
|
13
|
+
message: z.string().optional().describe('Status message'),
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export const deleteSubcommand = createCommand({
|
|
17
|
+
name: 'delete',
|
|
18
|
+
aliases: ['del', 'rm', 'remove'],
|
|
19
|
+
description: 'Delete a disk checkpoint',
|
|
20
|
+
tags: ['destructive', 'deletes-resource', 'slow', 'requires-auth'],
|
|
21
|
+
requires: { auth: true, apiClient: true },
|
|
22
|
+
idempotent: true,
|
|
23
|
+
examples: [
|
|
24
|
+
{
|
|
25
|
+
command: getCommand('cloud sandbox checkpoint delete sbx_abc123 ckpt_def456'),
|
|
26
|
+
description: 'Delete a disk checkpoint',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
command: getCommand('cloud sandbox checkpoint delete sbx_abc123 ckpt_def456 --confirm'),
|
|
30
|
+
description: 'Delete without confirmation prompt',
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
schema: {
|
|
34
|
+
args: z.object({
|
|
35
|
+
sandboxId: z.string().describe('Sandbox ID'),
|
|
36
|
+
checkpointId: z.string().describe('Checkpoint ID or name'),
|
|
37
|
+
}),
|
|
38
|
+
options: z.object({
|
|
39
|
+
confirm: z.boolean().optional().default(false).describe('Skip confirmation prompt'),
|
|
40
|
+
}),
|
|
41
|
+
response: CheckpointDeleteResponseSchema,
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
async handler(ctx) {
|
|
45
|
+
const { args, options, opts, auth, logger, apiClient } = ctx;
|
|
46
|
+
|
|
47
|
+
if (!opts.confirm) {
|
|
48
|
+
const confirmed = await tui.confirm(
|
|
49
|
+
`Delete disk checkpoint "${args.checkpointId}" from sandbox "${args.sandboxId}"?`,
|
|
50
|
+
false
|
|
51
|
+
);
|
|
52
|
+
if (!confirmed) {
|
|
53
|
+
logger.info('Cancelled');
|
|
54
|
+
return {
|
|
55
|
+
success: false,
|
|
56
|
+
sandboxId: args.sandboxId,
|
|
57
|
+
checkpointId: args.checkpointId,
|
|
58
|
+
durationMs: 0,
|
|
59
|
+
message: 'Cancelled',
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const started = Date.now();
|
|
65
|
+
|
|
66
|
+
// Resolve sandbox to get region and orgId using CLI API
|
|
67
|
+
const sandboxInfo = await sandboxResolve(apiClient, args.sandboxId);
|
|
68
|
+
|
|
69
|
+
const client = createSandboxClient(logger, auth, sandboxInfo.region);
|
|
70
|
+
|
|
71
|
+
await diskCheckpointDelete(client, {
|
|
72
|
+
sandboxId: args.sandboxId,
|
|
73
|
+
checkpointId: args.checkpointId,
|
|
74
|
+
orgId: sandboxInfo.orgId,
|
|
75
|
+
});
|
|
76
|
+
const durationMs = Date.now() - started;
|
|
77
|
+
|
|
78
|
+
if (!options.json) {
|
|
79
|
+
tui.success(
|
|
80
|
+
`deleted disk checkpoint ${tui.bold(args.checkpointId)} from sandbox ${tui.bold(args.sandboxId)} in ${durationMs}ms`
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return {
|
|
85
|
+
success: true,
|
|
86
|
+
sandboxId: args.sandboxId,
|
|
87
|
+
checkpointId: args.checkpointId,
|
|
88
|
+
durationMs,
|
|
89
|
+
};
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
export default deleteSubcommand;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { createCommand } from '../../../../types';
|
|
2
|
+
import { createSubcommand } from './create';
|
|
3
|
+
import { listSubcommand } from './list';
|
|
4
|
+
import { restoreSubcommand } from './restore';
|
|
5
|
+
import { deleteSubcommand } from './delete';
|
|
6
|
+
import { getCommand } from '../../../../command-prefix';
|
|
7
|
+
|
|
8
|
+
export const checkpointCommand = createCommand({
|
|
9
|
+
name: 'checkpoint',
|
|
10
|
+
aliases: ['ckpt'],
|
|
11
|
+
description: 'Manage disk checkpoints for sandbox filesystem',
|
|
12
|
+
tags: ['slow', 'requires-auth'],
|
|
13
|
+
requires: { auth: true, apiClient: true },
|
|
14
|
+
examples: [
|
|
15
|
+
{
|
|
16
|
+
command: getCommand('cloud sandbox checkpoint create sbx_abc123 my-checkpoint'),
|
|
17
|
+
description: 'Create a disk checkpoint',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
command: getCommand('cloud sandbox checkpoint list sbx_abc123'),
|
|
21
|
+
description: 'List disk checkpoints',
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
command: getCommand('cloud sandbox checkpoint restore sbx_abc123 ckpt_def456'),
|
|
25
|
+
description: 'Restore a disk checkpoint',
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
command: getCommand('cloud sandbox checkpoint delete sbx_abc123 ckpt_def456'),
|
|
29
|
+
description: 'Delete a disk checkpoint',
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
subcommands: [createSubcommand, listSubcommand, restoreSubcommand, deleteSubcommand],
|
|
33
|
+
});
|
|
@@ -0,0 +1,83 @@
|
|
|
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, diskCheckpointList } from '@agentuity/server';
|
|
7
|
+
|
|
8
|
+
const CheckpointInfoSchema = z.object({
|
|
9
|
+
id: z.string(),
|
|
10
|
+
name: z.string(),
|
|
11
|
+
createdAt: z.string(),
|
|
12
|
+
parent: z.string(),
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const CheckpointListResponseSchema = z.object({
|
|
16
|
+
checkpoints: z.array(CheckpointInfoSchema).describe('List of disk checkpoints'),
|
|
17
|
+
total: z.number().describe('Total number of checkpoints'),
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export const listSubcommand = createCommand({
|
|
21
|
+
name: 'list',
|
|
22
|
+
aliases: ['ls'],
|
|
23
|
+
description: 'List disk checkpoints for a sandbox',
|
|
24
|
+
tags: ['slow', 'requires-auth'],
|
|
25
|
+
requires: { auth: true, apiClient: true },
|
|
26
|
+
examples: [
|
|
27
|
+
{
|
|
28
|
+
command: getCommand('cloud sandbox checkpoint list sbx_abc123'),
|
|
29
|
+
description: 'List disk checkpoints for a sandbox',
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
schema: {
|
|
33
|
+
args: z.object({
|
|
34
|
+
sandboxId: z.string().describe('Sandbox ID'),
|
|
35
|
+
}),
|
|
36
|
+
options: z.object({}),
|
|
37
|
+
response: CheckpointListResponseSchema,
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
async handler(ctx) {
|
|
41
|
+
const { args, options, auth, logger, apiClient } = ctx;
|
|
42
|
+
|
|
43
|
+
// Resolve sandbox to get region and orgId using CLI API
|
|
44
|
+
const sandboxInfo = await sandboxResolve(apiClient, args.sandboxId);
|
|
45
|
+
|
|
46
|
+
const client = createSandboxClient(logger, auth, sandboxInfo.region);
|
|
47
|
+
|
|
48
|
+
const checkpoints = await diskCheckpointList(client, {
|
|
49
|
+
sandboxId: args.sandboxId,
|
|
50
|
+
orgId: sandboxInfo.orgId,
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
if (!options.json) {
|
|
54
|
+
if (checkpoints.length === 0) {
|
|
55
|
+
tui.info('No disk checkpoints found');
|
|
56
|
+
} else {
|
|
57
|
+
const tableData = checkpoints.map((ckpt) => ({
|
|
58
|
+
ID: ckpt.id,
|
|
59
|
+
Name: ckpt.name,
|
|
60
|
+
'Created At': ckpt.createdAt,
|
|
61
|
+
Parent: ckpt.parent || '-',
|
|
62
|
+
}));
|
|
63
|
+
tui.table(tableData, [
|
|
64
|
+
{ name: 'ID', alignment: 'left' },
|
|
65
|
+
{ name: 'Name', alignment: 'left' },
|
|
66
|
+
{ name: 'Created At', alignment: 'left' },
|
|
67
|
+
{ name: 'Parent', alignment: 'left' },
|
|
68
|
+
]);
|
|
69
|
+
|
|
70
|
+
tui.info(
|
|
71
|
+
`Total: ${checkpoints.length} ${tui.plural(checkpoints.length, 'checkpoint', 'checkpoints')}`
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return {
|
|
77
|
+
checkpoints,
|
|
78
|
+
total: checkpoints.length,
|
|
79
|
+
};
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
export default listSubcommand;
|