@agentuity/cli 0.1.43 → 0.1.45
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/auth.d.ts +2 -2
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +7 -5
- package/dist/auth.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +24 -12
- package/dist/cli.js.map +1 -1
- package/dist/cmd/build/entry-generator.d.ts.map +1 -1
- package/dist/cmd/build/entry-generator.js +26 -17
- package/dist/cmd/build/entry-generator.js.map +1 -1
- package/dist/cmd/build/vite/public-asset-path-plugin.d.ts +17 -20
- package/dist/cmd/build/vite/public-asset-path-plugin.d.ts.map +1 -1
- package/dist/cmd/build/vite/public-asset-path-plugin.js +62 -43
- package/dist/cmd/build/vite/public-asset-path-plugin.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 +3 -1
- package/dist/cmd/build/vite/vite-asset-server-config.js.map +1 -1
- package/dist/cmd/build/vite/vite-builder.js +1 -1
- package/dist/cmd/build/vite/vite-builder.js.map +1 -1
- package/dist/cmd/canary/index.js +1 -1
- package/dist/cmd/canary/index.js.map +1 -1
- package/dist/cmd/cloud/env/org-util.d.ts +2 -1
- package/dist/cmd/cloud/env/org-util.d.ts.map +1 -1
- package/dist/cmd/cloud/env/org-util.js +4 -2
- package/dist/cmd/cloud/env/org-util.js.map +1 -1
- package/dist/cmd/cloud/stream/create.d.ts +3 -0
- package/dist/cmd/cloud/stream/create.d.ts.map +1 -0
- package/dist/cmd/cloud/stream/create.js +227 -0
- package/dist/cmd/cloud/stream/create.js.map +1 -0
- package/dist/cmd/cloud/stream/delete.d.ts.map +1 -1
- package/dist/cmd/cloud/stream/delete.js +2 -1
- package/dist/cmd/cloud/stream/delete.js.map +1 -1
- package/dist/cmd/cloud/stream/get.d.ts.map +1 -1
- package/dist/cmd/cloud/stream/get.js +2 -1
- package/dist/cmd/cloud/stream/get.js.map +1 -1
- package/dist/cmd/cloud/stream/index.d.ts.map +1 -1
- package/dist/cmd/cloud/stream/index.js +10 -1
- package/dist/cmd/cloud/stream/index.js.map +1 -1
- package/dist/cmd/cloud/stream/list.d.ts.map +1 -1
- package/dist/cmd/cloud/stream/list.js +2 -1
- package/dist/cmd/cloud/stream/list.js.map +1 -1
- package/dist/cmd/cloud/stream/util.d.ts +6 -5
- package/dist/cmd/cloud/stream/util.d.ts.map +1 -1
- package/dist/cmd/cloud/stream/util.js +26 -5
- package/dist/cmd/cloud/stream/util.js.map +1 -1
- package/dist/cmd/upgrade/index.d.ts.map +1 -1
- package/dist/cmd/upgrade/index.js +23 -0
- package/dist/cmd/upgrade/index.js.map +1 -1
- package/dist/cmd/upgrade/npm-availability.d.ts +44 -0
- package/dist/cmd/upgrade/npm-availability.d.ts.map +1 -0
- package/dist/cmd/upgrade/npm-availability.js +73 -0
- package/dist/cmd/upgrade/npm-availability.js.map +1 -0
- package/dist/tui.d.ts +9 -1
- package/dist/tui.d.ts.map +1 -1
- package/dist/tui.js +39 -14
- package/dist/tui.js.map +1 -1
- package/dist/version-check.d.ts.map +1 -1
- package/dist/version-check.js +13 -2
- package/dist/version-check.js.map +1 -1
- package/package.json +6 -6
- package/src/auth.ts +9 -5
- package/src/cli.ts +44 -12
- package/src/cmd/build/entry-generator.ts +26 -17
- package/src/cmd/build/vite/public-asset-path-plugin.ts +73 -51
- package/src/cmd/build/vite/vite-asset-server-config.ts +3 -1
- package/src/cmd/build/vite/vite-builder.ts +1 -1
- package/src/cmd/canary/index.ts +1 -1
- package/src/cmd/cloud/env/org-util.ts +5 -2
- package/src/cmd/cloud/stream/create.ts +248 -0
- package/src/cmd/cloud/stream/delete.ts +2 -1
- package/src/cmd/cloud/stream/get.ts +2 -1
- package/src/cmd/cloud/stream/index.ts +10 -1
- package/src/cmd/cloud/stream/list.ts +2 -1
- package/src/cmd/cloud/stream/util.ts +39 -12
- package/src/cmd/upgrade/index.ts +25 -0
- package/src/cmd/upgrade/npm-availability.ts +105 -0
- package/src/tui.ts +42 -14
- package/src/version-check.ts +19 -3
package/src/cli.ts
CHANGED
|
@@ -1198,9 +1198,12 @@ async function registerSubcommand(
|
|
|
1198
1198
|
// Recreate apiClient with auth credentials
|
|
1199
1199
|
ctx.apiClient = createAPIClient(baseCtx, ctx.config as Config | null);
|
|
1200
1200
|
}
|
|
1201
|
+
// Auto-select org when --confirm flag is used
|
|
1202
|
+
const autoSelectOrg = options.confirm === true;
|
|
1201
1203
|
if (normalized.requiresOrg) {
|
|
1202
1204
|
ctx.orgId = await requireOrg(
|
|
1203
|
-
ctx as CommandContext & { apiClient: APIClientType }
|
|
1205
|
+
ctx as CommandContext & { apiClient: APIClientType },
|
|
1206
|
+
autoSelectOrg
|
|
1204
1207
|
);
|
|
1205
1208
|
}
|
|
1206
1209
|
// Skip org handling if --no-register is set (org only needed for registration)
|
|
@@ -1212,7 +1215,8 @@ async function registerSubcommand(
|
|
|
1212
1215
|
|
|
1213
1216
|
if (normalized.optionalOrg && ctx.auth && !skipOrg) {
|
|
1214
1217
|
ctx.orgId = await selectOptionalOrg(
|
|
1215
|
-
ctx as CommandContext & { apiClient: APIClientType }
|
|
1218
|
+
ctx as CommandContext & { apiClient: APIClientType },
|
|
1219
|
+
autoSelectOrg
|
|
1216
1220
|
);
|
|
1217
1221
|
}
|
|
1218
1222
|
// Skip region handling if --no-register is set (region only needed for registration)
|
|
@@ -1302,8 +1306,13 @@ async function registerSubcommand(
|
|
|
1302
1306
|
// Recreate apiClient with auth credentials
|
|
1303
1307
|
ctx.apiClient = createAPIClient(baseCtx, ctx.config as Config | null);
|
|
1304
1308
|
}
|
|
1309
|
+
// Auto-select org when --confirm flag is used
|
|
1310
|
+
const autoSelectOrg2 = options.confirm === true;
|
|
1305
1311
|
if (normalized.requiresOrg) {
|
|
1306
|
-
ctx.orgId = await requireOrg(
|
|
1312
|
+
ctx.orgId = await requireOrg(
|
|
1313
|
+
ctx as CommandContext & { apiClient: APIClientType },
|
|
1314
|
+
autoSelectOrg2
|
|
1315
|
+
);
|
|
1307
1316
|
}
|
|
1308
1317
|
// Skip org handling if --no-register is set (org only needed for registration)
|
|
1309
1318
|
const skipOrg =
|
|
@@ -1314,7 +1323,8 @@ async function registerSubcommand(
|
|
|
1314
1323
|
|
|
1315
1324
|
if (normalized.optionalOrg && ctx.auth && !skipOrg) {
|
|
1316
1325
|
ctx.orgId = await selectOptionalOrg(
|
|
1317
|
-
ctx as CommandContext & { apiClient: APIClientType }
|
|
1326
|
+
ctx as CommandContext & { apiClient: APIClientType },
|
|
1327
|
+
autoSelectOrg2
|
|
1318
1328
|
);
|
|
1319
1329
|
}
|
|
1320
1330
|
// Skip region handling if --no-register is set (region only needed for registration)
|
|
@@ -1454,9 +1464,12 @@ async function registerSubcommand(
|
|
|
1454
1464
|
!!ctx.apiClient,
|
|
1455
1465
|
!!auth
|
|
1456
1466
|
);
|
|
1467
|
+
// Auto-select org when --confirm flag is used
|
|
1468
|
+
const autoSelectOrg3 = options.confirm === true;
|
|
1457
1469
|
if (normalized.requiresOrg && ctx.apiClient) {
|
|
1458
1470
|
ctx.orgId = await requireOrg(
|
|
1459
|
-
ctx as CommandContext & { apiClient: APIClientType }
|
|
1471
|
+
ctx as CommandContext & { apiClient: APIClientType },
|
|
1472
|
+
autoSelectOrg3
|
|
1460
1473
|
);
|
|
1461
1474
|
}
|
|
1462
1475
|
// Skip org handling if --no-register is set (org only needed for registration)
|
|
@@ -1468,7 +1481,8 @@ async function registerSubcommand(
|
|
|
1468
1481
|
|
|
1469
1482
|
if (normalized.optionalOrg && ctx.apiClient && auth && !skipOrg) {
|
|
1470
1483
|
ctx.orgId = await selectOptionalOrg(
|
|
1471
|
-
ctx as CommandContext & { apiClient?: APIClientType; auth?: AuthData }
|
|
1484
|
+
ctx as CommandContext & { apiClient?: APIClientType; auth?: AuthData },
|
|
1485
|
+
autoSelectOrg3
|
|
1472
1486
|
);
|
|
1473
1487
|
baseCtx.logger.trace('selected orgId: %s', ctx.orgId);
|
|
1474
1488
|
}
|
|
@@ -1551,8 +1565,13 @@ async function registerSubcommand(
|
|
|
1551
1565
|
// Recreate apiClient with auth credentials if auth was provided
|
|
1552
1566
|
ctx.apiClient = createAPIClient(baseCtx, ctx.config as Config | null);
|
|
1553
1567
|
}
|
|
1568
|
+
// Auto-select org when --confirm flag is used
|
|
1569
|
+
const autoSelectOrg4 = options.confirm === true;
|
|
1554
1570
|
if (normalized.requiresOrg && ctx.apiClient) {
|
|
1555
|
-
ctx.orgId = await requireOrg(
|
|
1571
|
+
ctx.orgId = await requireOrg(
|
|
1572
|
+
ctx as CommandContext & { apiClient: APIClientType },
|
|
1573
|
+
autoSelectOrg4
|
|
1574
|
+
);
|
|
1556
1575
|
}
|
|
1557
1576
|
// Skip org handling if --no-register is set (org only needed for registration)
|
|
1558
1577
|
// For non-schema commands, check options directly (Commander passes all options)
|
|
@@ -1563,7 +1582,8 @@ async function registerSubcommand(
|
|
|
1563
1582
|
|
|
1564
1583
|
if (normalized.optionalOrg && ctx.apiClient && !skipOrg) {
|
|
1565
1584
|
ctx.orgId = await selectOptionalOrg(
|
|
1566
|
-
ctx as CommandContext & { apiClient?: APIClientType; auth?: AuthData }
|
|
1585
|
+
ctx as CommandContext & { apiClient?: APIClientType; auth?: AuthData },
|
|
1586
|
+
autoSelectOrg4
|
|
1567
1587
|
);
|
|
1568
1588
|
}
|
|
1569
1589
|
// Skip region handling if --no-register is set (region only needed for registration)
|
|
@@ -1656,14 +1676,18 @@ async function registerSubcommand(
|
|
|
1656
1676
|
if (normalized.requiresAPIClient && !ctx.apiClient) {
|
|
1657
1677
|
ctx.apiClient = createAPIClient(baseCtx, ctx.config as Config | null);
|
|
1658
1678
|
}
|
|
1679
|
+
// Auto-select org when --confirm flag is used
|
|
1680
|
+
const autoSelectOrg5 = options.confirm === true;
|
|
1659
1681
|
if (normalized.requiresOrg && ctx.apiClient) {
|
|
1660
1682
|
ctx.orgId = await requireOrg(
|
|
1661
|
-
ctx as CommandContext & { apiClient: APIClientType }
|
|
1683
|
+
ctx as CommandContext & { apiClient: APIClientType },
|
|
1684
|
+
autoSelectOrg5
|
|
1662
1685
|
);
|
|
1663
1686
|
}
|
|
1664
1687
|
if (normalized.optionalOrg && ctx.apiClient && ctx.auth) {
|
|
1665
1688
|
ctx.orgId = await requireOrg(
|
|
1666
|
-
ctx as CommandContext & { apiClient: APIClientType }
|
|
1689
|
+
ctx as CommandContext & { apiClient: APIClientType },
|
|
1690
|
+
autoSelectOrg5
|
|
1667
1691
|
);
|
|
1668
1692
|
}
|
|
1669
1693
|
await executeOrValidate(
|
|
@@ -1697,11 +1721,19 @@ async function registerSubcommand(
|
|
|
1697
1721
|
if (normalized.requiresAPIClient && !ctx.apiClient) {
|
|
1698
1722
|
ctx.apiClient = createAPIClient(baseCtx, ctx.config as Config | null);
|
|
1699
1723
|
}
|
|
1724
|
+
// Auto-select org when --confirm flag is used
|
|
1725
|
+
const autoSelectOrg6 = options.confirm === true;
|
|
1700
1726
|
if (normalized.requiresOrg && ctx.apiClient) {
|
|
1701
|
-
ctx.orgId = await requireOrg(
|
|
1727
|
+
ctx.orgId = await requireOrg(
|
|
1728
|
+
ctx as CommandContext & { apiClient: APIClientType },
|
|
1729
|
+
autoSelectOrg6
|
|
1730
|
+
);
|
|
1702
1731
|
}
|
|
1703
1732
|
if (normalized.optionalOrg && ctx.apiClient && ctx.auth) {
|
|
1704
|
-
ctx.orgId = await requireOrg(
|
|
1733
|
+
ctx.orgId = await requireOrg(
|
|
1734
|
+
ctx as CommandContext & { apiClient: APIClientType },
|
|
1735
|
+
autoSelectOrg6
|
|
1736
|
+
);
|
|
1705
1737
|
}
|
|
1706
1738
|
if ((normalized.requiresRegion || normalized.optionalRegion) && ctx.apiClient) {
|
|
1707
1739
|
const apiClient: APIClientType = ctx.apiClient as APIClientType;
|
|
@@ -154,10 +154,11 @@ if (hasWorkbench) {
|
|
|
154
154
|
if (isDevelopment() && process.env.VITE_PORT) {
|
|
155
155
|
const VITE_ASSET_PORT = parseInt(process.env.VITE_PORT, 10);
|
|
156
156
|
|
|
157
|
-
const proxyToVite = async (c: Context) => {
|
|
158
|
-
const
|
|
157
|
+
const proxyToVite = async (c: Context, pathOverride?: string) => {
|
|
158
|
+
const targetPath = pathOverride ?? c.req.path;
|
|
159
|
+
const viteUrl = \`http://127.0.0.1:\${VITE_ASSET_PORT}\${targetPath}\`;
|
|
159
160
|
try {
|
|
160
|
-
otel.logger.debug(\`[Proxy] \${c.req.method} \${c.req.path} -> Vite:\${VITE_ASSET_PORT}\`);
|
|
161
|
+
otel.logger.debug(\`[Proxy] \${c.req.method} \${c.req.path} -> Vite:\${VITE_ASSET_PORT}\${targetPath}\`);
|
|
161
162
|
const res = await fetch(viteUrl, { signal: AbortSignal.timeout(10000) });
|
|
162
163
|
otel.logger.debug(\`[Proxy] \${c.req.path} -> \${res.status} (\${res.headers.get('content-type')})\`);
|
|
163
164
|
return new Response(res.body, {
|
|
@@ -276,34 +277,42 @@ if (isDevelopment() && process.env.VITE_PORT) {
|
|
|
276
277
|
});
|
|
277
278
|
|
|
278
279
|
// Vite client scripts and HMR
|
|
279
|
-
app.get('/@vite/*', proxyToVite);
|
|
280
|
-
app.get('/@react-refresh', proxyToVite);
|
|
280
|
+
app.get('/@vite/*', (c: Context) => proxyToVite(c));
|
|
281
|
+
app.get('/@react-refresh', (c: Context) => proxyToVite(c));
|
|
281
282
|
|
|
282
283
|
// Source files for HMR
|
|
283
|
-
app.get('/src/web/*', proxyToVite);
|
|
284
|
-
app.get('/src/*', proxyToVite); // Catch-all for other source files
|
|
284
|
+
app.get('/src/web/*', (c: Context) => proxyToVite(c));
|
|
285
|
+
app.get('/src/*', (c: Context) => proxyToVite(c)); // Catch-all for other source files
|
|
285
286
|
|
|
286
287
|
// Workbench source files (in .agentuity/workbench-src/)
|
|
287
|
-
app.get('/.agentuity/workbench-src/*', proxyToVite);
|
|
288
|
+
app.get('/.agentuity/workbench-src/*', (c: Context) => proxyToVite(c));
|
|
288
289
|
|
|
289
290
|
// Node modules (Vite transforms these)
|
|
290
|
-
app.get('/node_modules/*', proxyToVite);
|
|
291
|
+
app.get('/node_modules/*', (c: Context) => proxyToVite(c));
|
|
291
292
|
|
|
292
293
|
// Scoped packages (e.g., @agentuity/*, @types/*)
|
|
293
|
-
app.get('/@*', proxyToVite);
|
|
294
|
+
app.get('/@*', (c: Context) => proxyToVite(c));
|
|
294
295
|
|
|
295
296
|
// File system access (for Vite's @fs protocol)
|
|
296
|
-
app.get('/@fs/*', proxyToVite);
|
|
297
|
+
app.get('/@fs/*', (c: Context) => proxyToVite(c));
|
|
297
298
|
|
|
298
299
|
// Module resolution (for Vite's @id protocol)
|
|
299
|
-
app.get('/@id/*', proxyToVite);
|
|
300
|
+
app.get('/@id/*', (c: Context) => proxyToVite(c));
|
|
301
|
+
|
|
302
|
+
// Static assets - Vite serves src/web/public/* at root, but code uses /public/* paths
|
|
303
|
+
// In production, the plugin transforms /public/foo.svg to CDN URLs
|
|
304
|
+
// Rewrite /public/foo.svg -> /foo.svg before proxying to Vite
|
|
305
|
+
app.get('/public/*', (c: Context) => {
|
|
306
|
+
const rootPath = c.req.path.replace(/^\\/public/, '');
|
|
307
|
+
return proxyToVite(c, rootPath);
|
|
308
|
+
});
|
|
300
309
|
|
|
301
310
|
// Any .js, .jsx, .ts, .tsx files (catch remaining modules)
|
|
302
|
-
app.get('/*.js', proxyToVite);
|
|
303
|
-
app.get('/*.jsx', proxyToVite);
|
|
304
|
-
app.get('/*.ts', proxyToVite);
|
|
305
|
-
app.get('/*.tsx', proxyToVite);
|
|
306
|
-
app.get('/*.css', proxyToVite);
|
|
311
|
+
app.get('/*.js', (c: Context) => proxyToVite(c));
|
|
312
|
+
app.get('/*.jsx', (c: Context) => proxyToVite(c));
|
|
313
|
+
app.get('/*.ts', (c: Context) => proxyToVite(c));
|
|
314
|
+
app.get('/*.tsx', (c: Context) => proxyToVite(c));
|
|
315
|
+
app.get('/*.css', (c: Context) => proxyToVite(c));
|
|
307
316
|
}
|
|
308
317
|
`;
|
|
309
318
|
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Vite plugin to fix incorrect public asset paths
|
|
3
3
|
*
|
|
4
|
-
* Developers
|
|
5
|
-
*
|
|
4
|
+
* Developers should use /public/ paths for static assets from src/web/public/.
|
|
5
|
+
* In production, these paths are transformed to CDN URLs.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
* This plugin:
|
|
8
|
+
* 1. During build: Rewrites /public/* paths to CDN URLs
|
|
9
|
+
* 2. During dev: Warns only about incorrect source paths (src/web/public/)
|
|
9
10
|
*
|
|
10
|
-
*
|
|
11
|
-
* - '/
|
|
12
|
-
* - './
|
|
13
|
-
* - 'src/web/public/foo.svg' → '/foo.svg'
|
|
14
|
-
* - './public/foo.svg' → '/foo.svg'
|
|
15
|
-
* - '/public/foo.svg' → '/foo.svg'
|
|
11
|
+
* Supported patterns (work in dev, rewritten to CDN in production):
|
|
12
|
+
* - '/public/foo.svg' → CDN URL (recommended)
|
|
13
|
+
* - './public/foo.svg' → CDN URL
|
|
16
14
|
*
|
|
17
|
-
*
|
|
15
|
+
* Incorrect patterns (warned in dev, rewritten in production):
|
|
16
|
+
* - '/src/web/public/foo.svg' → CDN URL
|
|
17
|
+
* - './src/web/public/foo.svg' → CDN URL
|
|
18
|
+
* - 'src/web/public/foo.svg' → CDN URL
|
|
18
19
|
*/
|
|
19
20
|
|
|
20
21
|
import type { Plugin } from 'vite';
|
|
@@ -29,23 +30,41 @@ export interface PublicAssetPathPluginOptions {
|
|
|
29
30
|
interface PathPattern {
|
|
30
31
|
regex: RegExp;
|
|
31
32
|
description: string;
|
|
33
|
+
/** Replacement template - use {base} for the target base URL */
|
|
34
|
+
replacement: string;
|
|
32
35
|
}
|
|
33
36
|
|
|
34
37
|
/**
|
|
35
|
-
*
|
|
36
|
-
* (RegExp with global flag maintains state via lastIndex)
|
|
38
|
+
* Patterns that are incorrect - reference source paths directly
|
|
37
39
|
*/
|
|
38
|
-
function
|
|
40
|
+
function createIncorrectPatterns(): PathPattern[] {
|
|
39
41
|
return [
|
|
40
42
|
// '/src/web/public/...' or './src/web/public/...' or 'src/web/public/...'
|
|
41
43
|
{
|
|
42
44
|
regex: /(['"`])(?:\.?\/)?src\/web\/public\//g,
|
|
43
45
|
description: 'src/web/public/',
|
|
46
|
+
replacement: '$1{base}',
|
|
44
47
|
},
|
|
45
|
-
|
|
48
|
+
];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Patterns that need rewriting for production CDN
|
|
53
|
+
* Both patterns simply replace the prefix while preserving the rest of the path naturally.
|
|
54
|
+
*/
|
|
55
|
+
function createPublicPatterns(): PathPattern[] {
|
|
56
|
+
return [
|
|
57
|
+
// './public/...' (relative public path) - replace prefix, keep rest
|
|
46
58
|
{
|
|
47
59
|
regex: /(['"`])\.\/public\//g,
|
|
48
60
|
description: './public/',
|
|
61
|
+
replacement: '$1{base}',
|
|
62
|
+
},
|
|
63
|
+
// '/public/...' (absolute public path) - replace prefix, keep rest
|
|
64
|
+
{
|
|
65
|
+
regex: /(['"`])\/public\//g,
|
|
66
|
+
description: '/public/',
|
|
67
|
+
replacement: '$1{base}',
|
|
49
68
|
},
|
|
50
69
|
];
|
|
51
70
|
}
|
|
@@ -53,21 +72,17 @@ function createPatterns(): PathPattern[] {
|
|
|
53
72
|
/**
|
|
54
73
|
* Vite plugin that fixes public asset paths and rewrites to CDN URLs
|
|
55
74
|
*
|
|
56
|
-
* Rewrites all public asset paths to CDN URLs in production
|
|
57
|
-
* if no CDN base URL is provided.
|
|
75
|
+
* Rewrites all public asset paths to CDN URLs in production.
|
|
58
76
|
*
|
|
59
77
|
* @example
|
|
60
78
|
* // In vite config:
|
|
61
79
|
* plugins: [publicAssetPathPlugin({ cdnBaseUrl: 'https://cdn.example.com/deploy/client/' })]
|
|
62
80
|
*
|
|
63
|
-
* //
|
|
64
|
-
*
|
|
65
|
-
* // './src/web/public/logo.svg' → 'https://cdn.example.com/deploy/client/logo.svg'
|
|
66
|
-
* // '/public/logo.svg' → 'https://cdn.example.com/deploy/client/logo.svg'
|
|
81
|
+
* // In code, use /public/ paths:
|
|
82
|
+
* <img src="/public/logo.svg" />
|
|
67
83
|
*
|
|
68
|
-
* // Transforms in production
|
|
69
|
-
* // '/
|
|
70
|
-
* // '/public/logo.svg' → '/logo.svg'
|
|
84
|
+
* // Transforms in production:
|
|
85
|
+
* // '/public/logo.svg' → 'https://cdn.example.com/deploy/client/logo.svg'
|
|
71
86
|
*/
|
|
72
87
|
export function publicAssetPathPlugin(options: PublicAssetPathPluginOptions = {}): Plugin {
|
|
73
88
|
const { warnInDev = true, cdnBaseUrl } = options;
|
|
@@ -89,17 +104,18 @@ export function publicAssetPathPlugin(options: PublicAssetPathPluginOptions = {}
|
|
|
89
104
|
}
|
|
90
105
|
|
|
91
106
|
// Quick check: does the code contain any patterns we care about?
|
|
92
|
-
const
|
|
93
|
-
const hasPublicPaths = code.includes('/public/');
|
|
107
|
+
const hasIncorrectSourcePaths = code.includes('src/web/public/');
|
|
108
|
+
const hasPublicPaths = code.includes('/public/') || code.includes('./public/');
|
|
94
109
|
|
|
95
|
-
if (!
|
|
110
|
+
if (!hasIncorrectSourcePaths && !hasPublicPaths) {
|
|
96
111
|
return null;
|
|
97
112
|
}
|
|
98
113
|
|
|
99
|
-
// In dev mode,
|
|
114
|
+
// In dev mode, only warn about incorrect source paths (src/web/public/)
|
|
115
|
+
// /public/ and ./public/ paths work correctly in dev mode
|
|
100
116
|
if (isDev) {
|
|
101
|
-
if (warnInDev &&
|
|
102
|
-
const patterns =
|
|
117
|
+
if (warnInDev && hasIncorrectSourcePaths) {
|
|
118
|
+
const patterns = createIncorrectPatterns();
|
|
103
119
|
const foundPatterns: string[] = [];
|
|
104
120
|
|
|
105
121
|
for (const { regex, description } of patterns) {
|
|
@@ -121,37 +137,43 @@ export function publicAssetPathPlugin(options: PublicAssetPathPluginOptions = {}
|
|
|
121
137
|
this.warn(
|
|
122
138
|
`Found incorrect asset path(s) in ${id}:\n` +
|
|
123
139
|
newWarnings.map((p) => ` - '${p}' should be '/public/'`).join('\n') +
|
|
124
|
-
`\nUse
|
|
140
|
+
`\nUse '/public/...' paths for static assets.`
|
|
125
141
|
);
|
|
126
142
|
}
|
|
127
143
|
}
|
|
128
144
|
}
|
|
129
145
|
// In dev mode, never transform - Vite serves from source paths
|
|
146
|
+
// and the Bun server proxies /public/* to Vite
|
|
130
147
|
return null;
|
|
131
148
|
}
|
|
132
149
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
150
|
+
// Build mode: transform paths to CDN URLs
|
|
151
|
+
let transformed = code;
|
|
152
|
+
|
|
153
|
+
// Determine target URL: CDN base if provided, otherwise root
|
|
154
|
+
const targetBase = cdnBaseUrl
|
|
155
|
+
? cdnBaseUrl.endsWith('/')
|
|
156
|
+
? cdnBaseUrl
|
|
157
|
+
: `${cdnBaseUrl}/`
|
|
158
|
+
: '/';
|
|
159
|
+
|
|
160
|
+
// Transform incorrect source paths (src/web/public/) → CDN
|
|
161
|
+
if (hasIncorrectSourcePaths) {
|
|
162
|
+
const patterns = createIncorrectPatterns();
|
|
163
|
+
for (const { regex, replacement } of patterns) {
|
|
164
|
+
const replaceRegex = new RegExp(regex.source, regex.flags);
|
|
165
|
+
transformed = transformed.replace(replaceRegex, replacement.replace('{base}', targetBase));
|
|
166
|
+
}
|
|
167
|
+
}
|
|
138
168
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
169
|
+
// Transform public paths → CDN
|
|
170
|
+
if (hasPublicPaths) {
|
|
171
|
+
const publicPatterns = createPublicPatterns();
|
|
172
|
+
for (const { regex, replacement } of publicPatterns) {
|
|
173
|
+
const replaceRegex = new RegExp(regex.source, regex.flags);
|
|
174
|
+
transformed = transformed.replace(replaceRegex, replacement.replace('{base}', targetBase));
|
|
175
|
+
}
|
|
145
176
|
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
// Then, rewrite /public/foo → {targetBase}foo
|
|
149
|
-
if (hasPublicPaths) {
|
|
150
|
-
// Match '/public/...' paths in strings (single, double, or backtick quotes)
|
|
151
|
-
// Captures: $1 = quote char, $2 = path after /public/
|
|
152
|
-
const publicPathRegex = /(['"`])\/public\/([^'"`\s]+)/g;
|
|
153
|
-
transformed = transformed.replace(publicPathRegex, `$1${targetBase}$2`);
|
|
154
|
-
}
|
|
155
177
|
|
|
156
178
|
// Return transformed code if changed
|
|
157
179
|
if (transformed !== code) {
|
|
@@ -68,7 +68,9 @@ export async function generateAssetServerConfig(
|
|
|
68
68
|
root: rootDir,
|
|
69
69
|
base: '/',
|
|
70
70
|
clearScreen: false,
|
|
71
|
-
|
|
71
|
+
// Serve public assets from src/web/public/ at root path (e.g., /favicon.png)
|
|
72
|
+
// The Bun server proxies /public/* requests to Vite, rewriting to root paths
|
|
73
|
+
publicDir: join(rootDir, 'src', 'web', 'public'),
|
|
72
74
|
|
|
73
75
|
resolve: {
|
|
74
76
|
alias,
|
|
@@ -153,7 +153,7 @@ export async function runViteBuild(options: ViteBuildOptions): Promise<void> {
|
|
|
153
153
|
// Use CDN for all non-dev builds with a deploymentId (including local region)
|
|
154
154
|
const isLocalRegion = options.region === 'local';
|
|
155
155
|
const cdnDomain = isLocalRegion
|
|
156
|
-
? 'localstack-static-assets.t3.
|
|
156
|
+
? 'localstack-static-assets.t3.storageapi.dev'
|
|
157
157
|
: 'cdn.agentuity.com';
|
|
158
158
|
const cdnBaseUrl =
|
|
159
159
|
!dev && deploymentId ? `https://${cdnDomain}/${deploymentId}/client/` : undefined;
|
package/src/cmd/canary/index.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { z } from 'zod';
|
|
|
3
3
|
import { $ } from 'bun';
|
|
4
4
|
import * as tui from '../../tui';
|
|
5
5
|
|
|
6
|
-
const CANARY_BASE_URL = 'https://agentuity-sdk-objects.t3.
|
|
6
|
+
const CANARY_BASE_URL = 'https://agentuity-sdk-objects.t3.storageapi.dev/npm';
|
|
7
7
|
|
|
8
8
|
const CanaryArgsSchema = z.object({
|
|
9
9
|
args: z
|
|
@@ -9,12 +9,14 @@ import { listOrganizations } from '@agentuity/server';
|
|
|
9
9
|
* @param apiClient - The API client
|
|
10
10
|
* @param config - The CLI config (may be null)
|
|
11
11
|
* @param orgOption - The --org option value (true for default/prompt, or explicit org ID)
|
|
12
|
+
* @param autoSelect - If true, auto-select preferred org without prompting (for --confirm)
|
|
12
13
|
* @returns The resolved organization ID
|
|
13
14
|
*/
|
|
14
15
|
export async function resolveOrgId(
|
|
15
16
|
apiClient: APIClient,
|
|
16
17
|
config: Config | null,
|
|
17
|
-
orgOption: boolean | string
|
|
18
|
+
orgOption: boolean | string,
|
|
19
|
+
autoSelect?: boolean
|
|
18
20
|
): Promise<string> {
|
|
19
21
|
// If an explicit org ID was provided (string), use it directly
|
|
20
22
|
if (typeof orgOption === 'string' && orgOption !== 'true') {
|
|
@@ -25,8 +27,9 @@ export async function resolveOrgId(
|
|
|
25
27
|
const orgs = await tui.spinner('Fetching organizations', () => listOrganizations(apiClient));
|
|
26
28
|
|
|
27
29
|
// Use preference if available, otherwise prompt
|
|
30
|
+
// Pass autoSelect to skip prompting when --confirm is used
|
|
28
31
|
const preferredOrgId = config?.preferences?.orgId;
|
|
29
|
-
return tui.selectOrganization(orgs, preferredOrgId);
|
|
32
|
+
return tui.selectOrganization(orgs, preferredOrgId, autoSelect);
|
|
30
33
|
}
|
|
31
34
|
|
|
32
35
|
/**
|