@agentuity/cli 0.0.64 → 0.0.66
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/api.d.ts +1 -0
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +12 -2
- package/dist/api.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +5 -1
- package/dist/cli.js.map +1 -1
- package/dist/cmd/auth/signup.js +1 -1
- package/dist/cmd/auth/signup.js.map +1 -1
- package/dist/cmd/build/ast.d.ts.map +1 -1
- package/dist/cmd/build/ast.js +70 -4
- package/dist/cmd/build/ast.js.map +1 -1
- package/dist/cmd/build/ast.test.js +186 -1
- package/dist/cmd/build/ast.test.js.map +1 -1
- package/dist/cmd/build/bundler.d.ts +2 -24
- package/dist/cmd/build/bundler.d.ts.map +1 -1
- package/dist/cmd/build/bundler.js +24 -41
- package/dist/cmd/build/bundler.js.map +1 -1
- package/dist/cmd/build/index.d.ts.map +1 -1
- package/dist/cmd/build/index.js +14 -24
- package/dist/cmd/build/index.js.map +1 -1
- package/dist/cmd/build/plugin.d.ts.map +1 -1
- package/dist/cmd/build/plugin.js +13 -10
- package/dist/cmd/build/plugin.js.map +1 -1
- package/dist/cmd/build/workbench-templates.d.ts +1 -1
- package/dist/cmd/build/workbench-templates.d.ts.map +1 -1
- package/dist/cmd/build/workbench-templates.js +6 -19
- package/dist/cmd/build/workbench-templates.js.map +1 -1
- package/dist/cmd/cloud/apikey/create.d.ts.map +1 -1
- package/dist/cmd/cloud/apikey/create.js +7 -16
- package/dist/cmd/cloud/apikey/create.js.map +1 -1
- package/dist/cmd/cloud/db/create.d.ts.map +1 -1
- package/dist/cmd/cloud/db/create.js +4 -3
- package/dist/cmd/cloud/db/create.js.map +1 -1
- package/dist/cmd/cloud/db/delete.js +1 -1
- 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 +73 -4
- package/dist/cmd/cloud/db/get.js.map +1 -1
- package/dist/cmd/cloud/db/index.d.ts.map +1 -1
- package/dist/cmd/cloud/db/index.js +9 -1
- package/dist/cmd/cloud/db/index.js.map +1 -1
- package/dist/cmd/cloud/db/list.js +1 -1
- package/dist/cmd/cloud/db/list.js.map +1 -1
- package/dist/cmd/cloud/db/logs.d.ts +2 -0
- package/dist/cmd/cloud/db/logs.d.ts.map +1 -0
- package/dist/cmd/cloud/db/logs.js +150 -0
- package/dist/cmd/cloud/db/logs.js.map +1 -0
- package/dist/cmd/cloud/db/sql.d.ts.map +1 -1
- package/dist/cmd/cloud/db/sql.js +17 -52
- package/dist/cmd/cloud/db/sql.js.map +1 -1
- package/dist/cmd/cloud/deploy.d.ts.map +1 -1
- package/dist/cmd/cloud/deploy.js +3 -2
- package/dist/cmd/cloud/deploy.js.map +1 -1
- package/dist/cmd/cloud/deployment/list.d.ts.map +1 -1
- package/dist/cmd/cloud/deployment/list.js +1 -1
- package/dist/cmd/cloud/deployment/list.js.map +1 -1
- package/dist/cmd/cloud/deployment/logs.d.ts.map +1 -1
- package/dist/cmd/cloud/deployment/logs.js +1 -1
- package/dist/cmd/cloud/deployment/logs.js.map +1 -1
- package/dist/cmd/cloud/deployment/remove.js +1 -1
- package/dist/cmd/cloud/deployment/remove.js.map +1 -1
- package/dist/cmd/cloud/deployment/rollback.js +1 -1
- package/dist/cmd/cloud/deployment/rollback.js.map +1 -1
- package/dist/cmd/cloud/deployment/show.js +1 -1
- package/dist/cmd/cloud/deployment/show.js.map +1 -1
- package/dist/cmd/cloud/deployment/undeploy.js +1 -1
- package/dist/cmd/cloud/deployment/undeploy.js.map +1 -1
- package/dist/cmd/cloud/keyvalue/util.d.ts +3 -0
- package/dist/cmd/cloud/keyvalue/util.d.ts.map +1 -1
- package/dist/cmd/cloud/keyvalue/util.js +4 -3
- package/dist/cmd/cloud/keyvalue/util.js.map +1 -1
- package/dist/cmd/cloud/objectstore/util.d.ts +3 -0
- package/dist/cmd/cloud/objectstore/util.d.ts.map +1 -1
- package/dist/cmd/cloud/objectstore/util.js +3 -3
- package/dist/cmd/cloud/objectstore/util.js.map +1 -1
- package/dist/cmd/cloud/session/get.d.ts.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.d.ts.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/session/logs.d.ts.map +1 -1
- package/dist/cmd/cloud/session/logs.js +1 -1
- package/dist/cmd/cloud/session/logs.js.map +1 -1
- package/dist/cmd/cloud/storage/create.js +1 -1
- package/dist/cmd/cloud/storage/create.js.map +1 -1
- package/dist/cmd/cloud/storage/delete.js +1 -1
- package/dist/cmd/cloud/storage/delete.js.map +1 -1
- package/dist/cmd/cloud/storage/download.js +1 -1
- package/dist/cmd/cloud/storage/download.js.map +1 -1
- package/dist/cmd/cloud/storage/get.js +1 -1
- package/dist/cmd/cloud/storage/get.js.map +1 -1
- package/dist/cmd/cloud/storage/list.js +1 -1
- package/dist/cmd/cloud/storage/list.js.map +1 -1
- package/dist/cmd/cloud/storage/upload.js +1 -1
- package/dist/cmd/cloud/storage/upload.js.map +1 -1
- package/dist/cmd/cloud/stream/util.d.ts +3 -0
- package/dist/cmd/cloud/stream/util.d.ts.map +1 -1
- package/dist/cmd/cloud/stream/util.js +4 -3
- package/dist/cmd/cloud/stream/util.js.map +1 -1
- package/dist/cmd/cloud/thread/delete.d.ts.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.d.ts.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.d.ts.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/cloud/vector/util.d.ts +3 -0
- package/dist/cmd/cloud/vector/util.d.ts.map +1 -1
- package/dist/cmd/cloud/vector/util.js +4 -3
- package/dist/cmd/cloud/vector/util.js.map +1 -1
- package/dist/cmd/dev/index.d.ts.map +1 -1
- package/dist/cmd/dev/index.js +48 -21
- package/dist/cmd/dev/index.js.map +1 -1
- package/dist/cmd/profile/current.d.ts +3 -0
- package/dist/cmd/profile/current.d.ts.map +1 -0
- package/dist/cmd/profile/current.js +27 -0
- package/dist/cmd/profile/current.js.map +1 -0
- package/dist/cmd/profile/index.d.ts.map +1 -1
- package/dist/cmd/profile/index.js +9 -1
- package/dist/cmd/profile/index.js.map +1 -1
- package/dist/cmd/profile/show.d.ts.map +1 -1
- package/dist/cmd/profile/show.js +0 -1
- package/dist/cmd/profile/show.js.map +1 -1
- package/dist/cmd/project/download.d.ts.map +1 -1
- package/dist/cmd/project/download.js +15 -16
- package/dist/cmd/project/download.js.map +1 -1
- package/dist/cmd/project/template-flow.d.ts.map +1 -1
- package/dist/cmd/project/template-flow.js +5 -4
- package/dist/cmd/project/template-flow.js.map +1 -1
- package/dist/cmd/project/templates.d.ts +2 -1
- package/dist/cmd/project/templates.d.ts.map +1 -1
- package/dist/cmd/project/templates.js +4 -9
- package/dist/cmd/project/templates.js.map +1 -1
- package/dist/command-prefix.d.ts.map +1 -1
- package/dist/command-prefix.js +2 -1
- package/dist/command-prefix.js.map +1 -1
- package/dist/config.d.ts +2 -2
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +127 -24
- package/dist/config.js.map +1 -1
- package/dist/download.js +1 -1
- package/dist/download.js.map +1 -1
- package/dist/env-util.d.ts.map +1 -1
- package/dist/env-util.js +3 -0
- package/dist/env-util.js.map +1 -1
- package/dist/schemas/deploy.d.ts +24 -0
- package/dist/schemas/deploy.d.ts.map +1 -0
- package/dist/schemas/deploy.js +26 -0
- package/dist/schemas/deploy.js.map +1 -0
- package/dist/types.d.ts +12 -12
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +11 -35
- package/dist/types.js.map +1 -1
- package/dist/utils/workbench-notify.d.ts +29 -0
- package/dist/utils/workbench-notify.d.ts.map +1 -0
- package/dist/utils/workbench-notify.js +56 -0
- package/dist/utils/workbench-notify.js.map +1 -0
- package/package.json +3 -3
- package/src/api.ts +13 -2
- package/src/cli.ts +6 -1
- package/src/cmd/auth/signup.ts +1 -1
- package/src/cmd/build/ast.test.ts +246 -1
- package/src/cmd/build/ast.ts +88 -4
- package/src/cmd/build/bundler.ts +27 -44
- package/src/cmd/build/index.ts +15 -24
- package/src/cmd/build/plugin.ts +13 -10
- package/src/cmd/build/workbench-templates.ts +6 -21
- package/src/cmd/cloud/apikey/create.ts +7 -15
- package/src/cmd/cloud/db/create.ts +4 -3
- package/src/cmd/cloud/db/delete.ts +1 -1
- package/src/cmd/cloud/db/get.ts +86 -6
- package/src/cmd/cloud/db/index.ts +9 -1
- package/src/cmd/cloud/db/list.ts +1 -1
- package/src/cmd/cloud/db/logs.ts +163 -0
- package/src/cmd/cloud/db/sql.ts +17 -67
- package/src/cmd/cloud/deploy.ts +3 -2
- package/src/cmd/cloud/deployment/list.ts +1 -4
- package/src/cmd/cloud/deployment/logs.ts +1 -4
- package/src/cmd/cloud/deployment/remove.ts +1 -1
- package/src/cmd/cloud/deployment/rollback.ts +1 -1
- package/src/cmd/cloud/deployment/show.ts +1 -1
- package/src/cmd/cloud/deployment/undeploy.ts +1 -1
- package/src/cmd/cloud/keyvalue/util.ts +5 -3
- package/src/cmd/cloud/objectstore/util.ts +4 -3
- package/src/cmd/cloud/session/get.ts +4 -7
- package/src/cmd/cloud/session/list.ts +4 -7
- package/src/cmd/cloud/session/logs.ts +1 -4
- package/src/cmd/cloud/storage/create.ts +1 -1
- package/src/cmd/cloud/storage/delete.ts +1 -1
- package/src/cmd/cloud/storage/download.ts +1 -1
- package/src/cmd/cloud/storage/get.ts +1 -1
- package/src/cmd/cloud/storage/list.ts +1 -1
- package/src/cmd/cloud/storage/upload.ts +1 -1
- package/src/cmd/cloud/stream/util.ts +7 -3
- package/src/cmd/cloud/thread/delete.ts +4 -7
- package/src/cmd/cloud/thread/get.ts +4 -7
- package/src/cmd/cloud/thread/list.ts +4 -7
- package/src/cmd/cloud/vector/util.ts +5 -3
- package/src/cmd/dev/index.ts +54 -21
- package/src/cmd/profile/current.ts +31 -0
- package/src/cmd/profile/index.ts +9 -1
- package/src/cmd/profile/show.ts +0 -1
- package/src/cmd/project/download.ts +15 -16
- package/src/cmd/project/template-flow.ts +6 -4
- package/src/cmd/project/templates.ts +9 -11
- package/src/command-prefix.ts +4 -1
- package/src/config.ts +150 -24
- package/src/download.ts +1 -1
- package/src/env-util.ts +3 -0
- package/src/schemas/deploy.ts +28 -0
- package/src/types.ts +11 -35
- package/src/utils/workbench-notify.ts +67 -0
package/src/cmd/cloud/db/sql.ts
CHANGED
|
@@ -1,23 +1,14 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
3
|
-
import { listResources, type ResourceList } from '@agentuity/server';
|
|
2
|
+
import { dbQuery } from '@agentuity/server';
|
|
4
3
|
import { createSubcommand } from '../../../types';
|
|
5
4
|
import * as tui from '../../../tui';
|
|
6
5
|
import { getCatalystAPIClient } from '../../../config';
|
|
7
6
|
import { getCommand } from '../../../command-prefix';
|
|
8
|
-
import { ErrorCode } from '../../../errors';
|
|
9
|
-
|
|
10
|
-
interface DatabaseResource {
|
|
11
|
-
name: string;
|
|
12
|
-
username?: string | null;
|
|
13
|
-
password?: string | null;
|
|
14
|
-
url?: string | null;
|
|
15
|
-
}
|
|
16
7
|
|
|
17
8
|
const DBSQLResponseSchema = z.object({
|
|
18
9
|
rows: z.array(z.record(z.string(), z.unknown())).describe('Query results'),
|
|
19
10
|
rowCount: z.number().describe('Number of rows returned'),
|
|
20
|
-
|
|
11
|
+
truncated: z.boolean().describe('Whether results were truncated'),
|
|
21
12
|
});
|
|
22
13
|
|
|
23
14
|
export const sqlSubcommand = createSubcommand({
|
|
@@ -53,82 +44,41 @@ export const sqlSubcommand = createSubcommand({
|
|
|
53
44
|
async handler(ctx) {
|
|
54
45
|
const { logger, args, options, orgId, region, config, auth } = ctx;
|
|
55
46
|
|
|
56
|
-
const catalystClient = getCatalystAPIClient(config, logger, auth);
|
|
47
|
+
const catalystClient = getCatalystAPIClient(config, logger, auth, region);
|
|
57
48
|
|
|
58
|
-
const
|
|
59
|
-
message: `
|
|
49
|
+
const result = await tui.spinner({
|
|
50
|
+
message: `Executing query on ${args.name}`,
|
|
60
51
|
clearOnSuccess: true,
|
|
61
52
|
callback: async () => {
|
|
62
|
-
return
|
|
53
|
+
return dbQuery(catalystClient, {
|
|
54
|
+
database: args.name,
|
|
55
|
+
query: args.query,
|
|
56
|
+
orgId,
|
|
57
|
+
region,
|
|
58
|
+
});
|
|
63
59
|
},
|
|
64
60
|
});
|
|
65
61
|
|
|
66
|
-
const db: DatabaseResource | undefined = resources.db.find(
|
|
67
|
-
(d: DatabaseResource) => d.name === args.name
|
|
68
|
-
);
|
|
69
|
-
|
|
70
|
-
if (!db) {
|
|
71
|
-
tui.fatal(`Database '${args.name}' not found`, ErrorCode.RESOURCE_NOT_FOUND);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
if (!db.url) {
|
|
75
|
-
tui.fatal(`Database '${args.name}' has no connection URL`, ErrorCode.RUNTIME_ERROR);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
let database: SQL | undefined;
|
|
79
|
-
let rows: Record<string, unknown>[];
|
|
80
|
-
let executionTime: number | undefined;
|
|
81
|
-
|
|
82
|
-
try {
|
|
83
|
-
// Add sslmode=require if not already present in URL
|
|
84
|
-
let connectionUrl = db.url;
|
|
85
|
-
if (!connectionUrl.includes('sslmode=') && !connectionUrl.includes('ssl=')) {
|
|
86
|
-
const separator = connectionUrl.includes('?') ? '&' : '?';
|
|
87
|
-
connectionUrl = `${connectionUrl}${separator}sslmode=require`;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
database = new SQL(connectionUrl);
|
|
91
|
-
|
|
92
|
-
const startTime = performance.now();
|
|
93
|
-
const result = await tui.spinner({
|
|
94
|
-
message: `Executing query on ${args.name}`,
|
|
95
|
-
clearOnSuccess: true,
|
|
96
|
-
callback: async () => {
|
|
97
|
-
return database!.unsafe(args.query);
|
|
98
|
-
},
|
|
99
|
-
});
|
|
100
|
-
executionTime = performance.now() - startTime;
|
|
101
|
-
|
|
102
|
-
rows = result;
|
|
103
|
-
} catch (error) {
|
|
104
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
105
|
-
tui.fatal(`Query execution failed: ${message}`, ErrorCode.RUNTIME_ERROR);
|
|
106
|
-
} finally {
|
|
107
|
-
if (database) {
|
|
108
|
-
await database.close();
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
62
|
if (!options.json) {
|
|
113
|
-
if (
|
|
63
|
+
if (result.rowCount === 0) {
|
|
114
64
|
tui.info('No rows returned');
|
|
115
65
|
} else {
|
|
116
66
|
if (process.stdout.isTTY) {
|
|
117
67
|
tui.newline();
|
|
118
68
|
tui.success(
|
|
119
|
-
`Query returned ${
|
|
69
|
+
`Query returned ${result.rowCount} row${result.rowCount !== 1 ? 's' : ''}${result.truncated ? ' (truncated to 1000 rows)' : ''}:`
|
|
120
70
|
);
|
|
121
71
|
tui.newline();
|
|
122
72
|
}
|
|
123
73
|
|
|
124
|
-
tui.table(rows);
|
|
74
|
+
tui.table(result.rows);
|
|
125
75
|
}
|
|
126
76
|
}
|
|
127
77
|
|
|
128
78
|
return {
|
|
129
|
-
rows,
|
|
130
|
-
rowCount:
|
|
131
|
-
|
|
79
|
+
rows: result.rows,
|
|
80
|
+
rowCount: result.rowCount,
|
|
81
|
+
truncated: result.truncated,
|
|
132
82
|
};
|
|
133
83
|
},
|
|
134
84
|
});
|
package/src/cmd/cloud/deploy.ts
CHANGED
|
@@ -27,9 +27,9 @@ import {
|
|
|
27
27
|
} from '../../env-util';
|
|
28
28
|
import { zipDir } from '../../utils/zip';
|
|
29
29
|
import { encryptFIPSKEMDEMStream } from '../../crypto/box';
|
|
30
|
-
import { DeployOptionsSchema } from '../build/bundler';
|
|
31
30
|
import { getCommand } from '../../command-prefix';
|
|
32
31
|
import { checkCustomDomainForDNS } from './domain';
|
|
32
|
+
import { DeployOptionsSchema } from '../../schemas/deploy';
|
|
33
33
|
|
|
34
34
|
const DeployResponseSchema = z.object({
|
|
35
35
|
success: z.boolean().describe('Whether deployment succeeded'),
|
|
@@ -162,7 +162,8 @@ export const deploySubcommand = createSubcommand({
|
|
|
162
162
|
);
|
|
163
163
|
return stepSuccess();
|
|
164
164
|
} catch (ex) {
|
|
165
|
-
|
|
165
|
+
const _ex = ex as { message?: string };
|
|
166
|
+
return stepError(_ex.message ?? String(_ex), ex as Error);
|
|
166
167
|
}
|
|
167
168
|
},
|
|
168
169
|
},
|
|
@@ -103,10 +103,7 @@ export const listSubcommand = createSubcommand({
|
|
|
103
103
|
|
|
104
104
|
return result;
|
|
105
105
|
} catch (ex) {
|
|
106
|
-
tui.fatal(
|
|
107
|
-
`Failed to list deployments: ${ex instanceof Error ? ex.message : String(ex)}`,
|
|
108
|
-
ErrorCode.API_ERROR
|
|
109
|
-
);
|
|
106
|
+
tui.fatal(`Failed to list deployments: ${ex}`, ErrorCode.API_ERROR);
|
|
110
107
|
}
|
|
111
108
|
},
|
|
112
109
|
});
|
|
@@ -78,10 +78,7 @@ export const logsSubcommand = createSubcommand({
|
|
|
78
78
|
|
|
79
79
|
return logs;
|
|
80
80
|
} catch (ex) {
|
|
81
|
-
tui.fatal(
|
|
82
|
-
`Failed to fetch deployment logs: ${ex instanceof Error ? ex.message : String(ex)}`,
|
|
83
|
-
ErrorCode.API_ERROR
|
|
84
|
-
);
|
|
81
|
+
tui.fatal(`Failed to fetch deployment logs: ${ex}`, ErrorCode.API_ERROR);
|
|
85
82
|
}
|
|
86
83
|
},
|
|
87
84
|
});
|
|
@@ -69,7 +69,7 @@ export const removeSubcommand = createSubcommand({
|
|
|
69
69
|
deploymentId: args.deployment_id,
|
|
70
70
|
};
|
|
71
71
|
} catch (ex) {
|
|
72
|
-
tui.fatal(`Failed to remove deployment: ${ex
|
|
72
|
+
tui.fatal(`Failed to remove deployment: ${ex}`);
|
|
73
73
|
}
|
|
74
74
|
},
|
|
75
75
|
});
|
|
@@ -155,7 +155,7 @@ export const showSubcommand = createSubcommand({
|
|
|
155
155
|
metadata: deployment.metadata ?? undefined,
|
|
156
156
|
};
|
|
157
157
|
} catch (ex) {
|
|
158
|
-
tui.fatal(`Failed to show deployment: ${ex
|
|
158
|
+
tui.fatal(`Failed to show deployment: ${ex}`);
|
|
159
159
|
}
|
|
160
160
|
},
|
|
161
161
|
});
|
|
@@ -50,7 +50,7 @@ export const undeploySubcommand = createSubcommand({
|
|
|
50
50
|
await projectDeploymentUndeploy(apiClient, projectId);
|
|
51
51
|
tui.success('Undeployed successfully.');
|
|
52
52
|
} catch (ex) {
|
|
53
|
-
tui.fatal(`Failed to undeploy: ${ex
|
|
53
|
+
tui.fatal(`Failed to undeploy: ${ex}`);
|
|
54
54
|
}
|
|
55
55
|
},
|
|
56
56
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { KeyValueStorageService, Logger } from '@agentuity/core';
|
|
2
|
-
import { createServerFetchAdapter } from '@agentuity/server';
|
|
2
|
+
import { createServerFetchAdapter, getServiceUrls } from '@agentuity/server';
|
|
3
3
|
import { loadProjectSDKKey } from '../../../config';
|
|
4
4
|
import { ErrorCode } from '../../../errors';
|
|
5
5
|
import type { Config } from '../../../types';
|
|
@@ -9,8 +9,9 @@ export async function createStorageAdapter(ctx: {
|
|
|
9
9
|
logger: Logger;
|
|
10
10
|
projectDir: string;
|
|
11
11
|
config: Config | null;
|
|
12
|
+
project: { region: string };
|
|
12
13
|
}) {
|
|
13
|
-
const sdkKey = await loadProjectSDKKey(ctx.projectDir);
|
|
14
|
+
const sdkKey = await loadProjectSDKKey(ctx.logger, ctx.projectDir);
|
|
14
15
|
if (!sdkKey) {
|
|
15
16
|
tui.fatal(
|
|
16
17
|
`Couldn't find the AGENTUITY_SDK_KEY in ${ctx.projectDir} .env file`,
|
|
@@ -27,6 +28,7 @@ export async function createStorageAdapter(ctx: {
|
|
|
27
28
|
ctx.logger
|
|
28
29
|
);
|
|
29
30
|
|
|
30
|
-
const
|
|
31
|
+
const urls = getServiceUrls(ctx.project.region);
|
|
32
|
+
const baseUrl = urls.catalyst;
|
|
31
33
|
return new KeyValueStorageService(baseUrl, adapter);
|
|
32
34
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Logger, ObjectStorageService } from '@agentuity/core';
|
|
2
|
-
import { createServerFetchAdapter } from '@agentuity/server';
|
|
2
|
+
import { createServerFetchAdapter, getServiceUrls } from '@agentuity/server';
|
|
3
3
|
import { loadProjectSDKKey } from '../../../config';
|
|
4
4
|
import type { Config } from '../../../types';
|
|
5
5
|
import * as tui from '../../../tui';
|
|
@@ -8,8 +8,9 @@ export async function createStorageAdapter(ctx: {
|
|
|
8
8
|
logger: Logger;
|
|
9
9
|
projectDir: string;
|
|
10
10
|
config: Config | null;
|
|
11
|
+
project: { region: string };
|
|
11
12
|
}) {
|
|
12
|
-
const sdkKey = await loadProjectSDKKey(ctx.projectDir);
|
|
13
|
+
const sdkKey = await loadProjectSDKKey(ctx.logger, ctx.projectDir);
|
|
13
14
|
if (!sdkKey) {
|
|
14
15
|
tui.fatal(`Couldn't find the AGENTUITY_SDK_KEY in ${ctx.projectDir} .env file`);
|
|
15
16
|
}
|
|
@@ -23,6 +24,6 @@ export async function createStorageAdapter(ctx: {
|
|
|
23
24
|
ctx.logger
|
|
24
25
|
);
|
|
25
26
|
|
|
26
|
-
const baseUrl = ctx.
|
|
27
|
+
const baseUrl = getServiceUrls(ctx.project.region).catalyst;
|
|
27
28
|
return new ObjectStorageService(baseUrl, adapter);
|
|
28
29
|
}
|
|
@@ -116,7 +116,7 @@ export const getSubcommand = createSubcommand({
|
|
|
116
116
|
description: 'Get a session by ID',
|
|
117
117
|
},
|
|
118
118
|
],
|
|
119
|
-
requires: { auth: true },
|
|
119
|
+
requires: { auth: true, region: true },
|
|
120
120
|
idempotent: true,
|
|
121
121
|
schema: {
|
|
122
122
|
args: z.object({
|
|
@@ -125,8 +125,8 @@ export const getSubcommand = createSubcommand({
|
|
|
125
125
|
response: SessionGetResponseSchema,
|
|
126
126
|
},
|
|
127
127
|
async handler(ctx) {
|
|
128
|
-
const { config, logger, auth, args, options } = ctx;
|
|
129
|
-
const catalystClient = getCatalystAPIClient(config, logger, auth);
|
|
128
|
+
const { config, logger, auth, args, options, region } = ctx;
|
|
129
|
+
const catalystClient = getCatalystAPIClient(config, logger, auth, region);
|
|
130
130
|
|
|
131
131
|
try {
|
|
132
132
|
const enriched = await sessionGet(catalystClient, { id: args.session_id });
|
|
@@ -247,10 +247,7 @@ export const getSubcommand = createSubcommand({
|
|
|
247
247
|
if (ex instanceof APIError && ex.status === 404) {
|
|
248
248
|
tui.fatal(`Session ${args.session_id} not found`, ErrorCode.RESOURCE_NOT_FOUND);
|
|
249
249
|
}
|
|
250
|
-
tui.fatal(
|
|
251
|
-
`Failed to get session: ${ex instanceof Error ? ex.message : String(ex)}`,
|
|
252
|
-
ErrorCode.API_ERROR
|
|
253
|
-
);
|
|
250
|
+
tui.fatal(`Failed to get session: ${ex}`, ErrorCode.API_ERROR);
|
|
254
251
|
}
|
|
255
252
|
},
|
|
256
253
|
});
|
|
@@ -55,7 +55,7 @@ export const listSubcommand = createSubcommand({
|
|
|
55
55
|
},
|
|
56
56
|
],
|
|
57
57
|
aliases: ['ls'],
|
|
58
|
-
requires: { auth: true },
|
|
58
|
+
requires: { auth: true, region: true },
|
|
59
59
|
optional: { project: true },
|
|
60
60
|
idempotent: true,
|
|
61
61
|
pagination: {
|
|
@@ -89,8 +89,8 @@ export const listSubcommand = createSubcommand({
|
|
|
89
89
|
response: SessionListResponseSchema,
|
|
90
90
|
},
|
|
91
91
|
async handler(ctx) {
|
|
92
|
-
const { config, logger, auth, project, opts, options } = ctx;
|
|
93
|
-
const catalystClient = getCatalystAPIClient(config, logger, auth);
|
|
92
|
+
const { config, logger, auth, project, opts, options, region } = ctx;
|
|
93
|
+
const catalystClient = getCatalystAPIClient(config, logger, auth, region);
|
|
94
94
|
|
|
95
95
|
const projectId = opts.projectId || project?.projectId;
|
|
96
96
|
|
|
@@ -157,10 +157,7 @@ export const listSubcommand = createSubcommand({
|
|
|
157
157
|
|
|
158
158
|
return result;
|
|
159
159
|
} catch (ex) {
|
|
160
|
-
tui.fatal(
|
|
161
|
-
`Failed to list sessions: ${ex instanceof Error ? ex.message : String(ex)}`,
|
|
162
|
-
ErrorCode.API_ERROR
|
|
163
|
-
);
|
|
160
|
+
tui.fatal(`Failed to list sessions: ${ex}`, ErrorCode.API_ERROR);
|
|
164
161
|
}
|
|
165
162
|
},
|
|
166
163
|
});
|
|
@@ -67,10 +67,7 @@ export const logsSubcommand = createSubcommand({
|
|
|
67
67
|
|
|
68
68
|
return logs;
|
|
69
69
|
} catch (ex) {
|
|
70
|
-
tui.fatal(
|
|
71
|
-
`Failed to get session logs: ${ex instanceof Error ? ex.message : String(ex)}`,
|
|
72
|
-
ErrorCode.API_ERROR
|
|
73
|
-
);
|
|
70
|
+
tui.fatal(`Failed to get session logs: ${ex}`, ErrorCode.API_ERROR);
|
|
74
71
|
}
|
|
75
72
|
},
|
|
76
73
|
});
|
|
@@ -51,7 +51,7 @@ export const createSubcommand = defineSubcommand({
|
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
const catalystClient = getCatalystAPIClient(config, logger, auth);
|
|
54
|
+
const catalystClient = getCatalystAPIClient(config, logger, auth, region);
|
|
55
55
|
|
|
56
56
|
const created = await tui.spinner({
|
|
57
57
|
message: `Creating storage in ${region}`,
|
|
@@ -51,7 +51,7 @@ export const deleteSubcommand = createSubcommand({
|
|
|
51
51
|
async handler(ctx) {
|
|
52
52
|
const { logger, args, opts, config, orgId, region, auth, options } = ctx;
|
|
53
53
|
|
|
54
|
-
const catalystClient = getCatalystAPIClient(config, logger, auth);
|
|
54
|
+
const catalystClient = getCatalystAPIClient(config, logger, auth, region);
|
|
55
55
|
|
|
56
56
|
const resources = await tui.spinner({
|
|
57
57
|
message: `Fetching storage for ${orgId} in ${region}`,
|
|
@@ -53,7 +53,7 @@ export const downloadSubcommand = createSubcommand({
|
|
|
53
53
|
async handler(ctx) {
|
|
54
54
|
const { logger, args, opts, options, orgId, region, config, auth } = ctx;
|
|
55
55
|
|
|
56
|
-
const catalystClient = getCatalystAPIClient(config, logger, auth);
|
|
56
|
+
const catalystClient = getCatalystAPIClient(config, logger, auth, region);
|
|
57
57
|
|
|
58
58
|
// Fetch bucket credentials
|
|
59
59
|
const resources = await tui.spinner({
|
|
@@ -53,7 +53,7 @@ export const getSubcommand = createSubcommand({
|
|
|
53
53
|
async handler(ctx) {
|
|
54
54
|
const { logger, args, opts, options, orgId, region, config, auth } = ctx;
|
|
55
55
|
|
|
56
|
-
const catalystClient = getCatalystAPIClient(config, logger, auth);
|
|
56
|
+
const catalystClient = getCatalystAPIClient(config, logger, auth, region);
|
|
57
57
|
|
|
58
58
|
const resources = await tui.spinner({
|
|
59
59
|
message: `Fetching storage bucket ${args.name}`,
|
|
@@ -76,7 +76,7 @@ export const listSubcommand = createSubcommand({
|
|
|
76
76
|
async handler(ctx) {
|
|
77
77
|
const { logger, args, opts, options, orgId, region, config, auth } = ctx;
|
|
78
78
|
|
|
79
|
-
const catalystClient = getCatalystAPIClient(config, logger, auth);
|
|
79
|
+
const catalystClient = getCatalystAPIClient(config, logger, auth, region);
|
|
80
80
|
|
|
81
81
|
const resources = await tui.spinner({
|
|
82
82
|
message: `Fetching storage for ${orgId} in ${region}`,
|
|
@@ -51,7 +51,7 @@ export const uploadSubcommand = createSubcommand({
|
|
|
51
51
|
async handler(ctx) {
|
|
52
52
|
const { logger, args, opts, options, orgId, region, config, auth } = ctx;
|
|
53
53
|
|
|
54
|
-
const catalystClient = getCatalystAPIClient(config, logger, auth);
|
|
54
|
+
const catalystClient = getCatalystAPIClient(config, logger, auth, region);
|
|
55
55
|
|
|
56
56
|
// Fetch bucket credentials
|
|
57
57
|
const resources = await tui.spinner({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StreamStorageService, Logger } from '@agentuity/core';
|
|
2
|
-
import { createServerFetchAdapter } from '@agentuity/server';
|
|
2
|
+
import { createServerFetchAdapter, getServiceUrls } from '@agentuity/server';
|
|
3
3
|
import { loadProjectSDKKey } from '../../../config';
|
|
4
4
|
import { ErrorCode } from '../../../errors';
|
|
5
5
|
import type { Config } from '../../../types';
|
|
@@ -9,8 +9,9 @@ export async function createStorageAdapter(ctx: {
|
|
|
9
9
|
logger: Logger;
|
|
10
10
|
projectDir: string;
|
|
11
11
|
config: Config | null;
|
|
12
|
+
project: { region: string };
|
|
12
13
|
}) {
|
|
13
|
-
const sdkKey = await loadProjectSDKKey(ctx.projectDir);
|
|
14
|
+
const sdkKey = await loadProjectSDKKey(ctx.logger, ctx.projectDir);
|
|
14
15
|
if (!sdkKey) {
|
|
15
16
|
tui.fatal(
|
|
16
17
|
`Couldn't find the AGENTUITY_SDK_KEY in ${ctx.projectDir} .env file`,
|
|
@@ -27,6 +28,9 @@ export async function createStorageAdapter(ctx: {
|
|
|
27
28
|
ctx.logger
|
|
28
29
|
);
|
|
29
30
|
|
|
30
|
-
const baseUrl = ctx.
|
|
31
|
+
const baseUrl = getServiceUrls(ctx.project.region).stream;
|
|
32
|
+
|
|
33
|
+
ctx.logger.trace('using stream url: %s', baseUrl);
|
|
34
|
+
|
|
31
35
|
return new StreamStorageService(baseUrl, adapter);
|
|
32
36
|
}
|
|
@@ -17,15 +17,15 @@ export const deleteSubcommand = createSubcommand({
|
|
|
17
17
|
},
|
|
18
18
|
],
|
|
19
19
|
aliases: ['rm'],
|
|
20
|
-
requires: { auth: true },
|
|
20
|
+
requires: { auth: true, region: 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 { config, logger, auth, args } = ctx;
|
|
28
|
-
const catalystClient = getCatalystAPIClient(config, logger, auth);
|
|
27
|
+
const { config, logger, auth, args, region } = ctx;
|
|
28
|
+
const catalystClient = getCatalystAPIClient(config, logger, auth, region);
|
|
29
29
|
|
|
30
30
|
try {
|
|
31
31
|
await threadDelete(catalystClient, { id: args.thread_id });
|
|
@@ -35,10 +35,7 @@ export const deleteSubcommand = createSubcommand({
|
|
|
35
35
|
tui.fatal(`Thread ${args.thread_id} not found`, ErrorCode.RESOURCE_NOT_FOUND);
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
38
|
-
tui.fatal(
|
|
39
|
-
`Failed to delete thread: ${ex instanceof Error ? ex.message : String(ex)}`,
|
|
40
|
-
ErrorCode.API_ERROR
|
|
41
|
-
);
|
|
38
|
+
tui.fatal(`Failed to delete thread: ${ex}`, ErrorCode.API_ERROR);
|
|
42
39
|
}
|
|
43
40
|
},
|
|
44
41
|
});
|
|
@@ -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, region: 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 { config, logger, auth, args, options } = ctx;
|
|
41
|
-
const catalystClient = getCatalystAPIClient(config, logger, auth);
|
|
40
|
+
const { config, logger, auth, args, options, region } = ctx;
|
|
41
|
+
const catalystClient = getCatalystAPIClient(config, logger, auth, region);
|
|
42
42
|
|
|
43
43
|
try {
|
|
44
44
|
const thread = await threadGet(catalystClient, { id: args.thread_id });
|
|
@@ -79,10 +79,7 @@ export const getSubcommand = createSubcommand({
|
|
|
79
79
|
if (ex instanceof APIError && ex.status === 404) {
|
|
80
80
|
tui.fatal(`Thread ${args.thread_id} not found`, ErrorCode.RESOURCE_NOT_FOUND);
|
|
81
81
|
}
|
|
82
|
-
tui.fatal(
|
|
83
|
-
`Failed to get thread: ${ex instanceof Error ? ex.message : String(ex)}`,
|
|
84
|
-
ErrorCode.API_ERROR
|
|
85
|
-
);
|
|
82
|
+
tui.fatal(`Failed to get thread: ${ex}`, ErrorCode.API_ERROR);
|
|
86
83
|
}
|
|
87
84
|
},
|
|
88
85
|
});
|
|
@@ -36,7 +36,7 @@ export const listSubcommand = createSubcommand({
|
|
|
36
36
|
},
|
|
37
37
|
],
|
|
38
38
|
aliases: ['ls'],
|
|
39
|
-
requires: { auth: true },
|
|
39
|
+
requires: { auth: true, region: 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 { config, logger, auth, project, opts, options } = ctx;
|
|
66
|
-
const catalystClient = getCatalystAPIClient(config, logger, auth);
|
|
65
|
+
const { config, logger, auth, project, opts, options, region } = ctx;
|
|
66
|
+
const catalystClient = getCatalystAPIClient(config, logger, auth, region);
|
|
67
67
|
|
|
68
68
|
const projectId = opts.projectId || project?.projectId;
|
|
69
69
|
const orgId = opts.orgId;
|
|
@@ -116,10 +116,7 @@ export const listSubcommand = createSubcommand({
|
|
|
116
116
|
|
|
117
117
|
return result;
|
|
118
118
|
} catch (ex) {
|
|
119
|
-
tui.fatal(
|
|
120
|
-
`Failed to list threads: ${ex instanceof Error ? ex.message : String(ex)}`,
|
|
121
|
-
ErrorCode.API_ERROR
|
|
122
|
-
);
|
|
119
|
+
tui.fatal(`Failed to list threads: ${ex}`, ErrorCode.API_ERROR);
|
|
123
120
|
}
|
|
124
121
|
},
|
|
125
122
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Logger, VectorStorageService } from '@agentuity/core';
|
|
2
|
-
import { createServerFetchAdapter } from '@agentuity/server';
|
|
2
|
+
import { createServerFetchAdapter, getServiceUrls } from '@agentuity/server';
|
|
3
3
|
import { loadProjectSDKKey } from '../../../config';
|
|
4
4
|
import type { Config } from '../../../types';
|
|
5
5
|
import * as tui from '../../../tui';
|
|
@@ -8,8 +8,9 @@ export async function createStorageAdapter(ctx: {
|
|
|
8
8
|
logger: Logger;
|
|
9
9
|
projectDir: string;
|
|
10
10
|
config: Config | null;
|
|
11
|
+
project: { region: string };
|
|
11
12
|
}) {
|
|
12
|
-
const sdkKey = await loadProjectSDKKey(ctx.projectDir);
|
|
13
|
+
const sdkKey = await loadProjectSDKKey(ctx.logger, ctx.projectDir);
|
|
13
14
|
if (!sdkKey) {
|
|
14
15
|
tui.fatal(`Couldn't find the AGENTUITY_SDK_KEY in ${ctx.projectDir} .env file`);
|
|
15
16
|
}
|
|
@@ -23,6 +24,7 @@ export async function createStorageAdapter(ctx: {
|
|
|
23
24
|
ctx.logger
|
|
24
25
|
);
|
|
25
26
|
|
|
26
|
-
const
|
|
27
|
+
const urls = getServiceUrls(ctx.project.region);
|
|
28
|
+
const baseUrl = urls.catalyst;
|
|
27
29
|
return new VectorStorageService(baseUrl, adapter);
|
|
28
30
|
}
|