@mycadet/cli 0.13.0-dev.202610192312.0264b52 → 0.13.0-dev.202610200020.9f20440
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/package.json
CHANGED
|
@@ -13,6 +13,7 @@ import { buildWebInterfaceConfig } from "../commands/client.js";
|
|
|
13
13
|
const BASE = {
|
|
14
14
|
webUrl: "https://app.example.com",
|
|
15
15
|
cloudUrl: "https://platform.example.com",
|
|
16
|
+
version: "0.13.0-local.202610191920.58bcf38",
|
|
16
17
|
};
|
|
17
18
|
|
|
18
19
|
describe("cadet client web __config", () => {
|
package/src/commands/client.ts
CHANGED
|
@@ -87,8 +87,8 @@ const AssistantIdBodySchema = z.object({
|
|
|
87
87
|
|
|
88
88
|
const TokenBodySchema = z.object({ token: z.unknown() }).nullable();
|
|
89
89
|
|
|
90
|
-
const
|
|
91
|
-
syncPlatform: z.
|
|
90
|
+
const SyncCloudBodySchema = z.object({
|
|
91
|
+
syncPlatform: z.boolean().optional(),
|
|
92
92
|
cloudAssistants: z.array(z.record(z.string(), z.unknown())).optional(),
|
|
93
93
|
organizationId: z.string().optional(),
|
|
94
94
|
rename: z.object({ assistantId: z.string(), name: z.string() }).optional(),
|
|
@@ -499,7 +499,7 @@ const PAIRING_POLL_PATTERN = /^(?:\/assistant)?\/__local\/pairing-poll$/;
|
|
|
499
499
|
const PAIRING_CANCEL_PATTERN = /^(?:\/assistant)?\/__local\/pairing-cancel$/;
|
|
500
500
|
const GUARDIAN_TOKEN_PATTERN =
|
|
501
501
|
/^(?:\/assistant)?\/__local\/guardian-token\/([^/]+)$/;
|
|
502
|
-
const
|
|
502
|
+
const CLOUD_SESSION_PATTERN = /^(?:\/assistant)?\/__local\/cloud-session$/;
|
|
503
503
|
|
|
504
504
|
// The loopback platform session token. Persisted via the same store the CLI
|
|
505
505
|
// uses (so `cadet client` restarts and CLI logins stay in sync), cached here
|
|
@@ -557,7 +557,7 @@ async function handleLocalEndpoints(
|
|
|
557
557
|
PAIRING_POLL_PATTERN.test(pathname) ||
|
|
558
558
|
PAIRING_CANCEL_PATTERN.test(pathname) ||
|
|
559
559
|
GUARDIAN_TOKEN_PATTERN.test(pathname) ||
|
|
560
|
-
|
|
560
|
+
CLOUD_SESSION_PATTERN.test(pathname) ||
|
|
561
561
|
parseGatewayUrl(pathname).match ||
|
|
562
562
|
parsePairedGatewayUrl(pathname).match;
|
|
563
563
|
|
|
@@ -579,7 +579,7 @@ async function handleLocalEndpoints(
|
|
|
579
579
|
// Platform session: the SPA hands over the loopback token here (after it has
|
|
580
580
|
// validated the `state` nonce) so the proxy below can authenticate to the
|
|
581
581
|
// platform. The browser never holds a session cookie.
|
|
582
|
-
if (
|
|
582
|
+
if (CLOUD_SESSION_PATTERN.test(pathname)) {
|
|
583
583
|
if (req.method === "DELETE") {
|
|
584
584
|
clearCloudToken();
|
|
585
585
|
cloudSessionToken = null;
|
|
@@ -614,9 +614,9 @@ async function handleLocalEndpoints(
|
|
|
614
614
|
return new Response(null, { status: result.status });
|
|
615
615
|
}
|
|
616
616
|
if (req.method === "POST") {
|
|
617
|
-
let body: z.infer<typeof
|
|
617
|
+
let body: z.infer<typeof SyncCloudBodySchema>;
|
|
618
618
|
try {
|
|
619
|
-
const parsed =
|
|
619
|
+
const parsed = SyncCloudBodySchema.safeParse(await req.json());
|
|
620
620
|
if (!parsed.success) throw new Error("invalid body");
|
|
621
621
|
body = parsed.data;
|
|
622
622
|
} catch {
|
|
@@ -1303,7 +1303,7 @@ async function spawnBackgroundWebInterface(
|
|
|
1303
1303
|
export function buildWebInterfaceConfig(opts: {
|
|
1304
1304
|
webUrl: string;
|
|
1305
1305
|
cloudUrl: string;
|
|
1306
|
-
version
|
|
1306
|
+
version: string;
|
|
1307
1307
|
}): Record<string, unknown> {
|
|
1308
1308
|
const { webUrl, cloudUrl } = opts;
|
|
1309
1309
|
return {
|
|
@@ -1311,7 +1311,7 @@ export function buildWebInterfaceConfig(opts: {
|
|
|
1311
1311
|
cloudUrl,
|
|
1312
1312
|
// Which CLI build is serving — the same string `cadet-local --version`
|
|
1313
1313
|
// prints, so devtools and the settings page answer identically.
|
|
1314
|
-
|
|
1314
|
+
version: opts.version,
|
|
1315
1315
|
};
|
|
1316
1316
|
}
|
|
1317
1317
|
|
|
@@ -1335,7 +1335,6 @@ async function runWebInterface(
|
|
|
1335
1335
|
disableCloud,
|
|
1336
1336
|
openInBrowser,
|
|
1337
1337
|
webPort,
|
|
1338
|
-
displayVersion(cliPkg.version),
|
|
1339
1338
|
);
|
|
1340
1339
|
}
|
|
1341
1340
|
|
|
@@ -1539,7 +1538,6 @@ async function runViteDevServer(
|
|
|
1539
1538
|
disableCloud: boolean,
|
|
1540
1539
|
openInBrowser: boolean,
|
|
1541
1540
|
webPort: number | undefined,
|
|
1542
|
-
serveVersion: string,
|
|
1543
1541
|
): Promise<void> {
|
|
1544
1542
|
const cloudUrl = getCloudUrl();
|
|
1545
1543
|
|
|
@@ -1572,7 +1570,6 @@ async function runViteDevServer(
|
|
|
1572
1570
|
API_PROXY_TARGET: cloudUrl,
|
|
1573
1571
|
CADET_WEB_URL: getWebUrl(),
|
|
1574
1572
|
CADET_CLOUD_URL: cloudUrl,
|
|
1575
|
-
CADET_CONFIG_VERSION: serveVersion,
|
|
1576
1573
|
PORT: String(port),
|
|
1577
1574
|
},
|
|
1578
1575
|
});
|