@agentuity/cli 0.1.20 → 0.1.22
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 +6 -6
- package/dist/cmd/cloud/keyvalue/util.d.ts.map +1 -1
- package/dist/cmd/cloud/keyvalue/util.js +10 -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/index.js +1 -1
- package/dist/cmd/cloud/sandbox/index.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 -7
- package/dist/cmd/cloud/vector/util.d.ts.map +1 -1
- package/dist/cmd/cloud/vector/util.js +9 -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 +19 -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/index.ts +1 -1
- 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 +18 -11
- package/src/cmd/setup/index.ts +7 -2
- package/src/config.ts +19 -4
- package/src/env-util.ts +1 -1
|
@@ -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' },
|
|
@@ -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
|
{
|
|
@@ -10,7 +10,7 @@ import { getCommand } from '../../../command-prefix';
|
|
|
10
10
|
export const storageCommand = createCommand({
|
|
11
11
|
name: 'storage',
|
|
12
12
|
aliases: ['s3'],
|
|
13
|
-
description: 'Manage storage resources',
|
|
13
|
+
description: 'Manage S3 compatible managed storage resources',
|
|
14
14
|
tags: ['slow', 'requires-auth', 'requires-deployment'],
|
|
15
15
|
examples: [
|
|
16
16
|
{ command: getCommand('cloud storage list'), description: 'List all storage resources' },
|
|
@@ -7,7 +7,7 @@ import { getCommand } from '../../../command-prefix';
|
|
|
7
7
|
export const streamCommand = createCommand({
|
|
8
8
|
name: 'stream',
|
|
9
9
|
aliases: ['streams'],
|
|
10
|
-
description: 'Manage streams',
|
|
10
|
+
description: 'Manage durable streams',
|
|
11
11
|
tags: ['slow', 'requires-auth'],
|
|
12
12
|
examples: [
|
|
13
13
|
{ command: getCommand('cloud stream list'), description: 'List all streams' },
|
|
@@ -11,7 +11,8 @@ export const deleteNamespaceSubcommand = createCommand({
|
|
|
11
11
|
description: 'Delete a vector namespace and all its vectors',
|
|
12
12
|
tags: ['destructive', 'deletes-resource', 'slow', 'requires-auth'],
|
|
13
13
|
idempotent: true,
|
|
14
|
-
requires: { auth: true,
|
|
14
|
+
requires: { auth: true, region: true },
|
|
15
|
+
optional: { project: true },
|
|
15
16
|
examples: [
|
|
16
17
|
{
|
|
17
18
|
command: getCommand('vector delete-namespace staging'),
|
|
@@ -18,7 +18,8 @@ export const deleteSubcommand = createCommand({
|
|
|
18
18
|
aliases: ['del', 'rm'],
|
|
19
19
|
description: 'Delete one or more vectors by key',
|
|
20
20
|
tags: ['destructive', 'deletes-resource', 'slow', 'requires-auth'],
|
|
21
|
-
requires: { auth: true,
|
|
21
|
+
requires: { auth: true, region: true },
|
|
22
|
+
optional: { project: true },
|
|
22
23
|
idempotent: true,
|
|
23
24
|
examples: [
|
|
24
25
|
{
|
|
@@ -16,7 +16,8 @@ export const getSubcommand = createCommand({
|
|
|
16
16
|
name: 'get',
|
|
17
17
|
description: 'Get a specific vector entry by key',
|
|
18
18
|
tags: ['read-only', 'fast', 'requires-auth'],
|
|
19
|
-
requires: { auth: true,
|
|
19
|
+
requires: { auth: true, region: true },
|
|
20
|
+
optional: { project: true },
|
|
20
21
|
idempotent: true,
|
|
21
22
|
examples: [
|
|
22
23
|
{
|
|
@@ -11,7 +11,8 @@ export const listNamespacesSubcommand = createCommand({
|
|
|
11
11
|
aliases: ['namespaces', 'ns'],
|
|
12
12
|
description: 'List all vector namespaces',
|
|
13
13
|
tags: ['read-only', 'fast', 'requires-auth'],
|
|
14
|
-
requires: { auth: true,
|
|
14
|
+
requires: { auth: true, region: true },
|
|
15
|
+
optional: { project: true },
|
|
15
16
|
examples: [
|
|
16
17
|
{ command: getCommand('vector list-namespaces'), description: 'List all namespaces' },
|
|
17
18
|
{ command: getCommand('vector namespaces'), description: 'List namespaces (using alias)' },
|
|
@@ -22,7 +22,8 @@ export const searchSubcommand = createCommand({
|
|
|
22
22
|
aliases: ['list', 'ls'],
|
|
23
23
|
description: 'Search for vectors using semantic similarity',
|
|
24
24
|
tags: ['read-only', 'slow', 'requires-auth'],
|
|
25
|
-
requires: { auth: true,
|
|
25
|
+
requires: { auth: true, region: true },
|
|
26
|
+
optional: { project: true },
|
|
26
27
|
idempotent: true,
|
|
27
28
|
examples: [
|
|
28
29
|
{
|
|
@@ -42,7 +42,8 @@ export const statsSubcommand = createCommand({
|
|
|
42
42
|
name: 'stats',
|
|
43
43
|
description: 'Get statistics for vector storage',
|
|
44
44
|
tags: ['read-only', 'fast', 'requires-auth'],
|
|
45
|
-
requires: { auth: true,
|
|
45
|
+
requires: { auth: true, region: true },
|
|
46
|
+
optional: { project: true },
|
|
46
47
|
idempotent: true,
|
|
47
48
|
examples: [
|
|
48
49
|
{ command: getCommand('vector stats'), description: 'Show stats for all namespaces' },
|
|
@@ -26,7 +26,8 @@ export const upsertSubcommand = createCommand({
|
|
|
26
26
|
description: 'Add or update vectors in the vector storage',
|
|
27
27
|
tags: ['mutating', 'updates-resource', 'slow', 'requires-auth'],
|
|
28
28
|
idempotent: true,
|
|
29
|
-
requires: { auth: true,
|
|
29
|
+
requires: { auth: true, region: true },
|
|
30
|
+
optional: { project: true },
|
|
30
31
|
examples: [
|
|
31
32
|
{
|
|
32
33
|
command: getCommand('vector upsert products doc1 --document "Comfortable office chair"'),
|
|
@@ -1,30 +1,37 @@
|
|
|
1
|
-
import { Logger, VectorStorageService } from '@agentuity/core';
|
|
1
|
+
import { type Logger, VectorStorageService } from '@agentuity/core';
|
|
2
2
|
import { createServerFetchAdapter, getServiceUrls } from '@agentuity/server';
|
|
3
|
-
import {
|
|
4
|
-
import type { Config } from '../../../types';
|
|
3
|
+
import type { AuthData, Config, GlobalOptions, ProjectConfig } from '../../../types';
|
|
5
4
|
import * as tui from '../../../tui';
|
|
6
5
|
|
|
7
|
-
export
|
|
6
|
+
export function createStorageAdapter(ctx: {
|
|
8
7
|
logger: Logger;
|
|
9
|
-
|
|
8
|
+
auth: AuthData;
|
|
9
|
+
region: string;
|
|
10
|
+
project?: ProjectConfig;
|
|
10
11
|
config: Config | null;
|
|
11
|
-
|
|
12
|
+
options: GlobalOptions;
|
|
12
13
|
}) {
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
const orgId =
|
|
15
|
+
ctx.project?.orgId ??
|
|
16
|
+
ctx.options.orgId ??
|
|
17
|
+
(process.env.AGENTUITY_CLOUD_ORG_ID || ctx.config?.preferences?.orgId);
|
|
18
|
+
if (!orgId) {
|
|
19
|
+
tui.fatal(
|
|
20
|
+
'Organization ID is required. Either run from a project directory or use --org-id flag.'
|
|
21
|
+
);
|
|
16
22
|
}
|
|
17
23
|
|
|
18
24
|
const adapter = createServerFetchAdapter(
|
|
19
25
|
{
|
|
20
26
|
headers: {
|
|
21
|
-
Authorization: `Bearer ${
|
|
27
|
+
Authorization: `Bearer ${ctx.auth.apiKey}`,
|
|
28
|
+
'x-agentuity-orgid': orgId,
|
|
22
29
|
},
|
|
23
30
|
},
|
|
24
31
|
ctx.logger
|
|
25
32
|
);
|
|
26
33
|
|
|
27
|
-
const urls = getServiceUrls(ctx.
|
|
34
|
+
const urls = getServiceUrls(ctx.region);
|
|
28
35
|
const baseUrl = urls.catalyst;
|
|
29
36
|
return new VectorStorageService(baseUrl, adapter);
|
|
30
37
|
}
|
package/src/cmd/setup/index.ts
CHANGED
|
@@ -37,9 +37,14 @@ export const command = createCommand({
|
|
|
37
37
|
message: 'Validating your identity',
|
|
38
38
|
clearOnSuccess: true,
|
|
39
39
|
callback: async () => {
|
|
40
|
-
|
|
40
|
+
// For compiled binaries, process.argv contains virtual paths (/$bunfs/root/...)
|
|
41
|
+
// Use process.execPath which has the actual binary path
|
|
42
|
+
const isCompiledBinary = process.argv[1]?.startsWith('/$bunfs/');
|
|
43
|
+
const cmd = isCompiledBinary
|
|
44
|
+
? [process.execPath, ...process.argv.slice(2).map((x) => (x === 'setup' ? 'login' : x))]
|
|
45
|
+
: process.argv.map((x) => (x === 'setup' ? 'login' : x));
|
|
41
46
|
const r = Bun.spawn({
|
|
42
|
-
cmd:
|
|
47
|
+
cmd: cmd.concat('--json'),
|
|
43
48
|
stdout: 'pipe',
|
|
44
49
|
stderr: 'inherit',
|
|
45
50
|
});
|
package/src/config.ts
CHANGED
|
@@ -733,10 +733,19 @@ export async function loadProjectSDKKey(
|
|
|
733
733
|
logger.trace(`[SDK_KEY] AGENTUITY_SDK_KEY not found in any file`);
|
|
734
734
|
}
|
|
735
735
|
|
|
736
|
-
export function getCatalystAPIClient(
|
|
736
|
+
export function getCatalystAPIClient(
|
|
737
|
+
logger: Logger,
|
|
738
|
+
auth: AuthData,
|
|
739
|
+
region: string,
|
|
740
|
+
orgId?: string
|
|
741
|
+
) {
|
|
737
742
|
const serviceUrls = getServiceUrls(region);
|
|
738
743
|
const catalystUrl = serviceUrls.catalyst;
|
|
739
|
-
|
|
744
|
+
const headers: Record<string, string> = {};
|
|
745
|
+
if (orgId) {
|
|
746
|
+
headers['x-agentuity-orgid'] = orgId;
|
|
747
|
+
}
|
|
748
|
+
return new ServerAPIClient(catalystUrl, logger, auth.apiKey, { headers });
|
|
740
749
|
}
|
|
741
750
|
|
|
742
751
|
interface RegionsCacheData {
|
|
@@ -795,14 +804,20 @@ export async function getDefaultRegion(
|
|
|
795
804
|
/**
|
|
796
805
|
* Get a Catalyst API client for global database operations.
|
|
797
806
|
* Uses the default region since the admin DB is global.
|
|
807
|
+
*
|
|
808
|
+
* @param logger - Logger instance
|
|
809
|
+
* @param auth - Authentication data
|
|
810
|
+
* @param profileName - Profile name (default: 'production')
|
|
811
|
+
* @param orgId - Optional organization ID for CLI key authentication
|
|
798
812
|
*/
|
|
799
813
|
export async function getGlobalCatalystAPIClient(
|
|
800
814
|
logger: Logger,
|
|
801
815
|
auth: AuthData,
|
|
802
|
-
profileName = 'production'
|
|
816
|
+
profileName = 'production',
|
|
817
|
+
orgId?: string
|
|
803
818
|
) {
|
|
804
819
|
const region = await getDefaultRegion(profileName);
|
|
805
|
-
return getCatalystAPIClient(logger, auth, region);
|
|
820
|
+
return getCatalystAPIClient(logger, auth, region, orgId);
|
|
806
821
|
}
|
|
807
822
|
|
|
808
823
|
export function getIONHost(config: Config | null, region: string) {
|
package/src/env-util.ts
CHANGED
|
@@ -17,7 +17,7 @@ export const PUBLIC_VAR_PREFIXES = ['VITE_', 'AGENTUITY_PUBLIC_', 'PUBLIC_'] as
|
|
|
17
17
|
* Specific AGENTUITY_ keys that are allowed to be set by users.
|
|
18
18
|
* Note: There is also a whitelist in the API that must be kept in sync.
|
|
19
19
|
*/
|
|
20
|
-
export const AGENTUITY_ALLOWED_KEYS = ['AGENTUITY_AUTH_SECRET'] as const;
|
|
20
|
+
export const AGENTUITY_ALLOWED_KEYS = ['AGENTUITY_AUTH_SECRET', 'AGENTUITY_CLOUD_BASE_URL'] as const;
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* Check if a key is a public variable (exposed to frontend)
|