@agentuity/cli 0.0.65 → 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/index.d.ts.map +1 -1
- package/dist/cmd/build/index.js +10 -19
- 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 +8 -6
- package/dist/cmd/build/plugin.js.map +1 -1
- package/dist/cmd/cloud/db/create.js +1 -1
- 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.js +1 -1
- package/dist/cmd/cloud/db/get.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.js +1 -1
- package/dist/cmd/cloud/db/logs.js.map +1 -1
- package/dist/cmd/cloud/db/sql.js +1 -1
- package/dist/cmd/cloud/db/sql.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 +3 -2
- 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 +2 -2
- package/dist/cmd/cloud/objectstore/util.js.map +1 -1
- package/dist/cmd/cloud/session/get.js +3 -3
- package/dist/cmd/cloud/session/get.js.map +1 -1
- package/dist/cmd/cloud/session/list.js +3 -3
- package/dist/cmd/cloud/session/list.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 +2 -2
- package/dist/cmd/cloud/stream/util.js.map +1 -1
- package/dist/cmd/cloud/thread/delete.js +3 -3
- package/dist/cmd/cloud/thread/delete.js.map +1 -1
- package/dist/cmd/cloud/thread/get.js +3 -3
- package/dist/cmd/cloud/thread/get.js.map +1 -1
- package/dist/cmd/cloud/thread/list.js +3 -3
- 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 +3 -2
- 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 +14 -20
- package/dist/cmd/dev/index.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/config.d.ts +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +109 -19
- package/dist/config.js.map +1 -1
- 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/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/index.ts +10 -19
- package/src/cmd/build/plugin.ts +8 -6
- package/src/cmd/cloud/db/create.ts +1 -1
- package/src/cmd/cloud/db/delete.ts +1 -1
- package/src/cmd/cloud/db/get.ts +1 -1
- package/src/cmd/cloud/db/list.ts +1 -1
- package/src/cmd/cloud/db/logs.ts +1 -1
- package/src/cmd/cloud/db/sql.ts +1 -1
- package/src/cmd/cloud/keyvalue/util.ts +4 -2
- package/src/cmd/cloud/objectstore/util.ts +3 -2
- package/src/cmd/cloud/session/get.ts +3 -3
- package/src/cmd/cloud/session/list.ts +3 -3
- 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 +3 -2
- package/src/cmd/cloud/thread/delete.ts +3 -3
- package/src/cmd/cloud/thread/get.ts +3 -3
- package/src/cmd/cloud/thread/list.ts +3 -3
- package/src/cmd/cloud/vector/util.ts +4 -2
- package/src/cmd/dev/index.ts +14 -20
- 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/config.ts +130 -19
- package/src/types.ts +11 -35
package/src/api.ts
CHANGED
|
@@ -85,10 +85,21 @@ export class APIClient extends BaseAPIClient {
|
|
|
85
85
|
|
|
86
86
|
export function getAPIBaseURL(config?: Config | null): string {
|
|
87
87
|
const overrides = config?.overrides as { api_url?: string } | undefined;
|
|
88
|
-
return baseGetAPIBaseURL(overrides);
|
|
88
|
+
return baseGetAPIBaseURL(config?.name, overrides);
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
export function getAppBaseURL(config?: Config | null): string {
|
|
92
92
|
const overrides = config?.overrides as { app_url?: string } | undefined;
|
|
93
|
-
return baseGetAppBaseURL(overrides);
|
|
93
|
+
return baseGetAppBaseURL(config?.name, overrides);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export function getGravityDevModeURL(region: string, config?: Config | null): string {
|
|
97
|
+
const overrides = config?.overrides as { gravity_url?: string } | undefined;
|
|
98
|
+
if (overrides?.gravity_url) {
|
|
99
|
+
return overrides.gravity_url;
|
|
100
|
+
}
|
|
101
|
+
if (config?.name === 'local') {
|
|
102
|
+
return 'grpc://gravity.agentuity.io:8443';
|
|
103
|
+
}
|
|
104
|
+
return `grpc://gravity-${region}.agentuity.cloud`;
|
|
94
105
|
}
|
package/src/cli.ts
CHANGED
|
@@ -398,6 +398,7 @@ interface ResolveRegionOptions {
|
|
|
398
398
|
apiClient: APIClientType;
|
|
399
399
|
logger: Logger;
|
|
400
400
|
required: boolean;
|
|
401
|
+
region?: string;
|
|
401
402
|
}
|
|
402
403
|
|
|
403
404
|
async function resolveRegion(opts: ResolveRegionOptions): Promise<string | undefined> {
|
|
@@ -425,7 +426,7 @@ async function resolveRegion(opts: ResolveRegionOptions): Promise<string | undef
|
|
|
425
426
|
}
|
|
426
427
|
|
|
427
428
|
// Check if region was provided via flag
|
|
428
|
-
let region = options.region as string | undefined;
|
|
429
|
+
let region = opts.region ?? (options.region as string | undefined);
|
|
429
430
|
|
|
430
431
|
// Validate --region flag if provided
|
|
431
432
|
if (region) {
|
|
@@ -746,6 +747,7 @@ async function registerSubcommand(
|
|
|
746
747
|
apiClient,
|
|
747
748
|
logger: baseCtx.logger,
|
|
748
749
|
required: !!normalized.requiresRegion,
|
|
750
|
+
region: project?.region,
|
|
749
751
|
});
|
|
750
752
|
},
|
|
751
753
|
});
|
|
@@ -810,6 +812,7 @@ async function registerSubcommand(
|
|
|
810
812
|
apiClient,
|
|
811
813
|
logger: baseCtx.logger,
|
|
812
814
|
required: !!normalized.requiresRegion,
|
|
815
|
+
region: project?.region,
|
|
813
816
|
});
|
|
814
817
|
});
|
|
815
818
|
if (region) {
|
|
@@ -921,6 +924,7 @@ async function registerSubcommand(
|
|
|
921
924
|
apiClient,
|
|
922
925
|
logger: baseCtx.logger,
|
|
923
926
|
required: !!normalized.requiresRegion,
|
|
927
|
+
region: project?.region,
|
|
924
928
|
});
|
|
925
929
|
if (region) {
|
|
926
930
|
ctx.region = region;
|
|
@@ -1092,6 +1096,7 @@ async function registerSubcommand(
|
|
|
1092
1096
|
apiClient,
|
|
1093
1097
|
logger: baseCtx.logger,
|
|
1094
1098
|
required: !!normalized.requiresRegion,
|
|
1099
|
+
region: project?.region,
|
|
1095
1100
|
});
|
|
1096
1101
|
if (region) {
|
|
1097
1102
|
ctx.region = region;
|
package/src/cmd/auth/signup.ts
CHANGED
|
@@ -20,7 +20,7 @@ export const signupCommand = createSubcommand({
|
|
|
20
20
|
|
|
21
21
|
async handler(ctx) {
|
|
22
22
|
const { logger, config, apiClient } = ctx;
|
|
23
|
-
const appUrl = getAppBaseURL(config?.overrides);
|
|
23
|
+
const appUrl = getAppBaseURL(config?.name, config?.overrides);
|
|
24
24
|
|
|
25
25
|
try {
|
|
26
26
|
const otp = generateSignupOTP();
|
package/src/cmd/build/index.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { resolve, join } from 'node:path';
|
|
3
|
+
import { getServiceUrls } from '@agentuity/server';
|
|
3
4
|
import { createCommand } from '../../types';
|
|
4
5
|
import { bundle } from './bundler';
|
|
5
6
|
import * as tui from '../../tui';
|
|
@@ -40,7 +41,7 @@ export const command = createCommand({
|
|
|
40
41
|
},
|
|
41
42
|
|
|
42
43
|
async handler(ctx) {
|
|
43
|
-
const { opts, projectDir, project
|
|
44
|
+
const { opts, projectDir, project } = ctx;
|
|
44
45
|
|
|
45
46
|
const absoluteProjectDir = resolve(projectDir);
|
|
46
47
|
const outDir = opts.outdir ? resolve(opts.outdir) : join(absoluteProjectDir, '.agentuity');
|
|
@@ -50,27 +51,17 @@ export const command = createCommand({
|
|
|
50
51
|
|
|
51
52
|
const env: Map<string, string> = new Map();
|
|
52
53
|
|
|
53
|
-
if (config?.overrides?.transport_url) {
|
|
54
|
-
env.set('AGENTUITY_TRANSPORT_URL', config.overrides.transport_url);
|
|
55
|
-
}
|
|
56
|
-
if (config?.overrides?.catalyst_url) {
|
|
57
|
-
env.set('AGENTUITY_CATALYST_URL', config.overrides.catalyst_url);
|
|
58
|
-
}
|
|
59
|
-
if (config?.overrides?.vector_url) {
|
|
60
|
-
env.set('AGENTUITY_VECTOR_URL', config.overrides.vector_url);
|
|
61
|
-
}
|
|
62
|
-
if (config?.overrides?.object_url) {
|
|
63
|
-
env.set('AGENTUITY_OBJECTSTORE_URL', config.overrides.object_url);
|
|
64
|
-
}
|
|
65
|
-
if (config?.overrides?.kv_url) {
|
|
66
|
-
env.set('AGENTUITY_KEYVALUE_URL', config.overrides.kv_url);
|
|
67
|
-
}
|
|
68
|
-
if (config?.overrides?.stream_url) {
|
|
69
|
-
env.set('AGENTUITY_STREAM_URL', config.overrides.stream_url);
|
|
70
|
-
}
|
|
71
54
|
if (project) {
|
|
55
|
+
const serviceUrls = getServiceUrls(project.region);
|
|
56
|
+
env.set('AGENTUITY_TRANSPORT_URL', serviceUrls.catalyst);
|
|
57
|
+
env.set('AGENTUITY_CATALYST_URL', serviceUrls.catalyst);
|
|
58
|
+
env.set('AGENTUITY_VECTOR_URL', serviceUrls.vector);
|
|
59
|
+
env.set('AGENTUITY_OBJECTSTORE_URL', serviceUrls.objectstore);
|
|
60
|
+
env.set('AGENTUITY_KEYVALUE_URL', serviceUrls.keyvalue);
|
|
61
|
+
env.set('AGENTUITY_STREAM_URL', serviceUrls.stream);
|
|
72
62
|
env.set('AGENTUITY_CLOUD_ORG_ID', project.orgId);
|
|
73
63
|
env.set('AGENTUITY_CLOUD_PROJECT_ID', project.projectId);
|
|
64
|
+
env.set('AGENTUITY_REGION', project.region);
|
|
74
65
|
}
|
|
75
66
|
|
|
76
67
|
ctx.logger.trace('setting env to %s', env);
|
package/src/cmd/build/plugin.ts
CHANGED
|
@@ -636,15 +636,17 @@ const AgentuityBundler: BunPlugin = {
|
|
|
636
636
|
const workbenchConfig = await setupWorkbench(srcDir);
|
|
637
637
|
|
|
638
638
|
if (existsSync(indexFile)) {
|
|
639
|
-
inserts.push(`
|
|
640
|
-
|
|
641
|
-
|
|
639
|
+
inserts.push(`import { serveStatic } from 'hono/bun';
|
|
640
|
+
import { getRouter, registerDevModeRoutes } from '@agentuity/runtime';
|
|
641
|
+
import { readFileSync, existsSync } from 'node:fs';
|
|
642
|
+
|
|
643
|
+
(() => {
|
|
642
644
|
const router = getRouter()!;
|
|
643
645
|
|
|
644
646
|
// Setup workbench routes if workbench was bundled
|
|
645
647
|
const workbenchIndexPath = import.meta.dir + '/workbench/index.html';
|
|
646
|
-
if (
|
|
647
|
-
let workbenchIndex =
|
|
648
|
+
if (existsSync(workbenchIndexPath)) {
|
|
649
|
+
let workbenchIndex = readFileSync(workbenchIndexPath, 'utf-8');
|
|
648
650
|
|
|
649
651
|
// Always serve assets at /workbench/* regardless of HTML route
|
|
650
652
|
const workbenchStatic = serveStatic({ root: import.meta.dir + '/workbench' });
|
|
@@ -662,7 +664,7 @@ const AgentuityBundler: BunPlugin = {
|
|
|
662
664
|
router.get(route, (c) => c.html(workbenchIndex));
|
|
663
665
|
}
|
|
664
666
|
|
|
665
|
-
let index =
|
|
667
|
+
let index = readFileSync(import.meta.dir + '/web/index.html', 'utf-8');
|
|
666
668
|
if (${isDevMode}) {
|
|
667
669
|
const end = index.lastIndexOf('</html>');
|
|
668
670
|
const html = registerDevModeRoutes(router);
|
|
@@ -49,7 +49,7 @@ export const createSubcommand = defineSubcommand({
|
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
const catalystClient = getCatalystAPIClient(config, logger, auth);
|
|
52
|
+
const catalystClient = getCatalystAPIClient(config, logger, auth, region);
|
|
53
53
|
|
|
54
54
|
try {
|
|
55
55
|
const created = await tui.spinner({
|
|
@@ -37,7 +37,7 @@ export const deleteSubcommand = createSubcommand({
|
|
|
37
37
|
async handler(ctx) {
|
|
38
38
|
const { logger, args, opts, config, orgId, region, auth, options } = ctx;
|
|
39
39
|
|
|
40
|
-
const catalystClient = getCatalystAPIClient(config, logger, auth);
|
|
40
|
+
const catalystClient = getCatalystAPIClient(config, logger, auth, region);
|
|
41
41
|
|
|
42
42
|
let dbName = args.name;
|
|
43
43
|
|
package/src/cmd/cloud/db/get.ts
CHANGED
|
@@ -67,7 +67,7 @@ export const getSubcommand = createSubcommand({
|
|
|
67
67
|
async handler(ctx) {
|
|
68
68
|
const { logger, args, opts, options, orgId, region, config, auth } = ctx;
|
|
69
69
|
|
|
70
|
-
const catalystClient = getCatalystAPIClient(config, logger, auth);
|
|
70
|
+
const catalystClient = getCatalystAPIClient(config, logger, auth, region);
|
|
71
71
|
|
|
72
72
|
const resources = await tui.spinner({
|
|
73
73
|
message: `Fetching database ${args.name}`,
|
package/src/cmd/cloud/db/list.ts
CHANGED
|
@@ -48,7 +48,7 @@ export const listSubcommand = createSubcommand({
|
|
|
48
48
|
async handler(ctx) {
|
|
49
49
|
const { logger, opts, options, orgId, region, config, auth } = ctx;
|
|
50
50
|
|
|
51
|
-
const catalystClient = getCatalystAPIClient(config, logger, auth);
|
|
51
|
+
const catalystClient = getCatalystAPIClient(config, logger, auth, region);
|
|
52
52
|
|
|
53
53
|
const resources = await tui.spinner({
|
|
54
54
|
message: `Fetching databases for ${orgId} in ${region}`,
|
package/src/cmd/cloud/db/logs.ts
CHANGED
|
@@ -85,7 +85,7 @@ export const logsSubcommand = createSubcommand({
|
|
|
85
85
|
const prettySQL = ctx.opts.pretty ?? false;
|
|
86
86
|
|
|
87
87
|
try {
|
|
88
|
-
const catalystClient = getCatalystAPIClient(config, logger, auth);
|
|
88
|
+
const catalystClient = getCatalystAPIClient(config, logger, auth, region);
|
|
89
89
|
|
|
90
90
|
const logs = await dbLogs(catalystClient, {
|
|
91
91
|
database: args.database,
|
package/src/cmd/cloud/db/sql.ts
CHANGED
|
@@ -44,7 +44,7 @@ export const sqlSubcommand = createSubcommand({
|
|
|
44
44
|
async handler(ctx) {
|
|
45
45
|
const { logger, args, options, orgId, region, config, auth } = ctx;
|
|
46
46
|
|
|
47
|
-
const catalystClient = getCatalystAPIClient(config, logger, auth);
|
|
47
|
+
const catalystClient = getCatalystAPIClient(config, logger, auth, region);
|
|
48
48
|
|
|
49
49
|
const result = await tui.spinner({
|
|
50
50
|
message: `Executing query on ${args.name}`,
|
|
@@ -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,6 +9,7 @@ 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
14
|
const sdkKey = await loadProjectSDKKey(ctx.logger, ctx.projectDir);
|
|
14
15
|
if (!sdkKey) {
|
|
@@ -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,6 +8,7 @@ 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
13
|
const sdkKey = await loadProjectSDKKey(ctx.logger, ctx.projectDir);
|
|
13
14
|
if (!sdkKey) {
|
|
@@ -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 });
|
|
@@ -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
|
|
|
@@ -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,6 +9,7 @@ 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
14
|
const sdkKey = await loadProjectSDKKey(ctx.logger, ctx.projectDir);
|
|
14
15
|
if (!sdkKey) {
|
|
@@ -27,7 +28,7 @@ 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;
|
|
31
32
|
|
|
32
33
|
ctx.logger.trace('using stream url: %s', baseUrl);
|
|
33
34
|
|
|
@@ -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 });
|
|
@@ -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 });
|
|
@@ -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;
|
|
@@ -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,6 +8,7 @@ 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
13
|
const sdkKey = await loadProjectSDKKey(ctx.logger, ctx.projectDir);
|
|
13
14
|
if (!sdkKey) {
|
|
@@ -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
|
}
|
package/src/cmd/dev/index.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { resolve, join } from 'node:path';
|
|
4
4
|
import { bundle } from '../build/bundler';
|
|
5
|
+
import { getServiceUrls } from '@agentuity/server';
|
|
5
6
|
import { getBuildMetadata } from '../build/plugin';
|
|
6
7
|
import { existsSync, type FSWatcher, watch, statSync, readdirSync } from 'node:fs';
|
|
7
8
|
import {
|
|
@@ -15,7 +16,7 @@ import { type Config, createCommand } from '../../types';
|
|
|
15
16
|
import * as tui from '../../tui';
|
|
16
17
|
import { createAgentTemplates, createAPITemplates } from './templates';
|
|
17
18
|
import { generateEndpoint, type DevmodeResponse } from './api';
|
|
18
|
-
import { APIClient, getAPIBaseURL } from '../../api';
|
|
19
|
+
import { APIClient, getAPIBaseURL, getGravityDevModeURL } from '../../api';
|
|
19
20
|
import { download } from './download';
|
|
20
21
|
import { createDevmodeSyncService } from './sync';
|
|
21
22
|
import { getDevmodeDeploymentId } from '../build/ast';
|
|
@@ -101,6 +102,7 @@ export const command = createCommand({
|
|
|
101
102
|
|
|
102
103
|
let devmode: DevmodeResponse | undefined;
|
|
103
104
|
let gravityBin: string | undefined;
|
|
105
|
+
let gravityURL: string | undefined;
|
|
104
106
|
|
|
105
107
|
if (auth && project && opts.public) {
|
|
106
108
|
// Generate devmode endpoint only when using --public
|
|
@@ -118,6 +120,8 @@ export const command = createCommand({
|
|
|
118
120
|
await saveConfig(_config);
|
|
119
121
|
config = _config;
|
|
120
122
|
devmode = endpoint;
|
|
123
|
+
gravityURL = getGravityDevModeURL(project.region, config);
|
|
124
|
+
logger.error('gravity url: %s', gravityURL);
|
|
121
125
|
}
|
|
122
126
|
|
|
123
127
|
logger.debug(
|
|
@@ -183,33 +187,23 @@ export const command = createCommand({
|
|
|
183
187
|
env.AGENTUITY_SDK_DEV_MODE = 'true';
|
|
184
188
|
env.AGENTUITY_ENV = 'development';
|
|
185
189
|
env.NODE_ENV = 'development';
|
|
190
|
+
env.AGENTUITY_REGION = project?.region;
|
|
186
191
|
env.PORT = Number(opts.port).toFixed();
|
|
187
192
|
env.AGENTUITY_PORT = env.PORT;
|
|
193
|
+
const serviceUrls = getServiceUrls(project?.region);
|
|
188
194
|
if (options.logLevel !== undefined) env.AGENTUITY_LOG_LEVEL = options.logLevel;
|
|
189
195
|
// Pass through AGENTUITY_SDK_LOG_LEVEL for internal SDK logger
|
|
190
196
|
if (process.env.AGENTUITY_SDK_LOG_LEVEL) {
|
|
191
197
|
env.AGENTUITY_SDK_LOG_LEVEL = process.env.AGENTUITY_SDK_LOG_LEVEL;
|
|
192
198
|
}
|
|
193
199
|
env.AGENTUITY_FORCE_LOCAL_SERVICES = opts.local === true ? 'true' : 'false';
|
|
194
|
-
if (config?.overrides?.transport_url) {
|
|
195
|
-
env.AGENTUITY_TRANSPORT_URL = config.overrides.transport_url;
|
|
196
|
-
}
|
|
197
|
-
if (config?.overrides?.catalyst_url) {
|
|
198
|
-
env.AGENTUITY_CATALYST_URL = config.overrides.catalyst_url;
|
|
199
|
-
}
|
|
200
|
-
if (config?.overrides?.vector_url) {
|
|
201
|
-
env.AGENTUITY_VECTOR_URL = config.overrides.vector_url;
|
|
202
|
-
}
|
|
203
|
-
if (config?.overrides?.object_url) {
|
|
204
|
-
env.AGENTUITY_OBJECTSTORE_URL = config.overrides.object_url;
|
|
205
|
-
}
|
|
206
|
-
if (config?.overrides?.kv_url) {
|
|
207
|
-
env.AGENTUITY_KEYVALUE_URL = config.overrides.kv_url;
|
|
208
|
-
}
|
|
209
|
-
if (config?.overrides?.stream_url) {
|
|
210
|
-
env.AGENTUITY_STREAM_URL = config.overrides.stream_url;
|
|
211
|
-
}
|
|
212
200
|
if (project) {
|
|
201
|
+
env.AGENTUITY_TRANSPORT_URL = serviceUrls.catalyst;
|
|
202
|
+
env.AGENTUITY_CATALYST_URL = serviceUrls.catalyst;
|
|
203
|
+
env.AGENTUITY_VECTOR_URL = serviceUrls.vector;
|
|
204
|
+
env.AGENTUITY_OBJECTSTORE_URL = serviceUrls.objectstore;
|
|
205
|
+
env.AGENTUITY_KEYVALUE_URL = serviceUrls.keyvalue;
|
|
206
|
+
env.AGENTUITY_STREAM_URL = serviceUrls.stream;
|
|
213
207
|
env.AGENTUITY_CLOUD_ORG_ID = project.orgId;
|
|
214
208
|
env.AGENTUITY_CLOUD_PROJECT_ID = project.projectId;
|
|
215
209
|
}
|
|
@@ -295,7 +289,7 @@ export const command = createCommand({
|
|
|
295
289
|
'--port',
|
|
296
290
|
env.PORT!,
|
|
297
291
|
'--url',
|
|
298
|
-
|
|
292
|
+
gravityURL!,
|
|
299
293
|
'--log-level',
|
|
300
294
|
process.env.AGENTUITY_GRAVITY_LOG_LEVEL ?? 'error',
|
|
301
295
|
],
|
|
@@ -22,7 +22,6 @@ import { generateLLMPrompt as generateWebPrompt } from '../ai/prompt/web';
|
|
|
22
22
|
import { generateLLMPrompt as generateAPIPrompt } from '../ai/prompt/api';
|
|
23
23
|
import type { TemplateInfo } from './templates';
|
|
24
24
|
|
|
25
|
-
const GITHUB_REPO = 'agentuity/sdk';
|
|
26
25
|
const GITHUB_BRANCH = 'main';
|
|
27
26
|
|
|
28
27
|
interface DownloadOptions {
|
|
@@ -91,14 +90,14 @@ export async function downloadTemplate(options: DownloadOptions): Promise<void>
|
|
|
91
90
|
// Download from GitHub
|
|
92
91
|
const branch = templateBranch || GITHUB_BRANCH;
|
|
93
92
|
const templatePath = `templates/${template.directory}`;
|
|
94
|
-
const url = `https://
|
|
93
|
+
const url = `https://agentuity.sh/template/sdk/${branch}/tar.gz`;
|
|
95
94
|
const tempDir = mkdtempSync(join(tmpdir(), 'agentuity-'));
|
|
96
95
|
const tarballPath = join(tempDir, 'download.tar.gz');
|
|
97
96
|
|
|
98
|
-
logger.debug('[download] URL:', url);
|
|
99
|
-
logger.debug('[download] Branch:', branch);
|
|
100
|
-
logger.debug('[download] Template path:', templatePath);
|
|
101
|
-
logger.debug('[download] Temp dir:', tempDir);
|
|
97
|
+
logger.debug('[download] URL: %s', url);
|
|
98
|
+
logger.debug('[download] Branch: %s', branch);
|
|
99
|
+
logger.debug('[download] Template path: %s', templatePath);
|
|
100
|
+
logger.debug('[download] Temp dir: %s', tempDir);
|
|
102
101
|
|
|
103
102
|
try {
|
|
104
103
|
// Step 1: Download tarball to temp file
|
|
@@ -120,8 +119,8 @@ export async function downloadTemplate(options: DownloadOptions): Promise<void>
|
|
|
120
119
|
const buffer = Buffer.concat(chunks);
|
|
121
120
|
await Bun.write(tarballPath, buffer);
|
|
122
121
|
|
|
123
|
-
logger.debug('[download] Downloaded bytes:', buffer.length);
|
|
124
|
-
logger.debug('[download] Tarball path:', tarballPath);
|
|
122
|
+
logger.debug('[download] Downloaded bytes: %dbytes', buffer.length);
|
|
123
|
+
logger.debug('[download] Tarball path: %s', tarballPath);
|
|
125
124
|
}
|
|
126
125
|
);
|
|
127
126
|
|
|
@@ -132,8 +131,8 @@ export async function downloadTemplate(options: DownloadOptions): Promise<void>
|
|
|
132
131
|
mkdirSync(extractDir, { recursive: true });
|
|
133
132
|
|
|
134
133
|
const prefix = `sdk-${branch}/${templatePath}/`;
|
|
135
|
-
logger.debug('[extract] Extract dir:', extractDir);
|
|
136
|
-
logger.debug('[extract] Filter prefix:', prefix);
|
|
134
|
+
logger.debug('[extract] Extract dir: %s', extractDir);
|
|
135
|
+
logger.debug('[extract] Filter prefix: %s', prefix);
|
|
137
136
|
|
|
138
137
|
// Track extraction stats for debugging
|
|
139
138
|
let ignoredCount = 0;
|
|
@@ -152,8 +151,8 @@ export async function downloadTemplate(options: DownloadOptions): Promise<void>
|
|
|
152
151
|
// This is a file/dir we want to extract - strip the prefix
|
|
153
152
|
header.name = header.name.substring(prefix.length);
|
|
154
153
|
mappedEntries.add(header.name); // Track that we mapped this
|
|
155
|
-
logger.debug('[extract] MAP:', originalName,
|
|
156
|
-
logger.debug('[extract] EXTRACT:', originalName);
|
|
154
|
+
logger.debug('[extract] MAP: %s -> %s', originalName, header.name);
|
|
155
|
+
logger.debug('[extract] EXTRACT: %s', originalName);
|
|
157
156
|
extractedCount++;
|
|
158
157
|
}
|
|
159
158
|
return header;
|
|
@@ -172,7 +171,7 @@ export async function downloadTemplate(options: DownloadOptions): Promise<void>
|
|
|
172
171
|
}
|
|
173
172
|
|
|
174
173
|
// Otherwise, ignore it
|
|
175
|
-
logger.debug('[extract] IGNORE:', header.name);
|
|
174
|
+
logger.debug('[extract] IGNORE: %s', header.name);
|
|
176
175
|
ignoredCount++;
|
|
177
176
|
return true;
|
|
178
177
|
},
|
|
@@ -183,14 +182,14 @@ export async function downloadTemplate(options: DownloadOptions): Promise<void>
|
|
|
183
182
|
await finished(extractor);
|
|
184
183
|
|
|
185
184
|
logger.debug('[extract] Extraction complete');
|
|
186
|
-
logger.debug('[extract] Ignored entries:', ignoredCount);
|
|
187
|
-
logger.debug('[extract] Extracted entries:', extractedCount);
|
|
185
|
+
logger.debug('[extract] Ignored entries: %d', ignoredCount);
|
|
186
|
+
logger.debug('[extract] Extracted entries: %d', extractedCount);
|
|
188
187
|
|
|
189
188
|
// Step 3: Copy extracted files to destination
|
|
190
189
|
await cleanup(extractDir, dest);
|
|
191
190
|
} finally {
|
|
192
191
|
// Clean up temp directory
|
|
193
|
-
logger.debug('[cleanup] Removing temp dir:', tempDir);
|
|
192
|
+
logger.debug('[cleanup] Removing temp dir: %s', tempDir);
|
|
194
193
|
rmSync(tempDir, { recursive: true, force: true });
|
|
195
194
|
}
|
|
196
195
|
}
|