@powerhousedao/ph-cli 6.2.3-dev.76 → 6.2.3-dev.78
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/{check-9KDSF1Wj.mjs → check-KEXBwJXM.mjs} +4 -4
- package/dist/{check-9KDSF1Wj.mjs.map → check-KEXBwJXM.mjs.map} +1 -1
- package/dist/{cli-connect-override-BrS-X8Rs.mjs → cli-connect-override-C65On7dE.mjs} +4 -4
- package/dist/{cli-connect-override-BrS-X8Rs.mjs.map → cli-connect-override-C65On7dE.mjs.map} +1 -1
- package/dist/cli.mjs +4 -4
- package/dist/{compound-Gjt5rBfF-BmSW1XPB.mjs → compound-Cfqa5Jal-B5rkCmIj.mjs} +24 -39
- package/dist/compound-Cfqa5Jal-B5rkCmIj.mjs.map +1 -0
- package/dist/{connect-build-B5nYqlLc.mjs → connect-build-B9jwzQlf.mjs} +4 -4
- package/dist/{connect-build-B5nYqlLc.mjs.map → connect-build-B9jwzQlf.mjs.map} +1 -1
- package/dist/{connect-config-Bi95JhNG.mjs → connect-config-D5SHcBf1.mjs} +4 -4
- package/dist/{connect-config-Bi95JhNG.mjs.map → connect-config-D5SHcBf1.mjs.map} +1 -1
- package/dist/{connect-plugin-configs-BwYEbQSY.mjs → connect-plugin-configs-BoPbxD9u.mjs} +4 -4
- package/dist/{connect-plugin-configs-BwYEbQSY.mjs.map → connect-plugin-configs-BoPbxD9u.mjs.map} +1 -1
- package/dist/{connect-studio-DGWUidCV.mjs → connect-studio-CEpyVlJ_.mjs} +4 -4
- package/dist/{connect-studio-DGWUidCV.mjs.map → connect-studio-CEpyVlJ_.mjs.map} +1 -1
- package/dist/{connect-studio-Co_UNyEC.mjs → connect-studio-CYETzL2c.mjs} +3 -3
- package/dist/{dist-BVqNlv1z.mjs → dist-CSn_YRdB.mjs} +105 -6
- package/dist/dist-CSn_YRdB.mjs.map +1 -0
- package/dist/{explain-CPD1tzoV.mjs → explain-BsZw-WrZ.mjs} +6 -17
- package/dist/explain-BsZw-WrZ.mjs.map +1 -0
- package/dist/export-BGJVYlCK.mjs +42 -0
- package/dist/export-BGJVYlCK.mjs.map +1 -0
- package/dist/{generate-all-CaAHbviS.mjs → generate-all-DgEFOXwU.mjs} +4 -4
- package/dist/{generate-all-CaAHbviS.mjs.map → generate-all-DgEFOXwU.mjs.map} +1 -1
- package/dist/{generate-desktop-shell-BdXDiS5o.mjs → generate-desktop-shell-BXcGvbms.mjs} +4 -4
- package/dist/{generate-desktop-shell-BdXDiS5o.mjs.map → generate-desktop-shell-BXcGvbms.mjs.map} +1 -1
- package/dist/{index-7hbcAZpm.d.mts → index-DHHaYrj2.d.mts} +4 -20
- package/dist/{index-7hbcAZpm.d.mts.map → index-DHHaYrj2.d.mts.map} +1 -1
- package/dist/{ph-cli-commands-kRpc2dhi.mjs → ph-cli-commands-DJYB9BDl.mjs} +30 -15
- package/dist/ph-cli-commands-DJYB9BDl.mjs.map +1 -0
- package/dist/ph-cli-commands-JBUwDL2d.mjs +4 -0
- package/dist/{run-sugar-BJxPKwlM.mjs → run-sugar-BzGnofrW.mjs} +4 -4
- package/dist/{run-sugar-BJxPKwlM.mjs.map → run-sugar-BzGnofrW.mjs.map} +1 -1
- package/dist/runners/connect.d.mts +1 -33
- package/dist/runners/connect.d.mts.map +1 -1
- package/dist/runners/connect.mjs +9 -8
- package/dist/runners/connect.mjs.map +1 -1
- package/dist/runners/switchboard.d.mts +3 -35
- package/dist/runners/switchboard.d.mts.map +1 -1
- package/dist/runners/switchboard.mjs +35 -12
- package/dist/runners/switchboard.mjs.map +1 -1
- package/dist/{schemas-D5N5U_Mf.mjs → schemas-Cnv5AnQT.mjs} +18 -4
- package/dist/{schemas-D5N5U_Mf.mjs.map → schemas-Cnv5AnQT.mjs.map} +1 -1
- package/dist/{start-run-CDZ3YAr9.mjs → start-run-BAQDM5Bu.mjs} +4 -4
- package/dist/{start-run-CDZ3YAr9.mjs.map → start-run-BAQDM5Bu.mjs.map} +1 -1
- package/dist/{vetra-DO5eUgAo.mjs → vetra-C4ri3YLH.mjs} +6 -6
- package/dist/{vetra-DO5eUgAo.mjs.map → vetra-C4ri3YLH.mjs.map} +1 -1
- package/package.json +13 -13
- package/dist/compound-Gjt5rBfF-BmSW1XPB.mjs.map +0 -1
- package/dist/dist-BVqNlv1z.mjs.map +0 -1
- package/dist/explain-CPD1tzoV.mjs.map +0 -1
- package/dist/ph-cli-commands-BQU6lpyM.mjs +0 -4
- package/dist/ph-cli-commands-kRpc2dhi.mjs.map +0 -1
|
@@ -1,7 +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]="
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
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]="6b9a4a1e-93da-5918-9899-5b0162df590c")}catch(e){}}();
|
|
3
|
+
import { A as loadProducers, B as processResolveEnv, D as isToken, F as outputSitesOf, G as renderTokens, I as planCompound, J as resolvePluginContributions, K as resolveHostOutputs, P as outputRefsOf, U as readProjectName, V as producerOutputsSchemas, X as runRecordOutputSource, Y as resolveRunnerModule, Z as runnerOutputsSchema, d as compoundOutputSource, g as drivesSchema, h as describeToken, j as memberForRef, k as loadHost, nt as validateDeclaredHost, o as applyChildWrapper, p as declaredHostSchemas, rt as validateHost, u as collectTokenSites, v as envSitesOf, x as formatPath, y as findDeadConnectConfig, z as probeRun } from "./compound-Cfqa5Jal-B5rkCmIj.mjs";
|
|
4
|
+
import { r as explainDrivePlan, s as mergeDrivePlan } from "./dist-CSn_YRdB.mjs";
|
|
5
5
|
//#region src/services/run/explain.ts
|
|
6
6
|
const TOPICS = ["drives", "outputs"];
|
|
7
7
|
async function loadView(projectRoot, name) {
|
|
@@ -30,18 +30,7 @@ async function loadView(projectRoot, name) {
|
|
|
30
30
|
const children = declaredHostSchemas.childrenSchema.parse(loaded.host.children);
|
|
31
31
|
const members = [];
|
|
32
32
|
for (const [key, wrapper] of Object.entries(children)) {
|
|
33
|
-
const
|
|
34
|
-
const reactor = wrapper.reactor ?? base.reactor;
|
|
35
|
-
const config = wrapper.config ?? base.config;
|
|
36
|
-
const host = {
|
|
37
|
-
name: base.name,
|
|
38
|
-
runner: {
|
|
39
|
-
...base.runner,
|
|
40
|
-
...wrapper.runner
|
|
41
|
-
},
|
|
42
|
-
...config !== void 0 ? { config } : {},
|
|
43
|
-
...reactor !== void 0 ? { reactor } : {}
|
|
44
|
-
};
|
|
33
|
+
const host = applyChildWrapper((await loadHost(projectRoot, wrapper.host)).host, wrapper);
|
|
45
34
|
const memberSpecifier = host.runner.module;
|
|
46
35
|
members.push({
|
|
47
36
|
key,
|
|
@@ -237,5 +226,5 @@ function explainOutputs(name, view) {
|
|
|
237
226
|
//#endregion
|
|
238
227
|
export { explainHost };
|
|
239
228
|
|
|
240
|
-
//# sourceMappingURL=explain-
|
|
241
|
-
//# debugId=
|
|
229
|
+
//# sourceMappingURL=explain-BsZw-WrZ.mjs.map
|
|
230
|
+
//# debugId=6b9a4a1e-93da-5918-9899-5b0162df590c
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"explain-BsZw-WrZ.mjs","sources":["../src/services/run/explain.ts"],"sourcesContent":["import {\n applyChildWrapper,\n collectTokenSites,\n compoundOutputSource,\n CONNECT_RUNNER,\n declaredHostSchemas,\n describeToken,\n drivesSchema,\n envSitesOf,\n explainDrivePlan,\n findDeadConnectConfig,\n formatPath,\n isToken,\n loadHost,\n loadProducers,\n memberForRef,\n mergeDrivePlan,\n outputRefsOf,\n outputSitesOf,\n planCompound,\n probeRun,\n processResolveEnv,\n producerOutputsSchemas,\n readProjectName,\n renderTokens,\n resolveHostOutputs,\n resolvePluginContributions,\n resolveRunnerModule,\n runnerOutputsSchema,\n runRecordOutputSource,\n validateDeclaredHost,\n validateHost,\n type ChildWrapper,\n type DriveDeclaration,\n type HostDefinition,\n type OutputSource,\n type PluginEntryData,\n type ReactorHostInput,\n type RunnerModule,\n} from \"@powerhousedao/host-core\";\n\n/**\n * `ph run <host> --explain <topic>`: print instead of running, after the\n * same declared validation `ph run` does first (so a printed explain is a\n * host that loads). `drives`: the merged drive plan with provenance\n * (browser-only plugins listed as unresolvable). `outputs`: the resolution\n * plan — consumed outputs and their producers, `$env` names, the compound\n * start order the tokens imply, which producers are running and, for a\n * running producer, the value each token resolves to now. A `$map` in\n * `reactor.drives` is shown as the token and, when its producer runs, as the\n * drives it renders.\n */\n\ninterface ExplainOptions {\n host: string;\n topic: string;\n}\n\nconst TOPICS = [\"drives\", \"outputs\"];\n\n/** A reactor host as explained: a standalone host, or a compound member\n * with its wrapper applied (declared form). */\ninterface ReactorView {\n name: string;\n runner: HostDefinition[\"runner\"];\n config?: Record<string, unknown>;\n reactor?: ReactorHostInput[\"reactor\"];\n}\n\ninterface MemberView {\n key: string;\n wrapper: ChildWrapper;\n host: ReactorView;\n runner: RunnerModule;\n specifier: string;\n file: string;\n /** Where the effective `config` lives (a wrapper `config` is a full\n * statement in the compound's file). */\n configWhere: string;\n}\n\ninterface LoadedView {\n host: HostDefinition;\n runner: RunnerModule;\n specifier: string;\n file: string;\n /** Set for a compound. */\n members?: MemberView[];\n /** Where tokens resolve NOW (for printing values): a standalone host's\n * producers' live run records; a compound's own live record (its members'\n * outputs), or none when it is not running. */\n source?: OutputSource;\n}\n\nasync function loadView(\n projectRoot: string,\n name: string,\n): Promise<LoadedView> {\n const loaded = await loadHost(projectRoot, name);\n const specifier = loaded.host.runner.module;\n const runner = await resolveRunnerModule(projectRoot, specifier);\n const file = `hosts/${name}/host.js`;\n if (runner.kind !== \"compound\") {\n const producers = await loadProducers(\n projectRoot,\n outputRefsOf(loaded.host),\n );\n validateDeclaredHost(runner, specifier, loaded.host, file, {\n outputsSchemaOf: producerOutputsSchemas(producers),\n });\n // The same lookup `ph run` resolves through.\n const source = runRecordOutputSource(projectRoot, {\n consumer: name,\n producers,\n projectName: readProjectName(projectRoot),\n });\n return { host: loaded.host, runner, specifier, file, source };\n }\n validateDeclaredHost(runner, specifier, loaded.host, file);\n validateHost(runner, specifier, loaded.host, file, { tokens: \"allow\" });\n // The compound runner's schema owns `config`; `children` is shared.\n const children = declaredHostSchemas.childrenSchema.parse(\n loaded.host.children,\n );\n const members: MemberView[] = [];\n for (const [key, wrapper] of Object.entries(children)) {\n const host: ReactorView = applyChildWrapper(\n (await loadHost(projectRoot, wrapper.host)).host,\n wrapper,\n );\n const memberSpecifier = host.runner.module;\n members.push({\n key,\n wrapper,\n host,\n runner: await resolveRunnerModule(projectRoot, memberSpecifier),\n specifier: memberSpecifier,\n file: `hosts/${wrapper.host}/host.js`,\n configWhere:\n wrapper.config !== undefined\n ? `hosts/${name}/host.js (children.${key}.config)`\n : `hosts/${wrapper.host}/host.js`,\n });\n }\n const refs = members.map((m) => ({ key: m.key, host: m.wrapper.host }));\n for (const m of members) {\n validateDeclaredHost(m.runner, m.specifier, m.host, m.file, {\n outputsSchemaOf: (ref) => {\n const target = memberForRef(ref, refs);\n if (\"error\" in target) return { error: target.error };\n const producer = members.find((p) => p.key === target.key);\n return producer\n ? runnerOutputsSchema(\n producer.runner,\n producer.specifier,\n `member \"${producer.key}\"`,\n )\n : { error: `names member \"${target.key}\", which is not declared.` };\n },\n });\n }\n // Members read each other's live outputs: shown only while this\n // compound runs (its record carries every member's outputs).\n const probe = probeRun(\n projectRoot,\n loaded.host.name,\n readProjectName(projectRoot),\n );\n const live = new Map<string, unknown>();\n if (probe.status === \"live\") {\n for (const [key, member] of Object.entries(probe.record.members ?? {})) {\n live.set(key, member.outputs);\n }\n }\n const source =\n probe.status === \"live\"\n ? compoundOutputSource(refs, live, loaded.host.name)\n : undefined;\n return { host: loaded.host, runner, specifier, file, members, source };\n}\n\n/** A token's value from running producers, or undefined (producer not\n * running, or the token reads the environment: `$env` values may be\n * secrets, so explain never prints them). */\nfunction currentValue(token: unknown, source?: OutputSource): unknown {\n if (!source) return undefined;\n if (collectTokenSites(token).some((site) => site.key === \"$env\")) {\n return undefined;\n }\n try {\n return resolveHostOutputs(token, { outputs: source });\n } catch {\n return undefined;\n }\n}\n\nexport async function explainHost(options: ExplainOptions): Promise<void> {\n if (!TOPICS.includes(options.topic)) {\n throw new Error(\n `Unknown --explain topic \"${options.topic}\" (supported: ${TOPICS.join(\", \")}).`,\n );\n }\n const projectRoot = process.cwd();\n const view = await loadView(projectRoot, options.host);\n if (options.topic === \"outputs\") {\n explainOutputs(options.host, view);\n return;\n }\n\n if (view.members) {\n // One plan per member, with the wrapper's full-statement semantics.\n const verb = view.host.runner.defaultVerb ?? \"run\";\n for (const m of view.members) {\n await explainDrives(\n projectRoot,\n `${options.host} › ${m.key} (${m.wrapper.host})`,\n m.host,\n verb,\n m.file,\n m.configWhere,\n view.source,\n );\n }\n return;\n }\n await explainDrives(\n projectRoot,\n options.host,\n view.host,\n \"run\",\n view.file,\n view.file,\n view.source,\n );\n}\n\n/* ------------------------------------------------------------------ drives */\n\nasync function explainDrives(\n projectRoot: string,\n label: string,\n host: ReactorView,\n verb: string,\n where: string,\n configWhere: string,\n source?: OutputSource,\n): Promise<void> {\n const entries: PluginEntryData[] = host.runner.plugins ?? [];\n const contributions =\n entries.length > 0\n ? await resolvePluginContributions(projectRoot, verb, entries, where)\n : { drives: [], unresolved: [] };\n const contributed = contributions.drives.map(({ declaration, source }) => {\n const parsed = drivesSchema.safeParse([declaration]);\n if (!parsed.success) {\n throw new Error(\n `${where}: plugin \"${source}\" contributes an invalid drive declaration.`,\n );\n }\n return { declaration: parsed.data[0], source };\n });\n // Declared drives may carry output tokens (a remote url): shown as\n // «$output …», resolved only at `ph run`. The whole list may be a token\n // (`$map` over a producer's drives): rendered from the running producer\n // when there is one, otherwise named and left out of the plan.\n const rawDrives: unknown = host.reactor?.drives ?? [];\n let listed: unknown = rawDrives;\n let listNote: string | undefined;\n if (isToken(rawDrives)) {\n const value = currentValue(rawDrives, source);\n listed = Array.isArray(value) ? value : [];\n listNote = ` reactor.drives ← «${describeToken(rawDrives)}»${\n Array.isArray(value)\n ? \" (rendered from the running producer's outputs)\"\n : \" (rendered at ph run from the producer's live outputs; its producer is not running now, so the plan below leaves them out)\"\n }`;\n }\n const parsed = drivesSchema.safeParse(renderTokens(listed));\n if (!parsed.success && listNote === undefined) {\n // a literal list: declared validation already ran; keep its error\n throw parsed.error;\n }\n const declared: DriveDeclaration[] = parsed.success ? parsed.data : [];\n console.log(`[${label}]`);\n if (listNote) console.log(listNote);\n if (!parsed.success) {\n console.log(\n ` the rendered drives fail the drive schema (ph run rejects them): ${parsed.error.issues\n .map((i) => `${i.path.map(String).join(\".\") || \"<root>\"}: ${i.message}`)\n .join(\"; \")}`,\n );\n }\n console.log(\n explainDrivePlan(mergeDrivePlan(projectRoot, declared, contributed)),\n );\n for (const module of contributions.unresolved) {\n const entry = entries\n .map((e) => (typeof e === \"string\" ? { module: e } : e))\n .find((e) => e.module === module);\n const drive: unknown =\n entry && \"config\" in entry ? entry.config?.drive : undefined;\n const attached =\n typeof drive === \"string\"\n ? ` attaches ${drive}`\n : isToken(drive)\n ? ` attaches «${describeToken(drive)}»`\n : \"\";\n console.log(\n ` (browser plugin ${module}: not resolvable from the project tree)${attached}`,\n );\n }\n // The same dead-config warnings the connect runner prints at boot,\n // naming the file the config lives in.\n if (host.runner.module === CONNECT_RUNNER) {\n for (const warning of findDeadConnectConfig(\n host.config,\n host.runner.plugins,\n verb,\n configWhere,\n )) {\n console.warn(warning.message);\n }\n }\n}\n\n/* ----------------------------------------------------------------- outputs */\n\nfunction outputKeys(runner: RunnerModule): string {\n const schema = runner.outputsSchema;\n if (typeof schema !== \"object\" || schema === null) return \"(no outputs)\";\n const shape =\n \"shape\" in schema && typeof schema.shape === \"object\" && schema.shape\n ? Object.keys(schema.shape)\n : [];\n return shape.length ? shape.join(\", \") : \"(declared)\";\n}\n\nfunction printConsumes(\n host: unknown,\n indent: string,\n producerNote: (folder: string, member?: string) => string,\n source?: OutputSource,\n): void {\n const outputs = outputSitesOf(host);\n const env = envSitesOf(host);\n if (outputs.length === 0 && env.length === 0) {\n console.log(`${indent}consumes: nothing (no $output or $env tokens)`);\n return;\n }\n const valueLine = (token: unknown) => {\n const value = currentValue(token, source);\n if (value !== undefined) {\n console.log(`${indent} = ${JSON.stringify(value)}`);\n }\n };\n for (const site of outputs) {\n const token = { $output: { ...site.ref, path: site.outputPath } };\n console.log(\n `${indent}${site.path} ← ${describeToken(token)}${producerNote(site.ref.host, site.ref.member)}`,\n );\n valueLine(token);\n }\n // Composite tokens (`$concat`, `$map`) outside any template: the value\n // the field gets, once its producers run.\n for (const site of collectTokenSites(host)) {\n const nested =\n site.scopes.length > 0 ||\n site.position === \"concat\" ||\n site.position === \"over\";\n if (nested || (site.key !== \"$concat\" && site.key !== \"$map\")) continue;\n console.log(\n `${indent}${formatPath(site.path)} ← ${describeToken(site.token)}`,\n );\n valueLine(site.token);\n }\n const { env: processEnv } = processResolveEnv(process.cwd());\n for (const site of env) {\n const builtin = site.name === \"userData\" || site.name === \"projectRoot\";\n const state =\n builtin || processEnv?.[site.name] !== undefined\n ? \"set\"\n : site.optional\n ? \"unset: the property is omitted\"\n : \"UNSET: ph run fails\";\n console.log(\n `${indent}${site.path} ← $env ${site.name}${site.optional ? \" (optional)\" : \"\"} [${state}]`,\n );\n }\n}\n\nfunction explainOutputs(name: string, view: LoadedView): void {\n if (!view.members) {\n const source = view.source;\n console.log(`[${name}] ${view.specifier}`);\n console.log(` produces: ${outputKeys(view.runner)}`);\n printConsumes(\n view.host,\n \" \",\n (folder, member) => {\n const ref =\n member === undefined ? { host: folder } : { host: folder, member };\n return source?.lookup(ref).status === \"available\"\n ? ` (host \"${folder}\": running)`\n : ` (host \"${folder}\": not running; start it first: ph run ${folder})`;\n },\n source,\n );\n return;\n }\n\n const members = view.members;\n const refs = members.map((x) => ({ key: x.key, host: x.wrapper.host }));\n const config: unknown = view.host.config;\n const startOrder =\n typeof config === \"object\" &&\n config !== null &&\n \"startOrder\" in config &&\n Array.isArray(config.startOrder)\n ? config.startOrder.filter((k): k is string => typeof k === \"string\")\n : undefined;\n const plan = planCompound(\n members.map((m) => ({\n key: m.key,\n host: m.wrapper.host,\n refs: outputSitesOf(m.host).map(({ ref, path }) => ({ ref, path })),\n })),\n startOrder,\n );\n console.log(\n `[${name}] start order (${plan.source === \"tokens\" ? \"from the output tokens\" : \"config.startOrder, checked against the tokens\"}):`,\n );\n plan.order.forEach((key, index) => {\n const m = members.find((x) => x.key === key);\n const needs = plan.edges\n .filter((e) => e.consumer === key)\n .map((e) => e.producer);\n console.log(\n ` ${index + 1}. ${key} (${m?.wrapper.host ?? \"?\"})${needs.length ? ` after ${needs.join(\", \")}` : \"\"}`,\n );\n });\n console.log(\" Ctrl-C stops members in reverse order (consumers first).\");\n for (const key of plan.order) {\n const m = members.find((x) => x.key === key);\n if (!m) continue;\n console.log(`[${name} › ${key} (${m.wrapper.host})] ${m.specifier}`);\n console.log(` produces: ${outputKeys(m.runner)}`);\n printConsumes(\n m.host,\n \" \",\n (folder, member) => {\n const ref =\n member === undefined ? { host: folder } : { host: folder, member };\n const target = memberForRef(ref, refs);\n return \"key\" in target\n ? ` (member \"${target.key}\", live outputs)`\n : \"\";\n },\n view.source,\n );\n }\n const own = { ...view.host, children: undefined };\n if (outputSitesOf(own).length > 0 || envSitesOf(own).length > 0) {\n console.log(`[${name}] the compound's own fields:`);\n printConsumes(own, \" \", () => \"\");\n }\n}\n"],"names":[],"mappings":";;;;;AA0DA,MAAM,SAAS,CAAC,UAAU,SAAS;AAoCnC,eAAe,SACb,aACA,MACqB;CACrB,MAAM,SAAS,MAAM,SAAS,aAAa,IAAI;CAC/C,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B,MAAM,IAAI,QAAQ,MAAM,MAAM,EAAE,QAAQ,GAAG;EAC3C,IAAI,CAAC,GAAG;EACR,QAAQ,IAAI,IAAI,KAAK,KAAK,IAAI,IAAI,EAAE,QAAQ,KAAK,KAAK,EAAE,WAAW;EACnE,QAAQ,IAAI,eAAe,WAAW,EAAE,MAAM,GAAG;EACjD,cACE,EAAE,MACF,OACC,QAAQ,WAAW;GAGlB,MAAM,SAAS,aADb,WAAW,KAAA,IAAY,EAAE,MAAM,OAAO,IAAI;IAAE,MAAM;IAAQ;GAAO,GAClC,IAAI;GACrC,OAAO,SAAS,SACZ,cAAc,OAAO,IAAI,oBACzB;EACN,GACA,KAAK,MACP;CACF;CACA,MAAM,MAAM;EAAE,GAAG,KAAK;EAAM,UAAU,KAAA;CAAU;CAChD,IAAI,cAAc,GAAG,CAAC,CAAC,SAAS,KAAK,WAAW,GAAG,CAAC,CAAC,SAAS,GAAG;EAC/D,QAAQ,IAAI,IAAI,KAAK,6BAA6B;EAClD,cAAc,KAAK,YAAY,EAAE;CACnC;AACF","debug_id":"6b9a4a1e-93da-5918-9899-5b0162df590c"}
|
|
@@ -0,0 +1,42 @@
|
|
|
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]="755b5793-79f6-5af7-988d-17ad7ff163e2")}catch(e){}}();
|
|
3
|
+
import { i as exportHost } from "./dist-CSn_YRdB.mjs";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { writeFile } from "node:fs/promises";
|
|
6
|
+
import { CALLER_CWD_ENV } from "@powerhousedao/shared/clis/command-names";
|
|
7
|
+
//#region src/services/host/export.ts
|
|
8
|
+
function message(error) {
|
|
9
|
+
return error instanceof Error ? error.message : String(error);
|
|
10
|
+
}
|
|
11
|
+
/** `ph host export <host>`: the declared host and its members as JSON. */
|
|
12
|
+
async function runHostExport(args) {
|
|
13
|
+
let exported;
|
|
14
|
+
try {
|
|
15
|
+
exported = await exportHost(args.projectRoot ?? process.cwd(), args.host);
|
|
16
|
+
} catch (error) {
|
|
17
|
+
return {
|
|
18
|
+
stderr: `${message(error)}\n`,
|
|
19
|
+
exitCode: 1
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
const json = `${JSON.stringify(exported, null, 2)}\n`;
|
|
23
|
+
if (args.out === void 0) return {
|
|
24
|
+
stdout: json,
|
|
25
|
+
exitCode: 0
|
|
26
|
+
};
|
|
27
|
+
try {
|
|
28
|
+
const from = process.env[CALLER_CWD_ENV] ?? process.cwd();
|
|
29
|
+
await writeFile(path.resolve(from, args.out), json);
|
|
30
|
+
} catch (error) {
|
|
31
|
+
return {
|
|
32
|
+
stderr: `Cannot write ${args.out}: ${message(error)}\n`,
|
|
33
|
+
exitCode: 1
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
return { exitCode: 0 };
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
export { runHostExport };
|
|
40
|
+
|
|
41
|
+
//# sourceMappingURL=export-BGJVYlCK.mjs.map
|
|
42
|
+
//# debugId=755b5793-79f6-5af7-988d-17ad7ff163e2
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export-BGJVYlCK.mjs","sources":["../src/services/host/export.ts"],"sourcesContent":["import { writeFile } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { exportHost, type HostExport } from \"@powerhousedao/host-core\";\nimport { CALLER_CWD_ENV } from \"@powerhousedao/shared/clis/command-names\";\n\nexport interface HostExportArgs {\n host: string;\n out?: string;\n projectRoot?: string;\n}\n\nexport interface HostExportResult {\n stdout?: string;\n stderr?: string;\n exitCode: number;\n}\n\nfunction message(error: unknown): string {\n return error instanceof Error ? error.message : String(error);\n}\n\n/** `ph host export <host>`: the declared host and its members as JSON. */\nexport async function runHostExport(\n args: HostExportArgs,\n): Promise<HostExportResult> {\n let exported: HostExport;\n try {\n exported = await exportHost(args.projectRoot ?? process.cwd(), args.host);\n } catch (error) {\n return { stderr: `${message(error)}\\n`, exitCode: 1 };\n }\n const json = `${JSON.stringify(exported, null, 2)}\\n`;\n if (args.out === undefined) return { stdout: json, exitCode: 0 };\n try {\n const from = process.env[CALLER_CWD_ENV] ?? process.cwd();\n await writeFile(path.resolve(from, args.out), json);\n } catch (error) {\n return {\n stderr: `Cannot write ${args.out}: ${message(error)}\\n`,\n exitCode: 1,\n };\n }\n return { exitCode: 0 };\n}\n"],"names":[],"mappings":";;;;;;;AAiBA,SAAS,QAAQ,OAAwB;CACvC,OAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AAC9D;;AAGA,eAAsB,cACpB,MAC2B;CAC3B,IAAI;CACJ,IAAI;EACF,WAAW,MAAM,WAAW,KAAK,eAAe,QAAQ,IAAI,GAAG,KAAK,IAAI;CAC1E,SAAS,OAAO;EACd,OAAO;GAAE,QAAQ,GAAG,QAAQ,KAAK,EAAE;GAAK,UAAU;EAAE;CACtD;CACA,MAAM,OAAO,GAAG,KAAK,UAAU,UAAU,MAAM,CAAC,EAAE;CAClD,IAAI,KAAK,QAAQ,KAAA,GAAW,OAAO;EAAE,QAAQ;EAAM,UAAU;CAAE;CAC/D,IAAI;EACF,MAAM,OAAO,QAAQ,IAAI,mBAAmB,QAAQ,IAAI;EACxD,MAAM,UAAU,KAAK,QAAQ,MAAM,KAAK,GAAG,GAAG,IAAI;CACpD,SAAS,OAAO;EACd,OAAO;GACL,QAAQ,gBAAgB,KAAK,IAAI,IAAI,QAAQ,KAAK,EAAE;GACpD,UAAU;EACZ;CACF;CACA,OAAO,EAAE,UAAU,EAAE;AACvB","debug_id":"755b5793-79f6-5af7-988d-17ad7ff163e2"}
|
|
@@ -1,7 +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]="3dbd8c87-859f-54a2-98f7-5a848c405a11")}catch(e){}}();
|
|
3
3
|
import { t as isUniformRunnersEnabled } from "./feature-flags-xwqcHEWC.mjs";
|
|
4
|
-
import {
|
|
4
|
+
import { R as probeHostsFolder } from "./compound-Cfqa5Jal-B5rkCmIj.mjs";
|
|
5
5
|
import { t as warnSubgraphTypeConflicts } from "./warn-subgraph-type-conflicts-BOHBmThq.mjs";
|
|
6
6
|
import { t as startGenerateHosts } from "./generate-hosts-BFmPIW2X.mjs";
|
|
7
7
|
import { generateAll } from "@powerhousedao/codegen";
|
|
@@ -32,5 +32,5 @@ async function startGenerateAll(args, projectDir) {
|
|
|
32
32
|
//#endregion
|
|
33
33
|
export { startGenerateAll };
|
|
34
34
|
|
|
35
|
-
//# sourceMappingURL=generate-all-
|
|
36
|
-
//# debugId=
|
|
35
|
+
//# sourceMappingURL=generate-all-DgEFOXwU.mjs.map
|
|
36
|
+
//# debugId=3dbd8c87-859f-54a2-98f7-5a848c405a11
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-all-
|
|
1
|
+
{"version":3,"file":"generate-all-DgEFOXwU.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 { probeHostsFolder } from \"@powerhousedao/host-core\";\nimport { isUniformRunnersEnabled } from \"../utils/feature-flags.js\";\nimport { warnSubgraphTypeConflicts } from \"../utils/warn-subgraph-type-conflicts.js\";\nimport { startGenerateHosts } from \"./generate-hosts.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 await warnSubgraphTypeConflicts(projectDir);\n if (\n isUniformRunnersEnabled() &&\n probeHostsFolder(projectDir).kind === \"present\" &&\n !(await startGenerateHosts(projectDir))\n ) {\n process.exitCode = 1;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;AAQA,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,MAAM,0BAA0B,UAAU;CAC1C,IACE,wBAAwB,KACxB,iBAAiB,UAAU,CAAC,CAAC,SAAS,aACtC,CAAE,MAAM,mBAAmB,UAAU,GAErC,QAAQ,WAAW;AAEvB","debug_id":"3dbd8c87-859f-54a2-98f7-5a848c405a11"}
|
|
@@ -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 {
|
|
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]="a5dfe778-ca81-57cd-a68e-ba67c237a776")}catch(e){}}();
|
|
3
|
+
import { d as union, l as strictObject, n as array, r as boolean, s as number, u as string } from "./schemas-Cnv5AnQT.mjs";
|
|
4
4
|
import "node:module";
|
|
5
5
|
import fs from "node:fs";
|
|
6
6
|
import path from "node:path";
|
|
@@ -314,5 +314,5 @@ function startGenerateDesktopShell(args, cwd) {
|
|
|
314
314
|
//#endregion
|
|
315
315
|
export { startGenerateDesktopShell };
|
|
316
316
|
|
|
317
|
-
//# sourceMappingURL=generate-desktop-shell-
|
|
318
|
-
//# debugId=
|
|
317
|
+
//# sourceMappingURL=generate-desktop-shell-BXcGvbms.mjs.map
|
|
318
|
+
//# debugId=a5dfe778-ca81-57cd-a68e-ba67c237a776
|
package/dist/{generate-desktop-shell-BdXDiS5o.mjs.map → generate-desktop-shell-BXcGvbms.mjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-desktop-shell-BdXDiS5o.mjs","sources":["../../../packages/desktop/dist/shell-C6KfHzBa.mjs","../../../packages/desktop/dist/index.mjs","../src/services/generate-desktop-shell.ts"],"sourcesContent":["import { createRequire } from \"node:module\";\nimport { colorVariants, imageVariants, layerStyleText, normalizeBackground, validateBackground } from \"@powerhousedao/shared/connect\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { z } from \"zod\";\nimport { execSync, spawn, spawnSync } from \"node:child_process\";\nimport { isPassthroughImageRef } from \"@powerhousedao/shared/connect/image-ref\";\nimport { pathToFileURL } from \"node:url\";\n//#region src/app-json.ts\n/**\n* `hosts/desktop/app.json` — the builder's desktop identity (phase 7, mode 1:\n* the builder ships under THEIR identity without writing Rust). It is the ONE\n* file a builder edits; `shell-project.ts` projects it into a generated\n* `tauri-shell/` that depends on the published `ph-desktop-shell` crate. Every\n* field validates strictly so a typo fails with the field named, not silently.\n*/\nconst identifierSchema = z.string().min(1).regex(/^[A-Za-z0-9-]+(\\.[A-Za-z0-9-]+)+$/, \"identifier must be reverse-DNS (e.g. com.acme.app): dot-separated alphanumeric segments\");\nconst windowSchema = z.strictObject({\n\ttitle: z.string().min(1).optional(),\n\twidth: z.number().int().positive().optional(),\n\theight: z.number().int().positive().optional(),\n\tresizable: z.boolean().optional(),\n\t/** Smallest size the window can be dragged to (logical pixels). */\n\tminWidth: z.number().int().positive().optional(),\n\tminHeight: z.number().int().positive().optional()\n}).optional();\nconst cssColorSchema = z.string().regex(/^#(?:[0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/, \"use a hex color (#rgb, #rgba, #rrggbb or #rrggbbaa)\");\n/** The loading page's colors. */\nconst loadingColorsSchema = z.strictObject({\n\t/** Page background (default #0f1115). */\n\tbackground: cssColorSchema.nullable().optional(),\n\t/** Status text color (default #e6e8eb). */\n\tcolor: cssColorSchema.nullable().optional(),\n\t/** The pulsing status dot (default #4ade80). */\n\taccent: cssColorSchema.nullable().optional()\n});\n/** The loading page's look, so the window opens in the app's own colors\n* instead of the default dark page. Every field is optional, and `null`\n* means the default (the scaffold lists the fields that way). */\nconst loadingSchema = loadingColorsSchema.extend({\n\t/** Status line under the art (default \"Starting <productName>…\"). */\n\tmessage: z.string().min(1).nullable().optional(),\n\t/** Colors for `prefers-color-scheme: dark`; without it the page keeps\n\t* the light colors in both schemes. */\n\tdark: loadingColorsSchema.nullable().optional(),\n\t/** Deprecated: a decoration pinned to the bottom-right corner, relative\n\t* to app.json, with `artDark` its dark-scheme counterpart. Superseded by\n\t* the top-level `background`, which ignores these when set. */\n\tart: z.string().min(1).nullable().optional(),\n\tartDark: z.string().min(1).nullable().optional()\n}).nullable().optional();\nconst imageRefSchema = z.string().min(1);\nconst schemedImageSchema = z.union([imageRefSchema, z.strictObject({\n\tlight: imageRefSchema,\n\tdark: imageRefSchema.nullable().optional()\n})]);\nconst lengthSchema = z.union([z.number(), z.string().min(1)]).nullable().optional();\nconst edgesSchema = z.strictObject({\n\ttop: lengthSchema,\n\tright: lengthSchema,\n\tbottom: lengthSchema,\n\tleft: lengthSchema\n}).nullable().optional();\nconst backgroundLayerSchema = z.strictObject({\n\tsrc: schemedImageSchema,\n\tposition: edgesSchema,\n\twidth: lengthSchema,\n\theight: lengthSchema,\n\tminWidth: lengthSchema,\n\tminHeight: lengthSchema,\n\tmaxWidth: lengthSchema,\n\tmaxHeight: lengthSchema,\n\topacity: z.number().min(0).max(1).nullable().optional(),\n\tfade: edgesSchema\n});\nconst backgroundSchema = z.union([imageRefSchema, z.strictObject({\n\tcolor: z.union([z.string().min(1), z.strictObject({\n\t\tlight: z.string().min(1),\n\t\tdark: z.string().min(1).nullable().optional()\n\t})]).nullable().optional(),\n\tlayers: z.array(backgroundLayerSchema)\n})]).superRefine((background, ctx) => {\n\tfor (const problem of validateBackground(background, \"background\")) ctx.addIssue({\n\t\tcode: \"custom\",\n\t\tmessage: problem\n\t});\n}).nullable().optional();\nconst fileAssociationSchema = z.strictObject({\n\t/** Extensions WITHOUT the leading dot (\"phd\", not \".phd\"). */\n\text: z.array(z.string().min(1).regex(/^[^.]/, \"drop the leading dot\")).min(1),\n\tname: z.string().min(1),\n\tdescription: z.string().optional(),\n\tmimeType: z.string().optional()\n});\n/** Where the generated Cargo.toml resolves `ph-desktop-shell` from. Default\n* (omitted) = the published crates.io version. */\nconst shellSourceSchema = z.strictObject({\n\t/** Local checkout for shell development (the lab points here). */\n\tpath: z.string().min(1).optional(),\n\t/** Git source, pinned to a tag/rev, for pre-publication consumption. */\n\tgit: z.string().min(1).optional(),\n\ttag: z.string().min(1).optional(),\n\trev: z.string().min(1).optional(),\n\t/** crates.io version requirement (default DEFAULT_SHELL_CRATE_VERSION). */\n\tversion: z.string().min(1).optional()\n}).refine((s) => !(s.path && s.git), { message: \"shell.source: set path OR git, not both\" }).optional();\nconst appJsonSchema = z.strictObject({\n\tidentifier: identifierSchema,\n\tproductName: z.string().min(1),\n\t/** Single source image (square PNG, 1024×1024 recommended); the icon set\n\t* for every platform is generated from it via `tauri icon`. */\n\ticon: z.string().min(1),\n\t/** The loading page's background: images positioned and sized over a\n\t* page colour (`{ color, layers }`), or one image pinned bottom-right.\n\t* The status line stays centred above them. `ph generate desktop-shell`\n\t* copies Connect's `connect.branding.homeBackground` here. null or\n\t* omitted: the app icon (or `splash`) above the status line. */\n\tbackground: backgroundSchema,\n\t/** Deprecated in favour of `background`: a wide splash image shown above\n\t* the status line instead of the square icon. Relative to this file. */\n\tsplash: z.string().min(1).nullable().optional(),\n\t/** Deprecated with `splash`: its `prefers-color-scheme: dark` variant. */\n\tsplashDark: z.string().min(1).nullable().optional(),\n\tloading: loadingSchema,\n\twindow: windowSchema,\n\tfileAssociations: z.array(fileAssociationSchema).optional(),\n\tshell: shellSourceSchema\n});\n/** Default crates.io version requirement for the shell crate (D7.b: the flip\n* to crates.io default once published — the crate is live). */\nconst DEFAULT_SHELL_CRATE_VERSION = \"0.1\";\nconst APP_JSON_FILE = \"app.json\";\n/** Read + validate hosts/<host>/app.json. Throws with the field named on a\n* bad value, and a clear message when the file is absent. */\nfunction loadAppJson(hostDir) {\n\tconst file = path.join(hostDir, APP_JSON_FILE);\n\tif (!fs.existsSync(file)) throw new Error(`No ${APP_JSON_FILE} in ${hostDir} — run \\`ph generate desktop-shell\\` to scaffold the builder identity, or set runner.shell.project to a prebuilt shell.`);\n\tlet raw;\n\ttry {\n\t\traw = JSON.parse(fs.readFileSync(file, \"utf8\"));\n\t} catch (error) {\n\t\tthrow new Error(`${file}: not valid JSON — ${String(error)}`, { cause: error });\n\t}\n\tconst result = appJsonSchema.safeParse(raw);\n\tif (!result.success) {\n\t\tconst issues = result.error.issues.map((i) => ` ${i.path.join(\".\") || \"(root)\"}: ${i.message}`).join(\"\\n\");\n\t\tthrow new Error(`${file} is invalid:\\n${issues}`);\n\t}\n\treturn result.data;\n}\n/** A filesystem/crate-safe slug of the product name — the generated binary\n* and Cargo package name. Falls back to the identifier's last segment. */\nfunction appSlug(app) {\n\tconst fromName = app.productName.toLowerCase().replace(/[^a-z0-9]+/g, \"-\").replace(/^-+|-+$/g, \"\");\n\tif (fromName) return fromName;\n\treturn (app.identifier.split(\".\").pop() ?? \"app\").toLowerCase().replace(/[^a-z0-9]+/g, \"-\");\n}\n//#endregion\n//#region src/bundle-stack.ts\n/**\n* P6.3 — stage the shippable STACK into the shell project: everything the\n* installed app needs to run `ph run desktop` with no environment at all\n* (D6.c). The shell's resources map `../dist-stack` → `stack`, and its\n* uniform-runners mode falls back to `resources/stack` when the env pair is\n* absent. Layout:\n*\n* dist-stack/\n* hosts/ the project's host files\n* agents/ when present\n* powerhouse.config.json\n* package.json minimal, names the project\n* dist/ the package's build (ph build)\n* .ph/connect-build/dist/ the BUILT Connect (ph run connect build)\n* node_modules/ vendored @powerhousedao/ph-cli (hoisted,\n* real files — computed-specifier imports and\n* PGlite wasm forbid bundling)\n*/\nconst CONNECT_BUILD_DIR = path.join(\".ph\", \"connect-build\", \"dist\");\nfunction copyIfExists(from, to) {\n\tif (!fs.existsSync(from)) return false;\n\tfs.cpSync(from, to, { recursive: true });\n\treturn true;\n}\n/**\n* Recursively copy `src` → `dest`, skipping any path in `excludes`. Unlike\n* fs.cpSync this tolerates `dest` living INSIDE `src`: in mode 1 the generated\n* shell (and its `dist-stack`) sits under `hosts/<desktop>/`, so staging the\n* project's `hosts/` straight into the shell would be a copy-into-self that\n* cpSync rejects outright. Excluding the shell subtree both avoids that and\n* keeps the crate + node sidecar out of the shippable stack.\n*/\nfunction copyDirFiltered(src, dest, excludes) {\n\tif (!fs.existsSync(src)) return false;\n\tconst skip = new Set(excludes.map((e) => path.resolve(e)));\n\tconst walk = (s, d) => {\n\t\tif (skip.has(path.resolve(s))) return;\n\t\tif (fs.statSync(s).isDirectory()) {\n\t\t\tfs.mkdirSync(d, { recursive: true });\n\t\t\tfor (const entry of fs.readdirSync(s)) walk(path.join(s, entry), path.join(d, entry));\n\t\t} else fs.copyFileSync(s, d);\n\t};\n\twalk(src, dest);\n\treturn true;\n}\n/** The npm spec of each tarball in `dir`, by the package name inside it. */\nfunction readLocalPackages(dir) {\n\tconst root = path.resolve(dir);\n\tconst tarballs = fs.existsSync(root) ? fs.readdirSync(root).filter((f) => f.endsWith(\".tgz\")) : [];\n\tif (tarballs.length === 0) throw new Error(`bundle-stack: no package tarballs (*.tgz) in ${root}`);\n\tconst specs = {};\n\tfor (const file of tarballs.sort()) {\n\t\tconst tarball = path.join(root, file);\n\t\tconst manifest = spawnSync(\"tar\", [\n\t\t\t\"-xzOf\",\n\t\t\ttarball,\n\t\t\t\"package/package.json\"\n\t\t], {\n\t\t\tencoding: \"utf8\",\n\t\t\twindowsHide: true\n\t\t});\n\t\tif (manifest.status !== 0) throw new Error(`bundle-stack: ${tarball} has no package/package.json: ${manifest.stderr}`);\n\t\tconst { name } = JSON.parse(manifest.stdout);\n\t\tif (specs[name]) throw new Error(`bundle-stack: two tarballs for ${name} in ${root} (a stale pack?): ${specs[name].slice(5)} and ${tarball}`);\n\t\tspecs[name] = `file:${tarball}`;\n\t}\n\treturn specs;\n}\n/**\n* The staged stack's package.json. With local packages, every one is an\n* override (so transitive dependents get it too) and the direct dependencies\n* name the same spec: npm rejects an override that contradicts one.\n*/\nfunction stackManifest(options) {\n\tconst local = options.local ?? {};\n\tconst spec = (pkg, fallback) => local[pkg] ?? fallback;\n\treturn {\n\t\tname: options.name,\n\t\tprivate: true,\n\t\ttype: \"module\",\n\t\tdependencies: {\n\t\t\t\"@powerhousedao/ph-cli\": spec(\"@powerhousedao/ph-cli\", options.phCliSpec ?? options.version),\n\t\t\t\"@powerhousedao/host-core\": spec(\"@powerhousedao/host-core\", options.version)\n\t\t},\n\t\t...Object.keys(local).length > 0 ? { overrides: local } : {}\n\t};\n}\n/** A vendored tree installed from local tarballs: the same version numbers\n* as the registry's, so npm would take either for the other. */\nfunction vendoredFromLocal(stackDir) {\n\tconst lock = path.join(stackDir, \"package-lock.json\");\n\treturn fs.existsSync(lock) && fs.readFileSync(lock, \"utf8\").includes(\"\\\"resolved\\\": \\\"file:\");\n}\nfunction bundleStack(options) {\n\tconst log = options.logger ?? console.log;\n\tconst stackDir = path.join(options.shellProjectDir, \"dist-stack\");\n\tfor (const entry of [\n\t\t\"hosts\",\n\t\t\"agents\",\n\t\t\"dist\",\n\t\t\".ph\",\n\t\t\"powerhouse.config.json\",\n\t\t\"package.json\"\n\t]) fs.rmSync(path.join(stackDir, entry), {\n\t\trecursive: true,\n\t\tforce: true\n\t});\n\tfs.mkdirSync(stackDir, { recursive: true });\n\tlog(` hosts/ ${copyDirFiltered(path.join(options.projectRoot, \"hosts\"), path.join(stackDir, \"hosts\"), options.excludeDirs ?? []) ? \"staged\" : \"absent — skipped\"}`);\n\tfor (const dir of [\n\t\t\"agents\",\n\t\t\"dist\",\n\t\tCONNECT_BUILD_DIR\n\t]) log(` ${dir}/ ${copyIfExists(path.join(options.projectRoot, dir), path.join(stackDir, dir)) ? \"staged\" : \"absent — skipped\"}`);\n\tconst stagedDesktopHost = path.join(stackDir, \"hosts\", \"desktop\", \"host.js\");\n\tif (fs.existsSync(stagedDesktopHost)) {\n\t\tconst source = fs.readFileSync(stagedDesktopHost, \"utf8\");\n\t\tif (source.includes(\"@powerhousedao/desktop/runner\")) {\n\t\t\tfs.writeFileSync(stagedDesktopHost, \"// STAGED COPY (bundle-stack): runner.module rewritten to the generic\\n// compound — the packaged shell is the window; there is no nested shell.\\n\" + source.replace(/@powerhousedao\\/desktop\\/runner/g, \"@powerhousedao/host-core/runners/compound\"));\n\t\t\tlog(\" hosts/desktop/host.js: runner rewritten to the generic compound (staged copy)\");\n\t\t}\n\t}\n\tcopyIfExists(path.join(options.projectRoot, \"powerhouse.config.json\"), path.join(stackDir, \"powerhouse.config.json\"));\n\tif (typeof options.connectPort === \"number\") {\n\t\tfs.writeFileSync(path.join(stackDir, \"shell.json\"), `${JSON.stringify({ connectPort: options.connectPort }, null, 2)}\\n`);\n\t\tlog(` shell.json: connectPort ${options.connectPort}`);\n\t}\n\tconst sourcePkg = JSON.parse(fs.readFileSync(path.join(options.projectRoot, \"package.json\"), \"utf8\"));\n\tconst version = options.phCliVersion ?? \"dev\";\n\tconst name = sourcePkg.name ?? \"powerhouse-desktop-stack\";\n\tconst vendor = options.vendor !== false;\n\tconst local = options.localPackagesDir ? readLocalPackages(options.localPackagesDir) : void 0;\n\tif (vendor && (local || vendoredFromLocal(stackDir))) for (const entry of [\"node_modules\", \"package-lock.json\"]) fs.rmSync(path.join(stackDir, entry), {\n\t\trecursive: true,\n\t\tforce: true\n\t});\n\tfs.writeFileSync(path.join(stackDir, \"package.json\"), `${JSON.stringify(local ? stackManifest({\n\t\tname,\n\t\tversion,\n\t\tphCliSpec: options.phCliSpec,\n\t\tlocal\n\t}) : {\n\t\tname,\n\t\tprivate: true,\n\t\ttype: \"module\",\n\t\tdependencies: { \"@powerhousedao/ph-cli\": version }\n\t}, null, 2)}\\n`);\n\tlet vendored = false;\n\tif (vendor) {\n\t\tconst specs = local ? \"\" : `\"${options.phCliSpec ?? `@powerhousedao/ph-cli@${version}`}\" \"@powerhousedao/host-core@${version}\"`;\n\t\tlog(local ? ` vendoring ${Object.keys(local).length} local packages from ${options.localPackagesDir} (hoisted, real files)…` : ` vendoring ${specs} (hoisted, real files)…`);\n\t\tconst result = spawnSync(`npm install ${specs} --install-strategy=hoisted --omit=dev --no-audit --no-fund`, {\n\t\t\tcwd: stackDir,\n\t\t\tstdio: \"pipe\",\n\t\t\tshell: true,\n\t\t\twindowsHide: true\n\t\t});\n\t\tif (result.status !== 0) throw new Error(`bundle-stack: vendoring failed (${result.status}):\\n${result.stderr.toString().slice(-800)}`);\n\t\tvendored = true;\n\t} else log(\" vendoring skipped (vendor: false) — existing tree left in place\");\n\treturn {\n\t\tstackDir,\n\t\tvendored\n\t};\n}\n//#endregion\n//#region src/shell-project.ts\n/**\n* P7.3 — project `hosts/desktop/app.json` into a generated `tauri-shell/`:\n* a STANDALONE tauri crate that depends on the published `ph-desktop-shell`\n* library, carries the builder's identity, and is built/run by the desktop\n* runner's dev/build verbs. The builder never writes Rust.\n*\n* Everything here mirrors the known-good reference app\n* (ph-desktop-shell/apps/powerhouse-desktop): the tauri plumbing (main.rs,\n* build.rs, capabilities, the loading page, externalBin + icon mechanics) is\n* copied verbatim; only identity/port fields are projected from app.json. The\n* projection is idempotent and stale-detected — a file is rewritten only when\n* its content changes, so Cargo.lock, the generated icon set, and tauri-build\n* output are never disturbed by a regen with an unchanged app.json.\n*/\nconst SHELL_DIR = \"tauri-shell\";\n/** The icon source the runner feeds to `tauri icon` (copied from app.icon). */\nconst ICON_SOURCE = \"app-icon.png\";\n/** `ph-desktop-shell` dependency line for the generated Cargo.toml, from\n* app.json's shell.source (path > git > crates.io version). */\nfunction shellDependency(source) {\n\tif (source?.path) {\n\t\tconst p = source.path.replace(/\\\\/g, \"/\");\n\t\treturn `ph-desktop-shell = { path = ${JSON.stringify(p)} }`;\n\t}\n\tif (source?.git) {\n\t\tconst parts = [`git = ${JSON.stringify(source.git)}`];\n\t\tif (source.tag) parts.push(`tag = ${JSON.stringify(source.tag)}`);\n\t\tif (source.rev) parts.push(`rev = ${JSON.stringify(source.rev)}`);\n\t\treturn `ph-desktop-shell = { ${parts.join(\", \")} }`;\n\t}\n\tconst version = source?.version ?? \"0.1\";\n\treturn `ph-desktop-shell = ${JSON.stringify(version)}`;\n}\nfunction cargoToml(app, binName) {\n\treturn `# GENERATED from ../app.json by @powerhousedao/desktop — do not edit by\n# hand; edit app.json and re-run \\`ph run desktop dev|build\\`. Cargo.lock is\n# preserved across regens.\n[package]\nname = ${JSON.stringify(binName)}\nversion = \"0.1.0\"\nedition = \"2021\"\n\n[build-dependencies]\ntauri-build = { version = \"2\", features = [] }\n\n[dependencies]\ntauri = { version = \"2\", features = [\"tray-icon\", \"devtools\"] }\n# Plugins must be DIRECT deps of the app crate: tauri-build only sees\n# permission manifests (shell:allow-spawn etc.) from direct dependencies.\ntauri-plugin-shell = \"2\"\ntauri-plugin-single-instance = \"2\"\n${shellDependency(app.shell)}\n\n[[bin]]\nname = ${JSON.stringify(binName)}\npath = \"src/main.rs\"\n\n[profile.release]\ncodegen-units = 1\nlto = true\n`;\n}\nconst MAIN_RS = `// GENERATED — identity bakes from tauri.conf.json via generate_context!;\n// behavior is the shared ph-desktop-shell library. Edit ../app.json, not this.\n#![cfg_attr(not(debug_assertions), windows_subsystem = \"windows\")]\n\nfn main() {\n ph_desktop_shell::run(tauri::generate_context!(), Default::default());\n}\n`;\nconst BUILD_RS = `// GENERATED — mirrors the reference shell. Connect is served over\n// http://127.0.0.1 (a remote origin to Tauri), so the launch-queue commands\n// need an explicit ACL; declaring the command manifest here generates the\n// allow-<command> permissions that capabilities/*.json grant.\nfn main() {\n // The icon set is a COMPILE-TIME input (the Windows resource icon here,\n // and the tray/window icon tauri::generate_context! embeds), but\n // tauri-build registers no rerun trigger for it: without this line a\n // regenerated icon set leaves the old icon compiled into the binary.\n println!(\"cargo:rerun-if-changed=icons\");\n tauri_build::try_build(tauri_build::Attributes::new().app_manifest(\n tauri_build::AppManifest::new().commands(&[\n \"take_launch_files\",\n \"read_launch_file\",\n \"log_from_webview\",\n ]),\n ))\n .expect(\"failed to run tauri-build\");\n}\n`;\n/** The loading page's logo: app.json's icon SOURCE (1024² recommended), copied\n* beside ui/index.html — not one of the downsampled `tauri icon` outputs, so\n* it stays sharp on HiDPI screens. Generated, like the rest of ui/. */\nconst LOADING_LOGO = \"logo.png\";\n/** The loading page's splash (app.json `splash`), copied beside it; shown\n* instead of the square logo when set. Generated, like the rest of ui/. */\nconst LOADING_SPLASH = \"splash.png\";\n/** Dark-scheme splash (app.json `splashDark`), beside the light one. */\nconst LOADING_SPLASH_DARK = \"splash-dark.png\";\n/** CSS size of the logo; the 1024² source keeps it crisp up to 8x DPR. */\nconst LOGO_CSS_PX = 128;\nfunction loadingHtml(app, art) {\n\tconst escape = (text) => text.replace(/[<&]/g, (c) => c === \"<\" ? \"<\" : \"&\");\n\tconst name = escape(app.productName);\n\tconst loading = app.loading;\n\tconst message = loading?.message ? escape(loading.message) : `Starting ${name}…`;\n\tconst pageColor = art.background?.color ?? null;\n\tconst background = pageColor?.light ?? loading?.background ?? \"#0f1115\";\n\tconst color = loading?.color ?? \"#e6e8eb\";\n\tconst accent = loading?.accent ?? \"#4ade80\";\n\tconst dark = loading?.dark;\n\tconst darkBackground = pageColor?.dark ?? dark?.background;\n\tconst darkVars = dark || darkBackground ? `\n @media (prefers-color-scheme: dark) {\n :root {\n --bg: ${darkBackground ?? background};\n --fg: ${dark?.color ?? color};\n --accent: ${dark?.accent ?? accent};\n }\n }` : \"\";\n\tconst attr = (text) => text.replace(/&/g, \"&\").replace(/\"/g, \""\");\n\tconst layersTag = art.background && art.background.layers.length > 0 ? `<div class=\"layers\" aria-hidden=\"true\">\n ${art.background.layers.map((layer) => layer.dark ? `<picture>\n <source srcset=\"${attr(layer.dark)}\" media=\"(prefers-color-scheme: dark)\" />\n <img src=\"${attr(layer.light)}\" alt=\"\" style=\"${attr(layer.style)}\" />\n </picture>` : `<img src=\"${attr(layer.light)}\" alt=\"\" style=\"${attr(layer.style)}\" />`).join(\"\\n \")}\n </div>\n ` : \"\";\n\tconst picture = (cls, file, darkFile, attrs = \"\") => darkFile ? `<picture>\n <source srcset=\"./${darkFile}\" media=\"(prefers-color-scheme: dark)\" />\n <img class=\"${cls}\" src=\"./${file}\" alt=\"\"${attrs} />\n </picture>\n ` : `<img class=\"${cls}\" src=\"./${file}\" alt=\"\"${attrs} />\n `;\n\tconst main = art.main;\n\tconst logoTag = main?.kind === \"splash\" ? picture(\"splash\", main.file, main.dark) : main ? picture(\"logo\", main.file, main.dark, ` width=\"${LOGO_CSS_PX}\" height=\"${LOGO_CSS_PX}\"`) : \"\";\n\tconst cornerTag = art.corner ? `<div class=\"corner\" aria-hidden=\"true\">${picture(\"art\", art.corner.file, art.corner.dark)}</div>\n ` : \"\";\n\treturn `<!doctype html>\n<html lang=\"en\">\n <head>\n <meta charset=\"utf-8\" />\n <title>${name}</title>\n <style>\n :root {\n color-scheme: light dark;\n --bg: ${background}; --fg: ${color}; --accent: ${accent};\n }${darkVars}\n body {\n margin: 0; height: 100vh; overflow: hidden;\n display: flex; align-items: center; justify-content: center;\n font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, \"Segoe UI\", sans-serif;\n background: var(--bg); color: var(--fg);\n }\n .box {\n position: relative; z-index: 1;\n text-align: center;\n display: flex; flex-direction: column; align-items: center; gap: 20px;\n }\n .logo {\n width: ${LOGO_CSS_PX}px; height: ${LOGO_CSS_PX}px;\n object-fit: contain; display: block;\n }\n .splash {\n width: min(720px, 80vw); max-height: 65vh;\n object-fit: contain; display: block;\n }\n .corner {\n position: fixed; right: 0; bottom: 0; z-index: 0;\n width: clamp(220px, 30vw, 520px); line-height: 0; pointer-events: none;\n }\n .layers { position: fixed; inset: 0; z-index: 0; }\n .art { width: 100%; height: auto; display: block; }\n .dot {\n width: 10px; height: 10px; border-radius: 50%;\n background: var(--accent); display: inline-block; margin-right: 8px;\n animation: pulse 1.2s ease-in-out infinite;\n }\n @keyframes pulse { 0%,100% { opacity: .35 } 50% { opacity: 1 } }\n @media (prefers-reduced-motion: reduce) { .dot { animation: none; } }\n </style>\n </head>\n <body>\n <div class=\"box\">\n ${logoTag}<div><span class=\"dot\"></span>${message}</div>\n </div>\n ${layersTag}${cornerTag}</body>\n</html>\n`;\n}\nfunction tauriConf(input) {\n\tconst { app } = input;\n\tconst win = app.window ?? {};\n\tconst fileAssociations = app.fileAssociations && app.fileAssociations.length > 0 ? app.fileAssociations.map((fa) => ({\n\t\text: fa.ext,\n\t\tname: fa.name,\n\t\t...fa.description ? { description: fa.description } : {},\n\t\t...fa.mimeType ? { mimeType: fa.mimeType } : {}\n\t})) : void 0;\n\tconst conf = {\n\t\t$schema: \"https://schema.tauri.app/config/2\",\n\t\tproductName: app.productName,\n\t\tversion: \"0.1.0\",\n\t\tidentifier: app.identifier,\n\t\tbuild: { frontendDist: \"./ui\" },\n\t\tapp: {\n\t\t\twindows: [{\n\t\t\t\ttitle: win.title ?? app.productName,\n\t\t\t\twidth: win.width ?? 1440,\n\t\t\t\theight: win.height ?? 900,\n\t\t\t\tresizable: win.resizable ?? true,\n\t\t\t\t...win.minWidth ? { minWidth: win.minWidth } : {},\n\t\t\t\t...win.minHeight ? { minHeight: win.minHeight } : {},\n\t\t\t\tvisible: true,\n\t\t\t\tdragDropEnabled: false,\n\t\t\t\tcreate: false\n\t\t\t}],\n\t\t\tsecurity: { csp: null }\n\t\t},\n\t\tbundle: {\n\t\t\tactive: true,\n\t\t\ttargets: [\n\t\t\t\t\"nsis\",\n\t\t\t\t\"app\",\n\t\t\t\t\"dmg\"\n\t\t\t],\n\t\t\ticon: [\n\t\t\t\t\"icons/32x32.png\",\n\t\t\t\t\"icons/128x128.png\",\n\t\t\t\t\"icons/128x128@2x.png\",\n\t\t\t\t\"icons/icon.icns\",\n\t\t\t\t\"icons/icon.ico\"\n\t\t\t],\n\t\t\t...fileAssociations ? { fileAssociations } : {},\n\t\t\texternalBin: [\"binaries/node\"],\n\t\t\tresources: { \"./dist-stack\": \"stack\" }\n\t\t}\n\t};\n\treturn JSON.stringify(conf, null, 2) + \"\\n\";\n}\nfunction defaultCapability() {\n\treturn JSON.stringify({\n\t\t$schema: \"../gen/schemas/desktop-schema.json\",\n\t\tidentifier: \"default\",\n\t\tdescription: \"Lets the shell spawn the bundled node sidecar.\",\n\t\twindows: [\"main\"],\n\t\tpermissions: [\n\t\t\t\"core:default\",\n\t\t\t\"allow-take-launch-files\",\n\t\t\t\"allow-read-launch-file\",\n\t\t\t\"allow-log-from-webview\",\n\t\t\t{\n\t\t\t\tidentifier: \"shell:allow-spawn\",\n\t\t\t\tallow: [{\n\t\t\t\t\tname: \"binaries/node\",\n\t\t\t\t\tsidecar: true,\n\t\t\t\t\targs: true\n\t\t\t\t}]\n\t\t\t},\n\t\t\t{\n\t\t\t\tidentifier: \"shell:allow-execute\",\n\t\t\t\tallow: [{\n\t\t\t\t\tname: \"binaries/node\",\n\t\t\t\t\tsidecar: true,\n\t\t\t\t\targs: true\n\t\t\t\t}]\n\t\t\t}\n\t\t]\n\t}, null, 2) + \"\\n\";\n}\nfunction connectCapability(connectPort) {\n\tconst origin = `http://127.0.0.1:${connectPort}`;\n\treturn JSON.stringify({\n\t\t$schema: \"../gen/schemas/desktop-schema.json\",\n\t\tidentifier: \"connect\",\n\t\tdescription: \"Connect is served over http://127.0.0.1 (a remote origin to Tauri); without this the launch-queue commands are rejected before they run.\",\n\t\twindows: [\"main\"],\n\t\tremote: { urls: [origin, `${origin}/*`] },\n\t\tpermissions: [\n\t\t\t\"allow-take-launch-files\",\n\t\t\t\"allow-read-launch-file\",\n\t\t\t\"allow-log-from-webview\"\n\t\t]\n\t}, null, 2) + \"\\n\";\n}\nconst GITIGNORE = `# Generated tauri shell — only Cargo.lock and app-icon.png are tracked.\n/target\n/gen\n/icons\n/ui/logo.png\n/ui/splash.png\n/ui/splash-dark.png\n/ui/art.*\n/ui/art-dark.*\n/ui/bg-*\n/dist-stack\n/binaries\n`;\nconst DIST_STACK_README = `This directory is replaced at \\`ph run desktop build\\` with the shippable\nstack (hosts + powerhouse.config.json + built Connect + vendored ph-cli). It\nis bundled as the app's \\`stack\\` resource so the installed app runs with no\nenvironment. Kept as a placeholder so tauri's resource glob resolves in dev.\n`;\n/** Write a file only when its content differs; returns whether it changed. */\nfunction writeIfChanged(file, content) {\n\tif (fs.existsSync(file) && fs.readFileSync(file, \"utf8\") === content) return false;\n\tfs.mkdirSync(path.dirname(file), { recursive: true });\n\tfs.writeFileSync(file, content);\n\treturn true;\n}\n/**\n* Materialize/refresh `<hostDir>/tauri-shell/` from app.json. Idempotent:\n* unchanged app.json rewrites nothing. Does NOT run `tauri icon` or fetch the\n* node binary — those are toolchain steps the runner performs at dev/build.\n*/\nfunction projectShell(input) {\n\tconst { hostDir, app, connectPort } = input;\n\tconst binName = appSlug(app);\n\tconst shellDir = path.join(hostDir, SHELL_DIR);\n\tconst iconSrc = path.resolve(hostDir, app.icon);\n\tconst iconBytes = fs.existsSync(iconSrc) ? fs.readFileSync(iconSrc) : null;\n\tconst readRel = (rel) => {\n\t\tif (!rel) return null;\n\t\tconst abs = path.resolve(hostDir, rel);\n\t\treturn fs.existsSync(abs) ? fs.readFileSync(abs) : null;\n\t};\n\tconst splashBytes = readRel(app.splash);\n\tconst splashDarkBytes = readRel(app.splashDark);\n\tconst artBytes = readRel(app.loading?.art);\n\tconst artDarkBytes = readRel(app.loading?.artDark);\n\tconst artExt = (rel) => rel ? path.extname(rel).toLowerCase() || \".png\" : \".png\";\n\tconst artFile = `art${artExt(app.loading?.art)}`;\n\tconst artDarkFile = `art-dark${artExt(app.loading?.artDark)}`;\n\tconst background = normalizeBackground(app.background);\n\tconst staged = [];\n\tconst stage = (ref, stem) => {\n\t\tif (isPassthroughImageRef(ref)) return ref;\n\t\tconst abs = path.resolve(hostDir, ref);\n\t\tif (!fs.existsSync(abs)) return void 0;\n\t\tconst file = `${stem}${artExt(ref)}`;\n\t\tstaged.push([path.join(shellDir, \"ui\", file), fs.readFileSync(abs)]);\n\t\treturn `./${file}`;\n\t};\n\tconst layers = (background?.layers ?? []).flatMap((layer, index) => {\n\t\tconst variants = imageVariants(layer.src);\n\t\tconst light = stage(variants.light, `bg-${index}`);\n\t\tif (!light) return [];\n\t\tconst dark = variants.dark ? stage(variants.dark, `bg-${index}-dark`) : void 0;\n\t\treturn [{\n\t\t\tlight,\n\t\t\t...dark ? { dark } : {},\n\t\t\tstyle: layerStyleText(layer)\n\t\t}];\n\t});\n\tconst art = {\n\t\tmain: background ? null : splashBytes ? {\n\t\t\tkind: \"splash\",\n\t\t\tfile: LOADING_SPLASH,\n\t\t\t...splashDarkBytes ? { dark: LOADING_SPLASH_DARK } : {}\n\t\t} : iconBytes ? {\n\t\t\tkind: \"logo\",\n\t\t\tfile: LOADING_LOGO\n\t\t} : null,\n\t\tcorner: !background && artBytes ? {\n\t\t\tfile: artFile,\n\t\t\t...artDarkBytes ? { dark: artDarkFile } : {}\n\t\t} : null,\n\t\tbackground: background ? {\n\t\t\tcolor: colorVariants(background.color),\n\t\t\tlayers\n\t\t} : null\n\t};\n\tconst files = [\n\t\t[\"Cargo.toml\", cargoToml(app, binName)],\n\t\t[\"src/main.rs\", MAIN_RS],\n\t\t[\"build.rs\", BUILD_RS],\n\t\t[\"tauri.conf.json\", tauriConf(input)],\n\t\t[\"ui/index.html\", loadingHtml(app, art)],\n\t\t[\"capabilities/default.json\", defaultCapability()],\n\t\t[\"capabilities/connect.json\", connectCapability(connectPort)],\n\t\t[\".gitignore\", GITIGNORE],\n\t\t[\"dist-stack/README.md\", DIST_STACK_README]\n\t];\n\tlet changed = false;\n\tfor (const [rel, content] of files) if (writeIfChanged(path.join(shellDir, rel), content)) changed = true;\n\tconst copies = [\n\t\t[path.join(shellDir, ICON_SOURCE), iconBytes],\n\t\t[path.join(shellDir, \"ui\", LOADING_LOGO), iconBytes],\n\t\t[path.join(shellDir, \"ui\", LOADING_SPLASH), splashBytes],\n\t\t[path.join(shellDir, \"ui\", LOADING_SPLASH_DARK), splashDarkBytes],\n\t\t[path.join(shellDir, \"ui\", artFile), artBytes],\n\t\t[path.join(shellDir, \"ui\", artDarkFile), artDarkBytes],\n\t\t...staged\n\t];\n\tfor (const [dest, bytes] of copies) {\n\t\tif (!bytes) continue;\n\t\tif (!fs.existsSync(dest) || !fs.readFileSync(dest).equals(bytes)) {\n\t\t\tfs.mkdirSync(path.dirname(dest), { recursive: true });\n\t\t\tfs.writeFileSync(dest, bytes);\n\t\t\tchanged = true;\n\t\t}\n\t}\n\treturn {\n\t\tshellDir,\n\t\tbinName,\n\t\tchanged\n\t};\n}\n//#endregion\n//#region src/shell-toolchain.ts\n/** The Node release triple for a build host — the sidecar filename tauri\n* resolves (`node-<triple>`). Pure, so the mapping is unit-tested. */\nfunction nodeSidecarTarget(platform, arch) {\n\tconst target = {\n\t\t\"win32 x64\": {\n\t\t\ttriple: \"x86_64-pc-windows-msvc\",\n\t\t\tdist: \"win-x64\",\n\t\t\tbin: \"node.exe\",\n\t\t\text: \".exe\"\n\t\t},\n\t\t\"darwin arm64\": {\n\t\t\ttriple: \"aarch64-apple-darwin\",\n\t\t\tdist: \"darwin-arm64\",\n\t\t\tbin: \"bin/node\",\n\t\t\text: \"\"\n\t\t},\n\t\t\"darwin x64\": {\n\t\t\ttriple: \"x86_64-apple-darwin\",\n\t\t\tdist: \"darwin-x64\",\n\t\t\tbin: \"bin/node\",\n\t\t\text: \"\"\n\t\t},\n\t\t\"linux x64\": {\n\t\t\ttriple: \"x86_64-unknown-linux-gnu\",\n\t\t\tdist: \"linux-x64\",\n\t\t\tbin: \"bin/node\",\n\t\t\text: \"\"\n\t\t}\n\t}[`${platform} ${arch}`];\n\tif (!target) throw new Error(`No Node sidecar mapping for ${platform} ${arch} — the desktop shell supports win32/x64, darwin/arm64, darwin/x64, linux/x64.`);\n\treturn target;\n}\n/** Fetch the stock Node the shell ships as its sidecar into `<shellDir>/\n* binaries`, named per target triple. No-op when already present. Ported from\n* the reference repo's fetch-node.mjs (the builder has no such script). */\nfunction fetchNodeSidecar(shellDir, version = process.versions.node, platform = process.platform, arch = process.arch) {\n\tconst target = nodeSidecarTarget(platform, arch);\n\tconst binariesDir = path.join(shellDir, \"binaries\");\n\tfs.mkdirSync(binariesDir, { recursive: true });\n\tconst dest = path.join(binariesDir, `node-${target.triple}${target.ext}`);\n\tif (fs.existsSync(dest)) return dest;\n\tif (platform === \"win32\") {\n\t\tconst url = `https://nodejs.org/dist/v${version}/win-x64/node.exe`;\n\t\texecSync(`curl -fsSL -o \"${dest}\" \"${url}\"`, { stdio: \"inherit\" });\n\t} else {\n\t\tconst name = `node-v${version}-${target.dist}`;\n\t\tconst url = `https://nodejs.org/dist/v${version}/${name}.tar.gz`;\n\t\texecSync(`curl -fsSL \"${url}\" | tar -xz -C \"${binariesDir}\" --strip-components=2 ${name}/${target.bin}`, {\n\t\t\tstdio: \"inherit\",\n\t\t\tshell: \"/bin/sh\"\n\t\t});\n\t\tfs.renameSync(path.join(binariesDir, \"node\"), dest);\n\t\tfs.chmodSync(dest, 493);\n\t}\n\treturn dest;\n}\n/** Default bundle targets for the build host (`cargo tauri build --bundles`).\n* macOS gets app+dmg, Windows nsis, Linux deb+appimage — a host only builds\n* installers it can produce. */\nfunction tauriBundlesForHost(platform = process.platform) {\n\tswitch (platform) {\n\t\tcase \"darwin\": return [\"app\", \"dmg\"];\n\t\tcase \"win32\": return [\"nsis\"];\n\t\tdefault: return [\"deb\", \"appimage\"];\n\t}\n}\n/** Spawn parameters that avoid DEP0190 (args array + shell:true): cargo on\n* Windows needs the shell for PATH/.exe + subcommand resolution — pass ONE\n* string, empty args; everything else runs argv directly (shell:false). The\n* joined tokens here are our own constants/paths, never user input. */\nfunction tauriSpawn(tauri, subcommand) {\n\tconst argv = [...tauri.prefix, ...subcommand];\n\tif (tauri.cmd === \"cargo\" && process.platform === \"win32\") return {\n\t\tcommand: [\"cargo\", ...argv].join(\" \"),\n\t\targs: [],\n\t\tshell: true\n\t};\n\treturn {\n\t\tcommand: tauri.cmd,\n\t\targs: argv,\n\t\tshell: false\n\t};\n}\nfunction probe(cmd, args) {\n\tconst onWin = process.platform === \"win32\";\n\ttry {\n\t\treturn spawnSync(onWin ? [cmd, ...args].join(\" \") : cmd, onWin ? [] : args, {\n\t\t\tstdio: \"ignore\",\n\t\t\tshell: onWin\n\t\t}).status === 0;\n\t} catch {\n\t\treturn false;\n\t}\n}\n/** Is a Rust `cargo` on PATH? (needed to compile the shell crate). */\nfunction hasCargo() {\n\treturn probe(\"cargo\", [\"--version\"]);\n}\n/** Resolve a Tauri CLI: a global `cargo tauri`, else a `@tauri-apps/cli`\n* resolvable from the project. Returns null when neither is available. */\nfunction resolveTauriCommand(projectRoot) {\n\tif (probe(\"cargo\", [\"tauri\", \"--version\"])) return {\n\t\tcmd: \"cargo\",\n\t\tprefix: [\"tauri\"],\n\t\tvia: \"cargo-tauri\"\n\t};\n\ttry {\n\t\tconst pkgJson = createRequire(pathToFileURL(path.join(projectRoot, \"package.json\")).href).resolve(\"@tauri-apps/cli/package.json\");\n\t\tconst pkgDir = path.dirname(pkgJson);\n\t\tconst bin = JSON.parse(fs.readFileSync(pkgJson, \"utf8\")).bin;\n\t\tconst rel = typeof bin === \"string\" ? bin : bin?.tauri;\n\t\tif (rel) return {\n\t\t\tcmd: process.execPath,\n\t\t\tprefix: [path.join(pkgDir, rel)],\n\t\t\tvia: \"node-cli\"\n\t\t};\n\t} catch {}\n\treturn null;\n}\nfunction detectToolchain(projectRoot) {\n\treturn {\n\t\tcargo: hasCargo(),\n\t\ttauri: resolveTauriCommand(projectRoot)\n\t};\n}\n/** Throw a clear, actionable error when the native toolchain is incomplete —\n* the desktop verbs call this before any cargo work so a missing executable\n* is an instruction, not a stack trace. */\nfunction preflightOrThrow(tc, hostName) {\n\tconst missing = [];\n\tif (!tc.cargo) missing.push(\" • Rust/cargo — install from https://rustup.rs (then restart your shell)\");\n\tif (!tc.tauri) missing.push(\" • Tauri CLI — `cargo install tauri-cli --version \\\"^2\\\"` (or add @tauri-apps/cli@^2 to your project's devDependencies)\");\n\tif (missing.length > 0 || !tc.tauri) throw new Error(`hosts/${hostName}: the desktop shell needs a native toolchain that is not installed:\\n${missing.join(\"\\n\")}\\nInstall the above, then re-run \\`ph run ${hostName} dev\\` / \\`ph run ${hostName} build\\`. (The headless stack — \\`ph run ${hostName}\\` — needs none of this.)`);\n\treturn tc.tauri;\n}\n/** `<tauri> icon <source>` — generates the per-platform icon set (icon.ico +\n* icon.icns + pngs) the bundle references and tauri-build requires. */\nfunction runTauriIcon(tauri, shellDir, iconSource) {\n\tconst { command, args, shell } = tauriSpawn(tauri, [\"icon\", iconSource]);\n\tconst r = spawnSync(command, args, {\n\t\tcwd: shellDir,\n\t\tstdio: \"inherit\",\n\t\tshell\n\t});\n\tif (r.status !== 0) throw new Error(`\\`tauri icon ${iconSource}\\` failed (exit ${r.status ?? \"?\"}) in ${shellDir} — check that app.icon is a square PNG.`);\n}\n//#endregion\n//#region src/shell.ts\nfunction resolveShell(projectRoot, options, env) {\n\tconst configured = options?.project ?? env.PH_DESKTOP_SHELL;\n\tif (!configured) throw new Error(\"No desktop shell configured: set runner.shell.project in the host file (path to a ph-win-desktop checkout) or the PH_DESKTOP_SHELL environment variable. `ph run desktop` (headless stack) needs neither.\");\n\tconst projectDir = path.resolve(projectRoot, configured);\n\tif (!fs.existsSync(path.join(projectDir, \"src-tauri\"))) throw new Error(`Desktop shell not found at ${projectDir} (no src-tauri/) — check runner.shell.project / PH_DESKTOP_SHELL.`);\n\treturn {\n\t\tprojectDir,\n\t\texe: [\n\t\t\tpath.join(projectDir, \"src-tauri\", \"target\", \"debug\", \"ph-win.exe\"),\n\t\t\tpath.join(projectDir, \"src-tauri\", \"target\", \"release\", \"ph-win.exe\"),\n\t\t\tpath.join(projectDir, \"src-tauri\", \"target\", \"debug\", \"ph-win\"),\n\t\t\tpath.join(projectDir, \"src-tauri\", \"target\", \"release\", \"ph-win\")\n\t\t].find((c) => fs.existsSync(c))\n\t};\n}\n/** Resolve the project's ph-cli entry from ITS dependency tree — the same\n* resolution `ph run` itself uses. */\nfunction resolvePhCliEntry(projectRoot) {\n\tconst pkgPath = createRequire(pathToFileURL(path.join(projectRoot, \"package.json\")).href).resolve(\"@powerhousedao/ph-cli/package.json\");\n\treturn path.join(path.dirname(pkgPath), \"dist\", \"cli.mjs\");\n}\n/** The env trio (plus flag and userData) the shell's uniform-runners mode\n* reads — wired by the RUNNER so nobody exports variables by hand. */\nfunction shellEnv(projectRoot, connectPort, env) {\n\treturn {\n\t\tFEATURE_UNIFORM_RUNNERS_ENABLED: \"1\",\n\t\tPH_RUN_PROJECT: projectRoot,\n\t\tPH_RUN_CLI: resolvePhCliEntry(projectRoot),\n\t\tPH_WIN_CONNECT_PORT: String(connectPort),\n\t\t...env.PH_USER_DATA_DIR ? { PH_USER_DATA_DIR: env.PH_USER_DATA_DIR } : {}\n\t};\n}\n/** Project host shell options onto a tauri `--config` merge patch (D6.d) —\n* the host file stays the single source for app identity on tauri-cli\n* invocations; a built exe has these baked. */\nfunction tauriConfigPatch(options) {\n\tif (!options) return void 0;\n\tconst patch = {};\n\tif (options.window) patch.app = { windows: [{\n\t\t...options.window.title ? { title: options.window.title } : {},\n\t\t...options.window.width ? { width: options.window.width } : {},\n\t\t...options.window.height ? { height: options.window.height } : {}\n\t}] };\n\tif (options.fileAssociations?.length) patch.bundle = { fileAssociations: [{\n\t\text: options.fileAssociations.map((e) => e.replace(/^\\./, \"\")),\n\t\tname: \"Powerhouse Document\"\n\t}] };\n\treturn Object.keys(patch).length > 0 ? patch : void 0;\n}\nfunction launchShell(shell, envVars, options) {\n\tif (shell.exe) return spawn(shell.exe, [], {\n\t\tcwd: shell.projectDir,\n\t\tenv: {\n\t\t\t...process.env,\n\t\t\t...envVars\n\t\t},\n\t\tstdio: \"inherit\",\n\t\twindowsHide: true\n\t});\n\tconst patch = tauriConfigPatch(options);\n\tconst args = [\"tauri\", \"dev\"];\n\tif (patch) args.push(\"--config\", JSON.stringify(patch));\n\treturn spawn(\"pnpm\", args, {\n\t\tcwd: shell.projectDir,\n\t\tenv: {\n\t\t\t...process.env,\n\t\t\t...envVars\n\t\t},\n\t\tstdio: \"inherit\",\n\t\tshell: true,\n\t\twindowsHide: true\n\t});\n}\n//#endregion\nexport { loadAppJson as S, bundleStack as _, tauriConfigPatch as a, appJsonSchema as b, nodeSidecarTarget as c, runTauriIcon as d, tauriBundlesForHost as f, projectShell as g, SHELL_DIR as h, shellEnv as i, preflightOrThrow as l, ICON_SOURCE as m, resolvePhCliEntry as n, detectToolchain as o, tauriSpawn as p, resolveShell as r, fetchNodeSidecar as s, launchShell as t, resolveTauriCommand as u, APP_JSON_FILE as v, appSlug as x, DEFAULT_SHELL_CRATE_VERSION as y };\n\n//# sourceMappingURL=shell-C6KfHzBa.mjs.map","import { S as loadAppJson, _ as bundleStack, a as tauriConfigPatch, b as appJsonSchema, c as nodeSidecarTarget, d as runTauriIcon, f as tauriBundlesForHost, g as projectShell, h as SHELL_DIR, i as shellEnv, l as preflightOrThrow, m as ICON_SOURCE, n as resolvePhCliEntry, o as detectToolchain, r as resolveShell, s as fetchNodeSidecar, t as launchShell, u as resolveTauriCommand, v as APP_JSON_FILE, x as appSlug, y as DEFAULT_SHELL_CRATE_VERSION } from \"./shell-C6KfHzBa.mjs\";\nimport { mapBackgroundImages } from \"@powerhousedao/shared/connect\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { isPassthroughImageRef } from \"@powerhousedao/shared/connect/image-ref\";\nimport { deflateSync } from \"node:zlib\";\n//#region src/scaffold.ts\n/**\n* A background whose project-relative paths are rewritten to be relative to\n* another directory (powerhouse.config.json's root -> hosts/desktop, where\n* app.json resolves them from). URLs and data URIs are left as they are.\n*/\nfunction rebaseBackground(background, fromDir, toDir) {\n\tconst rebase = (ref) => {\n\t\tif (isPassthroughImageRef(ref)) return ref;\n\t\tconst rel = path.relative(toDir, path.resolve(fromDir, ref)).split(path.sep).join(\"/\");\n\t\treturn rel.startsWith(\".\") ? rel : `./${rel}`;\n\t};\n\treturn typeof background === \"string\" ? rebase(background) : mapBackgroundImages(background, rebase);\n}\n/** Minimal PNG encoder — a solid square so `tauri icon` always has a valid\n* source. Pure Node (zlib); no binary asset ships in the package. The builder\n* replaces it with their real 1024×1024 artwork. */\nfunction solidPng(size, rgba) {\n\tconst [r, g, b, a] = rgba;\n\tconst row = Buffer.alloc(1 + size * 4);\n\tfor (let x = 0; x < size; x++) {\n\t\tconst o = 1 + x * 4;\n\t\trow[o] = r;\n\t\trow[o + 1] = g;\n\t\trow[o + 2] = b;\n\t\trow[o + 3] = a;\n\t}\n\tconst raw = Buffer.concat(Array.from({ length: size }, () => row));\n\tconst idat = deflateSync(raw);\n\tconst chunk = (type, data) => {\n\t\tconst len = Buffer.alloc(4);\n\t\tlen.writeUInt32BE(data.length, 0);\n\t\tconst typeBuf = Buffer.from(type, \"ascii\");\n\t\tconst body = Buffer.concat([typeBuf, data]);\n\t\tconst crc = Buffer.alloc(4);\n\t\tcrc.writeUInt32BE(crc32(body) >>> 0, 0);\n\t\treturn Buffer.concat([\n\t\t\tlen,\n\t\t\tbody,\n\t\t\tcrc\n\t\t]);\n\t};\n\tconst ihdr = Buffer.alloc(13);\n\tihdr.writeUInt32BE(size, 0);\n\tihdr.writeUInt32BE(size, 4);\n\tihdr[8] = 8;\n\tihdr[9] = 6;\n\tihdr[10] = 0;\n\tihdr[11] = 0;\n\tihdr[12] = 0;\n\treturn Buffer.concat([\n\t\tBuffer.from([\n\t\t\t137,\n\t\t\t80,\n\t\t\t78,\n\t\t\t71,\n\t\t\t13,\n\t\t\t10,\n\t\t\t26,\n\t\t\t10\n\t\t]),\n\t\tchunk(\"IHDR\", ihdr),\n\t\tchunk(\"IDAT\", idat),\n\t\tchunk(\"IEND\", Buffer.alloc(0))\n\t]);\n}\nlet crcTable;\nfunction crc32(buf) {\n\tif (!crcTable) {\n\t\tcrcTable = [];\n\t\tfor (let n = 0; n < 256; n++) {\n\t\t\tlet c = n;\n\t\t\tfor (let k = 0; k < 8; k++) c = c & 1 ? 3988292384 ^ c >>> 1 : c >>> 1;\n\t\t\tcrcTable[n] = c;\n\t\t}\n\t}\n\tlet crc = 4294967295;\n\tfor (let i = 0; i < buf.length; i++) crc = crcTable[(crc ^ buf[i]) & 255] ^ crc >>> 8;\n\treturn crc ^ 4294967295;\n}\nconst GITIGNORE = `# Generated tauri shell — only Cargo.lock and app-icon.png are tracked.\n/tauri-shell/target\n/tauri-shell/gen\n/tauri-shell/icons\n/tauri-shell/dist-stack\n/tauri-shell/binaries\n`;\nfunction scaffoldDesktopShell(hostDir, options) {\n\tconst created = [];\n\tconst skipped = [];\n\tfs.mkdirSync(hostDir, { recursive: true });\n\tconst iconFile = \"icon.png\";\n\tconst app = {\n\t\tidentifier: options.identifier,\n\t\tproductName: options.productName,\n\t\ticon: `./${iconFile}`,\n\t\tbackground: options.background ?? null,\n\t\tloading: null,\n\t\twindow: {\n\t\t\ttitle: options.productName,\n\t\t\twidth: 1440,\n\t\t\theight: 900\n\t\t},\n\t\tfileAssociations: [{\n\t\t\text: [\"phd\"],\n\t\t\tname: \"Powerhouse Document\",\n\t\t\tmimeType: \"application/vnd.powerhouse.document+zip\"\n\t\t}]\n\t};\n\tappJsonSchema.parse(app);\n\tconst appJsonPath = path.join(hostDir, APP_JSON_FILE);\n\tif (fs.existsSync(appJsonPath) && !options.force) skipped.push(appJsonPath);\n\telse {\n\t\tfs.writeFileSync(appJsonPath, `${JSON.stringify(app, null, 2)}\\n`);\n\t\tcreated.push(appJsonPath);\n\t}\n\tconst iconPath = path.join(hostDir, iconFile);\n\tif (fs.existsSync(iconPath)) skipped.push(iconPath);\n\telse {\n\t\tfs.writeFileSync(iconPath, solidPng(1024, [\n\t\t\t79,\n\t\t\t70,\n\t\t\t229,\n\t\t\t255\n\t\t]));\n\t\tcreated.push(iconPath);\n\t}\n\tconst gitignorePath = path.join(hostDir, \".gitignore\");\n\tif (fs.existsSync(gitignorePath)) skipped.push(gitignorePath);\n\telse {\n\t\tfs.writeFileSync(gitignorePath, GITIGNORE);\n\t\tcreated.push(gitignorePath);\n\t}\n\treturn {\n\t\thostDir,\n\t\tcreated,\n\t\tskipped\n\t};\n}\n//#endregion\nexport { APP_JSON_FILE, DEFAULT_SHELL_CRATE_VERSION, ICON_SOURCE, SHELL_DIR, appJsonSchema, appSlug, bundleStack, detectToolchain, fetchNodeSidecar, launchShell, loadAppJson, nodeSidecarTarget, preflightOrThrow, projectShell, rebaseBackground, resolvePhCliEntry, resolveShell, resolveTauriCommand, runTauriIcon, scaffoldDesktopShell, shellEnv, solidPng, tauriBundlesForHost, tauriConfigPatch };\n\n//# sourceMappingURL=index.mjs.map","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { rebaseBackground, scaffoldDesktopShell } from \"@powerhousedao/desktop\";\nimport type { PHBackground } from \"@powerhousedao/shared/clis\";\n\nexport interface GenerateDesktopShellArgs {\n name?: string;\n identifier?: string;\n force?: boolean;\n}\n\n/** A reverse-DNS-safe segment from the project name (drop scope, slugify). */\nfunction projectSlug(pkgName: string | undefined): string {\n const bare = (pkgName ?? \"app\").replace(/^@[^/]+\\//, \"\");\n const seg = bare\n .toLowerCase()\n .replace(/[^a-z0-9-]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\");\n return seg || \"app\";\n}\n\n/** `connect.home.background` of the project's powerhouse.config.json, if\n * any (absent or unreadable config: none). */\nfunction readHomeBackground(cwd: string): PHBackground | null {\n try {\n const config = JSON.parse(\n fs.readFileSync(path.join(cwd, \"powerhouse.config.json\"), \"utf8\"),\n ) as { connect?: { home?: { background?: PHBackground | null } } };\n return config.connect?.home?.background ?? null;\n } catch {\n return null;\n }\n}\n\n/** `ph generate desktop-shell`: write hosts/desktop/app.json + a placeholder\n * icon + .gitignore. Defaults product name / identifier from the project. */\nexport function startGenerateDesktopShell(\n args: GenerateDesktopShellArgs,\n cwd: string,\n): void {\n let pkgName: string | undefined;\n try {\n const pkg = JSON.parse(\n fs.readFileSync(path.join(cwd, \"package.json\"), \"utf8\"),\n ) as { name?: string };\n pkgName = pkg.name;\n } catch {\n // no package.json — fall back to defaults below\n }\n const slug = projectSlug(pkgName);\n const productName = args.name ?? pkgName?.replace(/^@[^/]+\\//, \"\") ?? \"App\";\n const identifier = args.identifier ?? `inc.powerhouse.desktop.${slug}`;\n\n const hostDir = path.join(cwd, \"hosts\", \"desktop\");\n // The loading page takes Connect's home background, the same layers in\n // the same places, with its paths rebased from the project root to\n // hosts/desktop (app.json resolves them from where it lives).\n const homeBackground = readHomeBackground(cwd);\n const result = scaffoldDesktopShell(hostDir, {\n identifier,\n productName,\n force: args.force,\n background: homeBackground\n ? rebaseBackground(homeBackground, cwd, hostDir)\n : null,\n });\n\n const rel = (p: string) => path.relative(cwd, p).replace(/\\\\/g, \"/\");\n for (const f of result.created) console.log(` created ${rel(f)}`);\n if (homeBackground && result.created.some((f) => f.endsWith(\"app.json\"))) {\n console.log(\n \" copied connect.home.background -> hosts/desktop/app.json background\",\n );\n }\n for (const f of result.skipped) {\n console.log(` skipped ${rel(f)} (exists — pass --force to overwrite)`);\n }\n if (!fs.existsSync(path.join(hostDir, \"host.js\"))) {\n console.log(\n `\\nNote: hosts/desktop/host.js not found. Add a desktop host (see the ` +\n `desktop topology from \\`ph init\\`) so \\`ph run desktop\\` can supervise ` +\n `the stack; app.json then gives it a native window.`,\n );\n }\n console.log(\n `\\nIdentity: ${productName} (${identifier}).\\n` +\n `• Replace hosts/desktop/icon.png with your 1024×1024 icon.\\n` +\n `• \\`ph run desktop dev\\` opens the native window (needs Rust + the Tauri CLI).\\n` +\n `• \\`ph run desktop build\\` produces installers for this OS.`,\n );\n}\n"],"names":["z.string","z.strictObject","z.number","z.boolean","z.union","z.array"],"mappings":";;;;;;;;;;;;;;;;;;;AAgBA,MAAM,mBAAmBA,OAAS,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,qCAAqC,yFAAyF;AAC/K,MAAM,eAAeC,aAAe;CACnC,OAAOD,OAAS,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;CAClC,OAAOE,OAAS,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS;CAC5C,QAAQA,OAAS,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS;CAC7C,WAAWC,QAAU,CAAC,CAAC,SAAS;;CAEhC,UAAUD,OAAS,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS;CAC/C,WAAWA,OAAS,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS;AACjD,CAAC,CAAC,C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
{"version":3,"file":"generate-desktop-shell-BXcGvbms.mjs","sources":["../../../packages/desktop/dist/shell-C6KfHzBa.mjs","../../../packages/desktop/dist/index.mjs","../src/services/generate-desktop-shell.ts"],"sourcesContent":["import { createRequire } from \"node:module\";\nimport { colorVariants, imageVariants, layerStyleText, normalizeBackground, validateBackground } from \"@powerhousedao/shared/connect\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { z } from \"zod\";\nimport { execSync, spawn, spawnSync } from \"node:child_process\";\nimport { isPassthroughImageRef } from \"@powerhousedao/shared/connect/image-ref\";\nimport { pathToFileURL } from \"node:url\";\n//#region src/app-json.ts\n/**\n* `hosts/desktop/app.json` — the builder's desktop identity (phase 7, mode 1:\n* the builder ships under THEIR identity without writing Rust). It is the ONE\n* file a builder edits; `shell-project.ts` projects it into a generated\n* `tauri-shell/` that depends on the published `ph-desktop-shell` crate. Every\n* field validates strictly so a typo fails with the field named, not silently.\n*/\nconst identifierSchema = z.string().min(1).regex(/^[A-Za-z0-9-]+(\\.[A-Za-z0-9-]+)+$/, \"identifier must be reverse-DNS (e.g. com.acme.app): dot-separated alphanumeric segments\");\nconst windowSchema = z.strictObject({\n\ttitle: z.string().min(1).optional(),\n\twidth: z.number().int().positive().optional(),\n\theight: z.number().int().positive().optional(),\n\tresizable: z.boolean().optional(),\n\t/** Smallest size the window can be dragged to (logical pixels). */\n\tminWidth: z.number().int().positive().optional(),\n\tminHeight: z.number().int().positive().optional()\n}).optional();\nconst cssColorSchema = z.string().regex(/^#(?:[0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/, \"use a hex color (#rgb, #rgba, #rrggbb or #rrggbbaa)\");\n/** The loading page's colors. */\nconst loadingColorsSchema = z.strictObject({\n\t/** Page background (default #0f1115). */\n\tbackground: cssColorSchema.nullable().optional(),\n\t/** Status text color (default #e6e8eb). */\n\tcolor: cssColorSchema.nullable().optional(),\n\t/** The pulsing status dot (default #4ade80). */\n\taccent: cssColorSchema.nullable().optional()\n});\n/** The loading page's look, so the window opens in the app's own colors\n* instead of the default dark page. Every field is optional, and `null`\n* means the default (the scaffold lists the fields that way). */\nconst loadingSchema = loadingColorsSchema.extend({\n\t/** Status line under the art (default \"Starting <productName>…\"). */\n\tmessage: z.string().min(1).nullable().optional(),\n\t/** Colors for `prefers-color-scheme: dark`; without it the page keeps\n\t* the light colors in both schemes. */\n\tdark: loadingColorsSchema.nullable().optional(),\n\t/** Deprecated: a decoration pinned to the bottom-right corner, relative\n\t* to app.json, with `artDark` its dark-scheme counterpart. Superseded by\n\t* the top-level `background`, which ignores these when set. */\n\tart: z.string().min(1).nullable().optional(),\n\tartDark: z.string().min(1).nullable().optional()\n}).nullable().optional();\nconst imageRefSchema = z.string().min(1);\nconst schemedImageSchema = z.union([imageRefSchema, z.strictObject({\n\tlight: imageRefSchema,\n\tdark: imageRefSchema.nullable().optional()\n})]);\nconst lengthSchema = z.union([z.number(), z.string().min(1)]).nullable().optional();\nconst edgesSchema = z.strictObject({\n\ttop: lengthSchema,\n\tright: lengthSchema,\n\tbottom: lengthSchema,\n\tleft: lengthSchema\n}).nullable().optional();\nconst backgroundLayerSchema = z.strictObject({\n\tsrc: schemedImageSchema,\n\tposition: edgesSchema,\n\twidth: lengthSchema,\n\theight: lengthSchema,\n\tminWidth: lengthSchema,\n\tminHeight: lengthSchema,\n\tmaxWidth: lengthSchema,\n\tmaxHeight: lengthSchema,\n\topacity: z.number().min(0).max(1).nullable().optional(),\n\tfade: edgesSchema\n});\nconst backgroundSchema = z.union([imageRefSchema, z.strictObject({\n\tcolor: z.union([z.string().min(1), z.strictObject({\n\t\tlight: z.string().min(1),\n\t\tdark: z.string().min(1).nullable().optional()\n\t})]).nullable().optional(),\n\tlayers: z.array(backgroundLayerSchema)\n})]).superRefine((background, ctx) => {\n\tfor (const problem of validateBackground(background, \"background\")) ctx.addIssue({\n\t\tcode: \"custom\",\n\t\tmessage: problem\n\t});\n}).nullable().optional();\nconst fileAssociationSchema = z.strictObject({\n\t/** Extensions WITHOUT the leading dot (\"phd\", not \".phd\"). */\n\text: z.array(z.string().min(1).regex(/^[^.]/, \"drop the leading dot\")).min(1),\n\tname: z.string().min(1),\n\tdescription: z.string().optional(),\n\tmimeType: z.string().optional()\n});\n/** Where the generated Cargo.toml resolves `ph-desktop-shell` from. Default\n* (omitted) = the published crates.io version. */\nconst shellSourceSchema = z.strictObject({\n\t/** Local checkout for shell development (the lab points here). */\n\tpath: z.string().min(1).optional(),\n\t/** Git source, pinned to a tag/rev, for pre-publication consumption. */\n\tgit: z.string().min(1).optional(),\n\ttag: z.string().min(1).optional(),\n\trev: z.string().min(1).optional(),\n\t/** crates.io version requirement (default DEFAULT_SHELL_CRATE_VERSION). */\n\tversion: z.string().min(1).optional()\n}).refine((s) => !(s.path && s.git), { message: \"shell.source: set path OR git, not both\" }).optional();\nconst appJsonSchema = z.strictObject({\n\tidentifier: identifierSchema,\n\tproductName: z.string().min(1),\n\t/** Single source image (square PNG, 1024×1024 recommended); the icon set\n\t* for every platform is generated from it via `tauri icon`. */\n\ticon: z.string().min(1),\n\t/** The loading page's background: images positioned and sized over a\n\t* page colour (`{ color, layers }`), or one image pinned bottom-right.\n\t* The status line stays centred above them. `ph generate desktop-shell`\n\t* copies Connect's `connect.branding.homeBackground` here. null or\n\t* omitted: the app icon (or `splash`) above the status line. */\n\tbackground: backgroundSchema,\n\t/** Deprecated in favour of `background`: a wide splash image shown above\n\t* the status line instead of the square icon. Relative to this file. */\n\tsplash: z.string().min(1).nullable().optional(),\n\t/** Deprecated with `splash`: its `prefers-color-scheme: dark` variant. */\n\tsplashDark: z.string().min(1).nullable().optional(),\n\tloading: loadingSchema,\n\twindow: windowSchema,\n\tfileAssociations: z.array(fileAssociationSchema).optional(),\n\tshell: shellSourceSchema\n});\n/** Default crates.io version requirement for the shell crate (D7.b: the flip\n* to crates.io default once published — the crate is live). */\nconst DEFAULT_SHELL_CRATE_VERSION = \"0.1\";\nconst APP_JSON_FILE = \"app.json\";\n/** Read + validate hosts/<host>/app.json. Throws with the field named on a\n* bad value, and a clear message when the file is absent. */\nfunction loadAppJson(hostDir) {\n\tconst file = path.join(hostDir, APP_JSON_FILE);\n\tif (!fs.existsSync(file)) throw new Error(`No ${APP_JSON_FILE} in ${hostDir} — run \\`ph generate desktop-shell\\` to scaffold the builder identity, or set runner.shell.project to a prebuilt shell.`);\n\tlet raw;\n\ttry {\n\t\traw = JSON.parse(fs.readFileSync(file, \"utf8\"));\n\t} catch (error) {\n\t\tthrow new Error(`${file}: not valid JSON — ${String(error)}`, { cause: error });\n\t}\n\tconst result = appJsonSchema.safeParse(raw);\n\tif (!result.success) {\n\t\tconst issues = result.error.issues.map((i) => ` ${i.path.join(\".\") || \"(root)\"}: ${i.message}`).join(\"\\n\");\n\t\tthrow new Error(`${file} is invalid:\\n${issues}`);\n\t}\n\treturn result.data;\n}\n/** A filesystem/crate-safe slug of the product name — the generated binary\n* and Cargo package name. Falls back to the identifier's last segment. */\nfunction appSlug(app) {\n\tconst fromName = app.productName.toLowerCase().replace(/[^a-z0-9]+/g, \"-\").replace(/^-+|-+$/g, \"\");\n\tif (fromName) return fromName;\n\treturn (app.identifier.split(\".\").pop() ?? \"app\").toLowerCase().replace(/[^a-z0-9]+/g, \"-\");\n}\n//#endregion\n//#region src/bundle-stack.ts\n/**\n* P6.3 — stage the shippable STACK into the shell project: everything the\n* installed app needs to run `ph run desktop` with no environment at all\n* (D6.c). The shell's resources map `../dist-stack` → `stack`, and its\n* uniform-runners mode falls back to `resources/stack` when the env pair is\n* absent. Layout:\n*\n* dist-stack/\n* hosts/ the project's host files\n* agents/ when present\n* powerhouse.config.json\n* package.json minimal, names the project\n* dist/ the package's build (ph build)\n* .ph/connect-build/dist/ the BUILT Connect (ph run connect build)\n* node_modules/ vendored @powerhousedao/ph-cli (hoisted,\n* real files — computed-specifier imports and\n* PGlite wasm forbid bundling)\n*/\nconst CONNECT_BUILD_DIR = path.join(\".ph\", \"connect-build\", \"dist\");\nfunction copyIfExists(from, to) {\n\tif (!fs.existsSync(from)) return false;\n\tfs.cpSync(from, to, { recursive: true });\n\treturn true;\n}\n/**\n* Recursively copy `src` → `dest`, skipping any path in `excludes`. Unlike\n* fs.cpSync this tolerates `dest` living INSIDE `src`: in mode 1 the generated\n* shell (and its `dist-stack`) sits under `hosts/<desktop>/`, so staging the\n* project's `hosts/` straight into the shell would be a copy-into-self that\n* cpSync rejects outright. Excluding the shell subtree both avoids that and\n* keeps the crate + node sidecar out of the shippable stack.\n*/\nfunction copyDirFiltered(src, dest, excludes) {\n\tif (!fs.existsSync(src)) return false;\n\tconst skip = new Set(excludes.map((e) => path.resolve(e)));\n\tconst walk = (s, d) => {\n\t\tif (skip.has(path.resolve(s))) return;\n\t\tif (fs.statSync(s).isDirectory()) {\n\t\t\tfs.mkdirSync(d, { recursive: true });\n\t\t\tfor (const entry of fs.readdirSync(s)) walk(path.join(s, entry), path.join(d, entry));\n\t\t} else fs.copyFileSync(s, d);\n\t};\n\twalk(src, dest);\n\treturn true;\n}\n/** The npm spec of each tarball in `dir`, by the package name inside it. */\nfunction readLocalPackages(dir) {\n\tconst root = path.resolve(dir);\n\tconst tarballs = fs.existsSync(root) ? fs.readdirSync(root).filter((f) => f.endsWith(\".tgz\")) : [];\n\tif (tarballs.length === 0) throw new Error(`bundle-stack: no package tarballs (*.tgz) in ${root}`);\n\tconst specs = {};\n\tfor (const file of tarballs.sort()) {\n\t\tconst tarball = path.join(root, file);\n\t\tconst manifest = spawnSync(\"tar\", [\n\t\t\t\"-xzOf\",\n\t\t\ttarball,\n\t\t\t\"package/package.json\"\n\t\t], {\n\t\t\tencoding: \"utf8\",\n\t\t\twindowsHide: true\n\t\t});\n\t\tif (manifest.status !== 0) throw new Error(`bundle-stack: ${tarball} has no package/package.json: ${manifest.stderr}`);\n\t\tconst { name } = JSON.parse(manifest.stdout);\n\t\tif (specs[name]) throw new Error(`bundle-stack: two tarballs for ${name} in ${root} (a stale pack?): ${specs[name].slice(5)} and ${tarball}`);\n\t\tspecs[name] = `file:${tarball}`;\n\t}\n\treturn specs;\n}\n/**\n* The staged stack's package.json. With local packages, every one is an\n* override (so transitive dependents get it too) and the direct dependencies\n* name the same spec: npm rejects an override that contradicts one.\n*/\nfunction stackManifest(options) {\n\tconst local = options.local ?? {};\n\tconst spec = (pkg, fallback) => local[pkg] ?? fallback;\n\treturn {\n\t\tname: options.name,\n\t\tprivate: true,\n\t\ttype: \"module\",\n\t\tdependencies: {\n\t\t\t\"@powerhousedao/ph-cli\": spec(\"@powerhousedao/ph-cli\", options.phCliSpec ?? options.version),\n\t\t\t\"@powerhousedao/host-core\": spec(\"@powerhousedao/host-core\", options.version)\n\t\t},\n\t\t...Object.keys(local).length > 0 ? { overrides: local } : {}\n\t};\n}\n/** A vendored tree installed from local tarballs: the same version numbers\n* as the registry's, so npm would take either for the other. */\nfunction vendoredFromLocal(stackDir) {\n\tconst lock = path.join(stackDir, \"package-lock.json\");\n\treturn fs.existsSync(lock) && fs.readFileSync(lock, \"utf8\").includes(\"\\\"resolved\\\": \\\"file:\");\n}\nfunction bundleStack(options) {\n\tconst log = options.logger ?? console.log;\n\tconst stackDir = path.join(options.shellProjectDir, \"dist-stack\");\n\tfor (const entry of [\n\t\t\"hosts\",\n\t\t\"agents\",\n\t\t\"dist\",\n\t\t\".ph\",\n\t\t\"powerhouse.config.json\",\n\t\t\"package.json\"\n\t]) fs.rmSync(path.join(stackDir, entry), {\n\t\trecursive: true,\n\t\tforce: true\n\t});\n\tfs.mkdirSync(stackDir, { recursive: true });\n\tlog(` hosts/ ${copyDirFiltered(path.join(options.projectRoot, \"hosts\"), path.join(stackDir, \"hosts\"), options.excludeDirs ?? []) ? \"staged\" : \"absent — skipped\"}`);\n\tfor (const dir of [\n\t\t\"agents\",\n\t\t\"dist\",\n\t\tCONNECT_BUILD_DIR\n\t]) log(` ${dir}/ ${copyIfExists(path.join(options.projectRoot, dir), path.join(stackDir, dir)) ? \"staged\" : \"absent — skipped\"}`);\n\tconst stagedDesktopHost = path.join(stackDir, \"hosts\", \"desktop\", \"host.js\");\n\tif (fs.existsSync(stagedDesktopHost)) {\n\t\tconst source = fs.readFileSync(stagedDesktopHost, \"utf8\");\n\t\tif (source.includes(\"@powerhousedao/desktop/runner\")) {\n\t\t\tfs.writeFileSync(stagedDesktopHost, \"// STAGED COPY (bundle-stack): runner.module rewritten to the generic\\n// compound — the packaged shell is the window; there is no nested shell.\\n\" + source.replace(/@powerhousedao\\/desktop\\/runner/g, \"@powerhousedao/host-core/runners/compound\"));\n\t\t\tlog(\" hosts/desktop/host.js: runner rewritten to the generic compound (staged copy)\");\n\t\t}\n\t}\n\tcopyIfExists(path.join(options.projectRoot, \"powerhouse.config.json\"), path.join(stackDir, \"powerhouse.config.json\"));\n\tif (typeof options.connectPort === \"number\") {\n\t\tfs.writeFileSync(path.join(stackDir, \"shell.json\"), `${JSON.stringify({ connectPort: options.connectPort }, null, 2)}\\n`);\n\t\tlog(` shell.json: connectPort ${options.connectPort}`);\n\t}\n\tconst sourcePkg = JSON.parse(fs.readFileSync(path.join(options.projectRoot, \"package.json\"), \"utf8\"));\n\tconst version = options.phCliVersion ?? \"dev\";\n\tconst name = sourcePkg.name ?? \"powerhouse-desktop-stack\";\n\tconst vendor = options.vendor !== false;\n\tconst local = options.localPackagesDir ? readLocalPackages(options.localPackagesDir) : void 0;\n\tif (vendor && (local || vendoredFromLocal(stackDir))) for (const entry of [\"node_modules\", \"package-lock.json\"]) fs.rmSync(path.join(stackDir, entry), {\n\t\trecursive: true,\n\t\tforce: true\n\t});\n\tfs.writeFileSync(path.join(stackDir, \"package.json\"), `${JSON.stringify(local ? stackManifest({\n\t\tname,\n\t\tversion,\n\t\tphCliSpec: options.phCliSpec,\n\t\tlocal\n\t}) : {\n\t\tname,\n\t\tprivate: true,\n\t\ttype: \"module\",\n\t\tdependencies: { \"@powerhousedao/ph-cli\": version }\n\t}, null, 2)}\\n`);\n\tlet vendored = false;\n\tif (vendor) {\n\t\tconst specs = local ? \"\" : `\"${options.phCliSpec ?? `@powerhousedao/ph-cli@${version}`}\" \"@powerhousedao/host-core@${version}\"`;\n\t\tlog(local ? ` vendoring ${Object.keys(local).length} local packages from ${options.localPackagesDir} (hoisted, real files)…` : ` vendoring ${specs} (hoisted, real files)…`);\n\t\tconst result = spawnSync(`npm install ${specs} --install-strategy=hoisted --omit=dev --no-audit --no-fund`, {\n\t\t\tcwd: stackDir,\n\t\t\tstdio: \"pipe\",\n\t\t\tshell: true,\n\t\t\twindowsHide: true\n\t\t});\n\t\tif (result.status !== 0) throw new Error(`bundle-stack: vendoring failed (${result.status}):\\n${result.stderr.toString().slice(-800)}`);\n\t\tvendored = true;\n\t} else log(\" vendoring skipped (vendor: false) — existing tree left in place\");\n\treturn {\n\t\tstackDir,\n\t\tvendored\n\t};\n}\n//#endregion\n//#region src/shell-project.ts\n/**\n* P7.3 — project `hosts/desktop/app.json` into a generated `tauri-shell/`:\n* a STANDALONE tauri crate that depends on the published `ph-desktop-shell`\n* library, carries the builder's identity, and is built/run by the desktop\n* runner's dev/build verbs. The builder never writes Rust.\n*\n* Everything here mirrors the known-good reference app\n* (ph-desktop-shell/apps/powerhouse-desktop): the tauri plumbing (main.rs,\n* build.rs, capabilities, the loading page, externalBin + icon mechanics) is\n* copied verbatim; only identity/port fields are projected from app.json. The\n* projection is idempotent and stale-detected — a file is rewritten only when\n* its content changes, so Cargo.lock, the generated icon set, and tauri-build\n* output are never disturbed by a regen with an unchanged app.json.\n*/\nconst SHELL_DIR = \"tauri-shell\";\n/** The icon source the runner feeds to `tauri icon` (copied from app.icon). */\nconst ICON_SOURCE = \"app-icon.png\";\n/** `ph-desktop-shell` dependency line for the generated Cargo.toml, from\n* app.json's shell.source (path > git > crates.io version). */\nfunction shellDependency(source) {\n\tif (source?.path) {\n\t\tconst p = source.path.replace(/\\\\/g, \"/\");\n\t\treturn `ph-desktop-shell = { path = ${JSON.stringify(p)} }`;\n\t}\n\tif (source?.git) {\n\t\tconst parts = [`git = ${JSON.stringify(source.git)}`];\n\t\tif (source.tag) parts.push(`tag = ${JSON.stringify(source.tag)}`);\n\t\tif (source.rev) parts.push(`rev = ${JSON.stringify(source.rev)}`);\n\t\treturn `ph-desktop-shell = { ${parts.join(\", \")} }`;\n\t}\n\tconst version = source?.version ?? \"0.1\";\n\treturn `ph-desktop-shell = ${JSON.stringify(version)}`;\n}\nfunction cargoToml(app, binName) {\n\treturn `# GENERATED from ../app.json by @powerhousedao/desktop — do not edit by\n# hand; edit app.json and re-run \\`ph run desktop dev|build\\`. Cargo.lock is\n# preserved across regens.\n[package]\nname = ${JSON.stringify(binName)}\nversion = \"0.1.0\"\nedition = \"2021\"\n\n[build-dependencies]\ntauri-build = { version = \"2\", features = [] }\n\n[dependencies]\ntauri = { version = \"2\", features = [\"tray-icon\", \"devtools\"] }\n# Plugins must be DIRECT deps of the app crate: tauri-build only sees\n# permission manifests (shell:allow-spawn etc.) from direct dependencies.\ntauri-plugin-shell = \"2\"\ntauri-plugin-single-instance = \"2\"\n${shellDependency(app.shell)}\n\n[[bin]]\nname = ${JSON.stringify(binName)}\npath = \"src/main.rs\"\n\n[profile.release]\ncodegen-units = 1\nlto = true\n`;\n}\nconst MAIN_RS = `// GENERATED — identity bakes from tauri.conf.json via generate_context!;\n// behavior is the shared ph-desktop-shell library. Edit ../app.json, not this.\n#![cfg_attr(not(debug_assertions), windows_subsystem = \"windows\")]\n\nfn main() {\n ph_desktop_shell::run(tauri::generate_context!(), Default::default());\n}\n`;\nconst BUILD_RS = `// GENERATED — mirrors the reference shell. Connect is served over\n// http://127.0.0.1 (a remote origin to Tauri), so the launch-queue commands\n// need an explicit ACL; declaring the command manifest here generates the\n// allow-<command> permissions that capabilities/*.json grant.\nfn main() {\n // The icon set is a COMPILE-TIME input (the Windows resource icon here,\n // and the tray/window icon tauri::generate_context! embeds), but\n // tauri-build registers no rerun trigger for it: without this line a\n // regenerated icon set leaves the old icon compiled into the binary.\n println!(\"cargo:rerun-if-changed=icons\");\n tauri_build::try_build(tauri_build::Attributes::new().app_manifest(\n tauri_build::AppManifest::new().commands(&[\n \"take_launch_files\",\n \"read_launch_file\",\n \"log_from_webview\",\n ]),\n ))\n .expect(\"failed to run tauri-build\");\n}\n`;\n/** The loading page's logo: app.json's icon SOURCE (1024² recommended), copied\n* beside ui/index.html — not one of the downsampled `tauri icon` outputs, so\n* it stays sharp on HiDPI screens. Generated, like the rest of ui/. */\nconst LOADING_LOGO = \"logo.png\";\n/** The loading page's splash (app.json `splash`), copied beside it; shown\n* instead of the square logo when set. Generated, like the rest of ui/. */\nconst LOADING_SPLASH = \"splash.png\";\n/** Dark-scheme splash (app.json `splashDark`), beside the light one. */\nconst LOADING_SPLASH_DARK = \"splash-dark.png\";\n/** CSS size of the logo; the 1024² source keeps it crisp up to 8x DPR. */\nconst LOGO_CSS_PX = 128;\nfunction loadingHtml(app, art) {\n\tconst escape = (text) => text.replace(/[<&]/g, (c) => c === \"<\" ? \"<\" : \"&\");\n\tconst name = escape(app.productName);\n\tconst loading = app.loading;\n\tconst message = loading?.message ? escape(loading.message) : `Starting ${name}…`;\n\tconst pageColor = art.background?.color ?? null;\n\tconst background = pageColor?.light ?? loading?.background ?? \"#0f1115\";\n\tconst color = loading?.color ?? \"#e6e8eb\";\n\tconst accent = loading?.accent ?? \"#4ade80\";\n\tconst dark = loading?.dark;\n\tconst darkBackground = pageColor?.dark ?? dark?.background;\n\tconst darkVars = dark || darkBackground ? `\n @media (prefers-color-scheme: dark) {\n :root {\n --bg: ${darkBackground ?? background};\n --fg: ${dark?.color ?? color};\n --accent: ${dark?.accent ?? accent};\n }\n }` : \"\";\n\tconst attr = (text) => text.replace(/&/g, \"&\").replace(/\"/g, \""\");\n\tconst layersTag = art.background && art.background.layers.length > 0 ? `<div class=\"layers\" aria-hidden=\"true\">\n ${art.background.layers.map((layer) => layer.dark ? `<picture>\n <source srcset=\"${attr(layer.dark)}\" media=\"(prefers-color-scheme: dark)\" />\n <img src=\"${attr(layer.light)}\" alt=\"\" style=\"${attr(layer.style)}\" />\n </picture>` : `<img src=\"${attr(layer.light)}\" alt=\"\" style=\"${attr(layer.style)}\" />`).join(\"\\n \")}\n </div>\n ` : \"\";\n\tconst picture = (cls, file, darkFile, attrs = \"\") => darkFile ? `<picture>\n <source srcset=\"./${darkFile}\" media=\"(prefers-color-scheme: dark)\" />\n <img class=\"${cls}\" src=\"./${file}\" alt=\"\"${attrs} />\n </picture>\n ` : `<img class=\"${cls}\" src=\"./${file}\" alt=\"\"${attrs} />\n `;\n\tconst main = art.main;\n\tconst logoTag = main?.kind === \"splash\" ? picture(\"splash\", main.file, main.dark) : main ? picture(\"logo\", main.file, main.dark, ` width=\"${LOGO_CSS_PX}\" height=\"${LOGO_CSS_PX}\"`) : \"\";\n\tconst cornerTag = art.corner ? `<div class=\"corner\" aria-hidden=\"true\">${picture(\"art\", art.corner.file, art.corner.dark)}</div>\n ` : \"\";\n\treturn `<!doctype html>\n<html lang=\"en\">\n <head>\n <meta charset=\"utf-8\" />\n <title>${name}</title>\n <style>\n :root {\n color-scheme: light dark;\n --bg: ${background}; --fg: ${color}; --accent: ${accent};\n }${darkVars}\n body {\n margin: 0; height: 100vh; overflow: hidden;\n display: flex; align-items: center; justify-content: center;\n font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, \"Segoe UI\", sans-serif;\n background: var(--bg); color: var(--fg);\n }\n .box {\n position: relative; z-index: 1;\n text-align: center;\n display: flex; flex-direction: column; align-items: center; gap: 20px;\n }\n .logo {\n width: ${LOGO_CSS_PX}px; height: ${LOGO_CSS_PX}px;\n object-fit: contain; display: block;\n }\n .splash {\n width: min(720px, 80vw); max-height: 65vh;\n object-fit: contain; display: block;\n }\n .corner {\n position: fixed; right: 0; bottom: 0; z-index: 0;\n width: clamp(220px, 30vw, 520px); line-height: 0; pointer-events: none;\n }\n .layers { position: fixed; inset: 0; z-index: 0; }\n .art { width: 100%; height: auto; display: block; }\n .dot {\n width: 10px; height: 10px; border-radius: 50%;\n background: var(--accent); display: inline-block; margin-right: 8px;\n animation: pulse 1.2s ease-in-out infinite;\n }\n @keyframes pulse { 0%,100% { opacity: .35 } 50% { opacity: 1 } }\n @media (prefers-reduced-motion: reduce) { .dot { animation: none; } }\n </style>\n </head>\n <body>\n <div class=\"box\">\n ${logoTag}<div><span class=\"dot\"></span>${message}</div>\n </div>\n ${layersTag}${cornerTag}</body>\n</html>\n`;\n}\nfunction tauriConf(input) {\n\tconst { app } = input;\n\tconst win = app.window ?? {};\n\tconst fileAssociations = app.fileAssociations && app.fileAssociations.length > 0 ? app.fileAssociations.map((fa) => ({\n\t\text: fa.ext,\n\t\tname: fa.name,\n\t\t...fa.description ? { description: fa.description } : {},\n\t\t...fa.mimeType ? { mimeType: fa.mimeType } : {}\n\t})) : void 0;\n\tconst conf = {\n\t\t$schema: \"https://schema.tauri.app/config/2\",\n\t\tproductName: app.productName,\n\t\tversion: \"0.1.0\",\n\t\tidentifier: app.identifier,\n\t\tbuild: { frontendDist: \"./ui\" },\n\t\tapp: {\n\t\t\twindows: [{\n\t\t\t\ttitle: win.title ?? app.productName,\n\t\t\t\twidth: win.width ?? 1440,\n\t\t\t\theight: win.height ?? 900,\n\t\t\t\tresizable: win.resizable ?? true,\n\t\t\t\t...win.minWidth ? { minWidth: win.minWidth } : {},\n\t\t\t\t...win.minHeight ? { minHeight: win.minHeight } : {},\n\t\t\t\tvisible: true,\n\t\t\t\tdragDropEnabled: false,\n\t\t\t\tcreate: false\n\t\t\t}],\n\t\t\tsecurity: { csp: null }\n\t\t},\n\t\tbundle: {\n\t\t\tactive: true,\n\t\t\ttargets: [\n\t\t\t\t\"nsis\",\n\t\t\t\t\"app\",\n\t\t\t\t\"dmg\"\n\t\t\t],\n\t\t\ticon: [\n\t\t\t\t\"icons/32x32.png\",\n\t\t\t\t\"icons/128x128.png\",\n\t\t\t\t\"icons/128x128@2x.png\",\n\t\t\t\t\"icons/icon.icns\",\n\t\t\t\t\"icons/icon.ico\"\n\t\t\t],\n\t\t\t...fileAssociations ? { fileAssociations } : {},\n\t\t\texternalBin: [\"binaries/node\"],\n\t\t\tresources: { \"./dist-stack\": \"stack\" }\n\t\t}\n\t};\n\treturn JSON.stringify(conf, null, 2) + \"\\n\";\n}\nfunction defaultCapability() {\n\treturn JSON.stringify({\n\t\t$schema: \"../gen/schemas/desktop-schema.json\",\n\t\tidentifier: \"default\",\n\t\tdescription: \"Lets the shell spawn the bundled node sidecar.\",\n\t\twindows: [\"main\"],\n\t\tpermissions: [\n\t\t\t\"core:default\",\n\t\t\t\"allow-take-launch-files\",\n\t\t\t\"allow-read-launch-file\",\n\t\t\t\"allow-log-from-webview\",\n\t\t\t{\n\t\t\t\tidentifier: \"shell:allow-spawn\",\n\t\t\t\tallow: [{\n\t\t\t\t\tname: \"binaries/node\",\n\t\t\t\t\tsidecar: true,\n\t\t\t\t\targs: true\n\t\t\t\t}]\n\t\t\t},\n\t\t\t{\n\t\t\t\tidentifier: \"shell:allow-execute\",\n\t\t\t\tallow: [{\n\t\t\t\t\tname: \"binaries/node\",\n\t\t\t\t\tsidecar: true,\n\t\t\t\t\targs: true\n\t\t\t\t}]\n\t\t\t}\n\t\t]\n\t}, null, 2) + \"\\n\";\n}\nfunction connectCapability(connectPort) {\n\tconst origin = `http://127.0.0.1:${connectPort}`;\n\treturn JSON.stringify({\n\t\t$schema: \"../gen/schemas/desktop-schema.json\",\n\t\tidentifier: \"connect\",\n\t\tdescription: \"Connect is served over http://127.0.0.1 (a remote origin to Tauri); without this the launch-queue commands are rejected before they run.\",\n\t\twindows: [\"main\"],\n\t\tremote: { urls: [origin, `${origin}/*`] },\n\t\tpermissions: [\n\t\t\t\"allow-take-launch-files\",\n\t\t\t\"allow-read-launch-file\",\n\t\t\t\"allow-log-from-webview\"\n\t\t]\n\t}, null, 2) + \"\\n\";\n}\nconst GITIGNORE = `# Generated tauri shell — only Cargo.lock and app-icon.png are tracked.\n/target\n/gen\n/icons\n/ui/logo.png\n/ui/splash.png\n/ui/splash-dark.png\n/ui/art.*\n/ui/art-dark.*\n/ui/bg-*\n/dist-stack\n/binaries\n`;\nconst DIST_STACK_README = `This directory is replaced at \\`ph run desktop build\\` with the shippable\nstack (hosts + powerhouse.config.json + built Connect + vendored ph-cli). It\nis bundled as the app's \\`stack\\` resource so the installed app runs with no\nenvironment. Kept as a placeholder so tauri's resource glob resolves in dev.\n`;\n/** Write a file only when its content differs; returns whether it changed. */\nfunction writeIfChanged(file, content) {\n\tif (fs.existsSync(file) && fs.readFileSync(file, \"utf8\") === content) return false;\n\tfs.mkdirSync(path.dirname(file), { recursive: true });\n\tfs.writeFileSync(file, content);\n\treturn true;\n}\n/**\n* Materialize/refresh `<hostDir>/tauri-shell/` from app.json. Idempotent:\n* unchanged app.json rewrites nothing. Does NOT run `tauri icon` or fetch the\n* node binary — those are toolchain steps the runner performs at dev/build.\n*/\nfunction projectShell(input) {\n\tconst { hostDir, app, connectPort } = input;\n\tconst binName = appSlug(app);\n\tconst shellDir = path.join(hostDir, SHELL_DIR);\n\tconst iconSrc = path.resolve(hostDir, app.icon);\n\tconst iconBytes = fs.existsSync(iconSrc) ? fs.readFileSync(iconSrc) : null;\n\tconst readRel = (rel) => {\n\t\tif (!rel) return null;\n\t\tconst abs = path.resolve(hostDir, rel);\n\t\treturn fs.existsSync(abs) ? fs.readFileSync(abs) : null;\n\t};\n\tconst splashBytes = readRel(app.splash);\n\tconst splashDarkBytes = readRel(app.splashDark);\n\tconst artBytes = readRel(app.loading?.art);\n\tconst artDarkBytes = readRel(app.loading?.artDark);\n\tconst artExt = (rel) => rel ? path.extname(rel).toLowerCase() || \".png\" : \".png\";\n\tconst artFile = `art${artExt(app.loading?.art)}`;\n\tconst artDarkFile = `art-dark${artExt(app.loading?.artDark)}`;\n\tconst background = normalizeBackground(app.background);\n\tconst staged = [];\n\tconst stage = (ref, stem) => {\n\t\tif (isPassthroughImageRef(ref)) return ref;\n\t\tconst abs = path.resolve(hostDir, ref);\n\t\tif (!fs.existsSync(abs)) return void 0;\n\t\tconst file = `${stem}${artExt(ref)}`;\n\t\tstaged.push([path.join(shellDir, \"ui\", file), fs.readFileSync(abs)]);\n\t\treturn `./${file}`;\n\t};\n\tconst layers = (background?.layers ?? []).flatMap((layer, index) => {\n\t\tconst variants = imageVariants(layer.src);\n\t\tconst light = stage(variants.light, `bg-${index}`);\n\t\tif (!light) return [];\n\t\tconst dark = variants.dark ? stage(variants.dark, `bg-${index}-dark`) : void 0;\n\t\treturn [{\n\t\t\tlight,\n\t\t\t...dark ? { dark } : {},\n\t\t\tstyle: layerStyleText(layer)\n\t\t}];\n\t});\n\tconst art = {\n\t\tmain: background ? null : splashBytes ? {\n\t\t\tkind: \"splash\",\n\t\t\tfile: LOADING_SPLASH,\n\t\t\t...splashDarkBytes ? { dark: LOADING_SPLASH_DARK } : {}\n\t\t} : iconBytes ? {\n\t\t\tkind: \"logo\",\n\t\t\tfile: LOADING_LOGO\n\t\t} : null,\n\t\tcorner: !background && artBytes ? {\n\t\t\tfile: artFile,\n\t\t\t...artDarkBytes ? { dark: artDarkFile } : {}\n\t\t} : null,\n\t\tbackground: background ? {\n\t\t\tcolor: colorVariants(background.color),\n\t\t\tlayers\n\t\t} : null\n\t};\n\tconst files = [\n\t\t[\"Cargo.toml\", cargoToml(app, binName)],\n\t\t[\"src/main.rs\", MAIN_RS],\n\t\t[\"build.rs\", BUILD_RS],\n\t\t[\"tauri.conf.json\", tauriConf(input)],\n\t\t[\"ui/index.html\", loadingHtml(app, art)],\n\t\t[\"capabilities/default.json\", defaultCapability()],\n\t\t[\"capabilities/connect.json\", connectCapability(connectPort)],\n\t\t[\".gitignore\", GITIGNORE],\n\t\t[\"dist-stack/README.md\", DIST_STACK_README]\n\t];\n\tlet changed = false;\n\tfor (const [rel, content] of files) if (writeIfChanged(path.join(shellDir, rel), content)) changed = true;\n\tconst copies = [\n\t\t[path.join(shellDir, ICON_SOURCE), iconBytes],\n\t\t[path.join(shellDir, \"ui\", LOADING_LOGO), iconBytes],\n\t\t[path.join(shellDir, \"ui\", LOADING_SPLASH), splashBytes],\n\t\t[path.join(shellDir, \"ui\", LOADING_SPLASH_DARK), splashDarkBytes],\n\t\t[path.join(shellDir, \"ui\", artFile), artBytes],\n\t\t[path.join(shellDir, \"ui\", artDarkFile), artDarkBytes],\n\t\t...staged\n\t];\n\tfor (const [dest, bytes] of copies) {\n\t\tif (!bytes) continue;\n\t\tif (!fs.existsSync(dest) || !fs.readFileSync(dest).equals(bytes)) {\n\t\t\tfs.mkdirSync(path.dirname(dest), { recursive: true });\n\t\t\tfs.writeFileSync(dest, bytes);\n\t\t\tchanged = true;\n\t\t}\n\t}\n\treturn {\n\t\tshellDir,\n\t\tbinName,\n\t\tchanged\n\t};\n}\n//#endregion\n//#region src/shell-toolchain.ts\n/** The Node release triple for a build host — the sidecar filename tauri\n* resolves (`node-<triple>`). Pure, so the mapping is unit-tested. */\nfunction nodeSidecarTarget(platform, arch) {\n\tconst target = {\n\t\t\"win32 x64\": {\n\t\t\ttriple: \"x86_64-pc-windows-msvc\",\n\t\t\tdist: \"win-x64\",\n\t\t\tbin: \"node.exe\",\n\t\t\text: \".exe\"\n\t\t},\n\t\t\"darwin arm64\": {\n\t\t\ttriple: \"aarch64-apple-darwin\",\n\t\t\tdist: \"darwin-arm64\",\n\t\t\tbin: \"bin/node\",\n\t\t\text: \"\"\n\t\t},\n\t\t\"darwin x64\": {\n\t\t\ttriple: \"x86_64-apple-darwin\",\n\t\t\tdist: \"darwin-x64\",\n\t\t\tbin: \"bin/node\",\n\t\t\text: \"\"\n\t\t},\n\t\t\"linux x64\": {\n\t\t\ttriple: \"x86_64-unknown-linux-gnu\",\n\t\t\tdist: \"linux-x64\",\n\t\t\tbin: \"bin/node\",\n\t\t\text: \"\"\n\t\t}\n\t}[`${platform} ${arch}`];\n\tif (!target) throw new Error(`No Node sidecar mapping for ${platform} ${arch} — the desktop shell supports win32/x64, darwin/arm64, darwin/x64, linux/x64.`);\n\treturn target;\n}\n/** Fetch the stock Node the shell ships as its sidecar into `<shellDir>/\n* binaries`, named per target triple. No-op when already present. Ported from\n* the reference repo's fetch-node.mjs (the builder has no such script). */\nfunction fetchNodeSidecar(shellDir, version = process.versions.node, platform = process.platform, arch = process.arch) {\n\tconst target = nodeSidecarTarget(platform, arch);\n\tconst binariesDir = path.join(shellDir, \"binaries\");\n\tfs.mkdirSync(binariesDir, { recursive: true });\n\tconst dest = path.join(binariesDir, `node-${target.triple}${target.ext}`);\n\tif (fs.existsSync(dest)) return dest;\n\tif (platform === \"win32\") {\n\t\tconst url = `https://nodejs.org/dist/v${version}/win-x64/node.exe`;\n\t\texecSync(`curl -fsSL -o \"${dest}\" \"${url}\"`, { stdio: \"inherit\" });\n\t} else {\n\t\tconst name = `node-v${version}-${target.dist}`;\n\t\tconst url = `https://nodejs.org/dist/v${version}/${name}.tar.gz`;\n\t\texecSync(`curl -fsSL \"${url}\" | tar -xz -C \"${binariesDir}\" --strip-components=2 ${name}/${target.bin}`, {\n\t\t\tstdio: \"inherit\",\n\t\t\tshell: \"/bin/sh\"\n\t\t});\n\t\tfs.renameSync(path.join(binariesDir, \"node\"), dest);\n\t\tfs.chmodSync(dest, 493);\n\t}\n\treturn dest;\n}\n/** Default bundle targets for the build host (`cargo tauri build --bundles`).\n* macOS gets app+dmg, Windows nsis, Linux deb+appimage — a host only builds\n* installers it can produce. */\nfunction tauriBundlesForHost(platform = process.platform) {\n\tswitch (platform) {\n\t\tcase \"darwin\": return [\"app\", \"dmg\"];\n\t\tcase \"win32\": return [\"nsis\"];\n\t\tdefault: return [\"deb\", \"appimage\"];\n\t}\n}\n/** Spawn parameters that avoid DEP0190 (args array + shell:true): cargo on\n* Windows needs the shell for PATH/.exe + subcommand resolution — pass ONE\n* string, empty args; everything else runs argv directly (shell:false). The\n* joined tokens here are our own constants/paths, never user input. */\nfunction tauriSpawn(tauri, subcommand) {\n\tconst argv = [...tauri.prefix, ...subcommand];\n\tif (tauri.cmd === \"cargo\" && process.platform === \"win32\") return {\n\t\tcommand: [\"cargo\", ...argv].join(\" \"),\n\t\targs: [],\n\t\tshell: true\n\t};\n\treturn {\n\t\tcommand: tauri.cmd,\n\t\targs: argv,\n\t\tshell: false\n\t};\n}\nfunction probe(cmd, args) {\n\tconst onWin = process.platform === \"win32\";\n\ttry {\n\t\treturn spawnSync(onWin ? [cmd, ...args].join(\" \") : cmd, onWin ? [] : args, {\n\t\t\tstdio: \"ignore\",\n\t\t\tshell: onWin\n\t\t}).status === 0;\n\t} catch {\n\t\treturn false;\n\t}\n}\n/** Is a Rust `cargo` on PATH? (needed to compile the shell crate). */\nfunction hasCargo() {\n\treturn probe(\"cargo\", [\"--version\"]);\n}\n/** Resolve a Tauri CLI: a global `cargo tauri`, else a `@tauri-apps/cli`\n* resolvable from the project. Returns null when neither is available. */\nfunction resolveTauriCommand(projectRoot) {\n\tif (probe(\"cargo\", [\"tauri\", \"--version\"])) return {\n\t\tcmd: \"cargo\",\n\t\tprefix: [\"tauri\"],\n\t\tvia: \"cargo-tauri\"\n\t};\n\ttry {\n\t\tconst pkgJson = createRequire(pathToFileURL(path.join(projectRoot, \"package.json\")).href).resolve(\"@tauri-apps/cli/package.json\");\n\t\tconst pkgDir = path.dirname(pkgJson);\n\t\tconst bin = JSON.parse(fs.readFileSync(pkgJson, \"utf8\")).bin;\n\t\tconst rel = typeof bin === \"string\" ? bin : bin?.tauri;\n\t\tif (rel) return {\n\t\t\tcmd: process.execPath,\n\t\t\tprefix: [path.join(pkgDir, rel)],\n\t\t\tvia: \"node-cli\"\n\t\t};\n\t} catch {}\n\treturn null;\n}\nfunction detectToolchain(projectRoot) {\n\treturn {\n\t\tcargo: hasCargo(),\n\t\ttauri: resolveTauriCommand(projectRoot)\n\t};\n}\n/** Throw a clear, actionable error when the native toolchain is incomplete —\n* the desktop verbs call this before any cargo work so a missing executable\n* is an instruction, not a stack trace. */\nfunction preflightOrThrow(tc, hostName) {\n\tconst missing = [];\n\tif (!tc.cargo) missing.push(\" • Rust/cargo — install from https://rustup.rs (then restart your shell)\");\n\tif (!tc.tauri) missing.push(\" • Tauri CLI — `cargo install tauri-cli --version \\\"^2\\\"` (or add @tauri-apps/cli@^2 to your project's devDependencies)\");\n\tif (missing.length > 0 || !tc.tauri) throw new Error(`hosts/${hostName}: the desktop shell needs a native toolchain that is not installed:\\n${missing.join(\"\\n\")}\\nInstall the above, then re-run \\`ph run ${hostName} dev\\` / \\`ph run ${hostName} build\\`. (The headless stack — \\`ph run ${hostName}\\` — needs none of this.)`);\n\treturn tc.tauri;\n}\n/** `<tauri> icon <source>` — generates the per-platform icon set (icon.ico +\n* icon.icns + pngs) the bundle references and tauri-build requires. */\nfunction runTauriIcon(tauri, shellDir, iconSource) {\n\tconst { command, args, shell } = tauriSpawn(tauri, [\"icon\", iconSource]);\n\tconst r = spawnSync(command, args, {\n\t\tcwd: shellDir,\n\t\tstdio: \"inherit\",\n\t\tshell\n\t});\n\tif (r.status !== 0) throw new Error(`\\`tauri icon ${iconSource}\\` failed (exit ${r.status ?? \"?\"}) in ${shellDir} — check that app.icon is a square PNG.`);\n}\n//#endregion\n//#region src/shell.ts\nfunction resolveShell(projectRoot, options, env) {\n\tconst configured = options?.project ?? env.PH_DESKTOP_SHELL;\n\tif (!configured) throw new Error(\"No desktop shell configured: set runner.shell.project in the host file (path to a ph-win-desktop checkout) or the PH_DESKTOP_SHELL environment variable. `ph run desktop` (headless stack) needs neither.\");\n\tconst projectDir = path.resolve(projectRoot, configured);\n\tif (!fs.existsSync(path.join(projectDir, \"src-tauri\"))) throw new Error(`Desktop shell not found at ${projectDir} (no src-tauri/) — check runner.shell.project / PH_DESKTOP_SHELL.`);\n\treturn {\n\t\tprojectDir,\n\t\texe: [\n\t\t\tpath.join(projectDir, \"src-tauri\", \"target\", \"debug\", \"ph-win.exe\"),\n\t\t\tpath.join(projectDir, \"src-tauri\", \"target\", \"release\", \"ph-win.exe\"),\n\t\t\tpath.join(projectDir, \"src-tauri\", \"target\", \"debug\", \"ph-win\"),\n\t\t\tpath.join(projectDir, \"src-tauri\", \"target\", \"release\", \"ph-win\")\n\t\t].find((c) => fs.existsSync(c))\n\t};\n}\n/** Resolve the project's ph-cli entry from ITS dependency tree — the same\n* resolution `ph run` itself uses. */\nfunction resolvePhCliEntry(projectRoot) {\n\tconst pkgPath = createRequire(pathToFileURL(path.join(projectRoot, \"package.json\")).href).resolve(\"@powerhousedao/ph-cli/package.json\");\n\treturn path.join(path.dirname(pkgPath), \"dist\", \"cli.mjs\");\n}\n/** The env trio (plus flag and userData) the shell's uniform-runners mode\n* reads — wired by the RUNNER so nobody exports variables by hand. */\nfunction shellEnv(projectRoot, connectPort, env) {\n\treturn {\n\t\tFEATURE_UNIFORM_RUNNERS_ENABLED: \"1\",\n\t\tPH_RUN_PROJECT: projectRoot,\n\t\tPH_RUN_CLI: resolvePhCliEntry(projectRoot),\n\t\tPH_WIN_CONNECT_PORT: String(connectPort),\n\t\t...env.PH_USER_DATA_DIR ? { PH_USER_DATA_DIR: env.PH_USER_DATA_DIR } : {}\n\t};\n}\n/** Project host shell options onto a tauri `--config` merge patch (D6.d) —\n* the host file stays the single source for app identity on tauri-cli\n* invocations; a built exe has these baked. */\nfunction tauriConfigPatch(options) {\n\tif (!options) return void 0;\n\tconst patch = {};\n\tif (options.window) patch.app = { windows: [{\n\t\t...options.window.title ? { title: options.window.title } : {},\n\t\t...options.window.width ? { width: options.window.width } : {},\n\t\t...options.window.height ? { height: options.window.height } : {}\n\t}] };\n\tif (options.fileAssociations?.length) patch.bundle = { fileAssociations: [{\n\t\text: options.fileAssociations.map((e) => e.replace(/^\\./, \"\")),\n\t\tname: \"Powerhouse Document\"\n\t}] };\n\treturn Object.keys(patch).length > 0 ? patch : void 0;\n}\nfunction launchShell(shell, envVars, options) {\n\tif (shell.exe) return spawn(shell.exe, [], {\n\t\tcwd: shell.projectDir,\n\t\tenv: {\n\t\t\t...process.env,\n\t\t\t...envVars\n\t\t},\n\t\tstdio: \"inherit\",\n\t\twindowsHide: true\n\t});\n\tconst patch = tauriConfigPatch(options);\n\tconst args = [\"tauri\", \"dev\"];\n\tif (patch) args.push(\"--config\", JSON.stringify(patch));\n\treturn spawn(\"pnpm\", args, {\n\t\tcwd: shell.projectDir,\n\t\tenv: {\n\t\t\t...process.env,\n\t\t\t...envVars\n\t\t},\n\t\tstdio: \"inherit\",\n\t\tshell: true,\n\t\twindowsHide: true\n\t});\n}\n//#endregion\nexport { loadAppJson as S, bundleStack as _, tauriConfigPatch as a, appJsonSchema as b, nodeSidecarTarget as c, runTauriIcon as d, tauriBundlesForHost as f, projectShell as g, SHELL_DIR as h, shellEnv as i, preflightOrThrow as l, ICON_SOURCE as m, resolvePhCliEntry as n, detectToolchain as o, tauriSpawn as p, resolveShell as r, fetchNodeSidecar as s, launchShell as t, resolveTauriCommand as u, APP_JSON_FILE as v, appSlug as x, DEFAULT_SHELL_CRATE_VERSION as y };\n\n//# sourceMappingURL=shell-C6KfHzBa.mjs.map","import { S as loadAppJson, _ as bundleStack, a as tauriConfigPatch, b as appJsonSchema, c as nodeSidecarTarget, d as runTauriIcon, f as tauriBundlesForHost, g as projectShell, h as SHELL_DIR, i as shellEnv, l as preflightOrThrow, m as ICON_SOURCE, n as resolvePhCliEntry, o as detectToolchain, r as resolveShell, s as fetchNodeSidecar, t as launchShell, u as resolveTauriCommand, v as APP_JSON_FILE, x as appSlug, y as DEFAULT_SHELL_CRATE_VERSION } from \"./shell-C6KfHzBa.mjs\";\nimport { mapBackgroundImages } from \"@powerhousedao/shared/connect\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { isPassthroughImageRef } from \"@powerhousedao/shared/connect/image-ref\";\nimport { deflateSync } from \"node:zlib\";\n//#region src/scaffold.ts\n/**\n* A background whose project-relative paths are rewritten to be relative to\n* another directory (powerhouse.config.json's root -> hosts/desktop, where\n* app.json resolves them from). URLs and data URIs are left as they are.\n*/\nfunction rebaseBackground(background, fromDir, toDir) {\n\tconst rebase = (ref) => {\n\t\tif (isPassthroughImageRef(ref)) return ref;\n\t\tconst rel = path.relative(toDir, path.resolve(fromDir, ref)).split(path.sep).join(\"/\");\n\t\treturn rel.startsWith(\".\") ? rel : `./${rel}`;\n\t};\n\treturn typeof background === \"string\" ? rebase(background) : mapBackgroundImages(background, rebase);\n}\n/** Minimal PNG encoder — a solid square so `tauri icon` always has a valid\n* source. Pure Node (zlib); no binary asset ships in the package. The builder\n* replaces it with their real 1024×1024 artwork. */\nfunction solidPng(size, rgba) {\n\tconst [r, g, b, a] = rgba;\n\tconst row = Buffer.alloc(1 + size * 4);\n\tfor (let x = 0; x < size; x++) {\n\t\tconst o = 1 + x * 4;\n\t\trow[o] = r;\n\t\trow[o + 1] = g;\n\t\trow[o + 2] = b;\n\t\trow[o + 3] = a;\n\t}\n\tconst raw = Buffer.concat(Array.from({ length: size }, () => row));\n\tconst idat = deflateSync(raw);\n\tconst chunk = (type, data) => {\n\t\tconst len = Buffer.alloc(4);\n\t\tlen.writeUInt32BE(data.length, 0);\n\t\tconst typeBuf = Buffer.from(type, \"ascii\");\n\t\tconst body = Buffer.concat([typeBuf, data]);\n\t\tconst crc = Buffer.alloc(4);\n\t\tcrc.writeUInt32BE(crc32(body) >>> 0, 0);\n\t\treturn Buffer.concat([\n\t\t\tlen,\n\t\t\tbody,\n\t\t\tcrc\n\t\t]);\n\t};\n\tconst ihdr = Buffer.alloc(13);\n\tihdr.writeUInt32BE(size, 0);\n\tihdr.writeUInt32BE(size, 4);\n\tihdr[8] = 8;\n\tihdr[9] = 6;\n\tihdr[10] = 0;\n\tihdr[11] = 0;\n\tihdr[12] = 0;\n\treturn Buffer.concat([\n\t\tBuffer.from([\n\t\t\t137,\n\t\t\t80,\n\t\t\t78,\n\t\t\t71,\n\t\t\t13,\n\t\t\t10,\n\t\t\t26,\n\t\t\t10\n\t\t]),\n\t\tchunk(\"IHDR\", ihdr),\n\t\tchunk(\"IDAT\", idat),\n\t\tchunk(\"IEND\", Buffer.alloc(0))\n\t]);\n}\nlet crcTable;\nfunction crc32(buf) {\n\tif (!crcTable) {\n\t\tcrcTable = [];\n\t\tfor (let n = 0; n < 256; n++) {\n\t\t\tlet c = n;\n\t\t\tfor (let k = 0; k < 8; k++) c = c & 1 ? 3988292384 ^ c >>> 1 : c >>> 1;\n\t\t\tcrcTable[n] = c;\n\t\t}\n\t}\n\tlet crc = 4294967295;\n\tfor (let i = 0; i < buf.length; i++) crc = crcTable[(crc ^ buf[i]) & 255] ^ crc >>> 8;\n\treturn crc ^ 4294967295;\n}\nconst GITIGNORE = `# Generated tauri shell — only Cargo.lock and app-icon.png are tracked.\n/tauri-shell/target\n/tauri-shell/gen\n/tauri-shell/icons\n/tauri-shell/dist-stack\n/tauri-shell/binaries\n`;\nfunction scaffoldDesktopShell(hostDir, options) {\n\tconst created = [];\n\tconst skipped = [];\n\tfs.mkdirSync(hostDir, { recursive: true });\n\tconst iconFile = \"icon.png\";\n\tconst app = {\n\t\tidentifier: options.identifier,\n\t\tproductName: options.productName,\n\t\ticon: `./${iconFile}`,\n\t\tbackground: options.background ?? null,\n\t\tloading: null,\n\t\twindow: {\n\t\t\ttitle: options.productName,\n\t\t\twidth: 1440,\n\t\t\theight: 900\n\t\t},\n\t\tfileAssociations: [{\n\t\t\text: [\"phd\"],\n\t\t\tname: \"Powerhouse Document\",\n\t\t\tmimeType: \"application/vnd.powerhouse.document+zip\"\n\t\t}]\n\t};\n\tappJsonSchema.parse(app);\n\tconst appJsonPath = path.join(hostDir, APP_JSON_FILE);\n\tif (fs.existsSync(appJsonPath) && !options.force) skipped.push(appJsonPath);\n\telse {\n\t\tfs.writeFileSync(appJsonPath, `${JSON.stringify(app, null, 2)}\\n`);\n\t\tcreated.push(appJsonPath);\n\t}\n\tconst iconPath = path.join(hostDir, iconFile);\n\tif (fs.existsSync(iconPath)) skipped.push(iconPath);\n\telse {\n\t\tfs.writeFileSync(iconPath, solidPng(1024, [\n\t\t\t79,\n\t\t\t70,\n\t\t\t229,\n\t\t\t255\n\t\t]));\n\t\tcreated.push(iconPath);\n\t}\n\tconst gitignorePath = path.join(hostDir, \".gitignore\");\n\tif (fs.existsSync(gitignorePath)) skipped.push(gitignorePath);\n\telse {\n\t\tfs.writeFileSync(gitignorePath, GITIGNORE);\n\t\tcreated.push(gitignorePath);\n\t}\n\treturn {\n\t\thostDir,\n\t\tcreated,\n\t\tskipped\n\t};\n}\n//#endregion\nexport { APP_JSON_FILE, DEFAULT_SHELL_CRATE_VERSION, ICON_SOURCE, SHELL_DIR, appJsonSchema, appSlug, bundleStack, detectToolchain, fetchNodeSidecar, launchShell, loadAppJson, nodeSidecarTarget, preflightOrThrow, projectShell, rebaseBackground, resolvePhCliEntry, resolveShell, resolveTauriCommand, runTauriIcon, scaffoldDesktopShell, shellEnv, solidPng, tauriBundlesForHost, tauriConfigPatch };\n\n//# sourceMappingURL=index.mjs.map","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { rebaseBackground, scaffoldDesktopShell } from \"@powerhousedao/desktop\";\nimport type { PHBackground } from \"@powerhousedao/shared/clis\";\n\nexport interface GenerateDesktopShellArgs {\n name?: string;\n identifier?: string;\n force?: boolean;\n}\n\n/** A reverse-DNS-safe segment from the project name (drop scope, slugify). */\nfunction projectSlug(pkgName: string | undefined): string {\n const bare = (pkgName ?? \"app\").replace(/^@[^/]+\\//, \"\");\n const seg = bare\n .toLowerCase()\n .replace(/[^a-z0-9-]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\");\n return seg || \"app\";\n}\n\n/** `connect.home.background` of the project's powerhouse.config.json, if\n * any (absent or unreadable config: none). */\nfunction readHomeBackground(cwd: string): PHBackground | null {\n try {\n const config = JSON.parse(\n fs.readFileSync(path.join(cwd, \"powerhouse.config.json\"), \"utf8\"),\n ) as { connect?: { home?: { background?: PHBackground | null } } };\n return config.connect?.home?.background ?? null;\n } catch {\n return null;\n }\n}\n\n/** `ph generate desktop-shell`: write hosts/desktop/app.json + a placeholder\n * icon + .gitignore. Defaults product name / identifier from the project. */\nexport function startGenerateDesktopShell(\n args: GenerateDesktopShellArgs,\n cwd: string,\n): void {\n let pkgName: string | undefined;\n try {\n const pkg = JSON.parse(\n fs.readFileSync(path.join(cwd, \"package.json\"), \"utf8\"),\n ) as { name?: string };\n pkgName = pkg.name;\n } catch {\n // no package.json — fall back to defaults below\n }\n const slug = projectSlug(pkgName);\n const productName = args.name ?? pkgName?.replace(/^@[^/]+\\//, \"\") ?? \"App\";\n const identifier = args.identifier ?? `inc.powerhouse.desktop.${slug}`;\n\n const hostDir = path.join(cwd, \"hosts\", \"desktop\");\n // The loading page takes Connect's home background, the same layers in\n // the same places, with its paths rebased from the project root to\n // hosts/desktop (app.json resolves them from where it lives).\n const homeBackground = readHomeBackground(cwd);\n const result = scaffoldDesktopShell(hostDir, {\n identifier,\n productName,\n force: args.force,\n background: homeBackground\n ? rebaseBackground(homeBackground, cwd, hostDir)\n : null,\n });\n\n const rel = (p: string) => path.relative(cwd, p).replace(/\\\\/g, \"/\");\n for (const f of result.created) console.log(` created ${rel(f)}`);\n if (homeBackground && result.created.some((f) => f.endsWith(\"app.json\"))) {\n console.log(\n \" copied connect.home.background -> hosts/desktop/app.json background\",\n );\n }\n for (const f of result.skipped) {\n console.log(` skipped ${rel(f)} (exists — pass --force to overwrite)`);\n }\n if (!fs.existsSync(path.join(hostDir, \"host.js\"))) {\n console.log(\n `\\nNote: hosts/desktop/host.js not found. Add a desktop host (see the ` +\n `desktop topology from \\`ph init\\`) so \\`ph run desktop\\` can supervise ` +\n `the stack; app.json then gives it a native window.`,\n );\n }\n console.log(\n `\\nIdentity: ${productName} (${identifier}).\\n` +\n `• Replace hosts/desktop/icon.png with your 1024×1024 icon.\\n` +\n `• \\`ph run desktop dev\\` opens the native window (needs Rust + the Tauri CLI).\\n` +\n `• \\`ph run desktop build\\` produces installers for this OS.`,\n );\n}\n"],"names":["z.string","z.strictObject","z.number","z.boolean","z.union","z.array"],"mappings":";;;;;;;;;;;;;;;;;;;AAgBA,MAAM,mBAAmBA,OAAS,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MA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AC,QAAQ,OAAO,GAAG;CACnE,KAAK,MAAM,KAAK,OAAO,SAAS,QAAQ,IAAI,cAAc,IAAI,CAAC,GAAG;CAClE,IAAI,kBAAkB,OAAO,QAAQ,MAAM,MAAM,EAAE,SAAS,UAAU,CAAC,GACrE,QAAQ,IACN,yEACF;CAEF,KAAK,MAAM,KAAK,OAAO,SACrB,QAAQ,IAAI,cAAc,IAAI,CAAC,EAAE,sCAAsC;CAEzE,IAAI,CAAC,GAAG,WAAW,KAAK,KAAK,SAAS,SAAS,CAAC,GAC9C,QAAQ,IACN,4LAGF;CAEF,QAAQ,IACN,eAAe,YAAY,IAAI,WAAW,4MAI5C;AACF","debug_id":"a5dfe778-ca81-57cd-a68e-ba67c237a776"}
|
|
@@ -4274,7 +4274,7 @@ declare namespace external_d_exports {
|
|
|
4274
4274
|
export { $brand, $input, $output, BRAND, CompileOptions, GlobalMeta, INVALID, Infer, IssueData, JSONType, NEVER, $RefinementCtx as RefinementCtx, SafeExtendShape, Schema, TimePrecision, TypeOf, ZodAny, ZodArray, ZodBase64, ZodBase64URL, ZodBigInt, ZodBigIntFormat, ZodBoolean, ZodCIDRv4, ZodCIDRv6, ZodCUID, ZodCUID2, ZodCatch, ZodCodec, ZodCoercedBigInt, ZodCoercedBoolean, ZodCoercedDate, ZodCoercedNumber, ZodCoercedString, ZodCompileAsyncError, ZodCompileUnsupportedError, ZodCreditCard, ZodCustom, ZodCustomStringFormat, ZodDate, ZodDefault, ZodDiscriminatedUnion, ZodE164, ZodEmail, ZodEmoji, ZodEnum, ZodError, ZodErrorMap, ZodExactOptional, ZodFile, ZodFirstPartySchemaTypes, ZodFirstPartyTypeKind, ZodFlattenedError, ZodFloat32, ZodFloat64, ZodFormattedError, ZodFunction, ZodGUID, ZodIBAN, ZodIPv4, ZodIPv6, ZodISODate, ZodISODateTime, ZodISODuration, ZodISOTime, ZodInstanceOf, ZodInt, ZodInt32, ZodInt64, ZodIntersection, ZodIssue, ZodIssueCode, ZodJSONSchema, ZodJSONSchemaInternals, ZodJWT, ZodKSUID, ZodLazy, ZodLiteral, ZodMAC, ZodMap, ZodNaN, ZodNanoID, ZodNever, ZodNonOptional, ZodNull, ZodNullable, ZodNumber, ZodNumberFormat, ZodObject, ZodOptional, ZodPipe, ZodPrefault, ZodPreprocess, ZodPromise, ZodRawShape, ZodReadonly, ZodRealError, ZodRecord, ZodSafeParseError, ZodSafeParseResult, ZodSafeParseSuccess, ZodSchema, ZodSet, ZodStandardSchemaWithJSON, ZodString, ZodStringFormat, ZodSuccess, ZodSymbol, ZodTemplateLiteral, ZodTransform, ZodTuple, ZodType, ZodTypeAny, ZodUInt32, ZodUInt64, ZodULID, ZodURL, ZodUUID, ZodUndefined, ZodUnion, ZodUnknown, ZodVoid, ZodXID, ZodXor, _ZodBigInt, _ZodBoolean, _ZodDate, _ZodNumber, _ZodString, _ZodType, _default, _function, any, array, base64, base64url, bigint$1 as bigint, boolean$1 as boolean, _catch as catch, check, cidrv4, cidrv6, clone, codec, coerce_d_exports as coerce, compile, config, index_d_exports as core, creditCard, cuid, cuid2, currencyCode, custom, date$2 as date, decode, decodeAsync, deepPartial, describe, discriminatedUnion, e164, email, emoji, encode, encodeAsync, _endsWith as endsWith, _enum as enum, exactOptional, file, flattenError, float32, float64, formatError, fromJSONSchema, _function as function, getDiscriminatedOption, getErrorMap, globalRegistry, _gt as gt, _gte as gte, guid, hash, hex, hostname, httpUrl, iban, _includes as includes, output$1 as infer, inferFlattenedErrors, inferFormattedError, input, _instanceof as instanceof, int, int32, int64, intersection, invertCodec, ipv4, ipv6, iso_d_exports as iso, json, jwt, keyof, ksuid, lazy, _length as length, literal, index_d_exports$1 as locales, looseObject, looseRecord, _lowercase as lowercase, _lt as lt, _lte as lte, mac, map, _maxLength as maxLength, _maxSize as maxSize, memoizer, meta, _mime as mime, _minLength as minLength, _minSize as minSize, _multipleOf as multipleOf, nan, nanoid, nativeEnum, _negative as negative, never, _nonnegative as nonnegative, nonoptional, _nonpositive as nonpositive, _normalize as normalize, _null as null, nullable, nullish, number$1 as number, object, optional, output, _overwrite as overwrite, parse, parseAsync, partialRecord, pipe, _positive as positive, prefault, preprocess, prettifyError, promise, _properties as properties, _property as property, readonly, record, refine, _regex as regex, regexes_d_exports as regexes, registry, safeDecode, safeDecodeAsync, safeEncode, safeEncodeAsync, safeParse, safeParseAsync, set, setErrorMap, _size as size, _slugify as slugify, _startsWith as startsWith, strictObject, string$1 as string, stringFormat, stringbool, success, superRefine, symbol, templateLiteral, toJSONSchema, _toLowerCase as toLowerCase, _toUpperCase as toUpperCase, toZod, transform, treeifyError, _trim as trim, tuple, uint32, uint64, ulid, _undefined as undefined, union, unknown, _uppercase as uppercase, url, util_d_exports as util, uuid, uuidv4, uuidv6, uuidv7, validate, validateAsync, _void as void, withParser, xid, xor };
|
|
4275
4275
|
}
|
|
4276
4276
|
//#endregion
|
|
4277
|
-
//#region ../../packages/host-core/dist/compound-
|
|
4277
|
+
//#region ../../packages/host-core/dist/compound-DXcOFNcC.d.mts
|
|
4278
4278
|
declare const declaredGenericCompoundHostSchema: ZodObject<{
|
|
4279
4279
|
name: ZodString;
|
|
4280
4280
|
runner: ZodObject<{
|
|
@@ -4294,7 +4294,6 @@ declare const declaredGenericCompoundHostSchema: ZodObject<{
|
|
|
4294
4294
|
runner: ZodOptional<ZodObject<{
|
|
4295
4295
|
module: ZodOptional<ZodString>;
|
|
4296
4296
|
defaultVerb: ZodOptional<ZodOptional<ZodString>>;
|
|
4297
|
-
port: ZodOptional<ZodOptional<ZodNumber>>;
|
|
4298
4297
|
host: ZodOptional<ZodOptional<ZodString>>;
|
|
4299
4298
|
plugins: ZodOptional<ZodOptional<ZodArray<ZodUnion<readonly [ZodString, ZodObject<{
|
|
4300
4299
|
module: ZodString;
|
|
@@ -4302,6 +4301,7 @@ declare const declaredGenericCompoundHostSchema: ZodObject<{
|
|
|
4302
4301
|
verbs: ZodOptional<ZodUnion<readonly [ZodLiteral<"*">, ZodArray<ZodString>]>>;
|
|
4303
4302
|
config: ZodOptional<ZodRecord<ZodString, ZodUnknown>>;
|
|
4304
4303
|
}, $strict>]>>>>;
|
|
4304
|
+
port: ZodOptional<ZodNumber>;
|
|
4305
4305
|
}, $loose>>;
|
|
4306
4306
|
config: ZodOptional<ZodObject<{}, $loose>>;
|
|
4307
4307
|
reactor: ZodOptional<ZodObject<{
|
|
@@ -4332,17 +4332,9 @@ declare const declaredGenericCompoundHostSchema: ZodObject<{
|
|
|
4332
4332
|
remote: ZodOptional<ZodObject<{
|
|
4333
4333
|
url: TokenableSchema<ZodURL>;
|
|
4334
4334
|
}, $strict>>;
|
|
4335
|
-
projection: ZodOptional<ZodObject<{
|
|
4336
|
-
enabled: ZodOptional<ZodBoolean>;
|
|
4337
|
-
dbPoolSize: ZodOptional<ZodNumber>;
|
|
4338
|
-
}, $strict>>;
|
|
4339
|
-
executors: ZodOptional<ZodObject<{
|
|
4340
|
-
numWorkers: ZodOptional<ZodUnion<readonly [ZodNumber, ZodLiteral<"auto">]>>;
|
|
4341
|
-
}, $strict>>;
|
|
4342
4335
|
}, $strict>>>;
|
|
4343
4336
|
placement: ZodOptional<ZodObject<{
|
|
4344
4337
|
primary: ZodOptional<ZodString>;
|
|
4345
|
-
default: ZodOptional<ZodObject<{}, $loose>>;
|
|
4346
4338
|
}, $strict>>;
|
|
4347
4339
|
protocol: ZodOptional<ZodObject<{
|
|
4348
4340
|
featureFlags: ZodOptional<ZodObject<{
|
|
@@ -4366,15 +4358,7 @@ declare const declaredGenericCompoundHostSchema: ZodObject<{
|
|
|
4366
4358
|
networkId: ZodOptional<ZodString>;
|
|
4367
4359
|
chainId: ZodOptional<ZodNumber>;
|
|
4368
4360
|
}, $strict>>;
|
|
4369
|
-
packages: ZodOptional<ZodObject<{
|
|
4370
|
-
registryUrl: ZodOptional<ZodString>;
|
|
4371
|
-
}, $strict>>;
|
|
4372
4361
|
namespace: ZodOptional<ZodString>;
|
|
4373
|
-
auth: ZodOptional<ZodObject<{
|
|
4374
|
-
enabled: ZodOptional<ZodBoolean>;
|
|
4375
|
-
admins: ZodOptional<ZodArray<ZodString>>;
|
|
4376
|
-
renown: ZodOptional<ZodObject<{}, $loose>>;
|
|
4377
|
-
}, $strict>>;
|
|
4378
4362
|
drives: ZodOptional<TokenableSchema<ZodArray<ZodObject<{
|
|
4379
4363
|
slug: ZodString;
|
|
4380
4364
|
id: ZodOptional<ZodString>;
|
|
@@ -4468,6 +4452,6 @@ declare global {
|
|
|
4468
4452
|
}
|
|
4469
4453
|
}
|
|
4470
4454
|
//#endregion
|
|
4471
|
-
export { ZodURL as C, $
|
|
4455
|
+
export { ZodURL as C, $strict as D, output$1 as E, ZodString as S, ZodUnknown as T, ZodNullable as _, ItemToken as a, ZodOptional as b, RunnerHandle as c, input as d, output as f, ZodLiteral as g, ZodEnum as h, EnvToken as i, TokenableSchema as l, ZodBoolean as m, BootIssue as n, OutputToken as o, ZodArray as p, ConcatToken as r, RunnerContext as s, BootCheckContext as t, external_d_exports as u, ZodNumber as v, ZodUnion as w, ZodRecord as x, ZodObject as y };
|
|
4472
4456
|
export {};
|
|
4473
|
-
//# sourceMappingURL=index-
|
|
4457
|
+
//# sourceMappingURL=index-DHHaYrj2.d.mts.map
|