@powerhousedao/desktop 6.2.3-dev.60 → 6.2.3-dev.61

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.
@@ -1 +1 @@
1
- {"version":3,"file":"runner.mjs","names":[],"sources":["../src/runner.ts"],"sourcesContent":["import {\n compoundHostSchema,\n getVerb,\n loadHost,\n resolveRunnerModule,\n validateHost,\n type HostDefinition,\n type RunnerContext,\n} from \"@powerhousedao/host-core\";\nimport { bundleStack } from \"./bundle-stack.js\";\nimport {\n launchShell,\n resolveShell,\n shellEnv,\n type ShellOptions,\n} from \"./shell.js\";\n\n/**\n * @powerhousedao/desktop/runner (phase 6): the desktop host productized.\n *\n * - `run`/`serve`: the headless stack — byte-identical delegation to\n * host-core's generic compound (phase-3 semantics unchanged).\n * - `dev`: the NATIVE window — resolves the shell (runner.shell.project /\n * PH_DESKTOP_SHELL), wires the env trio itself (PH_RUN_PROJECT, PH_RUN_CLI,\n * PH_WIN_CONNECT_PORT, + userData/flag) and launches the built exe when one\n * exists, else `pnpm tauri dev` with the shell-config projection (D6.d).\n * - `build`: the PACKAGING verb — forwards `build` to members that export it\n * (skipping the rest WITH a log line: packaging builds what is buildable,\n * unlike the generic compound's uniform fail-loud forwarding), then stages\n * the shippable stack into the shell project (bundle-stack: hosts + config\n * + built Connect + vendored ph-cli) so the installed app runs with no\n * environment at all (D6.c).\n */\n\nexport const kind = \"compound\";\n\nexport const hostSchema = compoundHostSchema;\n\ninterface DesktopRunnerOptions {\n shell?: ShellOptions;\n /** build: vendor ph-cli into the staged stack (default true). */\n vendorStack?: boolean;\n /** build: the ph-cli version/tag to vendor (default \"dev\"). */\n phCliVersion?: string;\n /** build: full install spec override (e.g. a pnpm-pack tarball path) for a\n * ph-cli not yet on the registry. */\n phCliSpec?: string;\n}\n\ninterface ChildWrapper {\n host: string;\n runner?: { port?: number; defaultVerb?: string } & Record<string, unknown>;\n}\n\nasync function compoundModule() {\n return import(\"@powerhousedao/host-core/runners/compound\");\n}\n\n/** The connect member's port — the shell's readiness probe and window URL. */\nasync function connectPort(\n host: HostDefinition,\n ctx: RunnerContext,\n): Promise<number> {\n const children = (host.children ?? {}) as Record<string, ChildWrapper>;\n for (const wrapper of Object.values(children)) {\n if (wrapper.host !== \"connect\") continue;\n if (typeof wrapper.runner?.port === \"number\") return wrapper.runner.port;\n const member = await loadHost(ctx.projectRoot, wrapper.host);\n if (typeof member.host.runner.port === \"number\") {\n return member.host.runner.port;\n }\n }\n throw new Error(\n `hosts/${host.name}: no connect member with a resolvable runner.port — ` +\n `the shell needs it for its readiness probe and window URL.`,\n );\n}\n\nexport async function run(host: HostDefinition, ctx: RunnerContext) {\n const compound = await compoundModule();\n return compound.run(host, ctx);\n}\n\nexport const serve = run;\n\n/** dev = the native window around the live stack, zero manual env. */\nexport interface ShellHandle {\n /** Resolves when the shell window exits — the runner's keep-alive. */\n ready: Promise<void>;\n shutdown: () => void;\n}\n\nexport async function dev(\n host: HostDefinition,\n ctx: RunnerContext,\n): Promise<ShellHandle> {\n const options = host.runner as { shell?: ShellOptions };\n const shell = resolveShell(ctx.projectRoot, options.shell, ctx.env);\n const port = await connectPort(host, ctx);\n const envVars = shellEnv(ctx.projectRoot, port, ctx.env);\n\n console.log(\n `[${host.name}] launching the desktop shell ` +\n `(${shell.exe ? shell.exe : \"pnpm tauri dev\"}) — stack via ` +\n `ph run ${host.name}, window at http://127.0.0.1:${port}/`,\n );\n const child = launchShell(shell, envVars, options.shell);\n const exited = new Promise<void>((resolve) =>\n child.once(\"exit\", () => resolve()),\n );\n\n return {\n // keep the runner alive as long as the window lives\n ready: exited,\n shutdown: () => {\n try {\n child.kill();\n } catch {\n // already gone\n }\n },\n };\n}\n\n/** build = members' builds (where exported) + the shippable stack staging. */\nexport async function build(\n host: HostDefinition,\n ctx: RunnerContext,\n): Promise<void> {\n const children = (host.children ?? {}) as Record<string, ChildWrapper>;\n for (const [name, wrapper] of Object.entries(children)) {\n const member = await loadHost(ctx.projectRoot, wrapper.host);\n const specifier = member.host.runner.module;\n const runner = await resolveRunnerModule(ctx.projectRoot, specifier);\n validateHost(\n runner,\n specifier,\n member.host,\n `hosts/${wrapper.host}/host.js`,\n );\n if (typeof (runner as Record<string, unknown>).build !== \"function\") {\n console.log(\n `[${host.name}] build: ${name} (${wrapper.host}) exports no build — skipped (packaging builds what is buildable)`,\n );\n continue;\n }\n const fn = getVerb(runner, specifier, \"build\");\n console.log(`[${host.name}] build → ${name} (${wrapper.host})`);\n await fn(member.host, { ...ctx, verb: \"build\" });\n }\n\n const runnerOptions = host.runner as DesktopRunnerOptions &\n HostDefinition[\"runner\"];\n if (!runnerOptions.shell?.project && !ctx.env.PH_DESKTOP_SHELL) {\n console.log(\n `[${host.name}] build: no shell configured — members built; stack ` +\n `staging skipped (set runner.shell.project to stage the shippable stack).`,\n );\n return;\n }\n const shell = resolveShell(ctx.projectRoot, runnerOptions.shell, ctx.env);\n console.log(`[${host.name}] staging the stack into ${shell.projectDir}…`);\n const result = bundleStack({\n projectRoot: ctx.projectRoot,\n shellProjectDir: shell.projectDir,\n vendor: runnerOptions.vendorStack,\n phCliVersion: runnerOptions.phCliVersion,\n phCliSpec: runnerOptions.phCliSpec ?? ctx.env.PH_DESKTOP_PHCLI_SPEC,\n connectPort: await connectPort(host, ctx),\n });\n console.log(\n `[${host.name}] stack staged at ${result.stackDir}` +\n `${result.vendored ? \" (ph-cli vendored)\" : \"\"} — the shell runs it with ` +\n `no environment (resources fallback).`,\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAkCA,MAAa,OAAO;AAEpB,MAAa,aAAa;AAkB1B,eAAe,iBAAiB;CAC9B,OAAO,OAAO;AAChB;;AAGA,eAAe,YACb,MACA,KACiB;CACjB,MAAM,WAAY,KAAK,YAAY,CAAC;CACpC,KAAK,MAAM,WAAW,OAAO,OAAO,QAAQ,GAAG;EAC7C,IAAI,QAAQ,SAAS,WAAW;EAChC,IAAI,OAAO,QAAQ,QAAQ,SA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E,QAAQ,IACN,IAAI,KAAK,KAAK,WAAW,KAAK,IAAI,QAAQ,KAAK,kEACjD;GACA;EACF;EACA,MAAM,KAAK,QAAQ,QAAQ,WAAW,OAAO;EAC7C,QAAQ,IAAI,IAAI,KAAK,KAAK,YAAY,KAAK,IAAI,QAAQ,KAAK,EAAE;EAC9D,MAAM,GAAG,OAAO,MAAM;GAAE,GAAG;GAAK,MAAM;EAAQ,CAAC;CACjD;CAEA,MAAM,gBAAgB,KAAK;CAE3B,IAAI,CAAC,cAAc,OAAO,WAAW,CAAC,IAAI,IAAI,kBAAkB;EAC9D,QAAQ,IACN,IAAI,KAAK,KAAK,6HAEhB;EACA;CACF;CACA,MAAM,QAAQ,aAAa,IAAI,aAAa,cAAc,OAAO,IAAI,GAAG;CACxE,QAAQ,IAAI,IAAI,KAAK,KAAK,2BAA2B,MAAM,WAAW,EAAE;CACxE,MAAM,SAAS,YAAY;EACzB,aAAa,IAAI;EACjB,iBAAiB,MAAM;EACvB,QAAQ,cAAc;EACtB,cAAc,cAAc;EAC5B,WAAW,cAAc,aAAa,IAAI,IAAI;EAC9C,aAAa,MAAM,YAAY,MAAM,GAAG;CAC1C,CAAC;CACD,QAAQ,IACN,IAAI,KAAK,KAAK,oBAAoB,OAAO,WACpC,OAAO,WAAW,uBAAuB,GAAG,+DAEnD;AACF"}
1
+ {"version":3,"file":"runner.mjs","names":[],"sources":["../src/runner.ts"],"sourcesContent":["import { spawn, spawnSync } from \"node:child_process\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport {\n compoundHostSchema,\n getVerb,\n loadHost,\n resolveRunnerModule,\n validateHost,\n type HostDefinition,\n type RunnerContext,\n} from \"@powerhousedao/host-core\";\nimport { APP_JSON_FILE, loadAppJson } from \"./app-json.js\";\nimport { bundleStack } from \"./bundle-stack.js\";\nimport { ICON_SOURCE, projectShell } from \"./shell-project.js\";\nimport {\n detectToolchain,\n fetchNodeSidecar,\n preflightOrThrow,\n runTauriIcon,\n tauriBundlesForHost,\n tauriSpawn,\n type TauriCommand,\n} from \"./shell-toolchain.js\";\nimport {\n launchShell,\n resolveShell,\n shellEnv,\n type ShellOptions,\n} from \"./shell.js\";\n\n/**\n * @powerhousedao/desktop/runner.\n *\n * - `run`/`serve`: the headless stack — byte-identical delegation to\n * host-core's generic compound (phase-3 semantics unchanged).\n * - `dev`: the NATIVE window. Mode 1 (phase 7) is the default — a builder\n * ships under THEIR identity by editing `hosts/<host>/app.json` and never\n * writing Rust: the runner projects app.json into a generated `tauri-shell/`\n * that depends on the published `ph-desktop-shell` crate, provisions the\n * native toolchain's compile-time inputs (node sidecar + icon set), and runs\n * `cargo tauri dev`. An explicit `runner.shell.project` (or PH_DESKTOP_SHELL)\n * still selects a prebuilt/hand-maintained shell instead.\n * - `build`: the PACKAGING verb — members' builds (where exported), then the\n * shippable stack staged into the shell + `cargo tauri build` with\n * host-appropriate installer targets (nsis / app+dmg / deb+appimage).\n *\n * The native toolchain is required ONLY for dev/build; a missing cargo or\n * Tauri CLI fails with install guidance (see shell-toolchain). `ph run <host>`\n * (headless) needs none of it.\n */\n\nexport const kind = \"compound\";\n\nexport const hostSchema = compoundHostSchema;\n\ninterface DesktopRunnerOptions {\n shell?: ShellOptions;\n /** build: vendor ph-cli into the staged stack (default true). */\n vendorStack?: boolean;\n /** build: the ph-cli version/tag to vendor (default \"dev\"). */\n phCliVersion?: string;\n /** build: full install spec override (e.g. a pnpm-pack tarball path) for a\n * ph-cli not yet on the registry. */\n phCliSpec?: string;\n}\n\ninterface ChildWrapper {\n host: string;\n runner?: { port?: number; defaultVerb?: string } & Record<string, unknown>;\n}\n\nasync function compoundModule() {\n return import(\"@powerhousedao/host-core/runners/compound\");\n}\n\n/** hosts/<host>/ — where app.json lives and the generated shell is written. */\nfunction hostDirOf(host: HostDefinition, ctx: RunnerContext): string {\n return path.join(ctx.projectRoot, \"hosts\", host.name);\n}\n\n/** The connect member's port — the shell's readiness probe and window URL. */\nasync function connectPort(\n host: HostDefinition,\n ctx: RunnerContext,\n): Promise<number> {\n const children = (host.children ?? {}) as Record<string, ChildWrapper>;\n for (const wrapper of Object.values(children)) {\n if (wrapper.host !== \"connect\") continue;\n if (typeof wrapper.runner?.port === \"number\") return wrapper.runner.port;\n const member = await loadHost(ctx.projectRoot, wrapper.host);\n if (typeof member.host.runner.port === \"number\") {\n return member.host.runner.port;\n }\n }\n throw new Error(\n `hosts/${host.name}: no connect member with a resolvable runner.port — ` +\n `the shell needs it for its readiness probe and window URL.`,\n );\n}\n\nexport async function run(host: HostDefinition, ctx: RunnerContext) {\n const compound = await compoundModule();\n return compound.run(host, ctx);\n}\n\nexport const serve = run;\n\nexport interface ShellHandle {\n /** Resolves when the shell window exits — the runner's keep-alive. */\n ready: Promise<void>;\n shutdown: () => void;\n}\n\n/** Which shell backs this host's native window (D7.d source order):\n * an explicit `runner.shell.project`, else the app.json-generated shell,\n * else the PH_DESKTOP_SHELL escape hatch. */\nexport function shellMode(\n host: HostDefinition,\n ctx: RunnerContext,\n): \"external-project\" | \"generated\" | \"external-env\" | \"none\" {\n const options = host.runner as { shell?: ShellOptions };\n if (options.shell?.project) return \"external-project\";\n if (fs.existsSync(path.join(hostDirOf(host, ctx), APP_JSON_FILE))) {\n return \"generated\";\n }\n if (ctx.env.PH_DESKTOP_SHELL) return \"external-env\";\n return \"none\";\n}\n\n/** Fetch the node sidecar + (re)generate the icon set — both are tauri-build\n * COMPILE-TIME inputs (externalBin; icon.ico for the Windows resource),\n * confirmed against a live cargo check. Icon regen only when app-icon.png\n * changed or the set is absent. */\nfunction provisionShell(\n shellDir: string,\n tauri: TauriCommand,\n iconChanged: boolean,\n): void {\n fetchNodeSidecar(shellDir);\n const iconIco = path.join(shellDir, \"icons\", \"icon.ico\");\n if (iconChanged || !fs.existsSync(iconIco)) {\n runTauriIcon(tauri, shellDir, ICON_SOURCE);\n }\n}\n\n/** Spawn a `<tauri> <subcommand>` in the generated shell with the uniform-\n * runners env trio wired in. */\nfunction spawnTauri(\n tauri: TauriCommand,\n subcommand: string[],\n shellDir: string,\n envVars: Record<string, string>,\n) {\n const { command, args, shell } = tauriSpawn(tauri, subcommand);\n return spawn(command, args, {\n cwd: shellDir,\n env: { ...process.env, ...envVars },\n stdio: \"inherit\",\n shell,\n windowsHide: true,\n });\n}\n\nexport async function dev(\n host: HostDefinition,\n ctx: RunnerContext,\n): Promise<ShellHandle> {\n const mode = shellMode(host, ctx);\n if (mode === \"none\") {\n throw new Error(\n `hosts/${host.name}: no desktop shell to run — add ${APP_JSON_FILE} ` +\n `(run \\`ph generate desktop-shell\\`) for a builder-owned identity, set ` +\n `runner.shell.project to a prebuilt shell, or export PH_DESKTOP_SHELL.`,\n );\n }\n\n const port = await connectPort(host, ctx);\n const envVars = shellEnv(ctx.projectRoot, port, ctx.env);\n\n if (mode === \"generated\") {\n const hostDir = hostDirOf(host, ctx);\n const app = loadAppJson(hostDir);\n const { shellDir, binName, changed } = projectShell({\n hostDir,\n app,\n connectPort: port,\n });\n const tauri = preflightOrThrow(detectToolchain(ctx.projectRoot), host.name);\n provisionShell(shellDir, tauri, changed);\n console.log(\n `[${host.name}] launching the generated desktop shell '${binName}' ` +\n `(${tauri.via}: cargo tauri dev) — stack via ph run ${host.name}, ` +\n `window at http://127.0.0.1:${port}/`,\n );\n const child = spawnTauri(tauri, [\"dev\"], shellDir, envVars);\n const exited = new Promise<void>((resolve) =>\n child.once(\"exit\", () => resolve()),\n );\n return {\n ready: exited,\n shutdown: () => {\n try {\n child.kill();\n } catch {\n // already gone\n }\n },\n };\n }\n\n // external-project / external-env: a prebuilt or hand-maintained shell.\n const options = host.runner as { shell?: ShellOptions };\n const shell = resolveShell(ctx.projectRoot, options.shell, ctx.env);\n console.log(\n `[${host.name}] launching the desktop shell ` +\n `(${shell.exe ? shell.exe : \"pnpm tauri dev\"}) — stack via ` +\n `ph run ${host.name}, window at http://127.0.0.1:${port}/`,\n );\n const child = launchShell(shell, envVars, options.shell);\n const exited = new Promise<void>((resolve) =>\n child.once(\"exit\", () => resolve()),\n );\n return {\n ready: exited,\n shutdown: () => {\n try {\n child.kill();\n } catch {\n // already gone\n }\n },\n };\n}\n\n/** Forward `build` to members that export it (packaging builds what is\n * buildable — unlike the generic compound's uniform fail-loud forwarding). */\nasync function buildMembers(\n host: HostDefinition,\n ctx: RunnerContext,\n): Promise<void> {\n const children = (host.children ?? {}) as Record<string, ChildWrapper>;\n for (const [name, wrapper] of Object.entries(children)) {\n const member = await loadHost(ctx.projectRoot, wrapper.host);\n const specifier = member.host.runner.module;\n const runner = await resolveRunnerModule(ctx.projectRoot, specifier);\n validateHost(\n runner,\n specifier,\n member.host,\n `hosts/${wrapper.host}/host.js`,\n );\n if (typeof (runner as Record<string, unknown>).build !== \"function\") {\n console.log(\n `[${host.name}] build: ${name} (${wrapper.host}) exports no build — skipped (packaging builds what is buildable)`,\n );\n continue;\n }\n const fn = getVerb(runner, specifier, \"build\");\n console.log(`[${host.name}] build → ${name} (${wrapper.host})`);\n await fn(member.host, { ...ctx, verb: \"build\" });\n }\n}\n\n/** build = members' builds + the shippable stack + the native installer. */\nexport async function build(\n host: HostDefinition,\n ctx: RunnerContext,\n): Promise<void> {\n await buildMembers(host, ctx);\n\n const runnerOptions = host.runner as DesktopRunnerOptions &\n HostDefinition[\"runner\"];\n const mode = shellMode(host, ctx);\n const port = await connectPort(host, ctx);\n\n if (mode === \"generated\") {\n const hostDir = hostDirOf(host, ctx);\n const app = loadAppJson(hostDir);\n const { shellDir, binName, changed } = projectShell({\n hostDir,\n app,\n connectPort: port,\n });\n const tauri = preflightOrThrow(detectToolchain(ctx.projectRoot), host.name);\n provisionShell(shellDir, tauri, changed);\n\n console.log(`[${host.name}] staging the stack into ${shellDir}…`);\n const staged = bundleStack({\n projectRoot: ctx.projectRoot,\n shellProjectDir: shellDir,\n vendor: runnerOptions.vendorStack,\n phCliVersion: runnerOptions.phCliVersion,\n phCliSpec: runnerOptions.phCliSpec ?? ctx.env.PH_DESKTOP_PHCLI_SPEC,\n connectPort: port,\n // the generated shell lives under hosts/ — never stage it into itself\n excludeDirs: [shellDir],\n });\n console.log(\n `[${host.name}] stack staged at ${staged.stackDir}` +\n `${staged.vendored ? \" (ph-cli vendored)\" : \"\"}.`,\n );\n\n const bundles = tauriBundlesForHost();\n console.log(\n `[${host.name}] building '${binName}' (${tauri.via}: cargo tauri ` +\n `build --bundles ${bundles.join(\",\")})…`,\n );\n const result = spawnSyncTauri(\n tauri,\n [\"build\", \"--bundles\", bundles.join(\",\")],\n shellDir,\n );\n if (result !== 0) {\n throw new Error(\n `hosts/${host.name}: \\`cargo tauri build\\` failed (exit ${result}).`,\n );\n }\n console.log(\n `[${host.name}] desktop app built — installers under ` +\n `${path.join(shellDir, \"target\", \"release\", \"bundle\")}.`,\n );\n return;\n }\n\n // external-project / external-env: stage into the prebuilt shell (phase 6).\n if (mode === \"none\") {\n console.log(\n `[${host.name}] build: no shell configured — members built; shell ` +\n `packaging skipped (add ${APP_JSON_FILE} or set runner.shell.project).`,\n );\n return;\n }\n const shell = resolveShell(ctx.projectRoot, runnerOptions.shell, ctx.env);\n console.log(`[${host.name}] staging the stack into ${shell.projectDir}…`);\n const result = bundleStack({\n projectRoot: ctx.projectRoot,\n shellProjectDir: shell.projectDir,\n vendor: runnerOptions.vendorStack,\n phCliVersion: runnerOptions.phCliVersion,\n phCliSpec: runnerOptions.phCliSpec ?? ctx.env.PH_DESKTOP_PHCLI_SPEC,\n connectPort: port,\n });\n console.log(\n `[${host.name}] stack staged at ${result.stackDir}` +\n `${result.vendored ? \" (ph-cli vendored)\" : \"\"} — the shell runs it with ` +\n `no environment (resources fallback).`,\n );\n}\n\n/** Synchronous `<tauri> <subcommand>` — build blocks until the installer is\n * produced. Returns the exit code. */\nfunction spawnSyncTauri(\n tauri: TauriCommand,\n subcommand: string[],\n shellDir: string,\n): number {\n const { command, args, shell } = tauriSpawn(tauri, subcommand);\n const r = spawnSync(command, args, {\n cwd: shellDir,\n stdio: \"inherit\",\n shell,\n windowsHide: true,\n });\n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