@agentuity/cli 1.0.23 → 1.0.25
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/cache/index.d.ts +1 -0
- package/dist/cache/index.d.ts.map +1 -1
- package/dist/cache/index.js +1 -0
- package/dist/cache/index.js.map +1 -1
- package/dist/cache/user-cache.d.ts +20 -0
- package/dist/cache/user-cache.d.ts.map +1 -0
- package/dist/cache/user-cache.js +79 -0
- package/dist/cache/user-cache.js.map +1 -0
- package/dist/cmd/auth/logout.d.ts.map +1 -1
- package/dist/cmd/auth/logout.js +3 -1
- package/dist/cmd/auth/logout.js.map +1 -1
- package/dist/cmd/build/entry-generator.d.ts +4 -0
- package/dist/cmd/build/entry-generator.d.ts.map +1 -1
- package/dist/cmd/build/entry-generator.js +18 -3
- package/dist/cmd/build/entry-generator.js.map +1 -1
- package/dist/cmd/build/vite/bun-dev-server.d.ts +1 -0
- package/dist/cmd/build/vite/bun-dev-server.d.ts.map +1 -1
- package/dist/cmd/build/vite/bun-dev-server.js +11 -9
- package/dist/cmd/build/vite/bun-dev-server.js.map +1 -1
- 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 +15 -10
- 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.d.ts.map +1 -1
- package/dist/cmd/cloud/email/destination/delete.js +6 -2
- 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.d.ts.map +1 -1
- package/dist/cmd/cloud/email/get.js +2 -4
- 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 +9 -15
- 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 -24
- 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.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/build.js +13 -10
- 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 +6 -4
- 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 +10 -5
- 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/index.d.ts.map +1 -1
- package/dist/cmd/cloud/schedule/destination/index.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 +19 -12
- 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 +6 -1
- 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 -7
- 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 +8 -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/attachment.d.ts +2 -0
- package/dist/cmd/cloud/task/attachment.d.ts.map +1 -0
- package/dist/cmd/cloud/task/attachment.js +393 -0
- package/dist/cmd/cloud/task/attachment.js.map +1 -0
- package/dist/cmd/cloud/task/create.d.ts.map +1 -1
- package/dist/cmd/cloud/task/create.js +125 -5
- 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 +33 -14
- 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 +14 -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 +32 -17
- 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 +68 -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 -12
- 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/create.d.ts.map +1 -1
- package/dist/cmd/cloud/webhook/create.js +6 -1
- package/dist/cmd/cloud/webhook/create.js.map +1 -1
- package/dist/cmd/cloud/webhook/deliveries.d.ts.map +1 -1
- package/dist/cmd/cloud/webhook/deliveries.js +12 -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 +19 -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/cmd/dev/index.d.ts.map +1 -1
- package/dist/cmd/dev/index.js +80 -34
- package/dist/cmd/dev/index.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/cache/index.ts +2 -0
- package/src/cache/user-cache.ts +93 -0
- package/src/cmd/auth/logout.ts +3 -1
- package/src/cmd/build/entry-generator.ts +34 -4
- package/src/cmd/build/vite/bun-dev-server.ts +21 -9
- package/src/cmd/cloud/db/index.ts +2 -0
- package/src/cmd/cloud/db/stats.ts +72 -0
- package/src/cmd/cloud/email/create.ts +17 -10
- package/src/cmd/cloud/email/delete.ts +1 -1
- package/src/cmd/cloud/email/destination/delete.ts +6 -2
- 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 +2 -4
- 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 +9 -15
- package/src/cmd/cloud/email/stats.ts +73 -0
- package/src/cmd/cloud/email/util.ts +11 -31
- 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 +34 -15
- package/src/cmd/cloud/sandbox/snapshot/get.ts +3 -3
- package/src/cmd/cloud/sandbox/stats.ts +82 -0
- package/src/cmd/cloud/schedule/create.ts +3 -4
- package/src/cmd/cloud/schedule/delete.ts +6 -4
- package/src/cmd/cloud/schedule/delivery/get.ts +3 -4
- package/src/cmd/cloud/schedule/delivery/list.ts +17 -16
- package/src/cmd/cloud/schedule/destination/create.ts +19 -7
- 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/index.ts +3 -1
- package/src/cmd/cloud/schedule/destination/list.ts +22 -15
- package/src/cmd/cloud/schedule/get.ts +30 -20
- package/src/cmd/cloud/schedule/index.ts +6 -1
- package/src/cmd/cloud/schedule/list.ts +20 -19
- package/src/cmd/cloud/schedule/stats.ts +72 -0
- package/src/cmd/cloud/schedule/update.ts +5 -5
- package/src/cmd/cloud/schedule/util.ts +14 -20
- package/src/cmd/cloud/services/index.ts +11 -0
- package/src/cmd/cloud/services/stats.ts +199 -0
- package/src/cmd/cloud/stream/index.ts +8 -1
- package/src/cmd/cloud/stream/stats.ts +70 -0
- package/src/cmd/cloud/task/attachment.ts +432 -0
- package/src/cmd/cloud/task/create.ts +130 -5
- package/src/cmd/cloud/task/get.ts +35 -16
- package/src/cmd/cloud/task/index.ts +14 -1
- package/src/cmd/cloud/task/list.ts +32 -17
- 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 +14 -28
- package/src/cmd/cloud/vector/get.ts +16 -11
- package/src/cmd/cloud/vector/stats.ts +10 -8
- package/src/cmd/cloud/webhook/create.ts +6 -1
- package/src/cmd/cloud/webhook/deliveries.ts +15 -3
- package/src/cmd/cloud/webhook/destinations.ts +21 -9
- package/src/cmd/cloud/webhook/get.ts +2 -2
- package/src/cmd/cloud/webhook/receipts.ts +16 -3
- package/src/cmd/dev/index.ts +91 -48
- package/src/tui.ts +9 -0
|
@@ -32,12 +32,14 @@ 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
|
|
36
|
-
optional: { project: true },
|
|
35
|
+
requires: { auth: true },
|
|
37
36
|
idempotent: true,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
examples: [
|
|
38
|
+
{
|
|
39
|
+
command: getCommand('cloud schedule get sched_abc123'),
|
|
40
|
+
description: 'Get schedule details',
|
|
41
|
+
},
|
|
42
|
+
],
|
|
41
43
|
schema: {
|
|
42
44
|
args: z.object({
|
|
43
45
|
schedule_id: z.string().min(1).describe('Schedule ID'),
|
|
@@ -47,7 +49,7 @@ export const getSubcommand = createCommand({
|
|
|
47
49
|
|
|
48
50
|
async handler(ctx) {
|
|
49
51
|
const { args, options } = ctx;
|
|
50
|
-
const schedule = createScheduleAdapter(ctx);
|
|
52
|
+
const schedule = await createScheduleAdapter(ctx);
|
|
51
53
|
const result = await schedule.get(args.schedule_id);
|
|
52
54
|
|
|
53
55
|
if (!options.json) {
|
|
@@ -55,7 +57,7 @@ export const getSubcommand = createCommand({
|
|
|
55
57
|
Name: result.schedule.name,
|
|
56
58
|
ID: result.schedule.id,
|
|
57
59
|
Expression: result.schedule.expression,
|
|
58
|
-
Description: result.schedule.description
|
|
60
|
+
Description: result.schedule.description || '-',
|
|
59
61
|
'Next Due': result.schedule.due_date,
|
|
60
62
|
Created: new Date(result.schedule.created_at).toLocaleString(),
|
|
61
63
|
Updated: new Date(result.schedule.updated_at).toLocaleString(),
|
|
@@ -64,23 +66,31 @@ export const getSubcommand = createCommand({
|
|
|
64
66
|
tui.table([details], undefined, { layout: 'vertical', padStart: ' ' });
|
|
65
67
|
|
|
66
68
|
tui.newline();
|
|
67
|
-
tui.
|
|
69
|
+
tui.header('Destinations');
|
|
68
70
|
if (result.destinations.length === 0) {
|
|
69
71
|
tui.info('No destinations configured');
|
|
70
72
|
} else {
|
|
71
73
|
tui.table(
|
|
72
|
-
result.destinations.map(
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
74
|
+
result.destinations.map(
|
|
75
|
+
(destination: {
|
|
76
|
+
id: string;
|
|
77
|
+
type: 'url' | 'sandbox';
|
|
78
|
+
config: Record<string, unknown>;
|
|
79
|
+
created_at: string;
|
|
80
|
+
}) => {
|
|
81
|
+
const configDisplay =
|
|
82
|
+
destination.type === 'url' && destination.config?.url
|
|
83
|
+
? String(destination.config.url)
|
|
84
|
+
: JSON.stringify(destination.config);
|
|
85
|
+
return {
|
|
86
|
+
ID: destination.id,
|
|
87
|
+
Type: destination.type,
|
|
88
|
+
URL: configDisplay,
|
|
89
|
+
Created: new Date(destination.created_at).toLocaleString(),
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
),
|
|
93
|
+
['ID', 'Type', 'URL', 'Created']
|
|
84
94
|
);
|
|
85
95
|
}
|
|
86
96
|
}
|
|
@@ -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' },
|
|
@@ -29,7 +31,10 @@ export const command = createCommand({
|
|
|
29
31
|
command: getCommand("cloud schedule create --name nightly --expression '0 0 * * *'"),
|
|
30
32
|
description: 'Create a schedule',
|
|
31
33
|
},
|
|
32
|
-
{
|
|
34
|
+
{
|
|
35
|
+
command: getCommand('cloud schedule get sched_abc123'),
|
|
36
|
+
description: 'Get schedule details',
|
|
37
|
+
},
|
|
33
38
|
],
|
|
34
39
|
});
|
|
35
40
|
|
|
@@ -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
|
|
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) {
|
|
@@ -50,22 +49,24 @@ export const listSubcommand = createCommand({
|
|
|
50
49
|
tui.info('No schedules found');
|
|
51
50
|
} else {
|
|
52
51
|
tui.table(
|
|
53
|
-
result.schedules.map(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
52
|
+
result.schedules.map(
|
|
53
|
+
(item: {
|
|
54
|
+
id: string;
|
|
55
|
+
created_at: string;
|
|
56
|
+
updated_at: string;
|
|
57
|
+
created_by: string;
|
|
58
|
+
name: string;
|
|
59
|
+
description: string | null;
|
|
60
|
+
expression: string;
|
|
61
|
+
due_date: string;
|
|
62
|
+
}) => ({
|
|
63
|
+
Name: item.name,
|
|
64
|
+
ID: item.id,
|
|
65
|
+
Expression: item.expression,
|
|
66
|
+
'Next Due': item.due_date,
|
|
67
|
+
Created: new Date(item.created_at).toLocaleString(),
|
|
68
|
+
})
|
|
69
|
+
),
|
|
69
70
|
['Name', 'ID', 'Expression', 'Next Due', 'Created']
|
|
70
71
|
);
|
|
71
72
|
}
|
|
@@ -0,0 +1,72 @@
|
|
|
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.schedule;
|
|
16
|
+
if (!svc) {
|
|
17
|
+
tui.info('No schedule data found.');
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
tui.header('Schedule Statistics');
|
|
21
|
+
tui.newline();
|
|
22
|
+
console.log(` ${tui.muted('Schedules:')} ${formatNumber(svc.scheduleCount)}`);
|
|
23
|
+
console.log(
|
|
24
|
+
` ${tui.muted('Deliveries:')} ${formatNumber(svc.totalDeliveries)} (${svc.successDeliveries} ok, ${svc.failedDeliveries} failed)`
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const statsSubcommand = createCommand({
|
|
29
|
+
name: 'stats',
|
|
30
|
+
description: 'View schedule statistics',
|
|
31
|
+
tags: ['read-only', 'requires-auth'],
|
|
32
|
+
requires: { auth: true, org: true },
|
|
33
|
+
examples: [
|
|
34
|
+
{
|
|
35
|
+
command: getCommand('cloud schedule stats'),
|
|
36
|
+
description: 'View schedule statistics',
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
schema: {
|
|
40
|
+
options: z.object({
|
|
41
|
+
start: z.string().optional().describe('Start time (ISO 8601)'),
|
|
42
|
+
end: z.string().optional().describe('End time (ISO 8601)'),
|
|
43
|
+
}),
|
|
44
|
+
},
|
|
45
|
+
idempotent: true,
|
|
46
|
+
|
|
47
|
+
async handler(ctx) {
|
|
48
|
+
const { opts, options } = ctx;
|
|
49
|
+
const client = await getGlobalCatalystAPIClient(ctx.logger, ctx.auth, ctx.config?.name);
|
|
50
|
+
const orgId = ctx.orgId ?? ctx.options.orgId ?? ctx.config?.preferences?.orgId;
|
|
51
|
+
|
|
52
|
+
if (!orgId) {
|
|
53
|
+
ctx.logger.fatal('Organization ID is required. Use --org-id or set a preferred org.');
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const data = await getServiceStats(client, orgId, {
|
|
58
|
+
service: 'schedule',
|
|
59
|
+
start: opts.start,
|
|
60
|
+
end: opts.end,
|
|
61
|
+
orgIdHeader: orgId,
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
if (!options.json) {
|
|
65
|
+
displayStats(data);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return data;
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
export default statsSubcommand;
|
|
@@ -21,8 +21,7 @@ export const updateSubcommand = createCommand({
|
|
|
21
21
|
name: 'update',
|
|
22
22
|
description: 'Update a schedule',
|
|
23
23
|
tags: ['mutating', 'requires-auth'],
|
|
24
|
-
requires: { auth: true
|
|
25
|
-
optional: { project: true },
|
|
24
|
+
requires: { auth: true },
|
|
26
25
|
examples: [
|
|
27
26
|
{
|
|
28
27
|
command: getCommand("cloud schedule update sched_abc123 --expression '*/5 * * * *'"),
|
|
@@ -37,17 +36,18 @@ export const updateSubcommand = createCommand({
|
|
|
37
36
|
name: z.string().optional().describe('Schedule name'),
|
|
38
37
|
expression: z.string().optional().describe('Cron expression'),
|
|
39
38
|
description: z.string().optional().describe('Schedule description'),
|
|
39
|
+
clearDescription: z.boolean().optional().describe('Clear the schedule description'),
|
|
40
40
|
}),
|
|
41
41
|
response: ScheduleUpdateResponseSchema,
|
|
42
42
|
},
|
|
43
43
|
|
|
44
44
|
async handler(ctx) {
|
|
45
45
|
const { args, opts, options } = ctx;
|
|
46
|
-
const schedule = createScheduleAdapter(ctx);
|
|
46
|
+
const schedule = await createScheduleAdapter(ctx);
|
|
47
47
|
const result = await schedule.update(args.schedule_id, {
|
|
48
48
|
name: opts.name,
|
|
49
49
|
expression: opts.expression,
|
|
50
|
-
description: opts.description,
|
|
50
|
+
description: opts.clearDescription ? '' : opts.description,
|
|
51
51
|
});
|
|
52
52
|
|
|
53
53
|
if (!options.json) {
|
|
@@ -58,7 +58,7 @@ export const updateSubcommand = createCommand({
|
|
|
58
58
|
Name: result.schedule.name,
|
|
59
59
|
ID: result.schedule.id,
|
|
60
60
|
Expression: result.schedule.expression,
|
|
61
|
-
Description: result.schedule.description
|
|
61
|
+
Description: result.schedule.description || '-',
|
|
62
62
|
Updated: new Date(result.schedule.updated_at).toLocaleString(),
|
|
63
63
|
},
|
|
64
64
|
],
|
|
@@ -1,34 +1,28 @@
|
|
|
1
1
|
import { ScheduleService, type Logger } from '@agentuity/core';
|
|
2
2
|
import { createServerFetchAdapter } from '@agentuity/server';
|
|
3
|
-
import type { AuthData, Config, GlobalOptions
|
|
3
|
+
import type { AuthData, Config, GlobalOptions } from '../../../types';
|
|
4
4
|
import { getCatalystUrl } from '../../../catalyst';
|
|
5
|
+
import { defaultProfileName, getDefaultRegion } from '../../../config';
|
|
5
6
|
import * as tui from '../../../tui';
|
|
6
7
|
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
},
|
|
16
|
-
explicitOrgId?: string
|
|
17
|
-
) {
|
|
8
|
+
export interface ScheduleContext {
|
|
9
|
+
logger: Logger;
|
|
10
|
+
auth: AuthData;
|
|
11
|
+
config: Config | null;
|
|
12
|
+
options: GlobalOptions;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export async function createScheduleAdapter(ctx: ScheduleContext) {
|
|
18
16
|
const orgId =
|
|
19
|
-
|
|
20
|
-
ctx.project?.orgId ??
|
|
21
|
-
ctx.options.orgId ??
|
|
22
|
-
(process.env.AGENTUITY_CLOUD_ORG_ID || ctx.config?.preferences?.orgId);
|
|
17
|
+
ctx.options.orgId ?? (process.env.AGENTUITY_CLOUD_ORG_ID || ctx.config?.preferences?.orgId);
|
|
23
18
|
if (!orgId) {
|
|
24
|
-
tui.fatal(
|
|
25
|
-
'Organization ID is required. Either run from a project directory or use --org-id flag.'
|
|
26
|
-
);
|
|
19
|
+
tui.fatal('Organization ID is required. Use --org-id flag or set AGENTUITY_CLOUD_ORG_ID.');
|
|
27
20
|
}
|
|
28
21
|
const adapter = createServerFetchAdapter(
|
|
29
22
|
{ headers: { Authorization: `Bearer ${ctx.auth.apiKey}`, 'x-agentuity-orgid': orgId } },
|
|
30
23
|
ctx.logger
|
|
31
24
|
);
|
|
32
|
-
const
|
|
25
|
+
const region = await getDefaultRegion(ctx.config?.name ?? defaultProfileName, ctx.config);
|
|
26
|
+
const baseUrl = getCatalystUrl(region);
|
|
33
27
|
return new ScheduleService(baseUrl, adapter);
|
|
34
28
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createCommand } from '../../../types';
|
|
2
|
+
import { statsSubcommand } from './stats';
|
|
3
|
+
|
|
4
|
+
const servicesCommand = createCommand({
|
|
5
|
+
name: 'services',
|
|
6
|
+
description: 'Service usage statistics',
|
|
7
|
+
tags: ['read-only', 'requires-auth'],
|
|
8
|
+
subcommands: [statsSubcommand],
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export default servicesCommand;
|
|
@@ -0,0 +1,199 @@
|
|
|
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 {
|
|
7
|
+
getServiceStats,
|
|
8
|
+
VALID_SERVICES,
|
|
9
|
+
type ServiceName,
|
|
10
|
+
type ServiceStatsData,
|
|
11
|
+
} from '@agentuity/server';
|
|
12
|
+
|
|
13
|
+
function formatNumber(n: number): string {
|
|
14
|
+
if (n >= 1_000_000) return `${(n / 1_000_000).toFixed(1)}M`;
|
|
15
|
+
if (n >= 1_000) return `${(n / 1_000).toFixed(1)}K`;
|
|
16
|
+
return String(n);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function formatLatency(ms: number): string {
|
|
20
|
+
if (ms >= 1000) return `${(ms / 1000).toFixed(1)}s`;
|
|
21
|
+
return `${Math.round(ms)}ms`;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function displayServiceStats(data: ServiceStatsData): void {
|
|
25
|
+
tui.header('Service Statistics');
|
|
26
|
+
|
|
27
|
+
const services = data.services;
|
|
28
|
+
let hasData = false;
|
|
29
|
+
|
|
30
|
+
if (services.keyvalue) {
|
|
31
|
+
hasData = true;
|
|
32
|
+
tui.newline();
|
|
33
|
+
console.log(tui.colorPrimary('Key-Value:'));
|
|
34
|
+
console.log(
|
|
35
|
+
` ${tui.muted('Namespaces:')} ${formatNumber(services.keyvalue.namespaceCount)}`
|
|
36
|
+
);
|
|
37
|
+
console.log(` ${tui.muted('Keys:')} ${formatNumber(services.keyvalue.keyCount)}`);
|
|
38
|
+
console.log(
|
|
39
|
+
` ${tui.muted('Total Size:')} ${tui.formatBytes(services.keyvalue.totalSizeBytes)}`
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (services.vector) {
|
|
44
|
+
hasData = true;
|
|
45
|
+
tui.newline();
|
|
46
|
+
console.log(tui.colorPrimary('Vector:'));
|
|
47
|
+
console.log(
|
|
48
|
+
` ${tui.muted('Namespaces:')} ${formatNumber(services.vector.namespaceCount)}`
|
|
49
|
+
);
|
|
50
|
+
console.log(
|
|
51
|
+
` ${tui.muted('Documents:')} ${formatNumber(services.vector.documentCount)}`
|
|
52
|
+
);
|
|
53
|
+
console.log(
|
|
54
|
+
` ${tui.muted('Total Size:')} ${tui.formatBytes(services.vector.totalSizeBytes)}`
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (services.queue) {
|
|
59
|
+
hasData = true;
|
|
60
|
+
tui.newline();
|
|
61
|
+
console.log(tui.colorPrimary('Queue:'));
|
|
62
|
+
console.log(` ${tui.muted('Queues:')} ${formatNumber(services.queue.queueCount)}`);
|
|
63
|
+
console.log(
|
|
64
|
+
` ${tui.muted('Total Messages:')} ${formatNumber(services.queue.totalMessages)}`
|
|
65
|
+
);
|
|
66
|
+
console.log(` ${tui.muted('DLQ Messages:')} ${formatNumber(services.queue.totalDlq)}`);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (services.stream) {
|
|
70
|
+
hasData = true;
|
|
71
|
+
tui.newline();
|
|
72
|
+
console.log(tui.colorPrimary('Stream:'));
|
|
73
|
+
console.log(
|
|
74
|
+
` ${tui.muted('Streams:')} ${formatNumber(services.stream.streamCount)}`
|
|
75
|
+
);
|
|
76
|
+
console.log(
|
|
77
|
+
` ${tui.muted('Total Size:')} ${tui.formatBytes(services.stream.totalSizeBytes)}`
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (services.sandbox) {
|
|
82
|
+
hasData = true;
|
|
83
|
+
const sb = services.sandbox;
|
|
84
|
+
tui.newline();
|
|
85
|
+
console.log(tui.colorPrimary('Sandbox:'));
|
|
86
|
+
console.log(
|
|
87
|
+
` ${tui.muted('Active:')} ${formatNumber(sb.totalActive)} (${sb.running} running, ${sb.idle} idle, ${sb.creating} creating)`
|
|
88
|
+
);
|
|
89
|
+
console.log(` ${tui.muted('Executions:')} ${formatNumber(sb.totalExecutions)}`);
|
|
90
|
+
console.log(` ${tui.muted('CPU Time:')} ${formatLatency(sb.totalCpuTimeMs)}`);
|
|
91
|
+
console.log(` ${tui.muted('Memory:')} ${tui.formatBytes(sb.totalMemoryByteSec)}`);
|
|
92
|
+
console.log(
|
|
93
|
+
` ${tui.muted('Network Out:')} ${tui.formatBytes(sb.totalNetworkEgressBytes)}`
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (services.email) {
|
|
98
|
+
hasData = true;
|
|
99
|
+
const em = services.email;
|
|
100
|
+
tui.newline();
|
|
101
|
+
console.log(tui.colorPrimary('Email:'));
|
|
102
|
+
console.log(` ${tui.muted('Addresses:')} ${formatNumber(em.addressCount)}`);
|
|
103
|
+
console.log(` ${tui.muted('Inbound:')} ${formatNumber(em.inboundCount)}`);
|
|
104
|
+
console.log(
|
|
105
|
+
` ${tui.muted('Outbound:')} ${formatNumber(em.outboundCount)} (${em.outboundSuccess} ok, ${em.outboundFailed} failed)`
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (services.task) {
|
|
110
|
+
hasData = true;
|
|
111
|
+
const tk = services.task;
|
|
112
|
+
tui.newline();
|
|
113
|
+
console.log(tui.colorPrimary('Task:'));
|
|
114
|
+
console.log(` ${tui.muted('Total:')} ${formatNumber(tk.total)}`);
|
|
115
|
+
console.log(` ${tui.muted('Open:')} ${formatNumber(tk.open)}`);
|
|
116
|
+
console.log(` ${tui.muted('In Progress:')} ${formatNumber(tk.inProgress)}`);
|
|
117
|
+
console.log(` ${tui.muted('Closed:')} ${formatNumber(tk.closed)}`);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (services.schedule) {
|
|
121
|
+
hasData = true;
|
|
122
|
+
const sc = services.schedule;
|
|
123
|
+
tui.newline();
|
|
124
|
+
console.log(tui.colorPrimary('Schedule:'));
|
|
125
|
+
console.log(` ${tui.muted('Schedules:')} ${formatNumber(sc.scheduleCount)}`);
|
|
126
|
+
console.log(
|
|
127
|
+
` ${tui.muted('Deliveries:')} ${formatNumber(sc.totalDeliveries)} (${sc.successDeliveries} ok, ${sc.failedDeliveries} failed)`
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if (services.database) {
|
|
132
|
+
hasData = true;
|
|
133
|
+
const db = services.database;
|
|
134
|
+
tui.newline();
|
|
135
|
+
console.log(tui.colorPrimary('Database:'));
|
|
136
|
+
console.log(` ${tui.muted('Databases:')} ${formatNumber(db.databaseCount)}`);
|
|
137
|
+
console.log(` ${tui.muted('Tables:')} ${formatNumber(db.totalTableCount)}`);
|
|
138
|
+
console.log(` ${tui.muted('Records:')} ${formatNumber(db.totalRecordCount)}`);
|
|
139
|
+
console.log(` ${tui.muted('Total Size:')} ${tui.formatBytes(db.totalSizeBytes)}`);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (!hasData) {
|
|
143
|
+
tui.info('No service usage data found.');
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export const statsSubcommand = createCommand({
|
|
148
|
+
name: 'stats',
|
|
149
|
+
description: 'View service usage statistics',
|
|
150
|
+
tags: ['read-only', 'requires-auth'],
|
|
151
|
+
requires: { auth: true, org: true },
|
|
152
|
+
examples: [
|
|
153
|
+
{
|
|
154
|
+
command: getCommand('cloud services stats'),
|
|
155
|
+
description: 'View stats for all services',
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
command: getCommand('cloud services stats --service keyvalue'),
|
|
159
|
+
description: 'View stats for key-value service only',
|
|
160
|
+
},
|
|
161
|
+
],
|
|
162
|
+
schema: {
|
|
163
|
+
options: z.object({
|
|
164
|
+
service: z
|
|
165
|
+
.string()
|
|
166
|
+
.optional()
|
|
167
|
+
.describe(`Service name to filter (${VALID_SERVICES.join(', ')})`),
|
|
168
|
+
start: z.string().optional().describe('Start time (ISO 8601)'),
|
|
169
|
+
end: z.string().optional().describe('End time (ISO 8601)'),
|
|
170
|
+
}),
|
|
171
|
+
},
|
|
172
|
+
idempotent: true,
|
|
173
|
+
|
|
174
|
+
async handler(ctx) {
|
|
175
|
+
const { opts, options } = ctx;
|
|
176
|
+
const client = await getGlobalCatalystAPIClient(ctx.logger, ctx.auth, ctx.config?.name);
|
|
177
|
+
const orgId = ctx.orgId ?? ctx.options.orgId ?? ctx.config?.preferences?.orgId;
|
|
178
|
+
|
|
179
|
+
if (!orgId) {
|
|
180
|
+
ctx.logger.fatal('Organization ID is required. Use --org-id or set a preferred org.');
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
const data = await getServiceStats(client, orgId, {
|
|
185
|
+
service: opts.service as ServiceName,
|
|
186
|
+
start: opts.start,
|
|
187
|
+
end: opts.end,
|
|
188
|
+
orgIdHeader: orgId,
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
if (!options.json) {
|
|
192
|
+
displayServiceStats(data);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
return data;
|
|
196
|
+
},
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
export default statsSubcommand;
|
|
@@ -3,6 +3,7 @@ import createSubcommand from './create';
|
|
|
3
3
|
import listSubcommand from './list';
|
|
4
4
|
import getSubcommand from './get';
|
|
5
5
|
import deleteSubcommand from './delete';
|
|
6
|
+
import statsSubcommand from './stats';
|
|
6
7
|
import { getCommand } from '../../../command-prefix';
|
|
7
8
|
|
|
8
9
|
export const streamCommand = createCommand({
|
|
@@ -22,7 +23,13 @@ export const streamCommand = createCommand({
|
|
|
22
23
|
{ command: getCommand('cloud stream list'), description: 'List all streams' },
|
|
23
24
|
{ command: getCommand('cloud stream get <id>'), description: 'Get stream details' },
|
|
24
25
|
],
|
|
25
|
-
subcommands: [
|
|
26
|
+
subcommands: [
|
|
27
|
+
createSubcommand,
|
|
28
|
+
listSubcommand,
|
|
29
|
+
getSubcommand,
|
|
30
|
+
deleteSubcommand,
|
|
31
|
+
statsSubcommand,
|
|
32
|
+
],
|
|
26
33
|
});
|
|
27
34
|
|
|
28
35
|
export default streamCommand;
|
|
@@ -0,0 +1,70 @@
|
|
|
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.stream;
|
|
16
|
+
if (!svc) {
|
|
17
|
+
tui.info('No stream data found.');
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
tui.header('Stream Statistics');
|
|
21
|
+
tui.newline();
|
|
22
|
+
console.log(` ${tui.muted('Streams:')} ${formatNumber(svc.streamCount)}`);
|
|
23
|
+
console.log(` ${tui.muted('Total Size:')} ${tui.formatBytes(svc.totalSizeBytes)}`);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const statsSubcommand = createCommand({
|
|
27
|
+
name: 'stats',
|
|
28
|
+
description: 'View stream statistics',
|
|
29
|
+
tags: ['read-only', 'requires-auth'],
|
|
30
|
+
requires: { auth: true, org: true },
|
|
31
|
+
examples: [
|
|
32
|
+
{
|
|
33
|
+
command: getCommand('cloud stream stats'),
|
|
34
|
+
description: 'View stream statistics',
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
schema: {
|
|
38
|
+
options: z.object({
|
|
39
|
+
start: z.string().optional().describe('Start time (ISO 8601)'),
|
|
40
|
+
end: z.string().optional().describe('End time (ISO 8601)'),
|
|
41
|
+
}),
|
|
42
|
+
},
|
|
43
|
+
idempotent: true,
|
|
44
|
+
|
|
45
|
+
async handler(ctx) {
|
|
46
|
+
const { opts, options } = ctx;
|
|
47
|
+
const client = await getGlobalCatalystAPIClient(ctx.logger, ctx.auth, ctx.config?.name);
|
|
48
|
+
const orgId = ctx.orgId ?? ctx.options.orgId ?? ctx.config?.preferences?.orgId;
|
|
49
|
+
|
|
50
|
+
if (!orgId) {
|
|
51
|
+
ctx.logger.fatal('Organization ID is required. Use --org-id or set a preferred org.');
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const data = await getServiceStats(client, orgId, {
|
|
56
|
+
service: 'stream',
|
|
57
|
+
start: opts.start,
|
|
58
|
+
end: opts.end,
|
|
59
|
+
orgIdHeader: orgId,
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
if (!options.json) {
|
|
63
|
+
displayStats(data);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return data;
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
export default statsSubcommand;
|