@agentuity/cli 0.1.9 → 0.1.11
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/README.md +2 -2
- package/bin/cli.ts +8 -0
- package/dist/cache/index.d.ts +2 -0
- package/dist/cache/index.d.ts.map +1 -0
- package/dist/cache/index.js +2 -0
- package/dist/cache/index.js.map +1 -0
- package/dist/cache/resource-region.d.ts +46 -0
- package/dist/cache/resource-region.d.ts.map +1 -0
- package/dist/cache/resource-region.js +115 -0
- package/dist/cache/resource-region.js.map +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +44 -32
- package/dist/cli.js.map +1 -1
- package/dist/cmd/ai/capabilities/show.d.ts.map +1 -1
- package/dist/cmd/ai/capabilities/show.js +12 -15
- package/dist/cmd/ai/capabilities/show.js.map +1 -1
- package/dist/cmd/ai/prompt/llm.js +5 -5
- package/dist/cmd/ai/prompt/llm.js.map +1 -1
- package/dist/cmd/auth/logout.d.ts.map +1 -1
- package/dist/cmd/auth/logout.js +5 -2
- package/dist/cmd/auth/logout.js.map +1 -1
- package/dist/cmd/build/ast.d.ts.map +1 -1
- package/dist/cmd/build/ast.js +87 -1
- package/dist/cmd/build/ast.js.map +1 -1
- package/dist/cmd/build/vite/vite-asset-server-config.d.ts.map +1 -1
- package/dist/cmd/build/vite/vite-asset-server-config.js +8 -3
- package/dist/cmd/build/vite/vite-asset-server-config.js.map +1 -1
- package/dist/cmd/build/vite/vite-asset-server.d.ts.map +1 -1
- package/dist/cmd/build/vite/vite-asset-server.js +5 -3
- package/dist/cmd/build/vite/vite-asset-server.js.map +1 -1
- package/dist/cmd/cloud/db/delete.d.ts.map +1 -1
- package/dist/cmd/cloud/db/delete.js +69 -11
- package/dist/cmd/cloud/db/delete.js.map +1 -1
- package/dist/cmd/cloud/db/get.d.ts.map +1 -1
- package/dist/cmd/cloud/db/get.js +23 -7
- package/dist/cmd/cloud/db/get.js.map +1 -1
- package/dist/cmd/cloud/db/list.d.ts.map +1 -1
- package/dist/cmd/cloud/db/list.js +15 -7
- package/dist/cmd/cloud/db/list.js.map +1 -1
- package/dist/cmd/cloud/db/logs.d.ts.map +1 -1
- package/dist/cmd/cloud/db/logs.js +24 -4
- package/dist/cmd/cloud/db/logs.js.map +1 -1
- package/dist/cmd/cloud/deploy.d.ts.map +1 -1
- package/dist/cmd/cloud/deploy.js +38 -0
- package/dist/cmd/cloud/deploy.js.map +1 -1
- package/dist/cmd/cloud/env/delete.d.ts.map +1 -1
- package/dist/cmd/cloud/env/delete.js +30 -13
- package/dist/cmd/cloud/env/delete.js.map +1 -1
- package/dist/cmd/cloud/env/get.d.ts.map +1 -1
- package/dist/cmd/cloud/env/get.js +27 -30
- package/dist/cmd/cloud/env/get.js.map +1 -1
- package/dist/cmd/cloud/env/import.d.ts.map +1 -1
- package/dist/cmd/cloud/env/import.js +41 -48
- package/dist/cmd/cloud/env/import.js.map +1 -1
- package/dist/cmd/cloud/env/index.d.ts.map +1 -1
- package/dist/cmd/cloud/env/index.js +6 -2
- package/dist/cmd/cloud/env/index.js.map +1 -1
- package/dist/cmd/cloud/env/list.d.ts.map +1 -1
- package/dist/cmd/cloud/env/list.js +51 -28
- package/dist/cmd/cloud/env/list.js.map +1 -1
- package/dist/cmd/cloud/env/pull.d.ts.map +1 -1
- package/dist/cmd/cloud/env/pull.js +3 -3
- package/dist/cmd/cloud/env/pull.js.map +1 -1
- package/dist/cmd/cloud/env/push.d.ts.map +1 -1
- package/dist/cmd/cloud/env/push.js +31 -11
- package/dist/cmd/cloud/env/push.js.map +1 -1
- package/dist/cmd/cloud/env/set.d.ts.map +1 -1
- package/dist/cmd/cloud/env/set.js +41 -26
- package/dist/cmd/cloud/env/set.js.map +1 -1
- package/dist/cmd/cloud/index.d.ts.map +1 -1
- package/dist/cmd/cloud/index.js +0 -2
- package/dist/cmd/cloud/index.js.map +1 -1
- package/dist/cmd/cloud/region-lookup.d.ts +18 -0
- package/dist/cmd/cloud/region-lookup.d.ts.map +1 -0
- package/dist/cmd/cloud/region-lookup.js +64 -0
- package/dist/cmd/cloud/region-lookup.js.map +1 -0
- package/dist/cmd/cloud/sandbox/cp.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/cp.js +5 -3
- package/dist/cmd/cloud/sandbox/cp.js.map +1 -1
- package/dist/cmd/cloud/sandbox/create.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/create.js +43 -6
- package/dist/cmd/cloud/sandbox/create.js.map +1 -1
- package/dist/cmd/cloud/sandbox/delete.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/delete.js +5 -3
- package/dist/cmd/cloud/sandbox/delete.js.map +1 -1
- package/dist/cmd/cloud/sandbox/download.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/download.js +4 -3
- package/dist/cmd/cloud/sandbox/download.js.map +1 -1
- package/dist/cmd/cloud/sandbox/env.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/env.js +4 -3
- package/dist/cmd/cloud/sandbox/env.js.map +1 -1
- package/dist/cmd/cloud/sandbox/exec.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/exec.js +4 -3
- package/dist/cmd/cloud/sandbox/exec.js.map +1 -1
- package/dist/cmd/cloud/sandbox/execution/get.js +4 -4
- package/dist/cmd/cloud/sandbox/execution/get.js.map +1 -1
- package/dist/cmd/cloud/sandbox/execution/index.js +1 -1
- package/dist/cmd/cloud/sandbox/execution/index.js.map +1 -1
- package/dist/cmd/cloud/sandbox/execution/list.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/execution/list.js +4 -3
- package/dist/cmd/cloud/sandbox/execution/list.js.map +1 -1
- package/dist/cmd/cloud/sandbox/get.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/get.js +9 -4
- 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.js +4 -4
- package/dist/cmd/cloud/sandbox/list.js.map +1 -1
- package/dist/cmd/cloud/sandbox/ls.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/ls.js +4 -3
- package/dist/cmd/cloud/sandbox/ls.js.map +1 -1
- package/dist/cmd/cloud/sandbox/mkdir.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/mkdir.js +4 -3
- package/dist/cmd/cloud/sandbox/mkdir.js.map +1 -1
- package/dist/cmd/cloud/sandbox/rm.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/rm.js +4 -3
- package/dist/cmd/cloud/sandbox/rm.js.map +1 -1
- package/dist/cmd/cloud/sandbox/rmdir.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/rmdir.js +4 -3
- package/dist/cmd/cloud/sandbox/rmdir.js.map +1 -1
- package/dist/cmd/cloud/sandbox/run.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/run.js +44 -6
- package/dist/cmd/cloud/sandbox/run.js.map +1 -1
- package/dist/cmd/cloud/sandbox/runtime/index.js +1 -1
- package/dist/cmd/cloud/sandbox/runtime/index.js.map +1 -1
- package/dist/cmd/cloud/sandbox/runtime/list.js +4 -4
- package/dist/cmd/cloud/sandbox/runtime/list.js.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/build.d.ts +5 -0
- package/dist/cmd/cloud/sandbox/snapshot/build.d.ts.map +1 -0
- package/dist/cmd/cloud/sandbox/snapshot/build.js +574 -0
- package/dist/cmd/cloud/sandbox/snapshot/build.js.map +1 -0
- package/dist/cmd/cloud/sandbox/snapshot/create.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/create.js +5 -3
- package/dist/cmd/cloud/sandbox/snapshot/create.js.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/delete.js +4 -4
- package/dist/cmd/cloud/sandbox/snapshot/delete.js.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/generate.d.ts +3 -0
- package/dist/cmd/cloud/sandbox/snapshot/generate.d.ts.map +1 -0
- package/dist/cmd/cloud/sandbox/snapshot/generate.js +127 -0
- package/dist/cmd/cloud/sandbox/snapshot/generate.js.map +1 -0
- package/dist/cmd/cloud/sandbox/snapshot/get.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/get.js +20 -4
- package/dist/cmd/cloud/sandbox/snapshot/get.js.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/index.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/index.js +20 -2
- package/dist/cmd/cloud/sandbox/snapshot/index.js.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/list.js +4 -4
- package/dist/cmd/cloud/sandbox/snapshot/list.js.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/tag.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/tag.js +4 -4
- package/dist/cmd/cloud/sandbox/snapshot/tag.js.map +1 -1
- package/dist/cmd/cloud/sandbox/upload.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/upload.js +4 -3
- package/dist/cmd/cloud/sandbox/upload.js.map +1 -1
- package/dist/cmd/cloud/sandbox/util.d.ts +13 -0
- package/dist/cmd/cloud/sandbox/util.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/util.js +40 -1
- package/dist/cmd/cloud/sandbox/util.js.map +1 -1
- package/dist/cmd/cloud/scp/download.d.ts.map +1 -1
- package/dist/cmd/cloud/scp/download.js +6 -2
- package/dist/cmd/cloud/scp/download.js.map +1 -1
- package/dist/cmd/cloud/scp/upload.d.ts.map +1 -1
- package/dist/cmd/cloud/scp/upload.js +6 -2
- package/dist/cmd/cloud/scp/upload.js.map +1 -1
- package/dist/cmd/cloud/session/get.js +4 -4
- package/dist/cmd/cloud/session/get.js.map +1 -1
- package/dist/cmd/cloud/session/list.js +4 -4
- package/dist/cmd/cloud/session/list.js.map +1 -1
- package/dist/cmd/cloud/ssh.d.ts.map +1 -1
- package/dist/cmd/cloud/ssh.js +7 -2
- package/dist/cmd/cloud/ssh.js.map +1 -1
- package/dist/cmd/cloud/storage/delete.d.ts.map +1 -1
- package/dist/cmd/cloud/storage/delete.js +46 -10
- package/dist/cmd/cloud/storage/delete.js.map +1 -1
- package/dist/cmd/cloud/storage/download.d.ts.map +1 -1
- package/dist/cmd/cloud/storage/download.js +19 -6
- package/dist/cmd/cloud/storage/download.js.map +1 -1
- package/dist/cmd/cloud/storage/get.d.ts.map +1 -1
- package/dist/cmd/cloud/storage/get.js +19 -6
- package/dist/cmd/cloud/storage/get.js.map +1 -1
- package/dist/cmd/cloud/storage/list.d.ts.map +1 -1
- package/dist/cmd/cloud/storage/list.js +17 -7
- package/dist/cmd/cloud/storage/list.js.map +1 -1
- package/dist/cmd/cloud/storage/upload.d.ts.map +1 -1
- package/dist/cmd/cloud/storage/upload.js +19 -6
- package/dist/cmd/cloud/storage/upload.js.map +1 -1
- package/dist/cmd/cloud/thread/delete.js +4 -4
- package/dist/cmd/cloud/thread/delete.js.map +1 -1
- package/dist/cmd/cloud/thread/get.js +4 -4
- package/dist/cmd/cloud/thread/get.js.map +1 -1
- package/dist/cmd/cloud/thread/list.js +4 -4
- package/dist/cmd/cloud/thread/list.js.map +1 -1
- package/dist/cmd/project/auth/init.d.ts.map +1 -1
- package/dist/cmd/project/auth/init.js +6 -3
- package/dist/cmd/project/auth/init.js.map +1 -1
- package/dist/cmd/project/auth/shared.d.ts +6 -2
- package/dist/cmd/project/auth/shared.d.ts.map +1 -1
- package/dist/cmd/project/auth/shared.js +41 -13
- package/dist/cmd/project/auth/shared.js.map +1 -1
- package/dist/config.d.ts +37 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +55 -8
- package/dist/config.js.map +1 -1
- package/dist/env-util.d.ts +25 -2
- package/dist/env-util.d.ts.map +1 -1
- package/dist/env-util.js +44 -4
- package/dist/env-util.js.map +1 -1
- package/dist/utils/apt-validator.d.ts +20 -0
- package/dist/utils/apt-validator.d.ts.map +1 -0
- package/dist/utils/apt-validator.js +157 -0
- package/dist/utils/apt-validator.js.map +1 -0
- package/package.json +6 -6
- package/src/cache/index.ts +11 -0
- package/src/cache/resource-region.ts +183 -0
- package/src/cli.ts +47 -38
- package/src/cmd/ai/capabilities/show.ts +12 -15
- package/src/cmd/ai/prompt/llm.ts +5 -5
- package/src/cmd/auth/logout.ts +5 -2
- package/src/cmd/build/ast.ts +160 -1
- package/src/cmd/build/vite/vite-asset-server-config.ts +7 -3
- package/src/cmd/build/vite/vite-asset-server.ts +6 -3
- package/src/cmd/cloud/db/delete.ts +83 -11
- package/src/cmd/cloud/db/get.ts +29 -7
- package/src/cmd/cloud/db/list.ts +16 -7
- package/src/cmd/cloud/db/logs.ts +33 -4
- package/src/cmd/cloud/deploy.ts +49 -0
- package/src/cmd/cloud/env/delete.ts +36 -12
- package/src/cmd/cloud/env/get.ts +28 -27
- package/src/cmd/cloud/env/import.ts +43 -56
- package/src/cmd/cloud/env/index.ts +6 -2
- package/src/cmd/cloud/env/list.ts +57 -30
- package/src/cmd/cloud/env/pull.ts +9 -3
- package/src/cmd/cloud/env/push.ts +44 -11
- package/src/cmd/cloud/env/set.ts +49 -30
- package/src/cmd/cloud/index.ts +0 -2
- package/src/cmd/cloud/region-lookup.ts +89 -0
- package/src/cmd/cloud/sandbox/cp.ts +5 -3
- package/src/cmd/cloud/sandbox/create.ts +50 -6
- package/src/cmd/cloud/sandbox/delete.ts +6 -3
- package/src/cmd/cloud/sandbox/download.ts +4 -3
- package/src/cmd/cloud/sandbox/env.ts +4 -3
- package/src/cmd/cloud/sandbox/exec.ts +4 -3
- package/src/cmd/cloud/sandbox/execution/get.ts +4 -4
- package/src/cmd/cloud/sandbox/execution/index.ts +1 -1
- package/src/cmd/cloud/sandbox/execution/list.ts +4 -3
- package/src/cmd/cloud/sandbox/get.ts +10 -4
- package/src/cmd/cloud/sandbox/index.ts +1 -1
- package/src/cmd/cloud/sandbox/list.ts +4 -4
- package/src/cmd/cloud/sandbox/ls.ts +4 -3
- package/src/cmd/cloud/sandbox/mkdir.ts +4 -3
- package/src/cmd/cloud/sandbox/rm.ts +4 -3
- package/src/cmd/cloud/sandbox/rmdir.ts +4 -3
- package/src/cmd/cloud/sandbox/run.ts +51 -6
- package/src/cmd/cloud/sandbox/runtime/index.ts +1 -1
- package/src/cmd/cloud/sandbox/runtime/list.ts +4 -4
- package/src/cmd/cloud/sandbox/snapshot/build.ts +696 -0
- package/src/cmd/cloud/sandbox/snapshot/create.ts +11 -5
- package/src/cmd/cloud/sandbox/snapshot/delete.ts +4 -4
- package/src/cmd/cloud/sandbox/snapshot/generate.ts +134 -0
- package/src/cmd/cloud/sandbox/snapshot/get.ts +23 -4
- package/src/cmd/cloud/sandbox/snapshot/index.ts +20 -2
- package/src/cmd/cloud/sandbox/snapshot/list.ts +4 -4
- package/src/cmd/cloud/sandbox/snapshot/tag.ts +7 -5
- package/src/cmd/cloud/sandbox/upload.ts +4 -3
- package/src/cmd/cloud/sandbox/util.ts +60 -1
- package/src/cmd/cloud/scp/download.ts +14 -2
- package/src/cmd/cloud/scp/upload.ts +14 -2
- package/src/cmd/cloud/session/get.ts +4 -4
- package/src/cmd/cloud/session/list.ts +4 -4
- package/src/cmd/cloud/ssh.ts +15 -2
- package/src/cmd/cloud/storage/delete.ts +61 -10
- package/src/cmd/cloud/storage/download.ts +31 -6
- package/src/cmd/cloud/storage/get.ts +31 -6
- package/src/cmd/cloud/storage/list.ts +18 -7
- package/src/cmd/cloud/storage/upload.ts +31 -6
- package/src/cmd/cloud/thread/delete.ts +4 -4
- package/src/cmd/cloud/thread/get.ts +4 -4
- package/src/cmd/cloud/thread/list.ts +4 -4
- package/src/cmd/project/auth/init.ts +7 -3
- package/src/cmd/project/auth/shared.ts +53 -14
- package/src/config.ts +69 -8
- package/src/env-util.ts +50 -5
- package/src/utils/apt-validator.ts +215 -0
- package/dist/cmd/cloud/secret/delete.d.ts +0 -2
- package/dist/cmd/cloud/secret/delete.d.ts.map +0 -1
- package/dist/cmd/cloud/secret/delete.js +0 -53
- package/dist/cmd/cloud/secret/delete.js.map +0 -1
- package/dist/cmd/cloud/secret/get.d.ts +0 -2
- package/dist/cmd/cloud/secret/get.d.ts.map +0 -1
- package/dist/cmd/cloud/secret/get.js +0 -73
- package/dist/cmd/cloud/secret/get.js.map +0 -1
- package/dist/cmd/cloud/secret/import.d.ts +0 -2
- package/dist/cmd/cloud/secret/import.d.ts.map +0 -1
- package/dist/cmd/cloud/secret/import.js +0 -91
- package/dist/cmd/cloud/secret/import.js.map +0 -1
- package/dist/cmd/cloud/secret/index.d.ts +0 -3
- package/dist/cmd/cloud/secret/index.d.ts.map +0 -1
- package/dist/cmd/cloud/secret/index.js +0 -33
- package/dist/cmd/cloud/secret/index.js.map +0 -1
- package/dist/cmd/cloud/secret/list.d.ts +0 -2
- package/dist/cmd/cloud/secret/list.d.ts.map +0 -1
- package/dist/cmd/cloud/secret/list.js +0 -65
- package/dist/cmd/cloud/secret/list.js.map +0 -1
- package/dist/cmd/cloud/secret/pull.d.ts +0 -2
- package/dist/cmd/cloud/secret/pull.d.ts.map +0 -1
- package/dist/cmd/cloud/secret/pull.js +0 -82
- package/dist/cmd/cloud/secret/pull.js.map +0 -1
- package/dist/cmd/cloud/secret/push.d.ts +0 -2
- package/dist/cmd/cloud/secret/push.d.ts.map +0 -1
- package/dist/cmd/cloud/secret/push.js +0 -61
- package/dist/cmd/cloud/secret/push.js.map +0 -1
- package/dist/cmd/cloud/secret/set.d.ts +0 -2
- package/dist/cmd/cloud/secret/set.d.ts.map +0 -1
- package/dist/cmd/cloud/secret/set.js +0 -63
- package/dist/cmd/cloud/secret/set.js.map +0 -1
- package/src/cmd/cloud/secret/delete.ts +0 -65
- package/src/cmd/cloud/secret/get.ts +0 -77
- package/src/cmd/cloud/secret/import.ts +0 -110
- package/src/cmd/cloud/secret/index.ts +0 -33
- package/src/cmd/cloud/secret/list.ts +0 -70
- package/src/cmd/cloud/secret/pull.ts +0 -92
- package/src/cmd/cloud/secret/push.ts +0 -69
- package/src/cmd/cloud/secret/set.ts +0 -76
package/src/cmd/cloud/ssh.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { createSubcommand } from '../../types';
|
|
|
3
3
|
import * as tui from '../../tui';
|
|
4
4
|
import { getIONHost } from '../../config';
|
|
5
5
|
import { getCommand } from '../../command-prefix';
|
|
6
|
+
import { getIdentifierRegion } from './region-lookup';
|
|
6
7
|
const args = z.object({
|
|
7
8
|
identifier: z.string().optional().describe('The project, deployment, or sandbox id to use'),
|
|
8
9
|
command: z.string().optional().describe('The command to run'),
|
|
@@ -39,13 +40,13 @@ export const sshSubcommand = createSubcommand({
|
|
|
39
40
|
},
|
|
40
41
|
],
|
|
41
42
|
toplevel: true,
|
|
42
|
-
requires: { auth: true, apiClient: true
|
|
43
|
+
requires: { auth: true, apiClient: true },
|
|
43
44
|
optional: { project: true },
|
|
44
45
|
prerequisites: ['cloud deploy'],
|
|
45
46
|
schema: { args, options },
|
|
46
47
|
|
|
47
48
|
async handler(ctx) {
|
|
48
|
-
const { apiClient, project, projectDir, args, config, opts,
|
|
49
|
+
const { apiClient, project, projectDir, args, config, opts, logger, auth, orgId } = ctx;
|
|
49
50
|
|
|
50
51
|
let projectId = project?.projectId;
|
|
51
52
|
let identifier = args?.identifier;
|
|
@@ -66,6 +67,18 @@ export const sshSubcommand = createSubcommand({
|
|
|
66
67
|
projectId = await tui.showProjectList(apiClient, true);
|
|
67
68
|
}
|
|
68
69
|
|
|
70
|
+
// Look up region from identifier (project/deployment/sandbox)
|
|
71
|
+
const profileName = config?.name;
|
|
72
|
+
const targetIdentifier = identifier ?? projectId!;
|
|
73
|
+
const region = await getIdentifierRegion(
|
|
74
|
+
logger,
|
|
75
|
+
auth,
|
|
76
|
+
apiClient,
|
|
77
|
+
profileName,
|
|
78
|
+
targetIdentifier,
|
|
79
|
+
orgId
|
|
80
|
+
);
|
|
81
|
+
|
|
69
82
|
const hostname = getIONHost(config, region);
|
|
70
83
|
|
|
71
84
|
const cmd = ['ssh', `${identifier ?? projectId}@${hostname}`, command].filter(
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
2
|
+
import { listOrgResources, deleteResources } from '@agentuity/server';
|
|
3
3
|
import enquirer from 'enquirer';
|
|
4
4
|
import { createSubcommand } from '../../../types';
|
|
5
5
|
import * as tui from '../../../tui';
|
|
6
|
-
import { getCatalystAPIClient } from '../../../config';
|
|
6
|
+
import { getGlobalCatalystAPIClient, getCatalystAPIClient } from '../../../config';
|
|
7
7
|
import { getCommand } from '../../../command-prefix';
|
|
8
8
|
import { isDryRunMode, outputDryRun } from '../../../explain';
|
|
9
9
|
import { ErrorCode } from '../../../errors';
|
|
10
10
|
import { createS3Client } from './utils';
|
|
11
11
|
import { removeResourceEnvVars } from '../../../env-util';
|
|
12
|
+
import { getResourceInfo, setResourceInfo, deleteResourceRegion } from '../../../cache';
|
|
12
13
|
|
|
13
14
|
export const deleteSubcommand = createSubcommand({
|
|
14
15
|
name: 'delete',
|
|
@@ -16,7 +17,8 @@ export const deleteSubcommand = createSubcommand({
|
|
|
16
17
|
description: 'Delete a storage resource or file',
|
|
17
18
|
tags: ['destructive', 'deletes-resource', 'slow', 'requires-auth', 'requires-deployment'],
|
|
18
19
|
idempotent: false,
|
|
19
|
-
requires: { auth: true
|
|
20
|
+
requires: { auth: true },
|
|
21
|
+
optional: { org: true },
|
|
20
22
|
examples: [
|
|
21
23
|
{
|
|
22
24
|
command: getCommand('cloud storage delete my-bucket'),
|
|
@@ -50,19 +52,50 @@ export const deleteSubcommand = createSubcommand({
|
|
|
50
52
|
},
|
|
51
53
|
|
|
52
54
|
async handler(ctx) {
|
|
53
|
-
const { logger, args, opts,
|
|
55
|
+
const { logger, args, opts, auth, options, config } = ctx;
|
|
54
56
|
|
|
55
|
-
const
|
|
57
|
+
const profileName = config?.name ?? 'production';
|
|
58
|
+
const catalystClient = await getGlobalCatalystAPIClient(logger, auth, profileName);
|
|
59
|
+
|
|
60
|
+
let bucketName = args.name;
|
|
61
|
+
|
|
62
|
+
// If bucket name provided, try cache first for orgId
|
|
63
|
+
let orgId = ctx.orgId;
|
|
64
|
+
if (bucketName && !orgId) {
|
|
65
|
+
const cachedInfo = await getResourceInfo('bucket', profileName, bucketName);
|
|
66
|
+
orgId = cachedInfo?.orgId;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// For interactive selection (no bucket name), we need orgId
|
|
70
|
+
if (!bucketName && !orgId) {
|
|
71
|
+
tui.fatal(
|
|
72
|
+
'Organization required for interactive bucket selection. Specify --org-id or provide bucket name.',
|
|
73
|
+
ErrorCode.INVALID_ARGUMENT
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// If we still don't have orgId and have a bucket name, error out
|
|
78
|
+
if (!orgId) {
|
|
79
|
+
tui.fatal(
|
|
80
|
+
`Organization not found for bucket '${bucketName}'. Run 'agentuity cloud storage list' first or specify --org-id.`,
|
|
81
|
+
ErrorCode.INVALID_ARGUMENT
|
|
82
|
+
);
|
|
83
|
+
}
|
|
56
84
|
|
|
57
85
|
const resources = await tui.spinner({
|
|
58
|
-
message: `Fetching storage for ${orgId}
|
|
86
|
+
message: `Fetching storage for ${orgId}`,
|
|
59
87
|
clearOnSuccess: true,
|
|
60
88
|
callback: async () => {
|
|
61
|
-
return
|
|
89
|
+
return listOrgResources(catalystClient, { type: 's3', orgId });
|
|
62
90
|
},
|
|
63
91
|
});
|
|
64
92
|
|
|
65
|
-
|
|
93
|
+
// Cache all fetched buckets
|
|
94
|
+
for (const s3 of resources.s3) {
|
|
95
|
+
if (s3.cloud_region) {
|
|
96
|
+
await setResourceInfo('bucket', profileName, s3.bucket_name, s3.cloud_region, orgId);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
66
99
|
|
|
67
100
|
if (!bucketName) {
|
|
68
101
|
if (resources.s3.length === 0) {
|
|
@@ -155,9 +188,22 @@ export const deleteSubcommand = createSubcommand({
|
|
|
155
188
|
}
|
|
156
189
|
|
|
157
190
|
// Otherwise, delete the bucket
|
|
191
|
+
// Find the bucket to get its region
|
|
192
|
+
const bucketToDelete = resources.s3.find((s3) => s3.bucket_name === bucketName);
|
|
193
|
+
if (!bucketToDelete) {
|
|
194
|
+
tui.fatal(`Storage bucket '${bucketName}' not found`, ErrorCode.RESOURCE_NOT_FOUND);
|
|
195
|
+
}
|
|
196
|
+
if (!bucketToDelete.cloud_region) {
|
|
197
|
+
tui.fatal(
|
|
198
|
+
`Storage bucket '${bucketName}' is missing region information`,
|
|
199
|
+
ErrorCode.RESOURCE_NOT_FOUND
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
const region = bucketToDelete.cloud_region;
|
|
203
|
+
|
|
158
204
|
// Handle dry-run mode
|
|
159
205
|
if (isDryRunMode(options)) {
|
|
160
|
-
outputDryRun(`Would delete storage bucket: ${bucketName}`, options);
|
|
206
|
+
outputDryRun(`Would delete storage bucket: ${bucketName} (region: ${region})`, options);
|
|
161
207
|
if (!options.json) {
|
|
162
208
|
tui.newline();
|
|
163
209
|
tui.info('[DRY RUN] Storage bucket deletion skipped');
|
|
@@ -184,11 +230,13 @@ export const deleteSubcommand = createSubcommand({
|
|
|
184
230
|
}
|
|
185
231
|
}
|
|
186
232
|
|
|
233
|
+
// Use regional client for the delete operation
|
|
234
|
+
const regionalClient = getCatalystAPIClient(logger, auth, region);
|
|
187
235
|
const deleted = await tui.spinner({
|
|
188
236
|
message: `Deleting storage bucket ${bucketName}`,
|
|
189
237
|
clearOnSuccess: true,
|
|
190
238
|
callback: async () => {
|
|
191
|
-
return deleteResources(
|
|
239
|
+
return deleteResources(regionalClient, orgId, region, [
|
|
192
240
|
{ type: 's3', name: bucketName },
|
|
193
241
|
]);
|
|
194
242
|
},
|
|
@@ -197,6 +245,9 @@ export const deleteSubcommand = createSubcommand({
|
|
|
197
245
|
if (deleted.length > 0) {
|
|
198
246
|
const resource = deleted[0];
|
|
199
247
|
|
|
248
|
+
// Clear cache entry for deleted bucket
|
|
249
|
+
await deleteResourceRegion('bucket', profileName, resource.name);
|
|
250
|
+
|
|
200
251
|
// Remove env vars from .env if running inside a project
|
|
201
252
|
if (ctx.projectDir && resource.env_keys.length > 0) {
|
|
202
253
|
await removeResourceEnvVars(ctx.projectDir, resource.env_keys);
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
2
|
+
import { listOrgResources } from '@agentuity/server';
|
|
3
3
|
import { createSubcommand } from '../../../types';
|
|
4
4
|
import * as tui from '../../../tui';
|
|
5
|
-
import {
|
|
5
|
+
import { getGlobalCatalystAPIClient } from '../../../config';
|
|
6
6
|
import { getCommand } from '../../../command-prefix';
|
|
7
7
|
import { ErrorCode } from '../../../errors';
|
|
8
8
|
import { createS3Client } from './utils';
|
|
9
|
+
import { getResourceInfo, setResourceInfo } from '../../../cache';
|
|
9
10
|
|
|
10
11
|
export const downloadSubcommand = createSubcommand({
|
|
11
12
|
name: 'download',
|
|
12
13
|
description: 'Download a file from storage bucket',
|
|
13
14
|
tags: ['read-only', 'requires-auth'],
|
|
14
|
-
requires: { auth: true
|
|
15
|
+
requires: { auth: true },
|
|
16
|
+
optional: { org: true },
|
|
15
17
|
idempotent: true,
|
|
16
18
|
examples: [
|
|
17
19
|
{
|
|
@@ -51,21 +53,44 @@ export const downloadSubcommand = createSubcommand({
|
|
|
51
53
|
},
|
|
52
54
|
|
|
53
55
|
async handler(ctx) {
|
|
54
|
-
const { logger, args, opts, options,
|
|
56
|
+
const { logger, args, opts, options, auth, config } = ctx;
|
|
55
57
|
|
|
56
|
-
const
|
|
58
|
+
const profileName = config?.name ?? 'production';
|
|
59
|
+
const catalystClient = await getGlobalCatalystAPIClient(logger, auth, profileName);
|
|
60
|
+
|
|
61
|
+
// Check cache first for orgId
|
|
62
|
+
const cachedInfo = await getResourceInfo('bucket', profileName, args.name);
|
|
63
|
+
const orgId = ctx.orgId ?? cachedInfo?.orgId;
|
|
64
|
+
|
|
65
|
+
if (!orgId) {
|
|
66
|
+
tui.fatal(
|
|
67
|
+
`Organization not found for bucket '${args.name}'. Run 'agentuity cloud storage list' first or specify --org-id.`,
|
|
68
|
+
ErrorCode.INVALID_ARGUMENT
|
|
69
|
+
);
|
|
70
|
+
}
|
|
57
71
|
|
|
58
72
|
// Fetch bucket credentials
|
|
59
73
|
const resources = await tui.spinner({
|
|
60
74
|
message: `Fetching credentials for ${args.name}`,
|
|
61
75
|
clearOnSuccess: true,
|
|
62
76
|
callback: async () => {
|
|
63
|
-
return
|
|
77
|
+
return listOrgResources(catalystClient, { type: 's3', orgId });
|
|
64
78
|
},
|
|
65
79
|
});
|
|
66
80
|
|
|
67
81
|
const bucket = resources.s3.find((s3) => s3.bucket_name === args.name);
|
|
68
82
|
|
|
83
|
+
// Cache the bucket info for future lookups
|
|
84
|
+
if (bucket?.cloud_region) {
|
|
85
|
+
await setResourceInfo(
|
|
86
|
+
'bucket',
|
|
87
|
+
profileName,
|
|
88
|
+
bucket.bucket_name,
|
|
89
|
+
bucket.cloud_region,
|
|
90
|
+
orgId
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
|
|
69
94
|
if (!bucket) {
|
|
70
95
|
tui.fatal(`Storage bucket '${args.name}' not found`, ErrorCode.RESOURCE_NOT_FOUND);
|
|
71
96
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
2
|
+
import { listOrgResources } from '@agentuity/server';
|
|
3
3
|
import { createSubcommand } from '../../../types';
|
|
4
4
|
import * as tui from '../../../tui';
|
|
5
|
-
import {
|
|
5
|
+
import { getGlobalCatalystAPIClient } from '../../../config';
|
|
6
6
|
import { getCommand } from '../../../command-prefix';
|
|
7
7
|
import { ErrorCode } from '../../../errors';
|
|
8
|
+
import { getResourceInfo, setResourceInfo } from '../../../cache';
|
|
8
9
|
|
|
9
10
|
const StorageGetResponseSchema = z.object({
|
|
10
11
|
bucket_name: z.string().describe('Storage bucket name'),
|
|
@@ -19,7 +20,8 @@ export const getSubcommand = createSubcommand({
|
|
|
19
20
|
aliases: ['show'],
|
|
20
21
|
description: 'Show details about a specific storage bucket',
|
|
21
22
|
tags: ['read-only', 'fast', 'requires-auth'],
|
|
22
|
-
requires: { auth: true
|
|
23
|
+
requires: { auth: true },
|
|
24
|
+
optional: { org: true },
|
|
23
25
|
idempotent: true,
|
|
24
26
|
examples: [
|
|
25
27
|
{
|
|
@@ -52,20 +54,43 @@ export const getSubcommand = createSubcommand({
|
|
|
52
54
|
webUrl: (ctx) => `/services/storage/${encodeURIComponent(ctx.args.name)}`,
|
|
53
55
|
|
|
54
56
|
async handler(ctx) {
|
|
55
|
-
const { logger, args, opts, options,
|
|
57
|
+
const { logger, args, opts, options, auth, config } = ctx;
|
|
56
58
|
|
|
57
|
-
const
|
|
59
|
+
const profileName = config?.name ?? 'production';
|
|
60
|
+
const catalystClient = await getGlobalCatalystAPIClient(logger, auth, profileName);
|
|
61
|
+
|
|
62
|
+
// Check cache first for orgId
|
|
63
|
+
const cachedInfo = await getResourceInfo('bucket', profileName, args.name);
|
|
64
|
+
const orgId = ctx.orgId ?? cachedInfo?.orgId;
|
|
65
|
+
|
|
66
|
+
if (!orgId) {
|
|
67
|
+
tui.fatal(
|
|
68
|
+
`Organization not found for bucket '${args.name}'. Run 'agentuity cloud storage list' first or specify --org-id.`,
|
|
69
|
+
ErrorCode.INVALID_ARGUMENT
|
|
70
|
+
);
|
|
71
|
+
}
|
|
58
72
|
|
|
59
73
|
const resources = await tui.spinner({
|
|
60
74
|
message: `Fetching storage bucket ${args.name}`,
|
|
61
75
|
clearOnSuccess: true,
|
|
62
76
|
callback: async () => {
|
|
63
|
-
return
|
|
77
|
+
return listOrgResources(catalystClient, { type: 's3', orgId });
|
|
64
78
|
},
|
|
65
79
|
});
|
|
66
80
|
|
|
67
81
|
const bucket = resources.s3.find((s3) => s3.bucket_name === args.name);
|
|
68
82
|
|
|
83
|
+
// Cache the bucket info for future lookups
|
|
84
|
+
if (bucket?.cloud_region) {
|
|
85
|
+
await setResourceInfo(
|
|
86
|
+
'bucket',
|
|
87
|
+
profileName,
|
|
88
|
+
bucket.bucket_name,
|
|
89
|
+
bucket.cloud_region,
|
|
90
|
+
orgId
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
|
|
69
94
|
if (!bucket) {
|
|
70
95
|
tui.fatal(`Storage bucket '${args.name}' not found`, ErrorCode.RESOURCE_NOT_FOUND);
|
|
71
96
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
2
|
+
import { listOrgResources } from '@agentuity/server';
|
|
3
3
|
import { createSubcommand } from '../../../types';
|
|
4
4
|
import * as tui from '../../../tui';
|
|
5
|
-
import {
|
|
5
|
+
import { getGlobalCatalystAPIClient } from '../../../config';
|
|
6
6
|
import { getCommand } from '../../../command-prefix';
|
|
7
7
|
import { ErrorCode } from '../../../errors';
|
|
8
8
|
import { createS3Client } from './utils';
|
|
9
|
+
import { setResourceInfo } from '../../../cache';
|
|
9
10
|
|
|
10
11
|
const StorageListResponseSchema = z.object({
|
|
11
12
|
buckets: z
|
|
@@ -16,6 +17,7 @@ const StorageListResponseSchema = z.object({
|
|
|
16
17
|
secret_key: z.string().optional().describe('S3 secret key'),
|
|
17
18
|
region: z.string().optional().describe('S3 region'),
|
|
18
19
|
endpoint: z.string().optional().describe('S3 endpoint URL'),
|
|
20
|
+
cloud_region: z.string().optional().describe('Cloud region where bucket is hosted'),
|
|
19
21
|
})
|
|
20
22
|
)
|
|
21
23
|
.optional()
|
|
@@ -37,7 +39,7 @@ export const listSubcommand = createSubcommand({
|
|
|
37
39
|
aliases: ['ls'],
|
|
38
40
|
description: 'List storage resources or files in a bucket',
|
|
39
41
|
tags: ['read-only', 'fast', 'requires-auth'],
|
|
40
|
-
requires: { auth: true, org: true
|
|
42
|
+
requires: { auth: true, org: true },
|
|
41
43
|
idempotent: true,
|
|
42
44
|
examples: [
|
|
43
45
|
{ command: getCommand('cloud storage list'), description: 'List items' },
|
|
@@ -78,18 +80,26 @@ export const listSubcommand = createSubcommand({
|
|
|
78
80
|
: '/services/storage',
|
|
79
81
|
|
|
80
82
|
async handler(ctx) {
|
|
81
|
-
const { logger, args, opts, options, orgId,
|
|
83
|
+
const { logger, args, opts, options, orgId, auth, config } = ctx;
|
|
82
84
|
|
|
83
|
-
const catalystClient =
|
|
85
|
+
const catalystClient = await getGlobalCatalystAPIClient(logger, auth, config?.name);
|
|
84
86
|
|
|
87
|
+
const profileName = config?.name ?? 'production';
|
|
85
88
|
const resources = await tui.spinner({
|
|
86
|
-
message: `Fetching storage for ${orgId}
|
|
89
|
+
message: `Fetching storage for ${orgId}`,
|
|
87
90
|
clearOnSuccess: true,
|
|
88
91
|
callback: async () => {
|
|
89
|
-
return
|
|
92
|
+
return listOrgResources(catalystClient, { type: 's3', orgId });
|
|
90
93
|
},
|
|
91
94
|
});
|
|
92
95
|
|
|
96
|
+
// Cache each bucket with its region and orgId for future lookups
|
|
97
|
+
for (const s3 of resources.s3) {
|
|
98
|
+
if (s3.cloud_region) {
|
|
99
|
+
await setResourceInfo('bucket', profileName, s3.bucket_name, s3.cloud_region, orgId);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
93
103
|
// If bucket name is provided, list files in the bucket
|
|
94
104
|
if (args.name) {
|
|
95
105
|
const bucket = resources.s3.find((s3) => s3.bucket_name === args.name);
|
|
@@ -219,6 +229,7 @@ export const listSubcommand = createSubcommand({
|
|
|
219
229
|
secret_key: s3.secret_key ?? undefined,
|
|
220
230
|
region: s3.region ?? undefined,
|
|
221
231
|
endpoint: s3.endpoint ?? undefined,
|
|
232
|
+
cloud_region: s3.cloud_region,
|
|
222
233
|
})),
|
|
223
234
|
};
|
|
224
235
|
},
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { basename } from 'path';
|
|
3
|
-
import {
|
|
3
|
+
import { listOrgResources } from '@agentuity/server';
|
|
4
4
|
import { createSubcommand } from '../../../types';
|
|
5
5
|
import * as tui from '../../../tui';
|
|
6
|
-
import {
|
|
6
|
+
import { getGlobalCatalystAPIClient } from '../../../config';
|
|
7
7
|
import { getCommand } from '../../../command-prefix';
|
|
8
8
|
import { ErrorCode } from '../../../errors';
|
|
9
9
|
import { createS3Client } from './utils';
|
|
10
|
+
import { getResourceInfo, setResourceInfo } from '../../../cache';
|
|
10
11
|
|
|
11
12
|
export const uploadSubcommand = createSubcommand({
|
|
12
13
|
name: 'upload',
|
|
13
14
|
aliases: ['put'],
|
|
14
15
|
description: 'Upload a file to storage bucket',
|
|
15
16
|
tags: ['write', 'requires-auth'],
|
|
16
|
-
requires: { auth: true
|
|
17
|
+
requires: { auth: true },
|
|
18
|
+
optional: { org: true },
|
|
17
19
|
idempotent: false,
|
|
18
20
|
examples: [
|
|
19
21
|
{
|
|
@@ -61,21 +63,44 @@ export const uploadSubcommand = createSubcommand({
|
|
|
61
63
|
},
|
|
62
64
|
|
|
63
65
|
async handler(ctx) {
|
|
64
|
-
const { logger, args, opts, options,
|
|
66
|
+
const { logger, args, opts, options, auth, config } = ctx;
|
|
65
67
|
|
|
66
|
-
const
|
|
68
|
+
const profileName = config?.name ?? 'production';
|
|
69
|
+
const catalystClient = await getGlobalCatalystAPIClient(logger, auth, profileName);
|
|
70
|
+
|
|
71
|
+
// Check cache first for orgId
|
|
72
|
+
const cachedInfo = await getResourceInfo('bucket', profileName, args.name);
|
|
73
|
+
const orgId = ctx.orgId ?? cachedInfo?.orgId;
|
|
74
|
+
|
|
75
|
+
if (!orgId) {
|
|
76
|
+
tui.fatal(
|
|
77
|
+
`Organization not found for bucket '${args.name}'. Run 'agentuity cloud storage list' first or specify --org-id.`,
|
|
78
|
+
ErrorCode.INVALID_ARGUMENT
|
|
79
|
+
);
|
|
80
|
+
}
|
|
67
81
|
|
|
68
82
|
// Fetch bucket credentials
|
|
69
83
|
const resources = await tui.spinner({
|
|
70
84
|
message: `Fetching credentials for ${args.name}`,
|
|
71
85
|
clearOnSuccess: true,
|
|
72
86
|
callback: async () => {
|
|
73
|
-
return
|
|
87
|
+
return listOrgResources(catalystClient, { type: 's3', orgId });
|
|
74
88
|
},
|
|
75
89
|
});
|
|
76
90
|
|
|
77
91
|
const bucket = resources.s3.find((s3) => s3.bucket_name === args.name);
|
|
78
92
|
|
|
93
|
+
// Cache the bucket info for future lookups
|
|
94
|
+
if (bucket?.cloud_region) {
|
|
95
|
+
await setResourceInfo(
|
|
96
|
+
'bucket',
|
|
97
|
+
profileName,
|
|
98
|
+
bucket.bucket_name,
|
|
99
|
+
bucket.cloud_region,
|
|
100
|
+
orgId
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
|
|
79
104
|
if (!bucket) {
|
|
80
105
|
tui.fatal(`Storage bucket '${args.name}' not found`, ErrorCode.RESOURCE_NOT_FOUND);
|
|
81
106
|
}
|
|
@@ -4,7 +4,7 @@ import * as tui from '../../../tui';
|
|
|
4
4
|
import { threadDelete, APIError } from '@agentuity/server';
|
|
5
5
|
import { getCommand } from '../../../command-prefix';
|
|
6
6
|
import { ErrorCode } from '../../../errors';
|
|
7
|
-
import {
|
|
7
|
+
import { getGlobalCatalystAPIClient } from '../../../config';
|
|
8
8
|
|
|
9
9
|
export const deleteSubcommand = createSubcommand({
|
|
10
10
|
name: 'delete',
|
|
@@ -17,15 +17,15 @@ export const deleteSubcommand = createSubcommand({
|
|
|
17
17
|
},
|
|
18
18
|
],
|
|
19
19
|
aliases: ['rm'],
|
|
20
|
-
requires: { auth: true
|
|
20
|
+
requires: { auth: true },
|
|
21
21
|
schema: {
|
|
22
22
|
args: z.object({
|
|
23
23
|
thread_id: z.string().describe('Thread ID'),
|
|
24
24
|
}),
|
|
25
25
|
},
|
|
26
26
|
async handler(ctx) {
|
|
27
|
-
const { logger, auth, args,
|
|
28
|
-
const catalystClient =
|
|
27
|
+
const { logger, auth, args, config } = ctx;
|
|
28
|
+
const catalystClient = await getGlobalCatalystAPIClient(logger, auth, config?.name);
|
|
29
29
|
|
|
30
30
|
try {
|
|
31
31
|
await threadDelete(catalystClient, { id: args.thread_id });
|
|
@@ -4,7 +4,7 @@ import * as tui from '../../../tui';
|
|
|
4
4
|
import { threadGet, APIError } from '@agentuity/server';
|
|
5
5
|
import { getCommand } from '../../../command-prefix';
|
|
6
6
|
import { ErrorCode } from '../../../errors';
|
|
7
|
-
import {
|
|
7
|
+
import { getGlobalCatalystAPIClient } from '../../../config';
|
|
8
8
|
|
|
9
9
|
const ThreadGetResponseSchema = z.object({
|
|
10
10
|
id: z.string().describe('Thread ID'),
|
|
@@ -28,7 +28,7 @@ export const getSubcommand = createSubcommand({
|
|
|
28
28
|
description: 'Get a thread by ID',
|
|
29
29
|
},
|
|
30
30
|
],
|
|
31
|
-
requires: { auth: true
|
|
31
|
+
requires: { auth: true },
|
|
32
32
|
idempotent: true,
|
|
33
33
|
schema: {
|
|
34
34
|
args: z.object({
|
|
@@ -37,8 +37,8 @@ export const getSubcommand = createSubcommand({
|
|
|
37
37
|
response: ThreadGetResponseSchema,
|
|
38
38
|
},
|
|
39
39
|
async handler(ctx) {
|
|
40
|
-
const { logger, auth, args, options,
|
|
41
|
-
const catalystClient =
|
|
40
|
+
const { logger, auth, args, options, config } = ctx;
|
|
41
|
+
const catalystClient = await getGlobalCatalystAPIClient(logger, auth, config?.name);
|
|
42
42
|
|
|
43
43
|
try {
|
|
44
44
|
const thread = await threadGet(catalystClient, { id: args.thread_id });
|
|
@@ -4,7 +4,7 @@ import * as tui from '../../../tui';
|
|
|
4
4
|
import { threadList, type Thread } from '@agentuity/server';
|
|
5
5
|
import { getCommand } from '../../../command-prefix';
|
|
6
6
|
import { ErrorCode } from '../../../errors';
|
|
7
|
-
import {
|
|
7
|
+
import { getGlobalCatalystAPIClient } from '../../../config';
|
|
8
8
|
|
|
9
9
|
const ThreadListResponseSchema = z.array(
|
|
10
10
|
z.object({
|
|
@@ -36,7 +36,7 @@ export const listSubcommand = createSubcommand({
|
|
|
36
36
|
},
|
|
37
37
|
],
|
|
38
38
|
aliases: ['ls'],
|
|
39
|
-
requires: { auth: true
|
|
39
|
+
requires: { auth: true },
|
|
40
40
|
optional: { project: true },
|
|
41
41
|
idempotent: true,
|
|
42
42
|
pagination: {
|
|
@@ -62,8 +62,8 @@ export const listSubcommand = createSubcommand({
|
|
|
62
62
|
response: ThreadListResponseSchema,
|
|
63
63
|
},
|
|
64
64
|
async handler(ctx) {
|
|
65
|
-
const { logger, auth, project, opts, options,
|
|
66
|
-
const catalystClient =
|
|
65
|
+
const { logger, auth, project, opts, options, config } = ctx;
|
|
66
|
+
const catalystClient = await getGlobalCatalystAPIClient(logger, auth, config?.name);
|
|
67
67
|
|
|
68
68
|
const projectId = opts.projectId || project?.projectId;
|
|
69
69
|
const orgId = opts.orgId;
|
|
@@ -20,7 +20,7 @@ export const initSubcommand = createSubcommand({
|
|
|
20
20
|
name: 'init',
|
|
21
21
|
description: 'Set up Agentuity Auth for your project',
|
|
22
22
|
tags: ['mutating', 'slow', 'requires-auth'],
|
|
23
|
-
requires: { auth: true, org: true
|
|
23
|
+
requires: { auth: true, org: true },
|
|
24
24
|
idempotent: false,
|
|
25
25
|
examples: [
|
|
26
26
|
{
|
|
@@ -46,7 +46,7 @@ export const initSubcommand = createSubcommand({
|
|
|
46
46
|
},
|
|
47
47
|
|
|
48
48
|
async handler(ctx) {
|
|
49
|
-
const { logger, opts, auth, orgId,
|
|
49
|
+
const { logger, opts, auth, orgId, config } = ctx;
|
|
50
50
|
|
|
51
51
|
tui.newline();
|
|
52
52
|
tui.info(tui.bold('Agentuity Auth Setup'));
|
|
@@ -86,10 +86,14 @@ export const initSubcommand = createSubcommand({
|
|
|
86
86
|
logger,
|
|
87
87
|
auth,
|
|
88
88
|
orgId,
|
|
89
|
-
|
|
89
|
+
config,
|
|
90
90
|
existingUrl: databaseUrl,
|
|
91
|
+
projectDir,
|
|
91
92
|
});
|
|
92
93
|
|
|
94
|
+
// Get the region from the selected database
|
|
95
|
+
const region = dbInfo.region;
|
|
96
|
+
|
|
93
97
|
const databaseName = dbInfo.name;
|
|
94
98
|
|
|
95
99
|
// Update .env with database URL
|