@agentuity/cli 0.1.19 → 0.1.21
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/auth/index.d.ts.map +1 -1
- package/dist/cmd/auth/index.js +2 -0
- package/dist/cmd/auth/index.js.map +1 -1
- package/dist/cmd/auth/machine/index.d.ts +2 -0
- package/dist/cmd/auth/machine/index.d.ts.map +1 -0
- package/dist/cmd/auth/machine/index.js +16 -0
- package/dist/cmd/auth/machine/index.js.map +1 -0
- package/dist/cmd/auth/machine/setup.d.ts +2 -0
- package/dist/cmd/auth/machine/setup.d.ts.map +1 -0
- package/dist/cmd/auth/machine/setup.js +87 -0
- package/dist/cmd/auth/machine/setup.js.map +1 -0
- package/dist/cmd/cloud/db/index.js +1 -1
- package/dist/cmd/cloud/db/index.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/keyvalue/create-namespace.d.ts.map +1 -1
- package/dist/cmd/cloud/keyvalue/create-namespace.js +2 -1
- package/dist/cmd/cloud/keyvalue/create-namespace.js.map +1 -1
- package/dist/cmd/cloud/keyvalue/delete-namespace.d.ts.map +1 -1
- package/dist/cmd/cloud/keyvalue/delete-namespace.js +2 -1
- package/dist/cmd/cloud/keyvalue/delete-namespace.js.map +1 -1
- package/dist/cmd/cloud/keyvalue/delete.d.ts.map +1 -1
- package/dist/cmd/cloud/keyvalue/delete.js +2 -1
- package/dist/cmd/cloud/keyvalue/delete.js.map +1 -1
- package/dist/cmd/cloud/keyvalue/get.d.ts.map +1 -1
- package/dist/cmd/cloud/keyvalue/get.js +2 -1
- package/dist/cmd/cloud/keyvalue/get.js.map +1 -1
- package/dist/cmd/cloud/keyvalue/keys.d.ts.map +1 -1
- package/dist/cmd/cloud/keyvalue/keys.js +2 -1
- package/dist/cmd/cloud/keyvalue/keys.js.map +1 -1
- package/dist/cmd/cloud/keyvalue/list-namespaces.d.ts.map +1 -1
- package/dist/cmd/cloud/keyvalue/list-namespaces.js +2 -1
- package/dist/cmd/cloud/keyvalue/list-namespaces.js.map +1 -1
- package/dist/cmd/cloud/keyvalue/repl.js +1 -1
- package/dist/cmd/cloud/keyvalue/repl.js.map +1 -1
- package/dist/cmd/cloud/keyvalue/search.d.ts.map +1 -1
- package/dist/cmd/cloud/keyvalue/search.js +2 -1
- package/dist/cmd/cloud/keyvalue/search.js.map +1 -1
- package/dist/cmd/cloud/keyvalue/set.d.ts.map +1 -1
- package/dist/cmd/cloud/keyvalue/set.js +2 -1
- package/dist/cmd/cloud/keyvalue/set.js.map +1 -1
- package/dist/cmd/cloud/keyvalue/stats.d.ts.map +1 -1
- package/dist/cmd/cloud/keyvalue/stats.js +2 -1
- package/dist/cmd/cloud/keyvalue/stats.js.map +1 -1
- package/dist/cmd/cloud/keyvalue/util.d.ts +5 -6
- package/dist/cmd/cloud/keyvalue/util.d.ts.map +1 -1
- package/dist/cmd/cloud/keyvalue/util.js +8 -4
- package/dist/cmd/cloud/keyvalue/util.js.map +1 -1
- package/dist/cmd/cloud/machine/delete.d.ts +2 -0
- package/dist/cmd/cloud/machine/delete.d.ts.map +1 -0
- package/dist/cmd/cloud/machine/delete.js +84 -0
- package/dist/cmd/cloud/machine/delete.js.map +1 -0
- package/dist/cmd/cloud/machine/deployments.d.ts +2 -0
- package/dist/cmd/cloud/machine/deployments.d.ts.map +1 -0
- package/dist/cmd/cloud/machine/deployments.js +86 -0
- package/dist/cmd/cloud/machine/deployments.js.map +1 -0
- package/dist/cmd/cloud/machine/get.d.ts +2 -0
- package/dist/cmd/cloud/machine/get.d.ts.map +1 -0
- package/dist/cmd/cloud/machine/get.js +104 -0
- package/dist/cmd/cloud/machine/get.js.map +1 -0
- package/dist/cmd/cloud/machine/index.d.ts +2 -0
- package/dist/cmd/cloud/machine/index.d.ts.map +1 -0
- package/dist/cmd/cloud/machine/index.js +22 -0
- package/dist/cmd/cloud/machine/index.js.map +1 -0
- package/dist/cmd/cloud/machine/list.d.ts +2 -0
- package/dist/cmd/cloud/machine/list.d.ts.map +1 -0
- package/dist/cmd/cloud/machine/list.js +73 -0
- package/dist/cmd/cloud/machine/list.js.map +1 -0
- package/dist/cmd/cloud/queue/index.js +1 -1
- package/dist/cmd/cloud/queue/index.js.map +1 -1
- package/dist/cmd/cloud/redis/index.js +1 -1
- package/dist/cmd/cloud/redis/index.js.map +1 -1
- package/dist/cmd/cloud/sandbox/get.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/get.js +25 -18
- package/dist/cmd/cloud/sandbox/get.js.map +1 -1
- package/dist/cmd/cloud/sandbox/index.js +1 -1
- package/dist/cmd/cloud/sandbox/index.js.map +1 -1
- package/dist/cmd/cloud/sandbox/list.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/list.js +40 -9
- package/dist/cmd/cloud/sandbox/list.js.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/get.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/get.js +16 -0
- package/dist/cmd/cloud/sandbox/snapshot/get.js.map +1 -1
- package/dist/cmd/cloud/storage/index.js +1 -1
- package/dist/cmd/cloud/storage/index.js.map +1 -1
- package/dist/cmd/cloud/stream/index.js +1 -1
- package/dist/cmd/cloud/stream/index.js.map +1 -1
- package/dist/cmd/cloud/vector/delete-namespace.d.ts.map +1 -1
- package/dist/cmd/cloud/vector/delete-namespace.js +2 -1
- package/dist/cmd/cloud/vector/delete-namespace.js.map +1 -1
- package/dist/cmd/cloud/vector/delete.d.ts.map +1 -1
- package/dist/cmd/cloud/vector/delete.js +2 -1
- package/dist/cmd/cloud/vector/delete.js.map +1 -1
- package/dist/cmd/cloud/vector/get.d.ts.map +1 -1
- package/dist/cmd/cloud/vector/get.js +2 -1
- package/dist/cmd/cloud/vector/get.js.map +1 -1
- package/dist/cmd/cloud/vector/index.js +1 -1
- package/dist/cmd/cloud/vector/index.js.map +1 -1
- package/dist/cmd/cloud/vector/list-namespaces.d.ts.map +1 -1
- package/dist/cmd/cloud/vector/list-namespaces.js +2 -1
- package/dist/cmd/cloud/vector/list-namespaces.js.map +1 -1
- package/dist/cmd/cloud/vector/search.d.ts.map +1 -1
- package/dist/cmd/cloud/vector/search.js +2 -1
- package/dist/cmd/cloud/vector/search.js.map +1 -1
- package/dist/cmd/cloud/vector/stats.d.ts.map +1 -1
- package/dist/cmd/cloud/vector/stats.js +2 -1
- package/dist/cmd/cloud/vector/stats.js.map +1 -1
- package/dist/cmd/cloud/vector/upsert.d.ts.map +1 -1
- package/dist/cmd/cloud/vector/upsert.js +2 -1
- package/dist/cmd/cloud/vector/upsert.js.map +1 -1
- package/dist/cmd/cloud/vector/util.d.ts +7 -8
- package/dist/cmd/cloud/vector/util.d.ts.map +1 -1
- package/dist/cmd/cloud/vector/util.js +7 -7
- package/dist/cmd/cloud/vector/util.js.map +1 -1
- package/dist/cmd/setup/index.d.ts.map +1 -1
- package/dist/cmd/setup/index.js +7 -2
- package/dist/cmd/setup/index.js.map +1 -1
- package/dist/config.d.ts +7 -2
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +13 -4
- package/dist/config.js.map +1 -1
- package/dist/env-util.d.ts +1 -1
- package/dist/env-util.d.ts.map +1 -1
- package/dist/env-util.js +1 -1
- package/dist/env-util.js.map +1 -1
- package/package.json +6 -6
- package/src/cmd/auth/index.ts +2 -0
- package/src/cmd/auth/machine/index.ts +16 -0
- package/src/cmd/auth/machine/setup.ts +104 -0
- package/src/cmd/cloud/db/index.ts +1 -1
- package/src/cmd/cloud/index.ts +2 -0
- package/src/cmd/cloud/keyvalue/create-namespace.ts +2 -1
- package/src/cmd/cloud/keyvalue/delete-namespace.ts +2 -1
- package/src/cmd/cloud/keyvalue/delete.ts +2 -1
- package/src/cmd/cloud/keyvalue/get.ts +2 -1
- package/src/cmd/cloud/keyvalue/keys.ts +2 -1
- package/src/cmd/cloud/keyvalue/list-namespaces.ts +2 -1
- package/src/cmd/cloud/keyvalue/repl.ts +1 -1
- package/src/cmd/cloud/keyvalue/search.ts +2 -1
- package/src/cmd/cloud/keyvalue/set.ts +2 -1
- package/src/cmd/cloud/keyvalue/stats.ts +2 -1
- package/src/cmd/cloud/keyvalue/util.ts +15 -7
- package/src/cmd/cloud/machine/delete.ts +91 -0
- package/src/cmd/cloud/machine/deployments.ts +94 -0
- package/src/cmd/cloud/machine/get.ts +110 -0
- package/src/cmd/cloud/machine/index.ts +22 -0
- package/src/cmd/cloud/machine/list.ts +80 -0
- package/src/cmd/cloud/queue/index.ts +1 -1
- package/src/cmd/cloud/redis/index.ts +1 -1
- package/src/cmd/cloud/sandbox/get.ts +28 -19
- package/src/cmd/cloud/sandbox/index.ts +1 -1
- package/src/cmd/cloud/sandbox/list.ts +44 -9
- package/src/cmd/cloud/sandbox/snapshot/get.ts +18 -0
- package/src/cmd/cloud/storage/index.ts +1 -1
- package/src/cmd/cloud/stream/index.ts +1 -1
- package/src/cmd/cloud/vector/delete-namespace.ts +2 -1
- package/src/cmd/cloud/vector/delete.ts +2 -1
- package/src/cmd/cloud/vector/get.ts +2 -1
- package/src/cmd/cloud/vector/index.ts +1 -1
- package/src/cmd/cloud/vector/list-namespaces.ts +2 -1
- package/src/cmd/cloud/vector/search.ts +2 -1
- package/src/cmd/cloud/vector/stats.ts +2 -1
- package/src/cmd/cloud/vector/upsert.ts +2 -1
- package/src/cmd/cloud/vector/util.ts +15 -12
- package/src/cmd/setup/index.ts +7 -2
- package/src/config.ts +19 -4
- package/src/env-util.ts +1 -1
|
@@ -13,7 +13,8 @@ export const keysSubcommand = createCommand({
|
|
|
13
13
|
aliases: ['ls', 'list'],
|
|
14
14
|
description: 'List all keys in a keyvalue namespace',
|
|
15
15
|
tags: ['read-only', 'slow', 'requires-auth'],
|
|
16
|
-
requires: { auth: true },
|
|
16
|
+
requires: { auth: true, region: true },
|
|
17
|
+
optional: { project: true },
|
|
17
18
|
idempotent: true,
|
|
18
19
|
examples: [
|
|
19
20
|
{ command: getCommand('kv keys production'), description: 'List all keys in production' },
|
|
@@ -10,7 +10,8 @@ export const listNamespacesSubcommand = createCommand({
|
|
|
10
10
|
aliases: ['namespaces', 'ns'],
|
|
11
11
|
description: 'List all keyvalue namespaces',
|
|
12
12
|
tags: ['read-only', 'fast', 'requires-auth'],
|
|
13
|
-
requires: { auth: true },
|
|
13
|
+
requires: { auth: true, region: true },
|
|
14
|
+
optional: { project: true },
|
|
14
15
|
examples: [
|
|
15
16
|
{ command: getCommand('kv list-namespaces'), description: 'List all namespaces' },
|
|
16
17
|
{ command: getCommand('kv namespaces'), description: 'List namespaces (using alias)' },
|
|
@@ -11,7 +11,7 @@ export const replSubcommand = createCommand({
|
|
|
11
11
|
description: 'Start an interactive repl for working with keyvalue database',
|
|
12
12
|
tags: ['slow', 'requires-auth'],
|
|
13
13
|
idempotent: false,
|
|
14
|
-
requires: { auth: true },
|
|
14
|
+
requires: { auth: true, region: true },
|
|
15
15
|
optional: { project: true },
|
|
16
16
|
examples: [{ command: getCommand('kv repl'), description: 'Start interactive KV session' }],
|
|
17
17
|
|
|
@@ -20,7 +20,8 @@ export const searchSubcommand = createCommand({
|
|
|
20
20
|
name: 'search',
|
|
21
21
|
description: 'Search for keys matching a keyword in a keyvalue namespace',
|
|
22
22
|
tags: ['read-only', 'slow', 'requires-auth'],
|
|
23
|
-
requires: { auth: true },
|
|
23
|
+
requires: { auth: true, region: true },
|
|
24
|
+
optional: { project: true },
|
|
24
25
|
idempotent: true,
|
|
25
26
|
examples: [
|
|
26
27
|
{
|
|
@@ -19,7 +19,8 @@ export const setSubcommand = createCommand({
|
|
|
19
19
|
description: 'Set a key and value in the keyvalue storage',
|
|
20
20
|
tags: ['mutating', 'updates-resource', 'slow', 'requires-auth'],
|
|
21
21
|
idempotent: true,
|
|
22
|
-
requires: { auth: true },
|
|
22
|
+
requires: { auth: true, region: true },
|
|
23
|
+
optional: { project: true },
|
|
23
24
|
examples: [
|
|
24
25
|
{
|
|
25
26
|
command: getCommand(
|
|
@@ -26,7 +26,8 @@ export const statsSubcommand = createCommand({
|
|
|
26
26
|
name: 'stats',
|
|
27
27
|
description: 'Get statistics for keyvalue storage',
|
|
28
28
|
tags: ['read-only', 'fast', 'requires-auth'],
|
|
29
|
-
requires: { auth: true },
|
|
29
|
+
requires: { auth: true, region: true },
|
|
30
|
+
optional: { project: true },
|
|
30
31
|
idempotent: true,
|
|
31
32
|
examples: [
|
|
32
33
|
{ command: getCommand('kv stats'), description: 'Show stats for all namespaces' },
|
|
@@ -1,25 +1,33 @@
|
|
|
1
1
|
import { KeyValueStorageService, type Logger } from '@agentuity/core';
|
|
2
2
|
import { createServerFetchAdapter, getServiceUrls } from '@agentuity/server';
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
3
|
+
import type { AuthData, GlobalOptions, ProjectConfig } from '../../../types';
|
|
4
|
+
import * as tui from '../../../tui';
|
|
5
5
|
|
|
6
|
-
export
|
|
6
|
+
export function createStorageAdapter(ctx: {
|
|
7
7
|
logger: Logger;
|
|
8
|
-
config: Config | null;
|
|
9
8
|
auth: AuthData;
|
|
10
|
-
|
|
9
|
+
region: string;
|
|
10
|
+
project?: ProjectConfig;
|
|
11
|
+
options: GlobalOptions;
|
|
11
12
|
}) {
|
|
13
|
+
const orgId = ctx.project?.orgId ?? ctx.options.orgId;
|
|
14
|
+
if (!orgId) {
|
|
15
|
+
tui.fatal(
|
|
16
|
+
'Organization ID is required. Either run from a project directory or use --org-id flag.'
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
12
20
|
const adapter = createServerFetchAdapter(
|
|
13
21
|
{
|
|
14
22
|
headers: {
|
|
15
23
|
Authorization: `Bearer ${ctx.auth.apiKey}`,
|
|
24
|
+
'x-agentuity-orgid': orgId,
|
|
16
25
|
},
|
|
17
26
|
},
|
|
18
27
|
ctx.logger
|
|
19
28
|
);
|
|
20
29
|
|
|
21
|
-
const
|
|
22
|
-
const urls = getServiceUrls(region);
|
|
30
|
+
const urls = getServiceUrls(ctx.region);
|
|
23
31
|
const baseUrl = urls.catalyst;
|
|
24
32
|
return new KeyValueStorageService(baseUrl, adapter);
|
|
25
33
|
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { createSubcommand } from '../../../types';
|
|
3
|
+
import * as tui from '../../../tui';
|
|
4
|
+
import { machineDelete, machineGet } from '@agentuity/server';
|
|
5
|
+
import { getCommand } from '../../../command-prefix';
|
|
6
|
+
import { ErrorCode } from '../../../errors';
|
|
7
|
+
import { getGlobalCatalystAPIClient } from '../../../config';
|
|
8
|
+
import enquirer from 'enquirer';
|
|
9
|
+
|
|
10
|
+
const MachineDeleteResponseSchema = z.object({
|
|
11
|
+
success: z.boolean().describe('Whether the deletion succeeded'),
|
|
12
|
+
machineId: z.string().describe('The deleted machine ID'),
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export const deleteSubcommand = createSubcommand({
|
|
16
|
+
name: 'delete',
|
|
17
|
+
description: 'Delete an organization managed machine',
|
|
18
|
+
tags: ['mutating', 'destructive', 'slow', 'requires-auth'],
|
|
19
|
+
examples: [
|
|
20
|
+
{
|
|
21
|
+
command: `${getCommand('cloud machine delete')} mach_abc123xyz`,
|
|
22
|
+
description: 'Delete a machine (with confirmation)',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
command: `${getCommand('cloud machine delete')} mach_abc123xyz --confirm`,
|
|
26
|
+
description: 'Delete a machine without confirmation',
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
aliases: ['rm', 'remove'],
|
|
30
|
+
requires: { auth: true, org: true },
|
|
31
|
+
idempotent: false,
|
|
32
|
+
schema: {
|
|
33
|
+
args: z.object({
|
|
34
|
+
machine_id: z.string().describe('Machine ID'),
|
|
35
|
+
}),
|
|
36
|
+
options: z.object({
|
|
37
|
+
confirm: z.boolean().optional().default(false).describe('Skip confirmation prompt'),
|
|
38
|
+
}),
|
|
39
|
+
response: MachineDeleteResponseSchema,
|
|
40
|
+
},
|
|
41
|
+
async handler(ctx) {
|
|
42
|
+
const { args, opts, options, logger, auth, config, orgId } = ctx;
|
|
43
|
+
|
|
44
|
+
const catalystClient = await getGlobalCatalystAPIClient(logger, auth, config?.name, orgId);
|
|
45
|
+
|
|
46
|
+
try {
|
|
47
|
+
const machine = await machineGet(catalystClient, args.machine_id);
|
|
48
|
+
|
|
49
|
+
if (!opts.confirm) {
|
|
50
|
+
if (process.stdin.isTTY) {
|
|
51
|
+
tui.newline();
|
|
52
|
+
tui.warn(`You are about to delete machine ${tui.bold(machine.id)}`);
|
|
53
|
+
if (machine.orgName) {
|
|
54
|
+
tui.info(`Organization: ${machine.orgName}`);
|
|
55
|
+
}
|
|
56
|
+
tui.newline();
|
|
57
|
+
|
|
58
|
+
const response = await enquirer.prompt<{ confirm: boolean }>({
|
|
59
|
+
type: 'confirm',
|
|
60
|
+
name: 'confirm',
|
|
61
|
+
message: 'Are you sure you want to delete this machine?',
|
|
62
|
+
initial: false,
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
if (!response.confirm) {
|
|
66
|
+
tui.info('Deletion cancelled.');
|
|
67
|
+
return { success: false, machineId: args.machine_id };
|
|
68
|
+
}
|
|
69
|
+
} else {
|
|
70
|
+
tui.error('Non-interactive sessions require --confirm flag to delete a machine.');
|
|
71
|
+
return { success: false, machineId: args.machine_id };
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
await tui.spinner({
|
|
76
|
+
type: 'simple',
|
|
77
|
+
message: 'Deleting machine...',
|
|
78
|
+
callback: () => machineDelete(catalystClient, args.machine_id),
|
|
79
|
+
clearOnSuccess: true,
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
if (!options.json) {
|
|
83
|
+
tui.success(`Machine ${args.machine_id} deleted successfully.`);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return { success: true, machineId: args.machine_id };
|
|
87
|
+
} catch (ex) {
|
|
88
|
+
tui.fatal(`Failed to delete machine: ${ex}`, ErrorCode.API_ERROR);
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
});
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { createSubcommand } from '../../../types';
|
|
3
|
+
import * as tui from '../../../tui';
|
|
4
|
+
import { machineDeployments } from '@agentuity/server';
|
|
5
|
+
import { getCommand } from '../../../command-prefix';
|
|
6
|
+
import { ErrorCode } from '../../../errors';
|
|
7
|
+
import { getGlobalCatalystAPIClient } from '../../../config';
|
|
8
|
+
|
|
9
|
+
const MachineDeploymentResponseSchema = z.array(
|
|
10
|
+
z.object({
|
|
11
|
+
id: z.string().describe('Deployment ID'),
|
|
12
|
+
identifier: z.string().optional().describe('Deployment identifier'),
|
|
13
|
+
state: z.string().optional().describe('Deployment state'),
|
|
14
|
+
projectName: z.string().optional().describe('Project name'),
|
|
15
|
+
projectId: z.string().optional().describe('Project ID'),
|
|
16
|
+
paused: z.boolean().describe('Whether the deployment is paused'),
|
|
17
|
+
domainSuffix: z.string().describe('Domain suffix'),
|
|
18
|
+
url: z.string().describe('URL to the deployment'),
|
|
19
|
+
})
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
export const deploymentsSubcommand = createSubcommand({
|
|
23
|
+
name: 'deployments',
|
|
24
|
+
description: 'List deployments running on a specific organization managed machine',
|
|
25
|
+
tags: ['read-only', 'slow', 'requires-auth'],
|
|
26
|
+
examples: [
|
|
27
|
+
{
|
|
28
|
+
command: `${getCommand('cloud machine deployments')} machine_abc123xyz`,
|
|
29
|
+
description: 'List deployments on a machine',
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
aliases: ['deps', 'deployment'],
|
|
33
|
+
requires: { auth: true, org: true },
|
|
34
|
+
idempotent: true,
|
|
35
|
+
schema: {
|
|
36
|
+
args: z.object({
|
|
37
|
+
machine_id: z.string().describe('Machine ID'),
|
|
38
|
+
}),
|
|
39
|
+
response: MachineDeploymentResponseSchema,
|
|
40
|
+
},
|
|
41
|
+
async handler(ctx) {
|
|
42
|
+
const { args, options, logger, auth, config, orgId } = ctx;
|
|
43
|
+
|
|
44
|
+
const catalystClient = await getGlobalCatalystAPIClient(logger, auth, config?.name, orgId);
|
|
45
|
+
|
|
46
|
+
try {
|
|
47
|
+
const deployments = await machineDeployments(catalystClient, args.machine_id);
|
|
48
|
+
|
|
49
|
+
const result = deployments.map((d) => ({
|
|
50
|
+
id: d.id,
|
|
51
|
+
identifier: d.identifier,
|
|
52
|
+
state: d.state,
|
|
53
|
+
projectName: d.project?.name,
|
|
54
|
+
projectId: d.project?.id,
|
|
55
|
+
paused: d.paused,
|
|
56
|
+
domainSuffix: d.domainSuffix,
|
|
57
|
+
url:
|
|
58
|
+
d.customDomains?.length > 0
|
|
59
|
+
? d.customDomains.map((domain) => `https://${domain}`).join(',')
|
|
60
|
+
: d.identifier
|
|
61
|
+
? `https://d${d.identifier}.${d.domainSuffix}`
|
|
62
|
+
: d.project?.identifier
|
|
63
|
+
? `https://p${d.project?.identifier}.${d.domainSuffix}`
|
|
64
|
+
: '',
|
|
65
|
+
}));
|
|
66
|
+
|
|
67
|
+
if (!options.json) {
|
|
68
|
+
if (deployments.length === 0) {
|
|
69
|
+
tui.info('No deployments found on this machine.');
|
|
70
|
+
} else {
|
|
71
|
+
const tableData = result.map((d) => ({
|
|
72
|
+
ID: d.id,
|
|
73
|
+
State: d.state || 'unknown',
|
|
74
|
+
Project: d.projectName ? `${d.projectName} (${d.projectId})` : '-',
|
|
75
|
+
Paused: d.paused ? 'Yes' : 'No',
|
|
76
|
+
URL: d.url,
|
|
77
|
+
}));
|
|
78
|
+
|
|
79
|
+
tui.table(tableData, [
|
|
80
|
+
{ name: 'ID', alignment: 'left' },
|
|
81
|
+
{ name: 'State', alignment: 'left' },
|
|
82
|
+
{ name: 'Project', alignment: 'left' },
|
|
83
|
+
{ name: 'Paused', alignment: 'center' },
|
|
84
|
+
{ name: 'URL', alignment: 'left' },
|
|
85
|
+
]);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return result;
|
|
90
|
+
} catch (ex) {
|
|
91
|
+
tui.fatal(`Failed to get machine deployments: ${ex}`, ErrorCode.API_ERROR);
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
});
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { createSubcommand } from '../../../types';
|
|
3
|
+
import * as tui from '../../../tui';
|
|
4
|
+
import { machineGet } from '@agentuity/server';
|
|
5
|
+
import { getCommand } from '../../../command-prefix';
|
|
6
|
+
import { ErrorCode } from '../../../errors';
|
|
7
|
+
import { getGlobalCatalystAPIClient } from '../../../config';
|
|
8
|
+
|
|
9
|
+
const MachineGetResponseSchema = z.object({
|
|
10
|
+
id: z.string().describe('Machine ID'),
|
|
11
|
+
status: z.string().describe('Machine status'),
|
|
12
|
+
provider: z.string().describe('Cloud provider'),
|
|
13
|
+
region: z.string().describe('Region'),
|
|
14
|
+
instanceId: z.string().nullable().optional().describe('Cloud instance ID'),
|
|
15
|
+
privateIPv4: z.string().nullable().optional().describe('Private IPv4 of the machine'),
|
|
16
|
+
availabilityZone: z.string().nullable().optional().describe('Availability zone of the machine'),
|
|
17
|
+
deploymentCount: z.number().describe('The number of deployments'),
|
|
18
|
+
orgId: z.string().nullable().optional().describe('Organization ID'),
|
|
19
|
+
orgName: z.string().nullable().optional().describe('Organization name'),
|
|
20
|
+
createdAt: z.string().describe('Creation timestamp'),
|
|
21
|
+
updatedAt: z.string().nullable().optional().describe('Last update timestamp'),
|
|
22
|
+
startedAt: z.string().nullable().optional().describe('Start timestamp'),
|
|
23
|
+
stoppedAt: z.string().nullable().optional().describe('Stop timestamp'),
|
|
24
|
+
error: z.string().nullable().optional().describe('Error message if any'),
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export const getSubcommand = createSubcommand({
|
|
28
|
+
name: 'get',
|
|
29
|
+
description: 'Get details about a specific organization managed machine',
|
|
30
|
+
tags: ['read-only', 'fast', 'requires-auth'],
|
|
31
|
+
examples: [
|
|
32
|
+
{
|
|
33
|
+
command: `${getCommand('cloud machine get')} machine_abc123xyz`,
|
|
34
|
+
description: 'Get machine details by ID',
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
aliases: ['show'],
|
|
38
|
+
requires: { auth: true, org: true },
|
|
39
|
+
idempotent: true,
|
|
40
|
+
schema: {
|
|
41
|
+
args: z.object({
|
|
42
|
+
machine_id: z.string().describe('Machine ID'),
|
|
43
|
+
}),
|
|
44
|
+
response: MachineGetResponseSchema,
|
|
45
|
+
},
|
|
46
|
+
async handler(ctx) {
|
|
47
|
+
const { args, options, logger, auth, config, orgId } = ctx;
|
|
48
|
+
|
|
49
|
+
const catalystClient = await getGlobalCatalystAPIClient(logger, auth, config?.name, orgId);
|
|
50
|
+
|
|
51
|
+
try {
|
|
52
|
+
const machine = await machineGet(catalystClient, args.machine_id);
|
|
53
|
+
|
|
54
|
+
if (!options.json) {
|
|
55
|
+
const tableData: Record<string, string> = {
|
|
56
|
+
ID: machine.id,
|
|
57
|
+
Status: machine.status,
|
|
58
|
+
Provider: machine.provider,
|
|
59
|
+
Region: machine.region,
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
if (machine.instanceId) {
|
|
63
|
+
tableData['Instance ID'] = machine.instanceId;
|
|
64
|
+
}
|
|
65
|
+
if (machine.privateIPv4) {
|
|
66
|
+
tableData['Private IP'] = machine.privateIPv4;
|
|
67
|
+
}
|
|
68
|
+
if (machine.availabilityZone) {
|
|
69
|
+
tableData['Availability Zone'] = machine.availabilityZone;
|
|
70
|
+
}
|
|
71
|
+
tableData['Deployments'] = (machine.deploymentCount ?? 0).toString();
|
|
72
|
+
tableData['Created'] = new Date(machine.createdAt).toLocaleString();
|
|
73
|
+
if (machine.updatedAt) {
|
|
74
|
+
tableData['Updated'] = new Date(machine.updatedAt).toLocaleString();
|
|
75
|
+
}
|
|
76
|
+
if (machine.startedAt) {
|
|
77
|
+
tableData['Started'] = new Date(machine.startedAt).toLocaleString();
|
|
78
|
+
}
|
|
79
|
+
if (machine.stoppedAt) {
|
|
80
|
+
tableData['Stopped'] = new Date(machine.stoppedAt).toLocaleString();
|
|
81
|
+
}
|
|
82
|
+
if (machine.error) {
|
|
83
|
+
tableData['Error'] = machine.error;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
tui.table([tableData], Object.keys(tableData), { layout: 'vertical', padStart: ' ' });
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return {
|
|
90
|
+
id: machine.id,
|
|
91
|
+
status: machine.status,
|
|
92
|
+
provider: machine.provider,
|
|
93
|
+
region: machine.region,
|
|
94
|
+
instanceId: machine.instanceId ?? undefined,
|
|
95
|
+
orgId: machine.orgId ?? undefined,
|
|
96
|
+
orgName: machine.orgName ?? undefined,
|
|
97
|
+
createdAt: machine.createdAt,
|
|
98
|
+
updatedAt: machine.updatedAt ?? undefined,
|
|
99
|
+
startedAt: machine.startedAt ?? undefined,
|
|
100
|
+
stoppedAt: machine.stoppedAt ?? undefined,
|
|
101
|
+
error: machine.error ?? undefined,
|
|
102
|
+
deploymentCount: machine.deploymentCount ?? 0,
|
|
103
|
+
privateIPv4: machine.privateIPv4,
|
|
104
|
+
availabilityZone: machine.availabilityZone,
|
|
105
|
+
};
|
|
106
|
+
} catch (ex) {
|
|
107
|
+
tui.fatal(`Failed to get machine: ${ex}`, ErrorCode.API_ERROR);
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createCommand } from '../../../types';
|
|
2
|
+
import { listSubcommand } from './list';
|
|
3
|
+
import { getSubcommand } from './get';
|
|
4
|
+
import { deploymentsSubcommand } from './deployments';
|
|
5
|
+
import { deleteSubcommand } from './delete';
|
|
6
|
+
import { getCommand } from '../../../command-prefix';
|
|
7
|
+
|
|
8
|
+
export const machineCommand = createCommand({
|
|
9
|
+
name: 'machine',
|
|
10
|
+
description: 'Manage organization managed machines',
|
|
11
|
+
tags: ['read-only', 'fast', 'requires-auth'],
|
|
12
|
+
aliases: ['machines'],
|
|
13
|
+
examples: [
|
|
14
|
+
{ command: getCommand('cloud machine list'), description: 'List all machines' },
|
|
15
|
+
{ command: getCommand('cloud machine get <id>'), description: 'Get machine details' },
|
|
16
|
+
{
|
|
17
|
+
command: getCommand('cloud machine deployments <id>'),
|
|
18
|
+
description: 'List deployments on a machine',
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
subcommands: [listSubcommand, getSubcommand, deploymentsSubcommand, deleteSubcommand],
|
|
22
|
+
});
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { createSubcommand } from '../../../types';
|
|
3
|
+
import * as tui from '../../../tui';
|
|
4
|
+
import { machineList } from '@agentuity/server';
|
|
5
|
+
import { getCommand } from '../../../command-prefix';
|
|
6
|
+
import { ErrorCode } from '../../../errors';
|
|
7
|
+
import { getGlobalCatalystAPIClient } from '../../../config';
|
|
8
|
+
|
|
9
|
+
const MachineListResponseSchema = z.array(
|
|
10
|
+
z.object({
|
|
11
|
+
id: z.string().describe('Machine ID'),
|
|
12
|
+
status: z.string().describe('Machine status'),
|
|
13
|
+
provider: z.string().describe('Cloud provider'),
|
|
14
|
+
region: z.string().describe('Region'),
|
|
15
|
+
orgName: z.string().nullable().optional().describe('Organization name'),
|
|
16
|
+
createdAt: z.string().describe('Creation timestamp'),
|
|
17
|
+
})
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
export const listSubcommand = createSubcommand({
|
|
21
|
+
name: 'list',
|
|
22
|
+
description: 'List organization managed machines',
|
|
23
|
+
tags: ['read-only', 'slow', 'requires-auth'],
|
|
24
|
+
examples: [
|
|
25
|
+
{
|
|
26
|
+
command: getCommand('cloud machine list'),
|
|
27
|
+
description: 'List all machines',
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
aliases: ['ls'],
|
|
31
|
+
requires: { auth: true, org: true },
|
|
32
|
+
idempotent: true,
|
|
33
|
+
schema: {
|
|
34
|
+
response: MachineListResponseSchema,
|
|
35
|
+
},
|
|
36
|
+
async handler(ctx) {
|
|
37
|
+
const { options, logger, auth, config, orgId } = ctx;
|
|
38
|
+
|
|
39
|
+
const catalystClient = await getGlobalCatalystAPIClient(logger, auth, config?.name, orgId);
|
|
40
|
+
|
|
41
|
+
try {
|
|
42
|
+
const machines = await machineList(catalystClient);
|
|
43
|
+
|
|
44
|
+
const result = machines.map((m) => ({
|
|
45
|
+
id: m.id,
|
|
46
|
+
status: m.status,
|
|
47
|
+
provider: m.provider,
|
|
48
|
+
region: m.region,
|
|
49
|
+
orgName: m.orgName ?? undefined,
|
|
50
|
+
createdAt: m.createdAt,
|
|
51
|
+
}));
|
|
52
|
+
|
|
53
|
+
if (!options.json) {
|
|
54
|
+
if (machines.length === 0) {
|
|
55
|
+
tui.info('No machines found.');
|
|
56
|
+
} else {
|
|
57
|
+
const tableData = machines.map((m) => ({
|
|
58
|
+
ID: m.id,
|
|
59
|
+
Status: m.status,
|
|
60
|
+
Provider: m.provider,
|
|
61
|
+
Region: m.region,
|
|
62
|
+
Created: new Date(m.createdAt).toLocaleString(),
|
|
63
|
+
}));
|
|
64
|
+
|
|
65
|
+
tui.table(tableData, [
|
|
66
|
+
{ name: 'ID', alignment: 'left' },
|
|
67
|
+
{ name: 'Status', alignment: 'left' },
|
|
68
|
+
{ name: 'Provider', alignment: 'left' },
|
|
69
|
+
{ name: 'Region', alignment: 'left' },
|
|
70
|
+
{ name: 'Created', alignment: 'left' },
|
|
71
|
+
]);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return result;
|
|
76
|
+
} catch (ex) {
|
|
77
|
+
tui.fatal(`Failed to list machines: ${ex}`, ErrorCode.API_ERROR);
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
});
|
|
@@ -19,7 +19,7 @@ import { getCommand } from '../../../command-prefix';
|
|
|
19
19
|
export const command = createCommand({
|
|
20
20
|
name: 'queue',
|
|
21
21
|
aliases: ['queues'],
|
|
22
|
-
description: 'Manage message queues',
|
|
22
|
+
description: 'Manage managed message queues',
|
|
23
23
|
tags: ['requires-auth'],
|
|
24
24
|
examples: [
|
|
25
25
|
{
|
|
@@ -4,7 +4,7 @@ import { getCommand } from '../../../command-prefix';
|
|
|
4
4
|
|
|
5
5
|
export const redisCommand = createCommand({
|
|
6
6
|
name: 'redis',
|
|
7
|
-
description: 'Manage Redis resources',
|
|
7
|
+
description: 'Manage Redis managed resources',
|
|
8
8
|
tags: ['slow', 'requires-auth'],
|
|
9
9
|
examples: [
|
|
10
10
|
{ command: getCommand('cloud redis show'), description: 'Show Redis connection URL' },
|
|
@@ -12,6 +12,22 @@ const SandboxResourcesSchema = z.object({
|
|
|
12
12
|
disk: z.string().optional().describe('Disk limit (e.g., "1Gi", "10Gi")'),
|
|
13
13
|
});
|
|
14
14
|
|
|
15
|
+
const SandboxRuntimeInfoSchema = z.object({
|
|
16
|
+
id: z.string().describe('Runtime ID'),
|
|
17
|
+
name: z.string().describe('Runtime name'),
|
|
18
|
+
iconUrl: z.string().optional().describe('URL for runtime icon'),
|
|
19
|
+
brandColor: z.string().optional().describe('Brand color for the runtime'),
|
|
20
|
+
tags: z.array(z.string()).optional().describe('Runtime tags'),
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const SandboxSnapshotInfoSchema = z.object({
|
|
24
|
+
id: z.string().describe('Snapshot ID'),
|
|
25
|
+
name: z.string().optional().describe('Snapshot name'),
|
|
26
|
+
tag: z.string().optional().describe('Snapshot tag'),
|
|
27
|
+
fullName: z.string().optional().describe('Full name with org slug'),
|
|
28
|
+
public: z.boolean().describe('Whether snapshot is public'),
|
|
29
|
+
});
|
|
30
|
+
|
|
15
31
|
const SandboxGetResponseSchema = z.object({
|
|
16
32
|
sandboxId: z.string().describe('Sandbox ID'),
|
|
17
33
|
name: z.string().optional().describe('Sandbox name'),
|
|
@@ -19,10 +35,8 @@ const SandboxGetResponseSchema = z.object({
|
|
|
19
35
|
status: z.string().describe('Current status'),
|
|
20
36
|
createdAt: z.string().describe('Creation timestamp'),
|
|
21
37
|
region: z.string().optional().describe('Region where sandbox is running'),
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
snapshotId: z.string().optional().describe('Snapshot ID sandbox was created from'),
|
|
25
|
-
snapshotTag: z.string().optional().describe('Snapshot tag sandbox was created from'),
|
|
38
|
+
runtime: SandboxRuntimeInfoSchema.optional().describe('Runtime information'),
|
|
39
|
+
snapshot: SandboxSnapshotInfoSchema.optional().describe('Snapshot information'),
|
|
26
40
|
executions: z.number().describe('Number of executions'),
|
|
27
41
|
stdoutStreamUrl: z.string().optional().describe('URL to stdout output stream'),
|
|
28
42
|
stderrStreamUrl: z.string().optional().describe('URL to stderr output stream'),
|
|
@@ -73,15 +87,6 @@ export const getSubcommand = createCommand({
|
|
|
73
87
|
? tui.colorError
|
|
74
88
|
: tui.colorMuted;
|
|
75
89
|
|
|
76
|
-
const snapshotDisplay =
|
|
77
|
-
result.snapshotId || result.snapshotTag
|
|
78
|
-
? result.snapshotTag
|
|
79
|
-
? result.snapshotId
|
|
80
|
-
? `${result.snapshotTag} ${tui.muted('(' + result.snapshotId + ')')}`
|
|
81
|
-
: result.snapshotTag
|
|
82
|
-
: result.snapshotId
|
|
83
|
-
: undefined;
|
|
84
|
-
|
|
85
90
|
let streamDisplay: string | undefined;
|
|
86
91
|
if (
|
|
87
92
|
result.stdoutStreamUrl &&
|
|
@@ -106,9 +111,15 @@ export const getSubcommand = createCommand({
|
|
|
106
111
|
if (result.description) tableData['Description'] = result.description;
|
|
107
112
|
tableData['Status'] = statusColor(result.status);
|
|
108
113
|
tableData['Created'] = result.createdAt;
|
|
109
|
-
if (result.
|
|
114
|
+
if (result.runtime?.name) tableData['Runtime'] = result.runtime.name;
|
|
110
115
|
if (result.region) tableData['Region'] = result.region;
|
|
111
|
-
if (
|
|
116
|
+
if (result.snapshot?.id) {
|
|
117
|
+
const snapshotDisplay =
|
|
118
|
+
result.snapshot.public && result.snapshot.fullName
|
|
119
|
+
? result.snapshot.fullName
|
|
120
|
+
: result.snapshot.tag || result.snapshot.id;
|
|
121
|
+
tableData['Snapshot'] = snapshotDisplay;
|
|
122
|
+
}
|
|
112
123
|
tableData['Executions'] = result.executions;
|
|
113
124
|
if (streamDisplay) {
|
|
114
125
|
tableData['Stream'] = streamDisplay;
|
|
@@ -141,10 +152,8 @@ export const getSubcommand = createCommand({
|
|
|
141
152
|
status: result.status,
|
|
142
153
|
createdAt: result.createdAt,
|
|
143
154
|
region: result.region,
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
snapshotId: result.snapshotId,
|
|
147
|
-
snapshotTag: result.snapshotTag,
|
|
155
|
+
runtime: result.runtime,
|
|
156
|
+
snapshot: result.snapshot,
|
|
148
157
|
executions: result.executions,
|
|
149
158
|
stdoutStreamUrl: result.stdoutStreamUrl,
|
|
150
159
|
stderrStreamUrl: result.stderrStreamUrl,
|
|
@@ -21,7 +21,7 @@ import { getCommand } from '../../../command-prefix';
|
|
|
21
21
|
export const command = createCommand({
|
|
22
22
|
name: 'sandbox',
|
|
23
23
|
aliases: ['sb'],
|
|
24
|
-
description: 'Manage sandboxes for isolated code execution',
|
|
24
|
+
description: 'Manage sandboxes for managed isolated code execution',
|
|
25
25
|
tags: ['slow', 'requires-auth'],
|
|
26
26
|
examples: [
|
|
27
27
|
{
|