@agentuity/cli 0.1.7 → 0.1.9
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/cli.d.ts.map +1 -1
- package/dist/cli.js +68 -4
- package/dist/cli.js.map +1 -1
- package/dist/cmd/ai/skills/generator.d.ts.map +1 -1
- package/dist/cmd/ai/skills/generator.js +9 -1
- package/dist/cmd/ai/skills/generator.js.map +1 -1
- package/dist/cmd/build/vite/agent-discovery.d.ts.map +1 -1
- package/dist/cmd/build/vite/agent-discovery.js +159 -16
- package/dist/cmd/build/vite/agent-discovery.js.map +1 -1
- package/dist/cmd/build/vite/docs-generator.d.ts.map +1 -1
- package/dist/cmd/build/vite/docs-generator.js +8 -4
- package/dist/cmd/build/vite/docs-generator.js.map +1 -1
- package/dist/cmd/build/vite/metadata-generator.js +1 -1
- package/dist/cmd/build/vite/metadata-generator.js.map +1 -1
- package/dist/cmd/build/vite/registry-generator.d.ts.map +1 -1
- package/dist/cmd/build/vite/registry-generator.js +27 -4
- package/dist/cmd/build/vite/registry-generator.js.map +1 -1
- package/dist/cmd/build/vite/server-bundler.d.ts.map +1 -1
- package/dist/cmd/build/vite/server-bundler.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 +5 -2
- package/dist/cmd/build/vite/vite-asset-server-config.js.map +1 -1
- package/dist/cmd/canary/index.d.ts.map +1 -1
- package/dist/cmd/canary/index.js.map +1 -1
- package/dist/cmd/cloud/deploy.d.ts.map +1 -1
- package/dist/cmd/cloud/deploy.js +13 -2
- package/dist/cmd/cloud/deploy.js.map +1 -1
- package/dist/cmd/cloud/sandbox/create.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/create.js +15 -0
- package/dist/cmd/cloud/sandbox/create.js.map +1 -1
- package/dist/cmd/cloud/sandbox/get.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/get.js +17 -0
- package/dist/cmd/cloud/sandbox/get.js.map +1 -1
- package/dist/cmd/cloud/sandbox/index.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/index.js +2 -0
- package/dist/cmd/cloud/sandbox/index.js.map +1 -1
- package/dist/cmd/cloud/sandbox/list.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/list.js +12 -5
- package/dist/cmd/cloud/sandbox/list.js.map +1 -1
- package/dist/cmd/cloud/sandbox/run.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/run.js +11 -0
- package/dist/cmd/cloud/sandbox/run.js.map +1 -1
- package/dist/cmd/cloud/sandbox/runtime/index.d.ts +3 -0
- package/dist/cmd/cloud/sandbox/runtime/index.d.ts.map +1 -0
- package/dist/cmd/cloud/sandbox/runtime/index.js +19 -0
- package/dist/cmd/cloud/sandbox/runtime/index.js.map +1 -0
- package/dist/cmd/cloud/sandbox/runtime/list.d.ts +3 -0
- package/dist/cmd/cloud/sandbox/runtime/list.d.ts.map +1 -0
- package/dist/cmd/cloud/sandbox/runtime/list.js +68 -0
- package/dist/cmd/cloud/sandbox/runtime/list.js.map +1 -0
- package/dist/cmd/cloud/sandbox/snapshot/create.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/create.js +36 -5
- package/dist/cmd/cloud/sandbox/snapshot/create.js.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/get.js +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/get.js.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/list.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/list.js +4 -0
- 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 +10 -0
- package/dist/cmd/cloud/sandbox/snapshot/tag.js.map +1 -1
- package/dist/cmd/git/account/add.js +1 -1
- package/dist/cmd/git/account/add.js.map +1 -1
- package/dist/cmd/git/account/list.js +1 -1
- package/dist/cmd/git/account/list.js.map +1 -1
- package/dist/cmd/git/account/remove.js +1 -1
- package/dist/cmd/git/account/remove.js.map +1 -1
- package/dist/cmd/git/api.d.ts.map +1 -0
- package/dist/cmd/git/api.js.map +1 -0
- package/dist/cmd/git/link.js +1 -1
- package/dist/cmd/git/link.js.map +1 -1
- package/dist/cmd/git/list.js +1 -1
- package/dist/cmd/git/list.js.map +1 -1
- package/dist/cmd/git/status.js +1 -1
- package/dist/cmd/git/status.js.map +1 -1
- package/dist/cmd/git/unlink.js +1 -1
- package/dist/cmd/git/unlink.js.map +1 -1
- package/dist/cmd/index.d.ts.map +1 -1
- package/dist/cmd/index.js +0 -1
- package/dist/cmd/index.js.map +1 -1
- package/dist/cmd/project/auth/generate.js.map +1 -1
- package/dist/cmd/project/auth/init.js.map +1 -1
- package/dist/cmd/project/template-flow.js.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +10 -0
- package/dist/config.js.map +1 -1
- package/dist/utils/dependency-checker.d.ts.map +1 -1
- package/dist/utils/dependency-checker.js +5 -1
- package/dist/utils/dependency-checker.js.map +1 -1
- package/package.json +6 -6
- package/src/cli.ts +89 -4
- package/src/cmd/ai/skills/generator.ts +9 -1
- package/src/cmd/build/vite/agent-discovery.ts +209 -16
- package/src/cmd/build/vite/docs-generator.ts +8 -4
- package/src/cmd/build/vite/metadata-generator.ts +1 -1
- package/src/cmd/build/vite/registry-generator.ts +29 -4
- package/src/cmd/build/vite/server-bundler.ts +1 -4
- package/src/cmd/build/vite/vite-asset-server-config.ts +5 -2
- package/src/cmd/canary/index.ts +3 -1
- package/src/cmd/cloud/deploy.ts +15 -1
- package/src/cmd/cloud/sandbox/create.ts +15 -0
- package/src/cmd/cloud/sandbox/get.ts +17 -0
- package/src/cmd/cloud/sandbox/index.ts +2 -0
- package/src/cmd/cloud/sandbox/list.ts +12 -5
- package/src/cmd/cloud/sandbox/run.ts +11 -0
- package/src/cmd/cloud/sandbox/runtime/index.ts +20 -0
- package/src/cmd/cloud/sandbox/runtime/list.ts +75 -0
- package/src/cmd/cloud/sandbox/snapshot/create.ts +44 -5
- package/src/cmd/cloud/sandbox/snapshot/get.ts +1 -1
- package/src/cmd/cloud/sandbox/snapshot/list.ts +4 -0
- package/src/cmd/cloud/sandbox/snapshot/tag.ts +14 -0
- package/src/cmd/git/account/add.ts +1 -1
- package/src/cmd/git/account/list.ts +1 -1
- package/src/cmd/git/account/remove.ts +1 -1
- package/src/cmd/git/link.ts +1 -1
- package/src/cmd/git/list.ts +1 -1
- package/src/cmd/git/status.ts +1 -1
- package/src/cmd/git/unlink.ts +1 -1
- package/src/cmd/index.ts +0 -1
- package/src/cmd/project/auth/generate.ts +4 -4
- package/src/cmd/project/auth/init.ts +2 -2
- package/src/cmd/project/template-flow.ts +3 -3
- package/src/config.ts +10 -0
- package/src/utils/dependency-checker.ts +6 -2
- package/dist/cmd/integration/api.d.ts.map +0 -1
- package/dist/cmd/integration/api.js.map +0 -1
- package/dist/cmd/integration/github/connect.d.ts +0 -2
- package/dist/cmd/integration/github/connect.d.ts.map +0 -1
- package/dist/cmd/integration/github/connect.js +0 -197
- package/dist/cmd/integration/github/connect.js.map +0 -1
- package/dist/cmd/integration/github/disconnect.d.ts +0 -2
- package/dist/cmd/integration/github/disconnect.d.ts.map +0 -1
- package/dist/cmd/integration/github/disconnect.js +0 -121
- package/dist/cmd/integration/github/disconnect.js.map +0 -1
- package/dist/cmd/integration/github/index.d.ts +0 -2
- package/dist/cmd/integration/github/index.d.ts.map +0 -1
- package/dist/cmd/integration/github/index.js +0 -21
- package/dist/cmd/integration/github/index.js.map +0 -1
- package/dist/cmd/integration/index.d.ts +0 -2
- package/dist/cmd/integration/index.d.ts.map +0 -1
- package/dist/cmd/integration/index.js +0 -16
- package/dist/cmd/integration/index.js.map +0 -1
- package/src/cmd/integration/github/connect.ts +0 -242
- package/src/cmd/integration/github/disconnect.ts +0 -149
- package/src/cmd/integration/github/index.ts +0 -21
- package/src/cmd/integration/index.ts +0 -16
- /package/dist/cmd/{integration → git}/api.d.ts +0 -0
- /package/dist/cmd/{integration → git}/api.js +0 -0
- /package/src/cmd/{integration → git}/api.ts +0 -0
|
@@ -36,9 +36,13 @@ export async function checkAndUpgradeDependencies(projectDir, logger) {
|
|
|
36
36
|
skipped: [],
|
|
37
37
|
failed: [],
|
|
38
38
|
};
|
|
39
|
-
const packageJsonPath = join(projectDir, 'package.json');
|
|
40
39
|
const cliVersion = getVersion();
|
|
41
40
|
logger.debug('CLI version: %s', cliVersion);
|
|
41
|
+
// check if this is a canary and if so, skip this check
|
|
42
|
+
if (cliVersion.includes('-')) {
|
|
43
|
+
return result;
|
|
44
|
+
}
|
|
45
|
+
const packageJsonPath = join(projectDir, 'package.json');
|
|
42
46
|
// Read package.json
|
|
43
47
|
let packageJson;
|
|
44
48
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dependency-checker.js","sourceRoot":"","sources":["../../src/utils/dependency-checker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAcxC;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,SAAiB;IACrD,kCAAkC;IAClC,IAAI,SAAS,KAAK,QAAQ,IAAI,SAAS,KAAK,GAAG,EAAE,CAAC;QACjD,OAAO,IAAI,CAAC;IACb,CAAC;IAED,mDAAmD;IACnD,IAAI,mCAAmC,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;QACzD,OAAO,KAAK,CAAC;IACd,CAAC;IAED,iDAAiD;IACjD,4CAA4C;IAC5C,IAAI,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;QAChC,OAAO,IAAI,CAAC;IACb,CAAC;IAED,iDAAiD;IACjD,OAAO,KAAK,CAAC;AACd,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAChD,UAAkB,EAClB,MAAc;IAEd,MAAM,MAAM,GAAkB;QAC7B,QAAQ,EAAE,EAAE;QACZ,OAAO,EAAE,EAAE;QACX,MAAM,EAAE,EAAE;KACV,CAAC;IAEF,MAAM,
|
|
1
|
+
{"version":3,"file":"dependency-checker.js","sourceRoot":"","sources":["../../src/utils/dependency-checker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAcxC;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,SAAiB;IACrD,kCAAkC;IAClC,IAAI,SAAS,KAAK,QAAQ,IAAI,SAAS,KAAK,GAAG,EAAE,CAAC;QACjD,OAAO,IAAI,CAAC;IACb,CAAC;IAED,mDAAmD;IACnD,IAAI,mCAAmC,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;QACzD,OAAO,KAAK,CAAC;IACd,CAAC;IAED,iDAAiD;IACjD,4CAA4C;IAC5C,IAAI,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;QAChC,OAAO,IAAI,CAAC;IACb,CAAC;IAED,iDAAiD;IACjD,OAAO,KAAK,CAAC;AACd,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAChD,UAAkB,EAClB,MAAc;IAEd,MAAM,MAAM,GAAkB;QAC7B,QAAQ,EAAE,EAAE;QACZ,OAAO,EAAE,EAAE;QACX,MAAM,EAAE,EAAE;KACV,CAAC;IAEF,MAAM,UAAU,GAAG,UAAU,EAAE,C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HANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentuity/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"author": "Agentuity employees and contributors",
|
|
6
6
|
"type": "module",
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
"prepublishOnly": "bun run clean && bun run build"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@agentuity/auth": "0.1.
|
|
44
|
-
"@agentuity/core": "0.1.
|
|
45
|
-
"@agentuity/server": "0.1.
|
|
43
|
+
"@agentuity/auth": "0.1.9",
|
|
44
|
+
"@agentuity/core": "0.1.9",
|
|
45
|
+
"@agentuity/server": "0.1.9",
|
|
46
46
|
"@datasert/cronjs-parser": "^1.4.0",
|
|
47
47
|
"@terascope/fetch-github-release": "^2.2.1",
|
|
48
48
|
"@vitejs/plugin-react": "^5.1.2",
|
|
@@ -60,10 +60,10 @@
|
|
|
60
60
|
"typescript": "^5.9.0",
|
|
61
61
|
"vite": "^7.2.7",
|
|
62
62
|
"zod": "^4.3.5",
|
|
63
|
-
"@agentuity/frontend": "0.1.
|
|
63
|
+
"@agentuity/frontend": "0.1.9"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
|
-
"@agentuity/test-utils": "0.1.
|
|
66
|
+
"@agentuity/test-utils": "0.1.9",
|
|
67
67
|
"@types/adm-zip": "^0.5.7",
|
|
68
68
|
"@types/bun": "latest",
|
|
69
69
|
"@types/tar-fs": "^2.0.4",
|
package/src/cli.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { mkdir } from 'node:fs/promises';
|
|
1
2
|
import { homedir } from 'node:os';
|
|
2
|
-
import { resolve } from 'node:path';
|
|
3
|
+
import { resolve, join } from 'node:path';
|
|
3
4
|
import { Command } from 'commander';
|
|
5
|
+
import { getDefaultConfigDir } from './config';
|
|
4
6
|
import type {
|
|
5
7
|
CommandDefinition,
|
|
6
8
|
SubcommandDefinition,
|
|
@@ -683,16 +685,91 @@ async function getRegion(regions: RegionList): Promise<string> {
|
|
|
683
685
|
interface ResolveRegionOptions {
|
|
684
686
|
options: Record<string, unknown>;
|
|
685
687
|
apiClient: APIClientType;
|
|
688
|
+
apiUrl: string;
|
|
686
689
|
logger: Logger;
|
|
687
690
|
required: boolean;
|
|
688
691
|
region?: string;
|
|
689
692
|
}
|
|
690
693
|
|
|
691
|
-
|
|
692
|
-
|
|
694
|
+
const REGIONS_CACHE_FILE = 'regions.json';
|
|
695
|
+
const REGIONS_CACHE_MAX_AGE_MS = 5 * 24 * 60 * 60 * 1000; // 5 days
|
|
696
|
+
|
|
697
|
+
interface RegionsCacheData {
|
|
698
|
+
timestamp: number;
|
|
699
|
+
regions: RegionList;
|
|
700
|
+
apiUrl?: string; // Added to make cache profile-aware
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
async function getCachedRegions(apiUrl: string, logger: Logger): Promise<RegionList | null> {
|
|
704
|
+
try {
|
|
705
|
+
const cachePath = join(getDefaultConfigDir(), REGIONS_CACHE_FILE);
|
|
706
|
+
const file = Bun.file(cachePath);
|
|
707
|
+
if (!(await file.exists())) {
|
|
708
|
+
return null;
|
|
709
|
+
}
|
|
710
|
+
const data: RegionsCacheData = await file.json();
|
|
711
|
+
// Check if cache is for the same API URL (profile-aware)
|
|
712
|
+
if (data.apiUrl && data.apiUrl !== apiUrl) {
|
|
713
|
+
logger.trace(
|
|
714
|
+
'regions cache is for different API URL (cached: %s, current: %s)',
|
|
715
|
+
data.apiUrl,
|
|
716
|
+
apiUrl
|
|
717
|
+
);
|
|
718
|
+
return null;
|
|
719
|
+
}
|
|
720
|
+
const age = Date.now() - data.timestamp;
|
|
721
|
+
if (age > REGIONS_CACHE_MAX_AGE_MS) {
|
|
722
|
+
logger.trace('regions cache expired (age: %dms)', age);
|
|
723
|
+
return null;
|
|
724
|
+
}
|
|
725
|
+
logger.trace('using cached regions (age: %dms)', age);
|
|
726
|
+
return data.regions;
|
|
727
|
+
} catch (error) {
|
|
728
|
+
logger.trace('failed to read regions cache: %s', error);
|
|
729
|
+
return null;
|
|
730
|
+
}
|
|
731
|
+
}
|
|
693
732
|
|
|
694
|
-
|
|
733
|
+
async function saveRegionsCache(
|
|
734
|
+
apiUrl: string,
|
|
735
|
+
regions: RegionList,
|
|
736
|
+
logger: Logger
|
|
737
|
+
): Promise<void> {
|
|
738
|
+
try {
|
|
739
|
+
const cacheDir = getDefaultConfigDir();
|
|
740
|
+
await mkdir(cacheDir, { recursive: true });
|
|
741
|
+
const cachePath = join(cacheDir, REGIONS_CACHE_FILE);
|
|
742
|
+
const data: RegionsCacheData = {
|
|
743
|
+
timestamp: Date.now(),
|
|
744
|
+
regions,
|
|
745
|
+
apiUrl,
|
|
746
|
+
};
|
|
747
|
+
await Bun.write(cachePath, JSON.stringify(data));
|
|
748
|
+
logger.trace('saved regions cache for %s', apiUrl);
|
|
749
|
+
} catch (error) {
|
|
750
|
+
logger.trace('failed to save regions cache: %s', error);
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
async function fetchRegionsWithCache(
|
|
755
|
+
apiUrl: string,
|
|
756
|
+
apiClient: APIClientType,
|
|
757
|
+
logger: Logger
|
|
758
|
+
): Promise<RegionList> {
|
|
759
|
+
const cached = await getCachedRegions(apiUrl, logger);
|
|
760
|
+
if (cached) {
|
|
761
|
+
return cached;
|
|
762
|
+
}
|
|
695
763
|
const regions = await listRegions(apiClient);
|
|
764
|
+
await saveRegionsCache(apiUrl, regions, logger);
|
|
765
|
+
return regions;
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
async function resolveRegion(opts: ResolveRegionOptions): Promise<string | undefined> {
|
|
769
|
+
const { options, apiClient, apiUrl, logger, required } = opts;
|
|
770
|
+
|
|
771
|
+
// Fetch regions (with caching)
|
|
772
|
+
const regions = await fetchRegionsWithCache(apiUrl, apiClient, logger);
|
|
696
773
|
|
|
697
774
|
// No regions available
|
|
698
775
|
if (regions.length === 0) {
|
|
@@ -1160,6 +1237,7 @@ async function registerSubcommand(
|
|
|
1160
1237
|
return resolveRegion({
|
|
1161
1238
|
options: options as Record<string, unknown>,
|
|
1162
1239
|
apiClient,
|
|
1240
|
+
apiUrl: getAPIBaseURL(baseCtx.config),
|
|
1163
1241
|
logger: baseCtx.logger,
|
|
1164
1242
|
required: !!normalized.requiresRegion,
|
|
1165
1243
|
region: project?.region,
|
|
@@ -1228,6 +1306,7 @@ async function registerSubcommand(
|
|
|
1228
1306
|
return resolveRegion({
|
|
1229
1307
|
options: options as Record<string, unknown>,
|
|
1230
1308
|
apiClient,
|
|
1309
|
+
apiUrl: getAPIBaseURL(baseCtx.config),
|
|
1231
1310
|
logger: baseCtx.logger,
|
|
1232
1311
|
required: !!normalized.requiresRegion,
|
|
1233
1312
|
region: project?.region,
|
|
@@ -1341,6 +1420,7 @@ async function registerSubcommand(
|
|
|
1341
1420
|
const region = await resolveRegion({
|
|
1342
1421
|
options: options as Record<string, unknown>,
|
|
1343
1422
|
apiClient,
|
|
1423
|
+
apiUrl: getAPIBaseURL(baseCtx.config),
|
|
1344
1424
|
logger: baseCtx.logger,
|
|
1345
1425
|
required: !!normalized.requiresRegion,
|
|
1346
1426
|
region: project?.region,
|
|
@@ -1405,6 +1485,7 @@ async function registerSubcommand(
|
|
|
1405
1485
|
const region = await resolveRegion({
|
|
1406
1486
|
options: options as Record<string, unknown>,
|
|
1407
1487
|
apiClient,
|
|
1488
|
+
apiUrl: getAPIBaseURL(baseCtx.config),
|
|
1408
1489
|
logger: baseCtx.logger,
|
|
1409
1490
|
required: !!normalized.requiresRegion,
|
|
1410
1491
|
});
|
|
@@ -1516,6 +1597,7 @@ async function registerSubcommand(
|
|
|
1516
1597
|
const region = await resolveRegion({
|
|
1517
1598
|
options: options as Record<string, unknown>,
|
|
1518
1599
|
apiClient,
|
|
1600
|
+
apiUrl: getAPIBaseURL(baseCtx.config),
|
|
1519
1601
|
logger: baseCtx.logger,
|
|
1520
1602
|
required: !!normalized.requiresRegion,
|
|
1521
1603
|
region: project?.region,
|
|
@@ -1644,6 +1726,7 @@ export async function registerCommands(
|
|
|
1644
1726
|
const region = await resolveRegion({
|
|
1645
1727
|
options: baseCtx.options as unknown as Record<string, unknown>,
|
|
1646
1728
|
apiClient,
|
|
1729
|
+
apiUrl: getAPIBaseURL(baseCtx.config),
|
|
1647
1730
|
logger: baseCtx.logger,
|
|
1648
1731
|
required: !!normalized.requiresRegion,
|
|
1649
1732
|
});
|
|
@@ -1701,6 +1784,7 @@ export async function registerCommands(
|
|
|
1701
1784
|
const region = await resolveRegion({
|
|
1702
1785
|
options: baseCtx.options as unknown as Record<string, unknown>,
|
|
1703
1786
|
apiClient,
|
|
1787
|
+
apiUrl: getAPIBaseURL(baseCtx.config),
|
|
1704
1788
|
logger: baseCtx.logger,
|
|
1705
1789
|
required: !!normalized.requiresRegion,
|
|
1706
1790
|
});
|
|
@@ -1721,6 +1805,7 @@ export async function registerCommands(
|
|
|
1721
1805
|
const region = await resolveRegion({
|
|
1722
1806
|
options: baseCtx.options as unknown as Record<string, unknown>,
|
|
1723
1807
|
apiClient,
|
|
1808
|
+
apiUrl: getAPIBaseURL(baseCtx.config),
|
|
1724
1809
|
logger: baseCtx.logger,
|
|
1725
1810
|
required: !!normalized.requiresRegion,
|
|
1726
1811
|
});
|
|
@@ -13,7 +13,15 @@ interface SkillInfo {
|
|
|
13
13
|
fullCommandPath: string[];
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
const EXCLUDED_COMMANDS = new Set([
|
|
16
|
+
const EXCLUDED_COMMANDS = new Set([
|
|
17
|
+
'ai',
|
|
18
|
+
'help',
|
|
19
|
+
'version',
|
|
20
|
+
'canary',
|
|
21
|
+
'setup',
|
|
22
|
+
'profile',
|
|
23
|
+
'upgrade',
|
|
24
|
+
]);
|
|
17
25
|
|
|
18
26
|
function isValidSkillName(name: string): boolean {
|
|
19
27
|
if (name.length < 1 || name.length > 64) return false;
|
|
@@ -46,11 +46,146 @@ interface ASTCallExpression extends ASTNode {
|
|
|
46
46
|
callee: ASTNode;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
+
interface ASTMemberExpression extends ASTNode {
|
|
50
|
+
object: ASTNode;
|
|
51
|
+
property: ASTNode;
|
|
52
|
+
computed?: boolean;
|
|
53
|
+
}
|
|
54
|
+
|
|
49
55
|
interface ASTVariableDeclarator extends ASTNode {
|
|
50
56
|
id: ASTNode;
|
|
51
57
|
init?: ASTNode;
|
|
52
58
|
}
|
|
53
59
|
|
|
60
|
+
interface ASTVariableDeclaration extends ASTNode {
|
|
61
|
+
declarations: ASTVariableDeclarator[];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
interface ASTExportNamedDeclaration extends ASTNode {
|
|
65
|
+
declaration?: ASTNode;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
interface ASTProgram {
|
|
69
|
+
type: string;
|
|
70
|
+
body: ASTNode[];
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Type for identifier resolver function
|
|
75
|
+
*/
|
|
76
|
+
type IdentifierResolver = (name: string) => ASTNode | undefined;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Build a file-local identifier resolver that maps top-level variable names
|
|
80
|
+
* to their initializer AST nodes. This allows resolving schema variable references.
|
|
81
|
+
*/
|
|
82
|
+
function buildIdentifierResolver(program: ASTProgram): IdentifierResolver {
|
|
83
|
+
const initMap = new Map<string, ASTNode>();
|
|
84
|
+
|
|
85
|
+
for (const node of program.body) {
|
|
86
|
+
// const x = ... or let x = ... or var x = ...
|
|
87
|
+
if (node.type === 'VariableDeclaration') {
|
|
88
|
+
const decl = node as unknown as ASTVariableDeclaration;
|
|
89
|
+
for (const d of decl.declarations) {
|
|
90
|
+
if (d.id.type === 'Identifier' && d.init) {
|
|
91
|
+
const id = d.id as ASTNodeIdentifier;
|
|
92
|
+
initMap.set(id.name, d.init);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// export const x = ...
|
|
98
|
+
if (node.type === 'ExportNamedDeclaration') {
|
|
99
|
+
const exp = node as unknown as ASTExportNamedDeclaration;
|
|
100
|
+
if (exp.declaration && exp.declaration.type === 'VariableDeclaration') {
|
|
101
|
+
const decl = exp.declaration as unknown as ASTVariableDeclaration;
|
|
102
|
+
for (const d of decl.declarations) {
|
|
103
|
+
if (d.id.type === 'Identifier' && d.init) {
|
|
104
|
+
const id = d.id as ASTNodeIdentifier;
|
|
105
|
+
initMap.set(id.name, d.init);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return (name: string) => initMap.get(name);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Get the property name from an AST node (Identifier or Literal).
|
|
117
|
+
*/
|
|
118
|
+
function getPropertyName(node: ASTNode): string | undefined {
|
|
119
|
+
if (node.type === 'Identifier') {
|
|
120
|
+
return (node as ASTNodeIdentifier).name;
|
|
121
|
+
}
|
|
122
|
+
if (node.type === 'Literal') {
|
|
123
|
+
const lit = node as ASTLiteral;
|
|
124
|
+
return typeof lit.value === 'string' ? lit.value : undefined;
|
|
125
|
+
}
|
|
126
|
+
return undefined;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Resolve an expression by following identifier references and member access chains.
|
|
131
|
+
* Applies a recursion limit to prevent infinite loops from cyclic references.
|
|
132
|
+
*
|
|
133
|
+
* Supported patterns:
|
|
134
|
+
* - Identifiers: `AgentInput` -> resolves to variable definition
|
|
135
|
+
* - Member access: `configs.agent1.schema` -> traverses object literals
|
|
136
|
+
*/
|
|
137
|
+
function resolveExpression(
|
|
138
|
+
node: ASTNode,
|
|
139
|
+
resolveIdentifier: IdentifierResolver,
|
|
140
|
+
depth = 0
|
|
141
|
+
): ASTNode {
|
|
142
|
+
if (!node) return node;
|
|
143
|
+
if (depth > 8) return node; // Prevent cycles / deep alias chains
|
|
144
|
+
|
|
145
|
+
// Follow identifiers to their definitions
|
|
146
|
+
if (node.type === 'Identifier') {
|
|
147
|
+
const id = node as ASTNodeIdentifier;
|
|
148
|
+
const resolved = resolveIdentifier(id.name);
|
|
149
|
+
if (resolved) {
|
|
150
|
+
return resolveExpression(resolved, resolveIdentifier, depth + 1);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// Follow member expressions: configs.agent1.schema, baseSchemas.shared
|
|
155
|
+
if (node.type === 'MemberExpression') {
|
|
156
|
+
const memberExpr = node as unknown as ASTMemberExpression;
|
|
157
|
+
|
|
158
|
+
// Skip computed properties like configs[agentName]
|
|
159
|
+
if (memberExpr.computed) return node;
|
|
160
|
+
|
|
161
|
+
const propName = getPropertyName(memberExpr.property);
|
|
162
|
+
if (!propName) return node;
|
|
163
|
+
|
|
164
|
+
// First resolve the object side (e.g., configs -> { agent1: {...} })
|
|
165
|
+
const resolvedObj = resolveExpression(memberExpr.object, resolveIdentifier, depth + 1);
|
|
166
|
+
|
|
167
|
+
// If we got an object literal, look up the property
|
|
168
|
+
if (resolvedObj.type === 'ObjectExpression') {
|
|
169
|
+
const obj = resolvedObj as ASTObjectExpression;
|
|
170
|
+
for (const prop of obj.properties) {
|
|
171
|
+
// Skip spread elements
|
|
172
|
+
if (!prop || !('key' in prop) || !prop.key) continue;
|
|
173
|
+
|
|
174
|
+
const keyName = getPropertyName(prop.key);
|
|
175
|
+
if (keyName === propName && prop.value) {
|
|
176
|
+
// Recurse into the property value
|
|
177
|
+
return resolveExpression(prop.value as ASTNode, resolveIdentifier, depth + 1);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// Couldn't resolve - return original node
|
|
183
|
+
return node;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
return node;
|
|
187
|
+
}
|
|
188
|
+
|
|
54
189
|
export interface AgentMetadata {
|
|
55
190
|
filename: string;
|
|
56
191
|
name: string;
|
|
@@ -117,9 +252,43 @@ function generateStableEvalId(projectId: string, agentId: string, name: string):
|
|
|
117
252
|
}
|
|
118
253
|
|
|
119
254
|
/**
|
|
120
|
-
*
|
|
255
|
+
* Check if a property key matches a given name.
|
|
256
|
+
* Handles both Identifier keys (schema) and Literal keys ('schema').
|
|
121
257
|
*/
|
|
122
|
-
function
|
|
258
|
+
function isKeyNamed(prop: ASTPropertyNode, name: 'schema' | 'input' | 'output'): boolean {
|
|
259
|
+
if (!prop || !prop.key) return false;
|
|
260
|
+
|
|
261
|
+
if (prop.key.type === 'Identifier') {
|
|
262
|
+
return (prop.key as ASTNodeIdentifier).name === name;
|
|
263
|
+
}
|
|
264
|
+
if (prop.key.type === 'Literal') {
|
|
265
|
+
const lit = prop.key as unknown as ASTLiteral;
|
|
266
|
+
return typeof lit.value === 'string' && lit.value === name;
|
|
267
|
+
}
|
|
268
|
+
return false;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Extract schema code from createAgent call arguments.
|
|
273
|
+
* Resolves variable references to their actual definitions when possible.
|
|
274
|
+
*
|
|
275
|
+
* Supported patterns:
|
|
276
|
+
* - Inline schema: `schema: { input: s.object({...}), output: s.object({...}) }`
|
|
277
|
+
* - Variable reference: `schema: { input: AgentInput, output: AgentOutput }`
|
|
278
|
+
* - Schema object variable: `schema: schemaVar` where schemaVar is a top-level const
|
|
279
|
+
* - Shorthand: `schema: { input, output }` where input/output are top-level consts
|
|
280
|
+
*
|
|
281
|
+
* Unsupported patterns (returns empty or partial result):
|
|
282
|
+
* - Config alias: `createAgent('x', configVar)` - config must be inline object
|
|
283
|
+
* - Schema from member access: `schema: configs.agent1.schema`
|
|
284
|
+
* - Schema from function call: `schema: getSchema()`
|
|
285
|
+
* - Destructured variables: `const { schema } = config`
|
|
286
|
+
* - Cross-file imports (falls back to identifier name)
|
|
287
|
+
*/
|
|
288
|
+
function extractSchemaCode(
|
|
289
|
+
callargexp: ASTObjectExpression,
|
|
290
|
+
resolveIdentifier: IdentifierResolver
|
|
291
|
+
): {
|
|
123
292
|
inputSchemaCode?: string;
|
|
124
293
|
outputSchemaCode?: string;
|
|
125
294
|
} {
|
|
@@ -127,9 +296,16 @@ function extractSchemaCode(callargexp: ASTObjectExpression): {
|
|
|
127
296
|
|
|
128
297
|
// Find the schema property
|
|
129
298
|
for (const prop of callargexp.properties) {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
299
|
+
// Skip spread elements or any non-Property nodes
|
|
300
|
+
if (!prop || !('key' in prop) || !prop.key) continue;
|
|
301
|
+
|
|
302
|
+
if (isKeyNamed(prop, 'schema')) {
|
|
303
|
+
// Resolve the schema value if it's an identifier (e.g., schema: schemaVar)
|
|
304
|
+
let valueNode = prop.value as ASTNode;
|
|
305
|
+
valueNode = resolveExpression(valueNode, resolveIdentifier);
|
|
306
|
+
|
|
307
|
+
if (valueNode.type === 'ObjectExpression') {
|
|
308
|
+
schemaObj = valueNode as ASTObjectExpression;
|
|
133
309
|
break;
|
|
134
310
|
}
|
|
135
311
|
}
|
|
@@ -144,12 +320,17 @@ function extractSchemaCode(callargexp: ASTObjectExpression): {
|
|
|
144
320
|
|
|
145
321
|
// Extract input and output schema code
|
|
146
322
|
for (const prop of schemaObj.properties) {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
323
|
+
// Skip spread elements or any non-Property nodes
|
|
324
|
+
if (!prop || !('key' in prop) || !prop.key) continue;
|
|
325
|
+
|
|
326
|
+
if (isKeyNamed(prop, 'input') && prop.value) {
|
|
327
|
+
// Resolve variable reference if the value is an identifier
|
|
328
|
+
const resolvedValue = resolveExpression(prop.value as ASTNode, resolveIdentifier);
|
|
329
|
+
inputSchemaCode = formatSchemaCode(generate(resolvedValue));
|
|
330
|
+
} else if (isKeyNamed(prop, 'output') && prop.value) {
|
|
331
|
+
// Resolve variable reference if the value is an identifier
|
|
332
|
+
const resolvedValue = resolveExpression(prop.value as ASTNode, resolveIdentifier);
|
|
333
|
+
outputSchemaCode = formatSchemaCode(generate(resolvedValue));
|
|
153
334
|
}
|
|
154
335
|
}
|
|
155
336
|
|
|
@@ -179,13 +360,19 @@ function extractAgentMetadata(
|
|
|
179
360
|
projectId: string,
|
|
180
361
|
deploymentId: string
|
|
181
362
|
): AgentMetadata | null {
|
|
182
|
-
const ast = acornLoose.parse(code, {
|
|
363
|
+
const ast = acornLoose.parse(code, {
|
|
364
|
+
ecmaVersion: 'latest',
|
|
365
|
+
sourceType: 'module',
|
|
366
|
+
}) as ASTProgram;
|
|
367
|
+
|
|
368
|
+
// Build identifier resolver for resolving schema variable references
|
|
369
|
+
const resolveIdentifier = buildIdentifierResolver(ast);
|
|
183
370
|
|
|
184
371
|
// Calculate file version (hash of contents)
|
|
185
372
|
const version = hash(code);
|
|
186
373
|
|
|
187
374
|
// Find createAgent calls
|
|
188
|
-
for (const node of
|
|
375
|
+
for (const node of ast.body) {
|
|
189
376
|
if (node.type === 'ExportDefaultDeclaration') {
|
|
190
377
|
const declaration = (node as unknown as { declaration: ASTNode }).declaration;
|
|
191
378
|
|
|
@@ -204,8 +391,11 @@ function extractAgentMetadata(
|
|
|
204
391
|
// Second arg is config object
|
|
205
392
|
const callargexp = callExpr.arguments[1] as ASTObjectExpression;
|
|
206
393
|
|
|
207
|
-
// Extract schemas
|
|
208
|
-
const { inputSchemaCode, outputSchemaCode } = extractSchemaCode(
|
|
394
|
+
// Extract schemas (with variable resolution)
|
|
395
|
+
const { inputSchemaCode, outputSchemaCode } = extractSchemaCode(
|
|
396
|
+
callargexp,
|
|
397
|
+
resolveIdentifier
|
|
398
|
+
);
|
|
209
399
|
|
|
210
400
|
// Extract description from either direct property or metadata object
|
|
211
401
|
let description: string | undefined;
|
|
@@ -262,7 +452,10 @@ function extractAgentMetadata(
|
|
|
262
452
|
const name = String(nameArg.value);
|
|
263
453
|
|
|
264
454
|
const callargexp = callExpr.arguments[1] as ASTObjectExpression;
|
|
265
|
-
const { inputSchemaCode, outputSchemaCode } = extractSchemaCode(
|
|
455
|
+
const { inputSchemaCode, outputSchemaCode } = extractSchemaCode(
|
|
456
|
+
callargexp,
|
|
457
|
+
resolveIdentifier
|
|
458
|
+
);
|
|
266
459
|
|
|
267
460
|
let description: string | undefined;
|
|
268
461
|
for (const prop of callargexp.properties) {
|
|
@@ -20,8 +20,10 @@ This directory contains auto-generated TypeScript files created by the Agentuity
|
|
|
20
20
|
- \`registry.ts\` - Agent registry from \`src/agent/**\`
|
|
21
21
|
- \`routes.ts\` - Route registry from \`src/api/**\`
|
|
22
22
|
- \`app.ts\` - Application entry point
|
|
23
|
-
- \`
|
|
24
|
-
- \`
|
|
23
|
+
- \`analytics-config.ts\` - Web analytics configuration from \`agentuity.json\`
|
|
24
|
+
- \`webanalytics.ts\` - Web analytics injection and route registration
|
|
25
|
+
- \`state.ts\` - App state type (only generated when \`setup()\` returns state in \`app.ts\`)
|
|
26
|
+
- \`router.ts\` - Runtime wrapper with type augmentation (only generated when \`setup()\` returns state in \`app.ts\`)
|
|
25
27
|
|
|
26
28
|
## For Developers
|
|
27
29
|
|
|
@@ -50,8 +52,10 @@ const AGENTS_MD_CONTENT = `# AI Agent Instructions
|
|
|
50
52
|
- \`registry.ts\` - Built from agent discovery in \`src/agent/\`
|
|
51
53
|
- \`routes.ts\` - Built from route discovery in \`src/api/\`
|
|
52
54
|
- \`app.ts\` - Entry point assembled from project configuration
|
|
53
|
-
- \`
|
|
54
|
-
- \`
|
|
55
|
+
- \`analytics-config.ts\` - Web analytics configuration from \`agentuity.json\`
|
|
56
|
+
- \`webanalytics.ts\` - Web analytics injection and route registration
|
|
57
|
+
- \`state.ts\` - App state type (only generated when \`setup()\` returns state in \`app.ts\`)
|
|
58
|
+
- \`router.ts\` - Runtime wrapper with type augmentation (only generated when \`setup()\` returns state)
|
|
55
59
|
|
|
56
60
|
These files are regenerated on every \`bun run build\` or \`bun run dev\`.
|
|
57
61
|
`;
|
|
@@ -745,7 +745,7 @@ function generateAgentsMd(metadata: BuildMetadata): string {
|
|
|
745
745
|
lines.push('**User & Permissions:**');
|
|
746
746
|
lines.push('- User: `agentuity` (UID: 1022, GID: 1777)');
|
|
747
747
|
lines.push('- Home directory: `/home/agentuity`');
|
|
748
|
-
lines.push('- Working directory: `/home/agentuity
|
|
748
|
+
lines.push('- Working directory: `/home/agentuity` (application code deployed here)');
|
|
749
749
|
lines.push('- Logs directory: `/home/agentuity/logs`');
|
|
750
750
|
lines.push('- Temp directory: `/home/agentuity/tmp`');
|
|
751
751
|
lines.push('');
|
|
@@ -935,11 +935,15 @@ ${routeSchemaTypes}
|
|
|
935
935
|
* Route Definitions
|
|
936
936
|
*
|
|
937
937
|
* Type-safe route registry for all API routes, WebSocket connections, and SSE endpoints.
|
|
938
|
-
* Used by @agentuity/react for client-side type-safe routing.
|
|
938
|
+
* Used by @agentuity/react and @agentuity/frontend for client-side type-safe routing.
|
|
939
939
|
*
|
|
940
940
|
* @remarks
|
|
941
941
|
* This module augmentation is auto-generated from your route files during build.
|
|
942
942
|
* Individual route Input/Output types are exported above for direct usage.
|
|
943
|
+
*
|
|
944
|
+
* The augmentation targets @agentuity/frontend (the canonical source of registry types).
|
|
945
|
+
* Since @agentuity/react re-exports these types, the augmentation is visible when
|
|
946
|
+
* importing from either package.
|
|
943
947
|
*/
|
|
944
948
|
${
|
|
945
949
|
shouldEmitFrontendClient
|
|
@@ -956,7 +960,7 @@ ${rpcRegistryType}
|
|
|
956
960
|
`
|
|
957
961
|
: ''
|
|
958
962
|
}
|
|
959
|
-
declare module '@agentuity/
|
|
963
|
+
declare module '@agentuity/frontend' {
|
|
960
964
|
\t/**
|
|
961
965
|
\t * API Route Registry
|
|
962
966
|
\t *
|
|
@@ -988,13 +992,34 @@ ${sseRouteEntries}
|
|
|
988
992
|
\t * RPC Route Registry
|
|
989
993
|
\t *
|
|
990
994
|
\t * Nested structure for RPC-style client access (e.g., client.hello.post())
|
|
991
|
-
\t * Used by createClient() from @agentuity/
|
|
995
|
+
\t * Used by createClient() from @agentuity/frontend for type-safe RPC calls.
|
|
992
996
|
\t */
|
|
993
997
|
\texport interface RPCRouteRegistry {
|
|
994
998
|
${rpcRegistryType}
|
|
995
999
|
\t}
|
|
996
1000
|
}
|
|
997
|
-
|
|
1001
|
+
${
|
|
1002
|
+
hasReactDependency
|
|
1003
|
+
? `
|
|
1004
|
+
// Backward compatibility: also augment @agentuity/react for older versions
|
|
1005
|
+
// that define RouteRegistry locally instead of re-exporting from @agentuity/frontend
|
|
1006
|
+
declare module '@agentuity/react' {
|
|
1007
|
+
\texport interface RouteRegistry {
|
|
1008
|
+
${apiRouteEntries}
|
|
1009
|
+
\t}
|
|
1010
|
+
\texport interface WebSocketRouteRegistry {
|
|
1011
|
+
${websocketRouteEntries}
|
|
1012
|
+
\t}
|
|
1013
|
+
\texport interface SSERouteRegistry {
|
|
1014
|
+
${sseRouteEntries}
|
|
1015
|
+
\t}
|
|
1016
|
+
\texport interface RPCRouteRegistry {
|
|
1017
|
+
${rpcRegistryType}
|
|
1018
|
+
\t}
|
|
1019
|
+
}
|
|
1020
|
+
`
|
|
1021
|
+
: ''
|
|
1022
|
+
}
|
|
998
1023
|
/**
|
|
999
1024
|
* Runtime metadata for RPC routes.
|
|
1000
1025
|
* Contains route type information for client routing decisions.
|
|
@@ -196,10 +196,7 @@ export async function installExternalsAndBuild(options: ServerBundleOptions): Pr
|
|
|
196
196
|
// Use npm with --force for cross-platform installs since Bun's --target flag
|
|
197
197
|
// doesn't correctly handle optional dependencies for other platforms
|
|
198
198
|
const allPackagesToInstall = [...externalInstalls, ...platformOptionalDeps];
|
|
199
|
-
logger.debug(
|
|
200
|
-
'Installing with npm (cross-platform): %s',
|
|
201
|
-
allPackagesToInstall.join(', ')
|
|
202
|
-
);
|
|
199
|
+
logger.debug('Installing with npm (cross-platform): %s', allPackagesToInstall.join(', '));
|
|
203
200
|
|
|
204
201
|
const proc = Bun.spawn(
|
|
205
202
|
[
|
|
@@ -70,9 +70,12 @@ export async function generateAssetServerConfig(
|
|
|
70
70
|
dedupe: ['react', 'react-dom', 'react/jsx-runtime', 'react/jsx-dev-runtime'],
|
|
71
71
|
},
|
|
72
72
|
|
|
73
|
-
// Pre-bundle
|
|
73
|
+
// Pre-bundle dependencies to avoid React preamble issues with pre-built JSX
|
|
74
|
+
// Only include @agentuity/workbench if workbench is enabled
|
|
74
75
|
optimizeDeps: {
|
|
75
|
-
include:
|
|
76
|
+
include: workbenchPath
|
|
77
|
+
? ['@agentuity/workbench', '@agentuity/core', '@agentuity/react']
|
|
78
|
+
: ['@agentuity/core', '@agentuity/react'],
|
|
76
79
|
},
|
|
77
80
|
|
|
78
81
|
// Only allow frontend env vars (server uses process.env)
|