@powerhousedao/ph-cli 6.2.3-dev.55 → 6.2.3-dev.57
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-connect-override-b4kKqgOZ.mjs → cli-connect-override-DGXyoqdV.mjs} +5 -28
- package/dist/cli-connect-override-DGXyoqdV.mjs.map +1 -0
- package/dist/cli.mjs +15 -1396
- package/dist/cli.mjs.map +1 -1
- package/dist/{connect-build-BLxeFrSb.mjs → connect-build-EYGNSUc_.mjs} +5 -5
- package/dist/{connect-build-BLxeFrSb.mjs.map → connect-build-EYGNSUc_.mjs.map} +1 -1
- package/dist/{connect-config-DGfPEeP8.mjs → connect-config-BDmghUZF.mjs} +4 -4
- package/dist/{connect-config-DGfPEeP8.mjs.map → connect-config-BDmghUZF.mjs.map} +1 -1
- package/dist/connect-preview-Clue7SVp.mjs +122 -0
- package/dist/connect-preview-Clue7SVp.mjs.map +1 -0
- package/dist/{connect-studio-f3K1qPWd.mjs → connect-studio-CM4t2tWz.mjs} +3 -3
- package/dist/{connect-studio-_-O1-oef.mjs → connect-studio-sc-e0xBI.mjs} +4 -4
- package/dist/{connect-studio-_-O1-oef.mjs.map → connect-studio-sc-e0xBI.mjs.map} +1 -1
- package/dist/dist-BVyjAjXL.mjs +142 -0
- package/dist/dist-BVyjAjXL.mjs.map +1 -0
- package/dist/feature-flags-DhEVzlCC.mjs +23 -0
- package/dist/feature-flags-DhEVzlCC.mjs.map +1 -0
- package/dist/{generate-all-CIwP-3aa.mjs → generate-all-CRfVwLJ9.mjs} +5 -3
- package/dist/generate-all-CRfVwLJ9.mjs.map +1 -0
- package/dist/{generate-document-model-DhDQ_06X.mjs → generate-document-model-ChkXjM1s.mjs} +5 -3
- package/dist/generate-document-model-ChkXjM1s.mjs.map +1 -0
- package/dist/{generate-subgraph-Dm27O59o.mjs → generate-subgraph-DmcQWVbd.mjs} +5 -3
- package/dist/generate-subgraph-DmcQWVbd.mjs.map +1 -0
- package/dist/host-schemas-C_MLcYX6-B2qQIdZ-.mjs +4154 -0
- package/dist/host-schemas-C_MLcYX6-B2qQIdZ-.mjs.map +1 -0
- package/dist/index-s1ABBFjB.d.mts +3752 -0
- package/dist/index-s1ABBFjB.d.mts.map +1 -0
- package/dist/{init-CIEMyAug.mjs → init-B6dv9eCs.mjs} +6 -4
- package/dist/init-B6dv9eCs.mjs.map +1 -0
- package/dist/ph-cli-commands-B95L289j.mjs +1439 -0
- package/dist/ph-cli-commands-B95L289j.mjs.map +1 -0
- package/dist/ph-cli-commands-C-uB91lq.mjs +4 -0
- package/dist/reactor-env-BXG9PlMa.mjs +4 -0
- package/dist/reactor-env-CtavpGtJ.mjs +29 -0
- package/dist/reactor-env-CtavpGtJ.mjs.map +1 -0
- package/dist/run-sugar-Dqn7up5U.mjs +39 -0
- package/dist/run-sugar-Dqn7up5U.mjs.map +1 -0
- package/dist/runners/compound.d.mts +90 -0
- package/dist/runners/compound.d.mts.map +1 -0
- package/dist/runners/compound.mjs +71 -0
- package/dist/runners/compound.mjs.map +1 -0
- package/dist/runners/connect.d.mts +100 -0
- package/dist/runners/connect.d.mts.map +1 -0
- package/dist/runners/connect.mjs +129 -0
- package/dist/runners/connect.mjs.map +1 -0
- package/dist/runners/switchboard.d.mts +92 -0
- package/dist/runners/switchboard.d.mts.map +1 -0
- package/dist/runners/switchboard.mjs +88 -0
- package/dist/runners/switchboard.mjs.map +1 -0
- package/dist/start-run-CAgkeWI1.mjs +36 -0
- package/dist/start-run-CAgkeWI1.mjs.map +1 -0
- package/dist/superseded-config-9D7BdLvd.mjs +53 -0
- package/dist/superseded-config-9D7BdLvd.mjs.map +1 -0
- package/dist/{vetra-B1V1iWGR.mjs → vetra-BY-MHg9R.mjs} +9 -22
- package/dist/vetra-BY-MHg9R.mjs.map +1 -0
- package/dist/warn-subgraph-type-conflicts-Jd6SeN-M.mjs +19 -0
- package/dist/warn-subgraph-type-conflicts-Jd6SeN-M.mjs.map +1 -0
- package/package.json +34 -12
- package/dist/cli-connect-override-b4kKqgOZ.mjs.map +0 -1
- package/dist/connect-preview-CzDqR-JN.mjs +0 -32
- package/dist/connect-preview-CzDqR-JN.mjs.map +0 -1
- package/dist/generate-all-CIwP-3aa.mjs.map +0 -1
- package/dist/generate-document-model-DhDQ_06X.mjs.map +0 -1
- package/dist/generate-subgraph-Dm27O59o.mjs.map +0 -1
- package/dist/init-CIEMyAug.mjs.map +0 -1
- package/dist/vetra-B1V1iWGR.mjs.map +0 -1
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="e2a007da-28a0-56d5-b58c-a7e6359b6605")}catch(e){}}();
|
|
3
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { deepMerge } from "@powerhousedao/shared/connect";
|
|
6
|
+
import { getConnectBaseViteConfig } from "@powerhousedao/builder-tools";
|
|
7
|
+
import { mergeConfig, preview } from "vite";
|
|
8
|
+
//#region src/services/connect-preview.ts
|
|
9
|
+
/**
|
|
10
|
+
* The env contract a supervisor can drive the preview with — the same
|
|
11
|
+
* variables the Docker entrypoint and clint's service manager already speak:
|
|
12
|
+
* PH_CONNECT_DEFAULT_DRIVES_URL (comma-separated drive urls, injected into
|
|
13
|
+
* drives.defaultDrives), PH_CONNECT_DRIVES_PRESERVE_STRATEGY, and
|
|
14
|
+
* PH_CONNECT_PACKAGES_REGISTRY (runtime registry: served config + baked-CSP
|
|
15
|
+
* patch). Lets `ph connect preview` replace hand-rolled static servers
|
|
16
|
+
* (clint's connect-server, the ph-win sidecar) without losing injection.
|
|
17
|
+
*/
|
|
18
|
+
function overrideFromEnv(env = process.env) {
|
|
19
|
+
const drivesUrl = env.PH_CONNECT_DEFAULT_DRIVES_URL;
|
|
20
|
+
const registry = env.PH_CONNECT_PACKAGES_REGISTRY;
|
|
21
|
+
if (!drivesUrl && !registry) return void 0;
|
|
22
|
+
const override = {};
|
|
23
|
+
if (drivesUrl) override.connect = { drives: {
|
|
24
|
+
defaultDrives: drivesUrl.split(",").map((s) => s.trim()).filter(Boolean).map((url) => ({
|
|
25
|
+
url,
|
|
26
|
+
name: null,
|
|
27
|
+
icon: null
|
|
28
|
+
})),
|
|
29
|
+
preserveStrategy: env.PH_CONNECT_DRIVES_PRESERVE_STRATEGY ?? "preserve-all"
|
|
30
|
+
} };
|
|
31
|
+
if (registry) {
|
|
32
|
+
override.packageRegistryUrl = registry;
|
|
33
|
+
override.cspRegistrySync = true;
|
|
34
|
+
}
|
|
35
|
+
return override;
|
|
36
|
+
}
|
|
37
|
+
function mergedConfigBody(outDir, override) {
|
|
38
|
+
const file = path.join(outDir, "powerhouse.config.json");
|
|
39
|
+
const baked = existsSync(file) ? JSON.parse(readFileSync(file, "utf8")) : {};
|
|
40
|
+
const connect = override.connect ? deepMerge(baked.connect ?? {}, override.connect) : baked.connect;
|
|
41
|
+
return JSON.stringify({
|
|
42
|
+
...baked,
|
|
43
|
+
connect,
|
|
44
|
+
...override.packageRegistryUrl ? { packageRegistryUrl: override.packageRegistryUrl } : {}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Append the registry origin to the baked CSP's script-src. The attribute
|
|
49
|
+
* value is HTML-escaped (every CSP keyword is `'`-quoted, which contains a
|
|
50
|
+
* semicolon), so decode before touching directives and re-escape after —
|
|
51
|
+
* ported from the ph-win-desktop sidecar, which this path replaces.
|
|
52
|
+
*/
|
|
53
|
+
function patchCspScriptSrc(html, registryUrl) {
|
|
54
|
+
return html.replace(/(<meta\s+http-equiv="Content-Security-Policy"\s+content=")([^"]*)(")/i, (_match, open, escaped, close) => {
|
|
55
|
+
const policy = escaped.replace(/&/g, "&").replace(/'/g, "'");
|
|
56
|
+
if (policy.includes(registryUrl)) return open + escaped + close;
|
|
57
|
+
return open + policy.replace(/script-src\s+([^;]*)/i, (_directive, sources) => `script-src ${sources.trim()} ${registryUrl}`).replace(/&/g, "&").replace(/'/g, "'") + close;
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
function serveOverridePlugin(outDir, override) {
|
|
61
|
+
return {
|
|
62
|
+
name: "ph:serve-override",
|
|
63
|
+
configurePreviewServer(server) {
|
|
64
|
+
server.middlewares.use((req, res, next) => {
|
|
65
|
+
const urlPath = (req.url ?? "/").split("?")[0];
|
|
66
|
+
if (urlPath === "/powerhouse.config.json") {
|
|
67
|
+
res.writeHead(200, {
|
|
68
|
+
"content-type": "application/json; charset=utf-8",
|
|
69
|
+
"cache-control": "no-store"
|
|
70
|
+
});
|
|
71
|
+
res.end(mergedConfigBody(outDir, override));
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
const isHtml = urlPath === "/" || urlPath.endsWith("/index.html") || !path.extname(urlPath);
|
|
75
|
+
if (override.cspRegistrySync && isHtml) {
|
|
76
|
+
const file = path.join(outDir, "index.html");
|
|
77
|
+
if (existsSync(file)) {
|
|
78
|
+
const registry = JSON.parse(mergedConfigBody(outDir, override)).packageRegistryUrl;
|
|
79
|
+
const html = readFileSync(file, "utf8");
|
|
80
|
+
res.writeHead(200, {
|
|
81
|
+
"content-type": "text/html; charset=utf-8",
|
|
82
|
+
"cache-control": "no-store"
|
|
83
|
+
});
|
|
84
|
+
res.end(registry ? patchCspScriptSrc(html, registry) : html);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
next();
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
async function runConnectPreview(args, serveOverride) {
|
|
94
|
+
serveOverride ??= overrideFromEnv();
|
|
95
|
+
const { outDir, port, host, open, cors, strictPort, printUrls, bindCLIShortcuts } = args;
|
|
96
|
+
const mode = "production";
|
|
97
|
+
const dirname = process.cwd();
|
|
98
|
+
const baseConfig = getConnectBaseViteConfig({
|
|
99
|
+
mode,
|
|
100
|
+
dirname
|
|
101
|
+
});
|
|
102
|
+
const previewConfig = {
|
|
103
|
+
build: { outDir },
|
|
104
|
+
preview: {
|
|
105
|
+
cors,
|
|
106
|
+
port,
|
|
107
|
+
strictPort,
|
|
108
|
+
host,
|
|
109
|
+
open
|
|
110
|
+
},
|
|
111
|
+
...serveOverride ? { plugins: [serveOverridePlugin(path.resolve(dirname, outDir), serveOverride)] } : {}
|
|
112
|
+
};
|
|
113
|
+
const config = mergeConfig(baseConfig, previewConfig);
|
|
114
|
+
const server = await preview(config);
|
|
115
|
+
if (printUrls) server.printUrls();
|
|
116
|
+
if (bindCLIShortcuts) server.bindCLIShortcuts({ print: true });
|
|
117
|
+
}
|
|
118
|
+
//#endregion
|
|
119
|
+
export { runConnectPreview };
|
|
120
|
+
|
|
121
|
+
//# sourceMappingURL=connect-preview-Clue7SVp.mjs.map
|
|
122
|
+
//# debugId=e2a007da-28a0-56d5-b58c-a7e6359b6605
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connect-preview-Clue7SVp.mjs","sources":["../src/services/connect-preview.ts"],"sourcesContent":["import { getConnectBaseViteConfig } from \"@powerhousedao/builder-tools\";\nimport type { PHConnectRuntimeConfig } from \"@powerhousedao/shared/clis\";\nimport { deepMerge } from \"@powerhousedao/shared/connect\";\nimport { existsSync, readFileSync } from \"node:fs\";\nimport path from \"node:path\";\nimport type { InlineConfig, Plugin } from \"vite\";\nimport { mergeConfig, preview } from \"vite\";\nimport type { ConnectPreviewArgs } from \"../types.js\";\n\n/**\n * Runtime shaping for a served (built) Connect, desktop shape: the compound\n * projects the live switchboard's drive into the connect member's config, and\n * this override makes the STATIC dist serve it — the built\n * powerhouse.config.json is baked, so without this the drive injection never\n * reaches the SPA. `cspRegistrySync` additionally patches the baked CSP's\n * script-src with the runtime registry (the build bakes the CSP for the\n * registry it was built against; setting the registry at run time breaks that\n * coupling and every package import gets blocked otherwise).\n */\nexport interface ConnectServeOverride {\n connect?: PHConnectRuntimeConfig;\n cspRegistrySync?: boolean;\n /** Overrides the baked top-level packageRegistryUrl in the served config. */\n packageRegistryUrl?: string;\n}\n\n/**\n * The env contract a supervisor can drive the preview with — the same\n * variables the Docker entrypoint and clint's service manager already speak:\n * PH_CONNECT_DEFAULT_DRIVES_URL (comma-separated drive urls, injected into\n * drives.defaultDrives), PH_CONNECT_DRIVES_PRESERVE_STRATEGY, and\n * PH_CONNECT_PACKAGES_REGISTRY (runtime registry: served config + baked-CSP\n * patch). Lets `ph connect preview` replace hand-rolled static servers\n * (clint's connect-server, the ph-win sidecar) without losing injection.\n */\nexport function overrideFromEnv(\n env: Record<string, string | undefined> = process.env,\n): ConnectServeOverride | undefined {\n const drivesUrl = env.PH_CONNECT_DEFAULT_DRIVES_URL;\n const registry = env.PH_CONNECT_PACKAGES_REGISTRY;\n if (!drivesUrl && !registry) return undefined;\n const override: ConnectServeOverride = {};\n if (drivesUrl) {\n override.connect = {\n drives: {\n defaultDrives: drivesUrl\n .split(\",\")\n .map((s) => s.trim())\n .filter(Boolean)\n .map((url) => ({ url, name: null, icon: null })),\n preserveStrategy:\n env.PH_CONNECT_DRIVES_PRESERVE_STRATEGY ?? \"preserve-all\",\n },\n } as PHConnectRuntimeConfig;\n }\n if (registry) {\n override.packageRegistryUrl = registry;\n override.cspRegistrySync = true;\n }\n return override;\n}\n\nfunction mergedConfigBody(\n outDir: string,\n override: ConnectServeOverride,\n): string {\n const file = path.join(outDir, \"powerhouse.config.json\");\n const baked = existsSync(file)\n ? (JSON.parse(readFileSync(file, \"utf8\")) as Record<string, unknown>)\n : {};\n const connect = override.connect\n ? deepMerge(\n (baked.connect ?? {}) as PHConnectRuntimeConfig,\n override.connect,\n )\n : baked.connect;\n return JSON.stringify({\n ...baked,\n connect,\n ...(override.packageRegistryUrl\n ? { packageRegistryUrl: override.packageRegistryUrl }\n : {}),\n });\n}\n\n/**\n * Append the registry origin to the baked CSP's script-src. The attribute\n * value is HTML-escaped (every CSP keyword is `'`-quoted, which contains a\n * semicolon), so decode before touching directives and re-escape after —\n * ported from the ph-win-desktop sidecar, which this path replaces.\n */\nexport function patchCspScriptSrc(html: string, registryUrl: string): string {\n return html.replace(\n /(<meta\\s+http-equiv=\"Content-Security-Policy\"\\s+content=\")([^\"]*)(\")/i,\n (_match, open: string, escaped: string, close: string) => {\n const policy = escaped.replace(/&/g, \"&\").replace(/'/g, \"'\");\n if (policy.includes(registryUrl)) return open + escaped + close;\n const patched = policy.replace(\n /script-src\\s+([^;]*)/i,\n (_directive, sources: string) =>\n `script-src ${sources.trim()} ${registryUrl}`,\n );\n const reEscaped = patched.replace(/&/g, \"&\").replace(/'/g, \"'\");\n return open + reEscaped + close;\n },\n );\n}\n\nfunction serveOverridePlugin(\n outDir: string,\n override: ConnectServeOverride,\n): Plugin {\n return {\n name: \"ph:serve-override\",\n configurePreviewServer(server) {\n server.middlewares.use((req, res, next) => {\n const urlPath = (req.url ?? \"/\").split(\"?\")[0];\n if (urlPath === \"/powerhouse.config.json\") {\n res.writeHead(200, {\n \"content-type\": \"application/json; charset=utf-8\",\n \"cache-control\": \"no-store\",\n });\n res.end(mergedConfigBody(outDir, override));\n return;\n }\n // index.html and extensionless SPA routes get the CSP patch.\n const isHtml =\n urlPath === \"/\" ||\n urlPath.endsWith(\"/index.html\") ||\n !path.extname(urlPath);\n if (override.cspRegistrySync && isHtml) {\n const file = path.join(outDir, \"index.html\");\n if (existsSync(file)) {\n const merged = JSON.parse(mergedConfigBody(outDir, override)) as {\n packageRegistryUrl?: string;\n };\n const registry = merged.packageRegistryUrl;\n const html = readFileSync(file, \"utf8\");\n res.writeHead(200, {\n \"content-type\": \"text/html; charset=utf-8\",\n \"cache-control\": \"no-store\",\n });\n res.end(registry ? patchCspScriptSrc(html, registry) : html);\n return;\n }\n }\n next();\n });\n },\n };\n}\n\nexport async function runConnectPreview(\n args: ConnectPreviewArgs,\n serveOverride?: ConnectServeOverride,\n) {\n // A supervisor can drive the preview via env when no explicit override is\n // passed (the classic `ph connect preview` command path).\n serveOverride ??= overrideFromEnv();\n const {\n outDir,\n port,\n host,\n open,\n cors,\n strictPort,\n printUrls,\n bindCLIShortcuts,\n } = args;\n\n const mode = \"production\";\n\n const dirname = process.cwd();\n\n const baseConfig = getConnectBaseViteConfig({\n mode,\n dirname,\n });\n\n const previewConfig: InlineConfig = {\n build: {\n outDir,\n },\n preview: {\n cors,\n port,\n strictPort,\n host,\n open,\n },\n ...(serveOverride\n ? {\n plugins: [\n serveOverridePlugin(path.resolve(dirname, outDir), serveOverride),\n ],\n }\n : {}),\n };\n\n const config = mergeConfig(baseConfig, previewConfig);\n\n const server = await preview(config);\n\n if (printUrls) server.printUrls();\n if (bindCLIShortcuts) server.bindCLIShortcuts({ print: true });\n}\n"],"names":[],"mappings":"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","debug_id":"e2a007da-28a0-56d5-b58c-a7e6359b6605"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as runConnectStudio } from "./connect-studio-
|
|
1
|
+
import { t as runConnectStudio } from "./connect-studio-sc-e0xBI.mjs";
|
|
2
2
|
export { runConnectStudio };
|
|
3
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
4
|
-
//# debugId=
|
|
3
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="361e84db-aa48-5286-afcb-3a049627e363")}catch(e){}}();
|
|
4
|
+
//# debugId=361e84db-aa48-5286-afcb-3a049627e363
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
3
|
-
import { r as buildStudioConnectOverride } from "./cli-connect-override-
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="07da03d6-ed5f-5632-a443-d0203b4c6304")}catch(e){}}();
|
|
3
|
+
import { r as buildStudioConnectOverride } from "./cli-connect-override-DGXyoqdV.mjs";
|
|
4
4
|
import { getConnectBaseViteConfig } from "@powerhousedao/builder-tools";
|
|
5
5
|
import { createServer, mergeConfig } from "vite";
|
|
6
6
|
//#region src/services/connect-studio.ts
|
|
@@ -32,5 +32,5 @@ async function runConnectStudio(args, customLogger, callerOverride) {
|
|
|
32
32
|
//#endregion
|
|
33
33
|
export { runConnectStudio as t };
|
|
34
34
|
|
|
35
|
-
//# sourceMappingURL=connect-studio-
|
|
36
|
-
//# debugId=
|
|
35
|
+
//# sourceMappingURL=connect-studio-sc-e0xBI.mjs.map
|
|
36
|
+
//# debugId=07da03d6-ed5f-5632-a443-d0203b4c6304
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect-studio-
|
|
1
|
+
{"version":3,"file":"connect-studio-sc-e0xBI.mjs","sources":["../src/services/connect-studio.ts"],"sourcesContent":["import { getConnectBaseViteConfig } from \"@powerhousedao/builder-tools\";\nimport type { PHConnectRuntimeConfig } from \"@powerhousedao/shared/clis\";\nimport type { InlineConfig, Logger } from \"vite\";\nimport { createServer, mergeConfig } from \"vite\";\nimport type { ConnectStudioArgs } from \"../types.js\";\nimport { buildStudioConnectOverride } from \"../utils/cli-connect-override.js\";\n\nexport async function runConnectStudio(\n args: ConnectStudioArgs,\n customLogger?: Logger,\n callerOverride?: PHConnectRuntimeConfig,\n) {\n const { port, host, open, cors, strictPort, printUrls, bindCLIShortcuts } =\n args;\n const mode = \"development\";\n\n const dirname = process.cwd();\n\n const cliConnectOverride = buildStudioConnectOverride(args, callerOverride);\n\n const baseConfig = getConnectBaseViteConfig({\n mode,\n dirname,\n cliConnectOverride,\n });\n\n const devServerConfig: InlineConfig = {\n server: { port, host, open, cors, strictPort },\n customLogger,\n };\n\n const config = mergeConfig(baseConfig, devServerConfig);\n\n const server = await createServer(config);\n\n await server.listen();\n\n if (printUrls) server.printUrls();\n if (bindCLIShortcuts) server.bindCLIShortcuts({ print: true });\n}\n"],"names":[],"mappings":";;;;;;AAOA,eAAsB,iBACpB,MACA,cACA,gBACA;CACA,MAAM,EAAE,MAAM,MAAM,MAAM,MAAM,YAAY,WAAW,qBACrD;CACF,MAAM,OAAO;CAEb,MAAM,UAAU,QAAQ,IAAI;CAE5B,MAAM,qBAAqB,2BAA2B,MAAM,cAAc;CAE1E,MAAM,aAAa,yBAAyB;EAC1C;EACA;EACA;CACF,CAAC;CAOD,MAAM,SAAS,YAAY,YAAY;EAJrC,QAAQ;GAAE;GAAM;GAAM;GAAM;GAAM;EAAW;EAC7C;CAGmD,CAAC;CAEtD,MAAM,SAAS,MAAM,aAAa,MAAM;CAExC,MAAM,OAAO,OAAO;CAEpB,IAAI,WAAW,OAAO,UAAU;CAChC,IAAI,kBAAkB,OAAO,iBAAiB,EAAE,OAAO,KAAK,CAAC;AAC/D","debug_id":"07da03d6-ed5f-5632-a443-d0203b4c6304"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
//#region ../../packages/host-core/dist/index.mjs
|
|
2
|
+
|
|
3
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="52e2d8f9-f49d-5819-bb63-c89d9476c43f")}catch(e){}}();
|
|
4
|
+
function projectStorage(name, storage) {
|
|
5
|
+
switch (storage.kind) {
|
|
6
|
+
case "idb": return { kind: "idb" };
|
|
7
|
+
case "memory": return { kind: "memory" };
|
|
8
|
+
case "path":
|
|
9
|
+
if (!storage.dataDir) throw new Error(`Backend "${name}": storage kind "path" requires dataDir.`);
|
|
10
|
+
return {
|
|
11
|
+
kind: "path",
|
|
12
|
+
dataDir: storage.dataDir
|
|
13
|
+
};
|
|
14
|
+
case "postgres": throw new Error(`Backend "${name}": storage kind "postgres" is server-side only — a provisioned (in-process/worker) reactor cannot use it. Point a "remote" backend at the switchboard that owns that database instead.`);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
/** One backend → one descriptor. The protocol's featureFlags ride every
|
|
18
|
+
* descriptor (they are fleet consensus, not per-backend). A remote backend
|
|
19
|
+
* must carry remote.url — provision() requires it. */
|
|
20
|
+
function backendToDescriptor(name, backend, protocol) {
|
|
21
|
+
const descriptor = {
|
|
22
|
+
kind: backend.kind ?? "in-process",
|
|
23
|
+
name
|
|
24
|
+
};
|
|
25
|
+
if (descriptor.kind === "remote") {
|
|
26
|
+
const url = backend.remote?.url;
|
|
27
|
+
if (!url) throw new Error(`Backend "${name}" is kind "remote" but has no remote.url — a remote descriptor attaches to an already-running reactor by URL.`);
|
|
28
|
+
descriptor.remote = { url };
|
|
29
|
+
return descriptor;
|
|
30
|
+
}
|
|
31
|
+
if (backend.storage) descriptor.storage = projectStorage(name, backend.storage);
|
|
32
|
+
if (backend.packages) descriptor.packages = backend.packages;
|
|
33
|
+
if (protocol?.featureFlags) descriptor.featureFlags = protocol.featureFlags;
|
|
34
|
+
return descriptor;
|
|
35
|
+
}
|
|
36
|
+
/** All named backends, in placement-primary-first order (the order a
|
|
37
|
+
* createReactorClients step would provision them). */
|
|
38
|
+
function backendsToDescriptors(reactor) {
|
|
39
|
+
const backends = reactor?.backends;
|
|
40
|
+
if (!backends) return [];
|
|
41
|
+
const names = Object.keys(backends);
|
|
42
|
+
const primary = reactor.placement?.primary;
|
|
43
|
+
return (primary && names.includes(primary) ? [primary, ...names.filter((n) => n !== primary)] : names).map((name) => backendToDescriptor(name, backends[name], reactor.protocol));
|
|
44
|
+
}
|
|
45
|
+
const LOCAL_KINDS = /* @__PURE__ */ new Set([
|
|
46
|
+
"in-process",
|
|
47
|
+
"worker",
|
|
48
|
+
void 0
|
|
49
|
+
]);
|
|
50
|
+
/**
|
|
51
|
+
* Structural multi-reactor (phase 4): true when the block names BOTH a local
|
|
52
|
+
* backend (in-process/worker — the tab's own reactor) and a remote one. This
|
|
53
|
+
* is the shape Connect's routing client serves; a lone remote backend is an
|
|
54
|
+
* attach-only host (assistant/agent shape), not a routed tab.
|
|
55
|
+
*/
|
|
56
|
+
function isStructuralMultiReactor(reactor) {
|
|
57
|
+
const backends = reactor?.backends;
|
|
58
|
+
if (!backends) return false;
|
|
59
|
+
const kinds = Object.values(backends).map((b) => b.kind);
|
|
60
|
+
return kinds.some((k) => LOCAL_KINDS.has(k)) && kinds.some((k) => k === "remote");
|
|
61
|
+
}
|
|
62
|
+
/** The remote backends' urls, placement order — what the routing client dials. */
|
|
63
|
+
function remoteBackendUrls(reactor) {
|
|
64
|
+
return backendsToDescriptors(reactor).filter((d) => d.kind === "remote").map((d) => d.remote?.url).filter((u) => typeof u === "string");
|
|
65
|
+
}
|
|
66
|
+
/** The single primary backend for phase-2 projection (multi-backend routing is
|
|
67
|
+
* track R). Prefers placement.primary, else "main"/"local", else the first. */
|
|
68
|
+
function primaryBackend(reactor) {
|
|
69
|
+
const backends = reactor?.backends;
|
|
70
|
+
if (!backends) return void 0;
|
|
71
|
+
const names = Object.keys(backends);
|
|
72
|
+
if (names.length === 0) return void 0;
|
|
73
|
+
return backends[reactor.placement?.primary ?? (names.includes("main") ? "main" : names.includes("local") ? "local" : names[0])];
|
|
74
|
+
}
|
|
75
|
+
const FLAG_ENV = {
|
|
76
|
+
documentDecisions: "REACTOR_DOCUMENT_DECISIONS",
|
|
77
|
+
authEnforcement: "REACTOR_AUTH_ENFORCEMENT",
|
|
78
|
+
authGroups: "REACTOR_AUTH_GROUPS",
|
|
79
|
+
authConditions: "REACTOR_AUTH_CONDITIONS"
|
|
80
|
+
};
|
|
81
|
+
/** The env vars a protocol block maps onto, with their string values. Only
|
|
82
|
+
* keys the block actually sets appear. */
|
|
83
|
+
function protocolEnv(protocol) {
|
|
84
|
+
const env = {};
|
|
85
|
+
if (!protocol) return env;
|
|
86
|
+
for (const [key, varName] of Object.entries(FLAG_ENV)) {
|
|
87
|
+
const value = protocol.featureFlags?.[key];
|
|
88
|
+
if (value !== void 0) env[varName] = value ? "true" : "false";
|
|
89
|
+
}
|
|
90
|
+
if (protocol.createSignaturePolicy !== void 0) env.CREATE_SIGNATURE_POLICY = protocol.createSignaturePolicy;
|
|
91
|
+
if (protocol.unsupportedStoredDocuments !== void 0) env.REACTOR_UNSUPPORTED_STORED_DOCUMENTS = protocol.unsupportedStoredDocuments;
|
|
92
|
+
return env;
|
|
93
|
+
}
|
|
94
|
+
/** Project the reactor block onto the switchboard's env + options. */
|
|
95
|
+
function projectReactorToSwitchboard(reactor) {
|
|
96
|
+
const env = protocolEnv(reactor?.protocol);
|
|
97
|
+
const backend = primaryBackend(reactor);
|
|
98
|
+
const options = {};
|
|
99
|
+
if (backend?.storage) {
|
|
100
|
+
const s = backend.storage;
|
|
101
|
+
const dbUrl = s.kind === "postgres" ? s.url : s.dataDir;
|
|
102
|
+
if (dbUrl) env.PH_REACTOR_DATABASE_URL = dbUrl;
|
|
103
|
+
}
|
|
104
|
+
if (backend?.readModel?.url) options.dbPath = backend.readModel.url;
|
|
105
|
+
if (backend?.packages?.dynamic) env.DYNAMIC_MODEL_LOADING = "true";
|
|
106
|
+
if (reactor?.workflows !== void 0) env.PH_WORKFLOWS_ENABLED = reactor.workflows ? "1" : "0";
|
|
107
|
+
return {
|
|
108
|
+
env,
|
|
109
|
+
options
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
/** Project the reactor block onto the Connect runtime config: protocol →
|
|
113
|
+
* connect.reactor (same shape), backend kind → instance.reactorWorker,
|
|
114
|
+
* workflows → app.workflowsEnabled. */
|
|
115
|
+
function projectReactorToConnect(reactor) {
|
|
116
|
+
const connect = {};
|
|
117
|
+
if (reactor?.protocol) connect.reactor = reactor.protocol;
|
|
118
|
+
const backend = primaryBackend(reactor);
|
|
119
|
+
if (backend?.kind !== void 0) connect.instance = { reactorWorker: backend.kind === "worker" };
|
|
120
|
+
if (reactor?.workflows !== void 0) connect.app = { workflowsEnabled: reactor.workflows };
|
|
121
|
+
return { connect };
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* The enforcement teeth of single-sourcing: if a pre-set env var CONTRADICTS
|
|
125
|
+
* the host's protocol block, fail loudly naming the var, the host value, and
|
|
126
|
+
* the env value. An env var that merely matches, or is unset, is fine (phase-2
|
|
127
|
+
* transition keeps an operator's explicit env as an escape hatch unless it
|
|
128
|
+
* disagrees with the protocol — see the WBS precedence note).
|
|
129
|
+
*/
|
|
130
|
+
function assertProtocolConsistency(protocol, env, hostFile = "the host file") {
|
|
131
|
+
if (!protocol) return;
|
|
132
|
+
const expected = protocolEnv(protocol);
|
|
133
|
+
for (const [varName, hostValue] of Object.entries(expected)) {
|
|
134
|
+
const envValue = env[varName];
|
|
135
|
+
if (envValue !== void 0 && envValue !== hostValue) throw new Error(`reactor.protocol conflict: ${varName} is "${envValue}" in the environment but "${hostValue}" in ${hostFile}. These are fleet-consensus settings — a mismatch would diverge replay. Remove the env override or align the host.`);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
//#endregion
|
|
139
|
+
export { projectReactorToSwitchboard as a, projectReactorToConnect as i, isStructuralMultiReactor as n, remoteBackendUrls as o, primaryBackend as r, assertProtocolConsistency as t };
|
|
140
|
+
|
|
141
|
+
//# sourceMappingURL=dist-BVyjAjXL.mjs.map
|
|
142
|
+
//# debugId=52e2d8f9-f49d-5819-bb63-c89d9476c43f
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dist-BVyjAjXL.mjs","sources":["../../../packages/host-core/dist/index.mjs"],"sourcesContent":["import { A as rebaseDriveUrl, C as HostLoadError, D as probeHostsFolder, E as loadHost, O as mergeDefaultDrives, S as validateHost, T as lintHostImports, _ as writeRunRecord, a as reactorBackendSchema, b as listVerbs, c as reactorSchema, d as defaultUserDataDir, f as resolveUserDataPlaceholders, g as readRunRecord, h as probeRun, i as profileSchema, k as projectDrivesIntoConnect, l as runnerBaseSchema, m as isPidAlive, n as compoundHostSchema, o as reactorHostSchema, p as clearRunRecord, r as emittedHostSchemas, s as reactorProtocolSchema, t as childrenSchema, u as runCompound, v as RunnerError, w as findNonStaticValue, x as resolveRunnerModule, y as getVerb } from \"./host-schemas-C_MLcYX6.mjs\";\n//#region src/backend-projection.ts\nfunction projectStorage(name, storage) {\n\tswitch (storage.kind) {\n\t\tcase \"idb\": return { kind: \"idb\" };\n\t\tcase \"memory\": return { kind: \"memory\" };\n\t\tcase \"path\":\n\t\t\tif (!storage.dataDir) throw new Error(`Backend \"${name}\": storage kind \"path\" requires dataDir.`);\n\t\t\treturn {\n\t\t\t\tkind: \"path\",\n\t\t\t\tdataDir: storage.dataDir\n\t\t\t};\n\t\tcase \"postgres\": throw new Error(`Backend \"${name}\": storage kind \"postgres\" is server-side only — a provisioned (in-process/worker) reactor cannot use it. Point a \"remote\" backend at the switchboard that owns that database instead.`);\n\t}\n}\n/** One backend → one descriptor. The protocol's featureFlags ride every\n* descriptor (they are fleet consensus, not per-backend). A remote backend\n* must carry remote.url — provision() requires it. */\nfunction backendToDescriptor(name, backend, protocol) {\n\tconst descriptor = {\n\t\tkind: backend.kind ?? \"in-process\",\n\t\tname\n\t};\n\tif (descriptor.kind === \"remote\") {\n\t\tconst url = backend.remote?.url;\n\t\tif (!url) throw new Error(`Backend \"${name}\" is kind \"remote\" but has no remote.url — a remote descriptor attaches to an already-running reactor by URL.`);\n\t\tdescriptor.remote = { url };\n\t\treturn descriptor;\n\t}\n\tif (backend.storage) descriptor.storage = projectStorage(name, backend.storage);\n\tif (backend.packages) descriptor.packages = backend.packages;\n\tif (protocol?.featureFlags) descriptor.featureFlags = protocol.featureFlags;\n\treturn descriptor;\n}\n/** All named backends, in placement-primary-first order (the order a\n* createReactorClients step would provision them). */\nfunction backendsToDescriptors(reactor) {\n\tconst backends = reactor?.backends;\n\tif (!backends) return [];\n\tconst names = Object.keys(backends);\n\tconst primary = reactor.placement?.primary;\n\treturn (primary && names.includes(primary) ? [primary, ...names.filter((n) => n !== primary)] : names).map((name) => backendToDescriptor(name, backends[name], reactor.protocol));\n}\nconst LOCAL_KINDS = /* @__PURE__ */ new Set([\n\t\"in-process\",\n\t\"worker\",\n\tvoid 0\n]);\n/**\n* Structural multi-reactor (phase 4): true when the block names BOTH a local\n* backend (in-process/worker — the tab's own reactor) and a remote one. This\n* is the shape Connect's routing client serves; a lone remote backend is an\n* attach-only host (assistant/agent shape), not a routed tab.\n*/\nfunction isStructuralMultiReactor(reactor) {\n\tconst backends = reactor?.backends;\n\tif (!backends) return false;\n\tconst kinds = Object.values(backends).map((b) => b.kind);\n\treturn kinds.some((k) => LOCAL_KINDS.has(k)) && kinds.some((k) => k === \"remote\");\n}\n/** The remote backends' urls, placement order — what the routing client dials. */\nfunction remoteBackendUrls(reactor) {\n\treturn backendsToDescriptors(reactor).filter((d) => d.kind === \"remote\").map((d) => d.remote?.url).filter((u) => typeof u === \"string\");\n}\n//#endregion\n//#region src/reactor-config.ts\n/** The single primary backend for phase-2 projection (multi-backend routing is\n* track R). Prefers placement.primary, else \"main\"/\"local\", else the first. */\nfunction primaryBackend(reactor) {\n\tconst backends = reactor?.backends;\n\tif (!backends) return void 0;\n\tconst names = Object.keys(backends);\n\tif (names.length === 0) return void 0;\n\treturn backends[reactor.placement?.primary ?? (names.includes(\"main\") ? \"main\" : names.includes(\"local\") ? \"local\" : names[0])];\n}\nconst FLAG_ENV = {\n\tdocumentDecisions: \"REACTOR_DOCUMENT_DECISIONS\",\n\tauthEnforcement: \"REACTOR_AUTH_ENFORCEMENT\",\n\tauthGroups: \"REACTOR_AUTH_GROUPS\",\n\tauthConditions: \"REACTOR_AUTH_CONDITIONS\"\n};\n/** The env vars a protocol block maps onto, with their string values. Only\n* keys the block actually sets appear. */\nfunction protocolEnv(protocol) {\n\tconst env = {};\n\tif (!protocol) return env;\n\tfor (const [key, varName] of Object.entries(FLAG_ENV)) {\n\t\tconst value = protocol.featureFlags?.[key];\n\t\tif (value !== void 0) env[varName] = value ? \"true\" : \"false\";\n\t}\n\tif (protocol.createSignaturePolicy !== void 0) env.CREATE_SIGNATURE_POLICY = protocol.createSignaturePolicy;\n\tif (protocol.unsupportedStoredDocuments !== void 0) env.REACTOR_UNSUPPORTED_STORED_DOCUMENTS = protocol.unsupportedStoredDocuments;\n\treturn env;\n}\n/** Project the reactor block onto the switchboard's env + options. */\nfunction projectReactorToSwitchboard(reactor) {\n\tconst env = protocolEnv(reactor?.protocol);\n\tconst backend = primaryBackend(reactor);\n\tconst options = {};\n\tif (backend?.storage) {\n\t\tconst s = backend.storage;\n\t\tconst dbUrl = s.kind === \"postgres\" ? s.url : s.dataDir;\n\t\tif (dbUrl) env.PH_REACTOR_DATABASE_URL = dbUrl;\n\t}\n\tif (backend?.readModel?.url) options.dbPath = backend.readModel.url;\n\tif (backend?.packages?.dynamic) env.DYNAMIC_MODEL_LOADING = \"true\";\n\tif (reactor?.workflows !== void 0) env.PH_WORKFLOWS_ENABLED = reactor.workflows ? \"1\" : \"0\";\n\treturn {\n\t\tenv,\n\t\toptions\n\t};\n}\n/** Project the reactor block onto the Connect runtime config: protocol →\n* connect.reactor (same shape), backend kind → instance.reactorWorker,\n* workflows → app.workflowsEnabled. */\nfunction projectReactorToConnect(reactor) {\n\tconst connect = {};\n\tif (reactor?.protocol) connect.reactor = reactor.protocol;\n\tconst backend = primaryBackend(reactor);\n\tif (backend?.kind !== void 0) connect.instance = { reactorWorker: backend.kind === \"worker\" };\n\tif (reactor?.workflows !== void 0) connect.app = { workflowsEnabled: reactor.workflows };\n\treturn { connect };\n}\n/**\n* The enforcement teeth of single-sourcing: if a pre-set env var CONTRADICTS\n* the host's protocol block, fail loudly naming the var, the host value, and\n* the env value. An env var that merely matches, or is unset, is fine (phase-2\n* transition keeps an operator's explicit env as an escape hatch unless it\n* disagrees with the protocol — see the WBS precedence note).\n*/\nfunction assertProtocolConsistency(protocol, env, hostFile = \"the host file\") {\n\tif (!protocol) return;\n\tconst expected = protocolEnv(protocol);\n\tfor (const [varName, hostValue] of Object.entries(expected)) {\n\t\tconst envValue = env[varName];\n\t\tif (envValue !== void 0 && envValue !== hostValue) throw new Error(`reactor.protocol conflict: ${varName} is \"${envValue}\" in the environment but \"${hostValue}\" in ${hostFile}. These are fleet-consensus settings — a mismatch would diverge replay. Remove the env override or align the host.`);\n\t}\n}\n//#endregion\nexport { HostLoadError, RunnerError, assertProtocolConsistency, backendToDescriptor, backendsToDescriptors, childrenSchema, clearRunRecord, compoundHostSchema, defaultUserDataDir, emittedHostSchemas, findNonStaticValue, getVerb, isPidAlive, isStructuralMultiReactor, lintHostImports, listVerbs, loadHost, mergeDefaultDrives, primaryBackend, probeHostsFolder, probeRun, profileSchema, projectDrivesIntoConnect, projectReactorToConnect, projectReactorToSwitchboard, protocolEnv, reactorBackendSchema, reactorHostSchema, reactorProtocolSchema, reactorSchema, readRunRecord, rebaseDriveUrl, remoteBackendUrls, resolveRunnerModule, resolveUserDataPlaceholders, runCompound, runnerBaseSchema, validateHost, writeRunRecord };\n\n//# sourceMappingURL=index.mjs.map"],"names":[],"mappings":";;;AAEA,SAAS,eAAe,MAAM,SAAS;CACtC,QAAQ,QAAQ,MAAhB;EACC,KAAK,OAAO,OAAO,EAAE,MAAM,MAAM;EACjC,KAAK,UAAU,OAAO,EAAE,MAAM,SAAS;EACvC,KAAK;GACJ,IAAI,CAAC,QAAQ,SAAS,MAAM,IAAI,MAAM,YAAY,KAAK,yCAAyC;GAChG,OAAO;IACN,MAAM;IACN,SAAS,QAAQ;GAClB;EACD,KAAK,YAAY,MAAM,IAAI,MAAM,YAAY,KAAK,uLAAuL;CAC1O;AACD;;;;AAIA,SAAS,oBAAoB,MAAM,SAAS,UAAU;CACrD,MAAM,aAAa;EAClB,MAAM,QAAQ,QAAQ;EACtB;CACD;CACA,IAAI,WAAW,SAAS,UAAU;EACjC,MAAM,MAAM,QAAQ,QAAQ;EAC5B,IAAI,CAAC,KAAK,MAAM,IAAI,MAAM,YAAY,KAAK,8GAA8G;EACzJ,WAAW,SAAS,EAAE,IAAI;EAC1B,OAAO;CACR;CACA,IAAI,QAAQ,SAAS,WAAW,UAAU,eAAe,MAAM,QAAQ,OAAO;CAC9E,IAAI,QAAQ,UAAU,WAAW,WAAW,QAAQ;CACpD,IAAI,UAAU,cAAc,WAAW,eAAe,SAAS;CAC/D,OAAO;AACR;;;AAGA,SAAS,sBAAsB,SAAS;CACvC,MAAM,WAAW,SAAS;CAC1B,IAAI,CAAC,UAAU,OAAO,CAAC;CACvB,MAAM,QAAQ,OAAO,KAAK,QAAQ;CAClC,MAAM,UAAU,QAAQ,WAAW;CACnC,QAAQ,WAAW,MAAM,SAAS,OAAO,IAAI,CAAC,SAAS,GAAG,MAAM,QAAQ,MAAM,MAAM,OAAO,CAAC,IAAI,MAAA,CAAO,KAAK,SAAS,oBAAoB,MAAM,SAAS,OAAO,QAAQ,QAAQ,CAAC;AACjL;AACA,MAAM,8BAA8B,IAAI,IAAI;CAC3C;CACA;CACA,KAAK;AACN,CAAC;;;;;;;AAOD,SAAS,yBAAyB,SAAS;CAC1C,MAAM,WAAW,SAAS;CAC1B,IAAI,CAAC,UAAU,OAAO;CACtB,MAAM,QAAQ,OAAO,OAAO,QAAQ,CAAC,CAAC,KAAK,MAAM,EAAE,IAAI;CACvD,OAAO,MAAM,MAAM,MAAM,YAAY,IAAI,CAAC,CAAC,KAAK,MAAM,MAAM,MAAM,MAAM,QAAQ;AACjF;;AAEA,SAAS,kBAAkB,SAAS;CACnC,OAAO,sBAAsB,OAAO,CAAC,CAAC,QAAQ,MAAM,EAAE,SAAS,QAAQ,CAAC,CAAC,KAAK,MAAM,EAAE,QAAQ,GAAG,CAAC,CAAC,QAAQ,MAAM,OAAO,MAAM,QAAQ;AACvI;;;AAKA,SAAS,eAAe,SAAS;CAChC,MAAM,WAAW,SAAS;CAC1B,IAAI,CAAC,UAAU,OAAO,KAAK;CAC3B,MAAM,QAAQ,OAAO,KAAK,QAAQ;CAClC,IAAI,MAAM,WAAW,GAAG,OAAO,KAAK;CACpC,OAAO,SAAS,QAAQ,WAAW,YAAY,MAAM,SAAS,MAAM,IAAI,SAAS,MAAM,SAAS,OAAO,IAAI,UAAU,MAAM;AAC5H;AACA,MAAM,WAAW;CAChB,mBAAmB;CACnB,iBAAiB;CACjB,YAAY;CACZ,gBAAgB;AACjB;;;AAGA,SAAS,YAAY,UAAU;CAC9B,MAAM,MAAM,CAAC;CACb,IAAI,CAAC,UAAU,OAAO;CACtB,KAAK,MAAM,CAAC,KAAK,YAAY,OAAO,QAAQ,QAAQ,GAAG;EACtD,MAAM,QAAQ,SAAS,eAAe;EACtC,IAAI,UAAU,KAAK,GAAG,IAAI,WAAW,QAAQ,SAAS;CACvD;CACA,IAAI,SAAS,0BAA0B,KAAK,GAAG,IAAI,0BAA0B,SAAS;CACtF,IAAI,SAAS,+BAA+B,KAAK,GAAG,IAAI,uCAAuC,SAAS;CACxG,OAAO;AACR;;AAEA,SAAS,4BAA4B,SAAS;CAC7C,MAAM,MAAM,YAAY,SAAS,QAAQ;CACzC,MAAM,UAAU,eAAe,OAAO;CACtC,MAAM,UAAU,CAAC;CACjB,IAAI,SAAS,SAAS;EACrB,MAAM,IAAI,QAAQ;EAClB,MAAM,QAAQ,EAAE,SAAS,aAAa,EAAE,MAAM,EAAE;EAChD,IAAI,OAAO,IAAI,0BAA0B;CAC1C;CACA,IAAI,SAAS,WAAW,KAAK,QAAQ,SAAS,QAAQ,UAAU;CAChE,IAAI,SAAS,UAAU,SAAS,IAAI,wBAAwB;CAC5D,IAAI,SAAS,cAAc,KAAK,GAAG,IAAI,uBAAuB,QAAQ,YAAY,MAAM;CACxF,OAAO;EACN;EACA;CACD;AACD;;;;AAIA,SAAS,wBAAwB,SAAS;CACzC,MAAM,UAAU,CAAC;CACjB,IAAI,SAAS,UAAU,QAAQ,UAAU,QAAQ;CACjD,MAAM,UAAU,eAAe,OAAO;CACtC,IAAI,SAAS,SAAS,KAAK,GAAG,QAAQ,WAAW,EAAE,eAAe,QAAQ,SAAS,SAAS;CAC5F,IAAI,SAAS,cAAc,KAAK,GAAG,QAAQ,MAAM,EAAE,kBAAkB,QAAQ,UAAU;CACvF,OAAO,EAAE,QAAQ;AAClB;;;;;;;;AAQA,SAAS,0BAA0B,UAAU,KAAK,WAAW,iBAAiB;CAC7E,IAAI,CAAC,UAAU;CACf,MAAM,WAAW,YAAY,QAAQ;CACrC,KAAK,MAAM,CAAC,SAAS,cAAc,OAAO,QAAQ,QAAQ,GAAG;EAC5D,MAAM,WAAW,IAAI;EACrB,IAAI,aAAa,KAAK,KAAK,aAAa,WAAW,MAAM,IAAI,MAAM,8BAA8B,QAAQ,OAAO,SAAS,4BAA4B,UAAU,OAAO,SAAS,mHAAmH;CACnS;AACD","debug_id":"52e2d8f9-f49d-5819-bb63-c89d9476c43f"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//#region src/utils/feature-flags.ts
|
|
2
|
+
/**
|
|
3
|
+
* Feature toggles for the ph CLI. Hand-rolled env predicates by this CLI's
|
|
4
|
+
* convention (PH_CONNECT_VENDOR, the telemetry flags) — deliberately no
|
|
5
|
+
* OpenFeature dependency here; that stack belongs to the runtime apps.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Gates the uniform-runners surface: the `ph run` command, host-name sugar,
|
|
9
|
+
* and the `ph init` hosts/ scaffold. Off by default; set to `1` or `true` to
|
|
10
|
+
* enable. Rollout plan: docs/plans/2026-10-13-uniform-runners.md.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="c758e7dd-c3a0-5cc2-8455-81aa3e65780c")}catch(e){}}();
|
|
14
|
+
const UNIFORM_RUNNERS_FLAG = "FEATURE_UNIFORM_RUNNERS_ENABLED";
|
|
15
|
+
function isUniformRunnersEnabled(env = process.env) {
|
|
16
|
+
const value = env[UNIFORM_RUNNERS_FLAG]?.trim().toLowerCase();
|
|
17
|
+
return value === "1" || value === "true";
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { isUniformRunnersEnabled as t };
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=feature-flags-DhEVzlCC.mjs.map
|
|
23
|
+
//# debugId=c758e7dd-c3a0-5cc2-8455-81aa3e65780c
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature-flags-DhEVzlCC.mjs","sources":["../src/utils/feature-flags.ts"],"sourcesContent":["/**\n * Feature toggles for the ph CLI. Hand-rolled env predicates by this CLI's\n * convention (PH_CONNECT_VENDOR, the telemetry flags) — deliberately no\n * OpenFeature dependency here; that stack belongs to the runtime apps.\n */\n\n/**\n * Gates the uniform-runners surface: the `ph run` command, host-name sugar,\n * and the `ph init` hosts/ scaffold. Off by default; set to `1` or `true` to\n * enable. Rollout plan: docs/plans/2026-10-13-uniform-runners.md.\n */\nexport const UNIFORM_RUNNERS_FLAG = \"FEATURE_UNIFORM_RUNNERS_ENABLED\";\n\nexport function isUniformRunnersEnabled(\n env: Record<string, string | undefined> = process.env,\n): boolean {\n const value = env[UNIFORM_RUNNERS_FLAG]?.trim().toLowerCase();\n return value === \"1\" || value === \"true\";\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;AAWA,MAAa,uBAAuB;AAEpC,SAAgB,wBACd,MAA0C,QAAQ,KACzC;CACT,MAAM,QAAQ,IAAI,qBAAqB,EAAE,KAAK,CAAC,CAAC,YAAY;CAC5D,OAAO,UAAU,OAAO,UAAU;AACpC","debug_id":"c758e7dd-c3a0-5cc2-8455-81aa3e65780c"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="2d046d0a-39ff-5107-97e9-021c7478cc58")}catch(e){}}();
|
|
3
|
+
import { t as warnSubgraphTypeConflicts } from "./warn-subgraph-type-conflicts-Jd6SeN-M.mjs";
|
|
3
4
|
import { generateAll } from "@powerhousedao/codegen";
|
|
4
5
|
import { buildTsMorphProject } from "@powerhousedao/codegen/utils";
|
|
5
6
|
import { extractAllDocuments, saveSpec } from "@powerhousedao/vetra/codegen";
|
|
@@ -22,9 +23,10 @@ async function startGenerateAll(args, projectDir) {
|
|
|
22
23
|
}
|
|
23
24
|
await generateAll(project);
|
|
24
25
|
await project.save();
|
|
26
|
+
warnSubgraphTypeConflicts(projectDir);
|
|
25
27
|
}
|
|
26
28
|
//#endregion
|
|
27
29
|
export { startGenerateAll };
|
|
28
30
|
|
|
29
|
-
//# sourceMappingURL=generate-all-
|
|
30
|
-
//# debugId=
|
|
31
|
+
//# sourceMappingURL=generate-all-CRfVwLJ9.mjs.map
|
|
32
|
+
//# debugId=2d046d0a-39ff-5107-97e9-021c7478cc58
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-all-CRfVwLJ9.mjs","sources":["../src/services/generate-all.ts"],"sourcesContent":["import { generateAll } from \"@powerhousedao/codegen\";\nimport { buildTsMorphProject } from \"@powerhousedao/codegen/utils\";\nimport { extractAllDocuments, saveSpec } from \"@powerhousedao/vetra/codegen\";\nimport { warnSubgraphTypeConflicts } from \"../utils/warn-subgraph-type-conflicts.js\";\n\nexport async function startGenerateAll(\n args: { extract?: boolean },\n projectDir: string,\n) {\n const project = buildTsMorphProject(projectDir);\n if (args.extract) {\n const all = extractAllDocuments(project);\n for (const doc of [\n ...all.documentModels,\n ...all.editors,\n ...all.processors,\n ...all.subgraphs,\n ...all.apps,\n ]) {\n const path = await saveSpec(doc, projectDir);\n console.log(`Wrote ${path}`);\n }\n return;\n }\n await generateAll(project);\n await project.save();\n warnSubgraphTypeConflicts(projectDir);\n}\n"],"names":[],"mappings":";;;;;;;AAKA,eAAsB,iBACpB,MACA,YACA;CACA,MAAM,UAAU,oBAAoB,UAAU;CAC9C,IAAI,KAAK,SAAS;EAChB,MAAM,MAAM,oBAAoB,OAAO;EACvC,KAAK,MAAM,OAAO;GAChB,GAAG,IAAI;GACP,GAAG,IAAI;GACP,GAAG,IAAI;GACP,GAAG,IAAI;GACP,GAAG,IAAI;EACT,GAAG;GACD,MAAM,OAAO,MAAM,SAAS,KAAK,UAAU;GAC3C,QAAQ,IAAI,SAAS,MAAM;EAC7B;EACA;CACF;CACA,MAAM,YAAY,OAAO;CACzB,MAAM,QAAQ,KAAK;CACnB,0BAA0B,UAAU;AACtC","debug_id":"2d046d0a-39ff-5107-97e9-021c7478cc58"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="49439419-5f64-5ecf-a840-c46e50265dc2")}catch(e){}}();
|
|
3
|
+
import { t as warnSubgraphTypeConflicts } from "./warn-subgraph-type-conflicts-Jd6SeN-M.mjs";
|
|
3
4
|
import { dirname, join } from "node:path";
|
|
4
5
|
import { generateAllDocumentModels, generateDocumentModel, loadDocumentModel } from "@powerhousedao/codegen";
|
|
5
6
|
import { buildTsMorphProject } from "@powerhousedao/codegen/utils";
|
|
@@ -36,9 +37,10 @@ async function startGenerateDocumentModel(args, projectDir) {
|
|
|
36
37
|
return;
|
|
37
38
|
}
|
|
38
39
|
await project.save();
|
|
40
|
+
warnSubgraphTypeConflicts(projectDir);
|
|
39
41
|
}
|
|
40
42
|
//#endregion
|
|
41
43
|
export { startGenerateDocumentModel };
|
|
42
44
|
|
|
43
|
-
//# sourceMappingURL=generate-document-model-
|
|
44
|
-
//# debugId=
|
|
45
|
+
//# sourceMappingURL=generate-document-model-ChkXjM1s.mjs.map
|
|
46
|
+
//# debugId=49439419-5f64-5ecf-a840-c46e50265dc2
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-document-model-ChkXjM1s.mjs","sources":["../src/services/generate-document-model.ts"],"sourcesContent":["import {\n generateAllDocumentModels,\n generateDocumentModel,\n loadDocumentModel,\n} from \"@powerhousedao/codegen\";\nimport { buildTsMorphProject } from \"@powerhousedao/codegen/utils\";\nimport {\n extractDocumentModelDocuments,\n generateDocumentModelFromDocument,\n getDocument,\n saveSpec,\n} from \"@powerhousedao/vetra/codegen\";\nimport type { DocumentModelDocument } from \"@powerhousedao/shared/document-model\";\nimport { dirname, join } from \"node:path\";\nimport type { GenerateDocumentModelArgs } from \"../types.js\";\nimport { warnSubgraphTypeConflicts } from \"../utils/warn-subgraph-type-conflicts.js\";\n\nexport async function startGenerateDocumentModel(\n args: GenerateDocumentModelArgs,\n projectDir: string,\n) {\n const { document, dir, all, extract, debug } = args;\n if (debug) {\n console.log({ args });\n }\n const project = buildTsMorphProject(projectDir);\n if (extract) {\n const docs = extractDocumentModelDocuments(project);\n for (const doc of docs) {\n const path = await saveSpec(doc, projectDir);\n console.log(`Wrote ${path}`);\n }\n return;\n }\n if (all) {\n await generateAllDocumentModels(project);\n } else if (document) {\n if (document.endsWith(\".phd\")) {\n const doc = (await getDocument(document)) as DocumentModelDocument;\n await generateDocumentModelFromDocument(doc, project);\n } else {\n const state = await loadDocumentModel(document);\n await generateDocumentModel(state, project);\n }\n } else if (dir) {\n const documentModelDirName = dirname(dir);\n const documentModelFileName = `${documentModelDirName}.json`;\n const documentModelFilePath = join(dir, documentModelFileName);\n const state = await loadDocumentModel(documentModelFilePath);\n await generateDocumentModel(state, project);\n } else {\n console.log(\n \"Please specify one of `document`, `dir`, `all`, or `extract`.\",\n );\n return;\n }\n await project.save();\n warnSubgraphTypeConflicts(projectDir);\n}\n"],"names":[],"mappings":";;;;;;;;AAiBA,eAAsB,2BACpB,MACA,YACA;CACA,MAAM,EAAE,UAAU,KAAK,KAAK,SAAS,UAAU;CAC/C,IAAI,OACF,QAAQ,IAAI,EAAE,KAAK,CAAC;CAEtB,MAAM,UAAU,oBAAoB,UAAU;CAC9C,IAAI,SAAS;EACX,MAAM,OAAO,8BAA8B,OAAO;EAClD,KAAK,MAAM,OAAO,MAAM;GACtB,MAAM,OAAO,MAAM,SAAS,KAAK,UAAU;GAC3C,QAAQ,IAAI,SAAS,MAAM;EAC7B;EACA;CACF;CACA,IAAI,KACF,MAAM,0BAA0B,OAAO;MAClC,IAAI,UAAU;EACnB,IAAI,SAAS,SAAS,MAAM,GAAG;GAC7B,MAAM,MAAO,MAAM,YAAY,QAAQ;GACvC,MAAM,kCAAkC,KAAK,OAAO;EACtD,OAAO;GACL,MAAM,QAAQ,MAAM,kBAAkB,QAAQ;GAC9C,MAAM,sBAAsB,OAAO,OAAO;EAC5C;CACF,OAAO,IAAI,KAAK;EAEd,MAAM,wBAAwB,GADD,QAAQ,GACe,EAAE;EACtD,MAAM,wBAAwB,KAAK,KAAK,qBAAqB;EAC7D,MAAM,QAAQ,MAAM,kBAAkB,qBAAqB;EAC3D,MAAM,sBAAsB,OAAO,OAAO;CAC5C,OAAO;EACL,QAAQ,IACN,+DACF;EACA;CACF;CACA,MAAM,QAAQ,KAAK;CACnB,0BAA0B,UAAU;AACtC","debug_id":"49439419-5f64-5ecf-a840-c46e50265dc2"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="199c47bd-ca2f-5628-a312-bbde798073fb")}catch(e){}}();
|
|
3
3
|
import { t as installAddedDependencies } from "./install-added-dependencies-DVSbzler.mjs";
|
|
4
|
+
import { t as warnSubgraphTypeConflicts } from "./warn-subgraph-type-conflicts-Jd6SeN-M.mjs";
|
|
4
5
|
import { dirname } from "node:path";
|
|
5
6
|
import { detectFeatures, generateAllSubgraphs, generateSubgraph, syncFeatureDependencies } from "@powerhousedao/codegen";
|
|
6
7
|
import { buildTsMorphProject, getSubgraphMetadata } from "@powerhousedao/codegen/utils";
|
|
@@ -32,11 +33,12 @@ async function startGenerateSubgraph(args, projectDir) {
|
|
|
32
33
|
return;
|
|
33
34
|
}
|
|
34
35
|
await project.save();
|
|
36
|
+
warnSubgraphTypeConflicts(projectDir);
|
|
35
37
|
const added = await syncFeatureDependencies(detectFeatures(projectDir), projectDir);
|
|
36
38
|
await installAddedDependencies(added, projectDir, args.skipInstall);
|
|
37
39
|
}
|
|
38
40
|
//#endregion
|
|
39
41
|
export { startGenerateSubgraph };
|
|
40
42
|
|
|
41
|
-
//# sourceMappingURL=generate-subgraph-
|
|
42
|
-
//# debugId=
|
|
43
|
+
//# sourceMappingURL=generate-subgraph-DmcQWVbd.mjs.map
|
|
44
|
+
//# debugId=199c47bd-ca2f-5628-a312-bbde798073fb
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-subgraph-DmcQWVbd.mjs","sources":["../src/services/generate-subgraph.ts"],"sourcesContent":["import {\n detectFeatures,\n generateAllSubgraphs,\n generateSubgraph,\n syncFeatureDependencies,\n} from \"@powerhousedao/codegen\";\nimport {\n buildTsMorphProject,\n getSubgraphMetadata,\n} from \"@powerhousedao/codegen/utils\";\nimport {\n extractSubgraphDocuments,\n generateSubgraphFromDocument,\n getDocument,\n saveSpec,\n} from \"@powerhousedao/vetra/codegen\";\nimport type { SubgraphModuleDocument } from \"@powerhousedao/vetra/document-models/subgraph-module\";\nimport { dirname } from \"node:path\";\nimport type { GenerateSubgraphArgs } from \"../types.js\";\nimport { installAddedDependencies } from \"../utils/install-added-dependencies.js\";\nimport { warnSubgraphTypeConflicts } from \"../utils/warn-subgraph-type-conflicts.js\";\n\nexport async function startGenerateSubgraph(\n args: GenerateSubgraphArgs,\n projectDir: string,\n) {\n const { name, document, dir, all, extract, debug } = args;\n if (debug) {\n console.log({ args });\n }\n const project = buildTsMorphProject(projectDir);\n if (extract) {\n const docs = extractSubgraphDocuments(project);\n for (const doc of docs) {\n const path = await saveSpec(doc, projectDir);\n console.log(`Wrote ${path}`);\n }\n return;\n }\n if (all) {\n await generateAllSubgraphs(project);\n } else if (document) {\n const doc = (await getDocument(document)) as SubgraphModuleDocument;\n await generateSubgraphFromDocument(doc, project);\n } else if (name) {\n await generateSubgraph(name, project);\n } else if (dir) {\n const { subgraphName } = getSubgraphMetadata(project, dirname(dir));\n if (!subgraphName) {\n throw new Error(`Failed to get data for subgraph in dir \"${dir}\"`);\n }\n await generateSubgraph(subgraphName, project);\n } else {\n console.log(\n \"Please specify one of `name`, `document`, `dir`, `all`, or `extract`.\",\n );\n return;\n }\n await project.save();\n warnSubgraphTypeConflicts(projectDir);\n const added = await syncFeatureDependencies(\n detectFeatures(projectDir),\n projectDir,\n );\n await installAddedDependencies(added, projectDir, args.skipInstall);\n}\n"],"names":[],"mappings":";;;;;;;;;AAsBA,eAAsB,sBACpB,MACA,YACA;CACA,MAAM,EAAE,MAAM,UAAU,KAAK,KAAK,SAAS,UAAU;CACrD,IAAI,OACF,QAAQ,IAAI,EAAE,KAAK,CAAC;CAEtB,MAAM,UAAU,oBAAoB,UAAU;CAC9C,IAAI,SAAS;EACX,MAAM,OAAO,yBAAyB,OAAO;EAC7C,KAAK,MAAM,OAAO,MAAM;GACtB,MAAM,OAAO,MAAM,SAAS,KAAK,UAAU;GAC3C,QAAQ,IAAI,SAAS,MAAM;EAC7B;EACA;CACF;CACA,IAAI,KACF,MAAM,qBAAqB,OAAO;MAC7B,IAAI,UAAU;EACnB,MAAM,MAAO,MAAM,YAAY,QAAQ;EACvC,MAAM,6BAA6B,KAAK,OAAO;CACjD,OAAO,IAAI,MACT,MAAM,iBAAiB,MAAM,OAAO;MAC/B,IAAI,KAAK;EACd,MAAM,EAAE,iBAAiB,oBAAoB,SAAS,QAAQ,GAAG,CAAC;EAClE,IAAI,CAAC,cACH,MAAM,IAAI,MAAM,2CAA2C,IAAI,EAAE;EAEnE,MAAM,iBAAiB,cAAc,OAAO;CAC9C,OAAO;EACL,QAAQ,IACN,uEACF;EACA;CACF;CACA,MAAM,QAAQ,KAAK;CACnB,0BAA0B,UAAU;CACpC,MAAM,QAAQ,MAAM,wBAClB,eAAe,UAAU,GACzB,UACF;CACA,MAAM,yBAAyB,OAAO,YAAY,KAAK,WAAW;AACpE","debug_id":"199c47bd-ca2f-5628-a312-bbde798073fb"}
|