@powerhousedao/desktop 6.2.3-dev.69 → 6.2.3-dev.71

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,8 +1,10 @@
1
1
  import { createRequire } from "node:module";
2
+ import { colorVariants, imageVariants, layerStyleText, normalizeBackground, validateBackground } from "@powerhousedao/shared/connect";
2
3
  import fs from "node:fs";
3
4
  import path from "node:path";
4
5
  import { z } from "zod";
5
6
  import { execSync, spawn, spawnSync } from "node:child_process";
7
+ import { isPassthroughImageRef } from "@powerhousedao/shared/connect/image-ref";
6
8
  import { pathToFileURL } from "node:url";
7
9
  //#region src/app-json.ts
8
10
  /**
@@ -17,8 +19,72 @@ const windowSchema = z.strictObject({
17
19
  title: z.string().min(1).optional(),
18
20
  width: z.number().int().positive().optional(),
19
21
  height: z.number().int().positive().optional(),
20
- resizable: z.boolean().optional()
22
+ resizable: z.boolean().optional(),
23
+ /** Smallest size the window can be dragged to (logical pixels). */
24
+ minWidth: z.number().int().positive().optional(),
25
+ minHeight: z.number().int().positive().optional()
21
26
  }).optional();
27
+ const 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)");
28
+ /** The loading page's colors. */
29
+ const loadingColorsSchema = z.strictObject({
30
+ /** Page background (default #0f1115). */
31
+ background: cssColorSchema.nullable().optional(),
32
+ /** Status text color (default #e6e8eb). */
33
+ color: cssColorSchema.nullable().optional(),
34
+ /** The pulsing status dot (default #4ade80). */
35
+ accent: cssColorSchema.nullable().optional()
36
+ });
37
+ /** The loading page's look, so the window opens in the app's own colors
38
+ * instead of the default dark page. Every field is optional, and `null`
39
+ * means the default (the scaffold lists the fields that way). */
40
+ const loadingSchema = loadingColorsSchema.extend({
41
+ /** Status line under the art (default "Starting <productName>…"). */
42
+ message: z.string().min(1).nullable().optional(),
43
+ /** Colors for `prefers-color-scheme: dark`; without it the page keeps
44
+ * the light colors in both schemes. */
45
+ dark: loadingColorsSchema.nullable().optional(),
46
+ /** Deprecated: a decoration pinned to the bottom-right corner, relative
47
+ * to app.json, with `artDark` its dark-scheme counterpart. Superseded by
48
+ * the top-level `background`, which ignores these when set. */
49
+ art: z.string().min(1).nullable().optional(),
50
+ artDark: z.string().min(1).nullable().optional()
51
+ }).nullable().optional();
52
+ const imageRefSchema = z.string().min(1);
53
+ const schemedImageSchema = z.union([imageRefSchema, z.strictObject({
54
+ light: imageRefSchema,
55
+ dark: imageRefSchema.nullable().optional()
56
+ })]);
57
+ const lengthSchema = z.union([z.number(), z.string().min(1)]).nullable().optional();
58
+ const edgesSchema = z.strictObject({
59
+ top: lengthSchema,
60
+ right: lengthSchema,
61
+ bottom: lengthSchema,
62
+ left: lengthSchema
63
+ }).nullable().optional();
64
+ const backgroundLayerSchema = z.strictObject({
65
+ src: schemedImageSchema,
66
+ position: edgesSchema,
67
+ width: lengthSchema,
68
+ height: lengthSchema,
69
+ minWidth: lengthSchema,
70
+ minHeight: lengthSchema,
71
+ maxWidth: lengthSchema,
72
+ maxHeight: lengthSchema,
73
+ opacity: z.number().min(0).max(1).nullable().optional(),
74
+ fade: edgesSchema
75
+ });
76
+ const backgroundSchema = z.union([imageRefSchema, z.strictObject({
77
+ color: z.union([z.string().min(1), z.strictObject({
78
+ light: z.string().min(1),
79
+ dark: z.string().min(1).nullable().optional()
80
+ })]).nullable().optional(),
81
+ layers: z.array(backgroundLayerSchema)
82
+ })]).superRefine((background, ctx) => {
83
+ for (const problem of validateBackground(background, "background")) ctx.addIssue({
84
+ code: "custom",
85
+ message: problem
86
+ });
87
+ }).nullable().optional();
22
88
  const fileAssociationSchema = z.strictObject({
23
89
  /** Extensions WITHOUT the leading dot ("phd", not ".phd"). */
24
90
  ext: z.array(z.string().min(1).regex(/^[^.]/, "drop the leading dot")).min(1),
@@ -44,6 +110,18 @@ const appJsonSchema = z.strictObject({
44
110
  /** Single source image (square PNG, 1024×1024 recommended); the icon set
45
111
  * for every platform is generated from it via `tauri icon`. */
46
112
  icon: z.string().min(1),
113
+ /** The loading page's background: images positioned and sized over a
114
+ * page colour (`{ color, layers }`), or one image pinned bottom-right.
115
+ * The status line stays centred above them. `ph generate desktop-shell`
116
+ * copies Connect's `connect.branding.homeBackground` here. null or
117
+ * omitted: the app icon (or `splash`) above the status line. */
118
+ background: backgroundSchema,
119
+ /** Deprecated in favour of `background`: a wide splash image shown above
120
+ * the status line instead of the square icon. Relative to this file. */
121
+ splash: z.string().min(1).nullable().optional(),
122
+ /** Deprecated with `splash`: its `prefers-color-scheme: dark` variant. */
123
+ splashDark: z.string().min(1).nullable().optional(),
124
+ loading: loadingSchema,
47
125
  window: windowSchema,
48
126
  fileAssociations: z.array(fileAssociationSchema).optional(),
49
127
  shell: shellSourceSchema
@@ -105,6 +183,54 @@ function copyDirFiltered(src, dest, excludes) {
105
183
  walk(src, dest);
106
184
  return true;
107
185
  }
186
+ /** The npm spec of each tarball in `dir`, by the package name inside it. */
187
+ function readLocalPackages(dir) {
188
+ const root = path.resolve(dir);
189
+ const tarballs = fs.existsSync(root) ? fs.readdirSync(root).filter((f) => f.endsWith(".tgz")) : [];
190
+ if (tarballs.length === 0) throw new Error(`bundle-stack: no package tarballs (*.tgz) in ${root}`);
191
+ const specs = {};
192
+ for (const file of tarballs.sort()) {
193
+ const tarball = path.join(root, file);
194
+ const manifest = spawnSync("tar", [
195
+ "-xzOf",
196
+ tarball,
197
+ "package/package.json"
198
+ ], {
199
+ encoding: "utf8",
200
+ windowsHide: true
201
+ });
202
+ if (manifest.status !== 0) throw new Error(`bundle-stack: ${tarball} has no package/package.json: ${manifest.stderr}`);
203
+ const { name } = JSON.parse(manifest.stdout);
204
+ if (specs[name]) throw new Error(`bundle-stack: two tarballs for ${name} in ${root} (a stale pack?): ${specs[name].slice(5)} and ${tarball}`);
205
+ specs[name] = `file:${tarball}`;
206
+ }
207
+ return specs;
208
+ }
209
+ /**
210
+ * The staged stack's package.json. With local packages, every one is an
211
+ * override (so transitive dependents get it too) and the direct dependencies
212
+ * name the same spec: npm rejects an override that contradicts one.
213
+ */
214
+ function stackManifest(options) {
215
+ const local = options.local ?? {};
216
+ const spec = (pkg, fallback) => local[pkg] ?? fallback;
217
+ return {
218
+ name: options.name,
219
+ private: true,
220
+ type: "module",
221
+ dependencies: {
222
+ "@powerhousedao/ph-cli": spec("@powerhousedao/ph-cli", options.phCliSpec ?? options.version),
223
+ "@powerhousedao/host-core": spec("@powerhousedao/host-core", options.version)
224
+ },
225
+ ...Object.keys(local).length > 0 ? { overrides: local } : {}
226
+ };
227
+ }
228
+ /** A vendored tree installed from local tarballs: the same version numbers
229
+ * as the registry's, so npm would take either for the other. */
230
+ function vendoredFromLocal(stackDir) {
231
+ const lock = path.join(stackDir, "package-lock.json");
232
+ return fs.existsSync(lock) && fs.readFileSync(lock, "utf8").includes("\"resolved\": \"file:");
233
+ }
108
234
  function bundleStack(options) {
109
235
  const log = options.logger ?? console.log;
110
236
  const stackDir = path.join(options.shellProjectDir, "dist-stack");
@@ -136,16 +262,28 @@ function bundleStack(options) {
136
262
  }
137
263
  const sourcePkg = JSON.parse(fs.readFileSync(path.join(options.projectRoot, "package.json"), "utf8"));
138
264
  const version = options.phCliVersion ?? "dev";
139
- fs.writeFileSync(path.join(stackDir, "package.json"), `${JSON.stringify({
140
- name: sourcePkg.name ?? "powerhouse-desktop-stack",
265
+ const name = sourcePkg.name ?? "powerhouse-desktop-stack";
266
+ const vendor = options.vendor !== false;
267
+ const local = options.localPackagesDir ? readLocalPackages(options.localPackagesDir) : void 0;
268
+ if (vendor && (local || vendoredFromLocal(stackDir))) for (const entry of ["node_modules", "package-lock.json"]) fs.rmSync(path.join(stackDir, entry), {
269
+ recursive: true,
270
+ force: true
271
+ });
272
+ fs.writeFileSync(path.join(stackDir, "package.json"), `${JSON.stringify(local ? stackManifest({
273
+ name,
274
+ version,
275
+ phCliSpec: options.phCliSpec,
276
+ local
277
+ }) : {
278
+ name,
141
279
  private: true,
142
280
  type: "module",
143
281
  dependencies: { "@powerhousedao/ph-cli": version }
144
282
  }, null, 2)}\n`);
145
283
  let vendored = false;
146
- if (options.vendor !== false) {
147
- const specs = `"${options.phCliSpec ?? `@powerhousedao/ph-cli@${version}`}" "@powerhousedao/host-core@${version}"`;
148
- log(` vendoring ${specs} (hoisted, real files)…`);
284
+ if (vendor) {
285
+ const specs = local ? "" : `"${options.phCliSpec ?? `@powerhousedao/ph-cli@${version}`}" "@powerhousedao/host-core@${version}"`;
286
+ log(local ? ` vendoring ${Object.keys(local).length} local packages from ${options.localPackagesDir} (hoisted, real files)…` : ` vendoring ${specs} (hoisted, real files)…`);
149
287
  const result = spawnSync(`npm install ${specs} --install-strategy=hoisted --omit=dev --no-audit --no-fund`, {
150
288
  cwd: stackDir,
151
289
  stdio: "pipe",
@@ -237,6 +375,11 @@ const BUILD_RS = `// GENERATED — mirrors the reference shell. Connect is serve
237
375
  // need an explicit ACL; declaring the command manifest here generates the
238
376
  // allow-<command> permissions that capabilities/*.json grant.
239
377
  fn main() {
378
+ // The icon set is a COMPILE-TIME input (the Windows resource icon here,
379
+ // and the tray/window icon tauri::generate_context! embeds), but
380
+ // tauri-build registers no rerun trigger for it: without this line a
381
+ // regenerated icon set leaves the old icon compiled into the binary.
382
+ println!("cargo:rerun-if-changed=icons");
240
383
  tauri_build::try_build(tauri_build::Attributes::new().app_manifest(
241
384
  tauri_build::AppManifest::new().commands(&[
242
385
  "take_launch_files",
@@ -251,26 +394,68 @@ fn main() {
251
394
  * beside ui/index.html — not one of the downsampled `tauri icon` outputs, so
252
395
  * it stays sharp on HiDPI screens. Generated, like the rest of ui/. */
253
396
  const LOADING_LOGO = "logo.png";
397
+ /** The loading page's splash (app.json `splash`), copied beside it; shown
398
+ * instead of the square logo when set. Generated, like the rest of ui/. */
399
+ const LOADING_SPLASH = "splash.png";
400
+ /** Dark-scheme splash (app.json `splashDark`), beside the light one. */
401
+ const LOADING_SPLASH_DARK = "splash-dark.png";
254
402
  /** CSS size of the logo; the 1024² source keeps it crisp up to 8x DPR. */
255
403
  const LOGO_CSS_PX = 128;
256
- function loadingHtml(productName, logo) {
257
- const name = productName.replace(/[<&]/g, (c) => c === "<" ? "&lt;" : "&amp;");
258
- const logoTag = logo ? `<img class="logo" src="./${logo}" width="${LOGO_CSS_PX}" height="${LOGO_CSS_PX}" alt="" />
259
- ` : "";
404
+ function loadingHtml(app, art) {
405
+ const escape = (text) => text.replace(/[<&]/g, (c) => c === "<" ? "&lt;" : "&amp;");
406
+ const name = escape(app.productName);
407
+ const loading = app.loading;
408
+ const message = loading?.message ? escape(loading.message) : `Starting ${name}…`;
409
+ const pageColor = art.background?.color ?? null;
410
+ const background = pageColor?.light ?? loading?.background ?? "#0f1115";
411
+ const color = loading?.color ?? "#e6e8eb";
412
+ const accent = loading?.accent ?? "#4ade80";
413
+ const dark = loading?.dark;
414
+ const darkBackground = pageColor?.dark ?? dark?.background;
415
+ const darkVars = dark || darkBackground ? `
416
+ @media (prefers-color-scheme: dark) {
417
+ :root {
418
+ --bg: ${darkBackground ?? background};
419
+ --fg: ${dark?.color ?? color};
420
+ --accent: ${dark?.accent ?? accent};
421
+ }
422
+ }` : "";
423
+ const attr = (text) => text.replace(/&/g, "&amp;").replace(/"/g, "&quot;");
424
+ const layersTag = art.background && art.background.layers.length > 0 ? `<div class="layers" aria-hidden="true">
425
+ ${art.background.layers.map((layer) => layer.dark ? `<picture>
426
+ <source srcset="${attr(layer.dark)}" media="(prefers-color-scheme: dark)" />
427
+ <img src="${attr(layer.light)}" alt="" style="${attr(layer.style)}" />
428
+ </picture>` : `<img src="${attr(layer.light)}" alt="" style="${attr(layer.style)}" />`).join("\n ")}
429
+ </div>
430
+ ` : "";
431
+ const picture = (cls, file, darkFile, attrs = "") => darkFile ? `<picture>
432
+ <source srcset="./${darkFile}" media="(prefers-color-scheme: dark)" />
433
+ <img class="${cls}" src="./${file}" alt=""${attrs} />
434
+ </picture>
435
+ ` : `<img class="${cls}" src="./${file}" alt=""${attrs} />
436
+ `;
437
+ const main = art.main;
438
+ const 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}"`) : "";
439
+ const cornerTag = art.corner ? `<div class="corner" aria-hidden="true">${picture("art", art.corner.file, art.corner.dark)}</div>
440
+ ` : "";
260
441
  return `<!doctype html>
261
442
  <html lang="en">
262
443
  <head>
263
444
  <meta charset="utf-8" />
264
445
  <title>${name}</title>
265
446
  <style>
266
- :root { color-scheme: light dark; }
447
+ :root {
448
+ color-scheme: light dark;
449
+ --bg: ${background}; --fg: ${color}; --accent: ${accent};
450
+ }${darkVars}
267
451
  body {
268
- margin: 0; height: 100vh;
452
+ margin: 0; height: 100vh; overflow: hidden;
269
453
  display: flex; align-items: center; justify-content: center;
270
454
  font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
271
- background: #0f1115; color: #e6e8eb;
455
+ background: var(--bg); color: var(--fg);
272
456
  }
273
457
  .box {
458
+ position: relative; z-index: 1;
274
459
  text-align: center;
275
460
  display: flex; flex-direction: column; align-items: center; gap: 20px;
276
461
  }
@@ -278,9 +463,19 @@ function loadingHtml(productName, logo) {
278
463
  width: ${LOGO_CSS_PX}px; height: ${LOGO_CSS_PX}px;
279
464
  object-fit: contain; display: block;
280
465
  }
466
+ .splash {
467
+ width: min(720px, 80vw); max-height: 65vh;
468
+ object-fit: contain; display: block;
469
+ }
470
+ .corner {
471
+ position: fixed; right: 0; bottom: 0; z-index: 0;
472
+ width: clamp(220px, 30vw, 520px); line-height: 0; pointer-events: none;
473
+ }
474
+ .layers { position: fixed; inset: 0; z-index: 0; }
475
+ .art { width: 100%; height: auto; display: block; }
281
476
  .dot {
282
477
  width: 10px; height: 10px; border-radius: 50%;
283
- background: #4ade80; display: inline-block; margin-right: 8px;
478
+ background: var(--accent); display: inline-block; margin-right: 8px;
284
479
  animation: pulse 1.2s ease-in-out infinite;
285
480
  }
286
481
  @keyframes pulse { 0%,100% { opacity: .35 } 50% { opacity: 1 } }
@@ -289,9 +484,9 @@ function loadingHtml(productName, logo) {
289
484
  </head>
290
485
  <body>
291
486
  <div class="box">
292
- ${logoTag}<div><span class="dot"></span>Starting ${name}…</div>
487
+ ${logoTag}<div><span class="dot"></span>${message}</div>
293
488
  </div>
294
- </body>
489
+ ${layersTag}${cornerTag}</body>
295
490
  </html>
296
491
  `;
297
492
  }
@@ -316,6 +511,8 @@ function tauriConf(input) {
316
511
  width: win.width ?? 1440,
317
512
  height: win.height ?? 900,
318
513
  resizable: win.resizable ?? true,
514
+ ...win.minWidth ? { minWidth: win.minWidth } : {},
515
+ ...win.minHeight ? { minHeight: win.minHeight } : {},
319
516
  visible: true,
320
517
  dragDropEnabled: false,
321
518
  create: false
@@ -393,6 +590,11 @@ const GITIGNORE = `# Generated tauri shell — only Cargo.lock and app-icon.png
393
590
  /gen
394
591
  /icons
395
592
  /ui/logo.png
593
+ /ui/splash.png
594
+ /ui/splash-dark.png
595
+ /ui/art.*
596
+ /ui/art-dark.*
597
+ /ui/bg-*
396
598
  /dist-stack
397
599
  /binaries
398
600
  `;
@@ -419,12 +621,63 @@ function projectShell(input) {
419
621
  const shellDir = path.join(hostDir, SHELL_DIR);
420
622
  const iconSrc = path.resolve(hostDir, app.icon);
421
623
  const iconBytes = fs.existsSync(iconSrc) ? fs.readFileSync(iconSrc) : null;
624
+ const readRel = (rel) => {
625
+ if (!rel) return null;
626
+ const abs = path.resolve(hostDir, rel);
627
+ return fs.existsSync(abs) ? fs.readFileSync(abs) : null;
628
+ };
629
+ const splashBytes = readRel(app.splash);
630
+ const splashDarkBytes = readRel(app.splashDark);
631
+ const artBytes = readRel(app.loading?.art);
632
+ const artDarkBytes = readRel(app.loading?.artDark);
633
+ const artExt = (rel) => rel ? path.extname(rel).toLowerCase() || ".png" : ".png";
634
+ const artFile = `art${artExt(app.loading?.art)}`;
635
+ const artDarkFile = `art-dark${artExt(app.loading?.artDark)}`;
636
+ const background = normalizeBackground(app.background);
637
+ const staged = [];
638
+ const stage = (ref, stem) => {
639
+ if (isPassthroughImageRef(ref)) return ref;
640
+ const abs = path.resolve(hostDir, ref);
641
+ if (!fs.existsSync(abs)) return void 0;
642
+ const file = `${stem}${artExt(ref)}`;
643
+ staged.push([path.join(shellDir, "ui", file), fs.readFileSync(abs)]);
644
+ return `./${file}`;
645
+ };
646
+ const layers = (background?.layers ?? []).flatMap((layer, index) => {
647
+ const variants = imageVariants(layer.src);
648
+ const light = stage(variants.light, `bg-${index}`);
649
+ if (!light) return [];
650
+ const dark = variants.dark ? stage(variants.dark, `bg-${index}-dark`) : void 0;
651
+ return [{
652
+ light,
653
+ ...dark ? { dark } : {},
654
+ style: layerStyleText(layer)
655
+ }];
656
+ });
657
+ const art = {
658
+ main: background ? null : splashBytes ? {
659
+ kind: "splash",
660
+ file: LOADING_SPLASH,
661
+ ...splashDarkBytes ? { dark: LOADING_SPLASH_DARK } : {}
662
+ } : iconBytes ? {
663
+ kind: "logo",
664
+ file: LOADING_LOGO
665
+ } : null,
666
+ corner: !background && artBytes ? {
667
+ file: artFile,
668
+ ...artDarkBytes ? { dark: artDarkFile } : {}
669
+ } : null,
670
+ background: background ? {
671
+ color: colorVariants(background.color),
672
+ layers
673
+ } : null
674
+ };
422
675
  const files = [
423
676
  ["Cargo.toml", cargoToml(app, binName)],
424
677
  ["src/main.rs", MAIN_RS],
425
678
  ["build.rs", BUILD_RS],
426
679
  ["tauri.conf.json", tauriConf(input)],
427
- ["ui/index.html", loadingHtml(app.productName, iconBytes ? LOADING_LOGO : null)],
680
+ ["ui/index.html", loadingHtml(app, art)],
428
681
  ["capabilities/default.json", defaultCapability()],
429
682
  ["capabilities/connect.json", connectCapability(connectPort)],
430
683
  [".gitignore", GITIGNORE],
@@ -432,10 +685,20 @@ function projectShell(input) {
432
685
  ];
433
686
  let changed = false;
434
687
  for (const [rel, content] of files) if (writeIfChanged(path.join(shellDir, rel), content)) changed = true;
435
- if (iconBytes) {
436
- for (const dest of [path.join(shellDir, ICON_SOURCE), path.join(shellDir, "ui", LOADING_LOGO)]) if (!fs.existsSync(dest) || !fs.readFileSync(dest).equals(iconBytes)) {
688
+ const copies = [
689
+ [path.join(shellDir, ICON_SOURCE), iconBytes],
690
+ [path.join(shellDir, "ui", LOADING_LOGO), iconBytes],
691
+ [path.join(shellDir, "ui", LOADING_SPLASH), splashBytes],
692
+ [path.join(shellDir, "ui", LOADING_SPLASH_DARK), splashDarkBytes],
693
+ [path.join(shellDir, "ui", artFile), artBytes],
694
+ [path.join(shellDir, "ui", artDarkFile), artDarkBytes],
695
+ ...staged
696
+ ];
697
+ for (const [dest, bytes] of copies) {
698
+ if (!bytes) continue;
699
+ if (!fs.existsSync(dest) || !fs.readFileSync(dest).equals(bytes)) {
437
700
  fs.mkdirSync(path.dirname(dest), { recursive: true });
438
- fs.writeFileSync(dest, iconBytes);
701
+ fs.writeFileSync(dest, bytes);
439
702
  changed = true;
440
703
  }
441
704
  }
@@ -671,4 +934,4 @@ function launchShell(shell, envVars, options) {
671
934
  //#endregion
672
935
  export { 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 };
673
936
 
674
- //# sourceMappingURL=shell-DbRGck6R.mjs.map
937
+ //# sourceMappingURL=shell-CfgLhSXp.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shell-CfgLhSXp.mjs","names":[],"sources":["../src/app-json.ts","../src/bundle-stack.ts","../src/shell-project.ts","../src/shell-toolchain.ts","../src/shell.ts"],"sourcesContent":["import type { PHBackground } from \"@powerhousedao/shared/clis\";\nimport { validateBackground } from \"@powerhousedao/shared/connect\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { z } from \"zod\";\n\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 */\n\nconst identifierSchema = z\n .string()\n .min(1)\n .regex(\n /^[A-Za-z0-9-]+(\\.[A-Za-z0-9-]+)+$/,\n \"identifier must be reverse-DNS (e.g. com.acme.app): dot-separated alphanumeric segments\",\n );\n\nconst windowSchema = z\n .strictObject({\n title: z.string().min(1).optional(),\n width: z.number().int().positive().optional(),\n height: z.number().int().positive().optional(),\n resizable: z.boolean().optional(),\n /** Smallest size the window can be dragged to (logical pixels). */\n minWidth: z.number().int().positive().optional(),\n minHeight: z.number().int().positive().optional(),\n })\n .optional();\n\nconst cssColorSchema = z\n .string()\n .regex(\n /^#(?:[0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/,\n \"use a hex color (#rgb, #rgba, #rrggbb or #rrggbbaa)\",\n );\n\n/** The loading page's colors. */\nconst loadingColorsSchema = z.strictObject({\n /** Page background (default #0f1115). */\n background: cssColorSchema.nullable().optional(),\n /** Status text color (default #e6e8eb). */\n color: cssColorSchema.nullable().optional(),\n /** The pulsing status dot (default #4ade80). */\n accent: cssColorSchema.nullable().optional(),\n});\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\n .extend({\n /** Status line under the art (default \"Starting <productName>…\"). */\n message: z.string().min(1).nullable().optional(),\n /** Colors for `prefers-color-scheme: dark`; without it the page keeps\n * the light colors in both schemes. */\n dark: loadingColorsSchema.nullable().optional(),\n /** Deprecated: a decoration pinned to the bottom-right corner, relative\n * to app.json, with `artDark` its dark-scheme counterpart. Superseded by\n * the top-level `background`, which ignores these when set. */\n art: z.string().min(1).nullable().optional(),\n artDark: z.string().min(1).nullable().optional(),\n })\n .nullable()\n .optional();\n\n// The loading page's background: the same `PHBackground` as Connect's\n// `connect.branding.homeBackground` (shared/clis/types.ts), so the scaffold\n// can copy one into the other and both pages place their art alike. Paths\n// are relative to app.json; URLs and data URIs pass through.\nconst imageRefSchema = z.string().min(1);\nconst schemedImageSchema = z.union([\n imageRefSchema,\n z.strictObject({\n light: imageRefSchema,\n dark: imageRefSchema.nullable().optional(),\n }),\n]);\nconst lengthSchema = z\n .union([z.number(), z.string().min(1)])\n .nullable()\n .optional();\nconst edgesSchema = z\n .strictObject({\n top: lengthSchema,\n right: lengthSchema,\n bottom: lengthSchema,\n left: lengthSchema,\n })\n .nullable()\n .optional();\nconst backgroundLayerSchema = z.strictObject({\n src: schemedImageSchema,\n position: edgesSchema,\n width: lengthSchema,\n height: lengthSchema,\n minWidth: lengthSchema,\n minHeight: lengthSchema,\n maxWidth: lengthSchema,\n maxHeight: lengthSchema,\n opacity: z.number().min(0).max(1).nullable().optional(),\n fade: edgesSchema,\n});\nconst backgroundSchema = z\n .union([\n imageRefSchema,\n z.strictObject({\n color: z\n .union([\n z.string().min(1),\n z.strictObject({\n light: z.string().min(1),\n dark: z.string().min(1).nullable().optional(),\n }),\n ])\n .nullable()\n .optional(),\n layers: z.array(backgroundLayerSchema),\n }),\n ])\n .superRefine((background: PHBackground, ctx) => {\n for (const problem of validateBackground(background, \"background\")) {\n ctx.addIssue({ code: \"custom\", message: problem });\n }\n })\n .nullable()\n .optional();\n\nconst fileAssociationSchema = z.strictObject({\n /** Extensions WITHOUT the leading dot (\"phd\", not \".phd\"). */\n ext: z.array(z.string().min(1).regex(/^[^.]/, \"drop the leading dot\")).min(1),\n name: z.string().min(1),\n description: z.string().optional(),\n mimeType: z.string().optional(),\n});\n\n/** Where the generated Cargo.toml resolves `ph-desktop-shell` from. Default\n * (omitted) = the published crates.io version. */\nconst shellSourceSchema = z\n .strictObject({\n /** Local checkout for shell development (the lab points here). */\n path: z.string().min(1).optional(),\n /** Git source, pinned to a tag/rev, for pre-publication consumption. */\n git: z.string().min(1).optional(),\n tag: z.string().min(1).optional(),\n rev: z.string().min(1).optional(),\n /** crates.io version requirement (default DEFAULT_SHELL_CRATE_VERSION). */\n version: z.string().min(1).optional(),\n })\n .refine((s) => !(s.path && s.git), {\n message: \"shell.source: set path OR git, not both\",\n })\n .optional();\n\nexport const appJsonSchema = z.strictObject({\n identifier: identifierSchema,\n productName: z.string().min(1),\n /** Single source image (square PNG, 1024×1024 recommended); the icon set\n * for every platform is generated from it via `tauri icon`. */\n icon: z.string().min(1),\n /** The loading page's background: images positioned and sized over a\n * page colour (`{ color, layers }`), or one image pinned bottom-right.\n * The status line stays centred above them. `ph generate desktop-shell`\n * copies Connect's `connect.branding.homeBackground` here. null or\n * omitted: the app icon (or `splash`) above the status line. */\n background: backgroundSchema,\n /** Deprecated in favour of `background`: a wide splash image shown above\n * the status line instead of the square icon. Relative to this file. */\n splash: z.string().min(1).nullable().optional(),\n /** Deprecated with `splash`: its `prefers-color-scheme: dark` variant. */\n splashDark: z.string().min(1).nullable().optional(),\n loading: loadingSchema,\n window: windowSchema,\n fileAssociations: z.array(fileAssociationSchema).optional(),\n shell: shellSourceSchema,\n});\n\nexport type AppJson = z.infer<typeof appJsonSchema>;\nexport type AppJsonShellSource = NonNullable<AppJson[\"shell\"]>;\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). */\nexport const DEFAULT_SHELL_CRATE_VERSION = \"0.1\";\n\nexport const APP_JSON_FILE = \"app.json\";\n\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. */\nexport function loadAppJson(hostDir: string): AppJson {\n const file = path.join(hostDir, APP_JSON_FILE);\n if (!fs.existsSync(file)) {\n throw new Error(\n `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 );\n }\n let raw: unknown;\n try {\n raw = JSON.parse(fs.readFileSync(file, \"utf8\"));\n } catch (error) {\n throw new Error(`${file}: not valid JSON — ${String(error)}`, {\n cause: error,\n });\n }\n const result = appJsonSchema.safeParse(raw);\n if (!result.success) {\n const issues = result.error.issues\n .map((i) => ` ${i.path.join(\".\") || \"(root)\"}: ${i.message}`)\n .join(\"\\n\");\n throw new Error(`${file} is invalid:\\n${issues}`);\n }\n return result.data;\n}\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. */\nexport function appSlug(app: AppJson): string {\n const fromName = app.productName\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\");\n if (fromName) return fromName;\n const seg = app.identifier.split(\".\").pop() ?? \"app\";\n return seg.toLowerCase().replace(/[^a-z0-9]+/g, \"-\");\n}\n","import { spawnSync } from \"node:child_process\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\n\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 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 */\nexport interface BundleStackOptions {\n projectRoot: string;\n shellProjectDir: string;\n /** Vendor the runtime packages (slow). Skipped when false — an existing\n * vendored tree is left in place. */\n vendor?: boolean;\n /** The ph-cli version/tag to vendor. Default: \"dev\". NOTE: the vendored\n * ph-cli must carry the `run` command — registry tags published before\n * uniform-runners landed cannot run a stack; until a nightly catches up,\n * pass `phCliSpec` with a locally packed tarball instead. */\n phCliVersion?: string;\n /** Overrides the ph-cli install spec entirely (e.g. a `pnpm pack` tarball\n * path for a not-yet-published build). */\n phCliSpec?: string;\n /** A directory of `pnpm pack` tarballs (env PH_DESKTOP_LOCAL_PACKAGES).\n * Each replaces its package everywhere in the vendored tree: a packed\n * ph-cli alone would still pull its dependencies, at the same version\n * number, from the registry. `pnpm pack:desktop-stack` in the monorepo\n * packs the set ph-cli and host-core need. */\n localPackagesDir?: string;\n /** The connect member's port — written into the stack's shell.json so the\n * shell knows where to probe/navigate with no environment at all. */\n connectPort?: number;\n /** Absolute paths to skip when staging `hosts/` — in mode 1 the generated\n * shell dir sits under `hosts/` and must not be copied into itself. */\n excludeDirs?: string[];\n logger?: (message: string) => void;\n}\n\nexport interface BundleStackResult {\n stackDir: string;\n vendored: boolean;\n}\n\nfunction copyIfExists(from: string, to: string): boolean {\n if (!fs.existsSync(from)) return false;\n fs.cpSync(from, to, { recursive: true });\n return true;\n}\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(\n src: string,\n dest: string,\n excludes: string[],\n): boolean {\n if (!fs.existsSync(src)) return false;\n const skip = new Set(excludes.map((e) => path.resolve(e)));\n const walk = (s: string, d: string): void => {\n if (skip.has(path.resolve(s))) return;\n const stat = fs.statSync(s);\n if (stat.isDirectory()) {\n fs.mkdirSync(d, { recursive: true });\n for (const entry of fs.readdirSync(s)) {\n walk(path.join(s, entry), path.join(d, entry));\n }\n } else {\n fs.copyFileSync(s, d);\n }\n };\n walk(src, dest);\n return true;\n}\n\n/** The npm spec of each tarball in `dir`, by the package name inside it. */\nexport function readLocalPackages(dir: string): Record<string, string> {\n const root = path.resolve(dir);\n const tarballs = fs.existsSync(root)\n ? fs.readdirSync(root).filter((f) => f.endsWith(\".tgz\"))\n : [];\n if (tarballs.length === 0) {\n throw new Error(`bundle-stack: no package tarballs (*.tgz) in ${root}`);\n }\n const specs: Record<string, string> = {};\n for (const file of tarballs.sort()) {\n const tarball = path.join(root, file);\n const manifest = spawnSync(\n \"tar\",\n [\"-xzOf\", tarball, \"package/package.json\"],\n {\n encoding: \"utf8\",\n windowsHide: true,\n },\n );\n if (manifest.status !== 0) {\n throw new Error(\n `bundle-stack: ${tarball} has no package/package.json: ${manifest.stderr}`,\n );\n }\n const { name } = JSON.parse(manifest.stdout) as { name: string };\n if (specs[name]) {\n throw new Error(\n `bundle-stack: two tarballs for ${name} in ${root} (a stale pack?): ` +\n `${specs[name].slice(\"file:\".length)} and ${tarball}`,\n );\n }\n specs[name] = `file:${tarball}`;\n }\n return specs;\n}\n\nexport interface StackManifestOptions {\n name: string;\n /** The registry version for what `local` lacks. */\n version: string;\n phCliSpec?: string;\n /** Package name → spec, from readLocalPackages. */\n local?: Record<string, string>;\n}\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 */\nexport function stackManifest(options: StackManifestOptions) {\n const local = options.local ?? {};\n const spec = (pkg: string, fallback: string) => local[pkg] ?? fallback;\n return {\n name: options.name,\n private: true,\n type: \"module\",\n dependencies: {\n \"@powerhousedao/ph-cli\": spec(\n \"@powerhousedao/ph-cli\",\n options.phCliSpec ?? options.version,\n ),\n \"@powerhousedao/host-core\": spec(\n \"@powerhousedao/host-core\",\n options.version,\n ),\n },\n ...(Object.keys(local).length > 0 ? { overrides: local } : {}),\n };\n}\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: string): boolean {\n const lock = path.join(stackDir, \"package-lock.json\");\n return (\n fs.existsSync(lock) &&\n fs.readFileSync(lock, \"utf8\").includes('\"resolved\": \"file:')\n );\n}\n\nexport function bundleStack(options: BundleStackOptions): BundleStackResult {\n const log = options.logger ?? console.log;\n const stackDir = path.join(options.shellProjectDir, \"dist-stack\");\n\n // Fresh staging for project files; the vendored node_modules survives\n // unless re-vendoring (it is by far the slowest part).\n for (const entry of [\n \"hosts\",\n \"agents\",\n \"dist\",\n \"powerhouse.config.json\",\n \"package.json\",\n ]) {\n fs.rmSync(path.join(stackDir, entry), { recursive: true, force: true });\n }\n fs.mkdirSync(stackDir, { recursive: true });\n\n // hosts/ gets the filtered copy — the generated shell subtree lives under\n // it and must not be copied into itself (nor shipped in the stack).\n const hostsStaged = copyDirFiltered(\n path.join(options.projectRoot, \"hosts\"),\n path.join(stackDir, \"hosts\"),\n options.excludeDirs ?? [],\n );\n log(` hosts/ ${hostsStaged ? \"staged\" : \"absent — skipped\"}`);\n for (const dir of [\"agents\", \"dist\"]) {\n const copied = copyIfExists(\n path.join(options.projectRoot, dir),\n path.join(stackDir, dir),\n );\n log(` ${dir}/ ${copied ? \"staged\" : \"absent — skipped\"}`);\n }\n\n // Inside the package there is no nested shell — the shell IS the window —\n // so the staged desktop host runs on the generic compound. Rewrite the\n // runner.module projection in the STAGED copy only.\n const stagedDesktopHost = path.join(stackDir, \"hosts\", \"desktop\", \"host.js\");\n if (fs.existsSync(stagedDesktopHost)) {\n const source = fs.readFileSync(stagedDesktopHost, \"utf8\");\n if (source.includes(\"@powerhousedao/desktop/runner\")) {\n fs.writeFileSync(\n stagedDesktopHost,\n \"// STAGED COPY (bundle-stack): runner.module rewritten to the generic\\n\" +\n \"// compound — the packaged shell is the window; there is no nested shell.\\n\" +\n source.replace(\n /@powerhousedao\\/desktop\\/runner/g,\n \"@powerhousedao/host-core/runners/compound\",\n ),\n );\n log(\n \" hosts/desktop/host.js: runner rewritten to the generic compound (staged copy)\",\n );\n }\n }\n copyIfExists(\n path.join(options.projectRoot, \"powerhouse.config.json\"),\n path.join(stackDir, \"powerhouse.config.json\"),\n );\n\n // shell.json: the stack's contract with the shell. The no-env (packaged)\n // path has nobody to set PH_WIN_CONNECT_PORT, so the shell reads the probe\n // and window port from here.\n if (typeof options.connectPort === \"number\") {\n fs.writeFileSync(\n path.join(stackDir, \"shell.json\"),\n `${JSON.stringify({ connectPort: options.connectPort }, null, 2)}\\n`,\n );\n log(` shell.json: connectPort ${options.connectPort}`);\n }\n\n // A minimal manifest: names the project (lock identity) and depends on\n // ph-cli so the vendored tree resolves exactly like a real install.\n const sourcePkg = JSON.parse(\n fs.readFileSync(path.join(options.projectRoot, \"package.json\"), \"utf8\"),\n ) as { name?: string };\n const version = options.phCliVersion ?? \"dev\";\n const name = sourcePkg.name ?? \"powerhouse-desktop-stack\";\n const vendor = options.vendor !== false;\n const local = options.localPackagesDir\n ? readLocalPackages(options.localPackagesDir)\n : undefined;\n // Switching between local and registry packages starts the tree afresh:\n // their version numbers match, so npm would keep whichever it has.\n if (vendor && (local || vendoredFromLocal(stackDir))) {\n for (const entry of [\"node_modules\", \"package-lock.json\"]) {\n fs.rmSync(path.join(stackDir, entry), { recursive: true, force: true });\n }\n }\n fs.writeFileSync(\n path.join(stackDir, \"package.json\"),\n `${JSON.stringify(\n local\n ? stackManifest({ name, version, phCliSpec: options.phCliSpec, local })\n : {\n name,\n private: true,\n type: \"module\",\n dependencies: { \"@powerhousedao/ph-cli\": version },\n },\n null,\n 2,\n )}\\n`,\n );\n\n let vendored = false;\n if (vendor) {\n // Local: the manifest names every spec. Registry: host-core rides along\n // with ph-cli, since host files resolve runner modules (the generic\n // compound) from the STACK's own node_modules.\n const specs = local\n ? \"\"\n : `\"${options.phCliSpec ?? `@powerhousedao/ph-cli@${version}`}\" \"@powerhousedao/host-core@${version}\"`;\n log(\n local\n ? ` vendoring ${Object.keys(local).length} local packages from ${options.localPackagesDir} (hoisted, real files)…`\n : ` vendoring ${specs} (hoisted, real files)…`,\n );\n // One command string: shell:true with an args ARRAY concatenates without\n // escaping (DEP0190 warns); the spec values are our own constants/paths.\n const result = spawnSync(\n `npm install ${specs} --install-strategy=hoisted --omit=dev --no-audit --no-fund`,\n { cwd: stackDir, stdio: \"pipe\", shell: true, windowsHide: true },\n );\n if (result.status !== 0) {\n throw new Error(\n `bundle-stack: vendoring failed (${result.status}):\\n` +\n `${result.stderr.toString().slice(-800)}`,\n );\n }\n vendored = true;\n } else {\n log(\" vendoring skipped (vendor: false) — existing tree left in place\");\n }\n\n return { stackDir, vendored };\n}\n","import {\n colorVariants,\n imageVariants,\n layerStyleText,\n normalizeBackground,\n} from \"@powerhousedao/shared/connect\";\nimport { isPassthroughImageRef } from \"@powerhousedao/shared/connect/image-ref\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport {\n appSlug,\n DEFAULT_SHELL_CRATE_VERSION,\n type AppJson,\n type AppJsonShellSource,\n} from \"./app-json.js\";\n\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 */\n\nexport const SHELL_DIR = \"tauri-shell\";\n/** The icon source the runner feeds to `tauri icon` (copied from app.icon). */\nexport const ICON_SOURCE = \"app-icon.png\";\n\nexport interface ProjectShellInput {\n /** hosts/<host>/ — where app.json lives and tauri-shell/ is written. */\n hostDir: string;\n app: AppJson;\n /** The connect member's port — baked into the remote capability so the\n * served Connect origin can reach the shell's launch-queue commands. */\n connectPort: number;\n}\n\nexport interface ProjectShellResult {\n shellDir: string;\n /** The crate/bin name (and the built exe stem the runner looks for). */\n binName: string;\n /** True when any projected file was created or changed this call. */\n changed: boolean;\n}\n\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: AppJsonShellSource | undefined): string {\n if (source?.path) {\n // Forward slashes work in Cargo.toml on every platform.\n const p = source.path.replace(/\\\\/g, \"/\");\n return `ph-desktop-shell = { path = ${JSON.stringify(p)} }`;\n }\n if (source?.git) {\n const parts = [`git = ${JSON.stringify(source.git)}`];\n if (source.tag) parts.push(`tag = ${JSON.stringify(source.tag)}`);\n if (source.rev) parts.push(`rev = ${JSON.stringify(source.rev)}`);\n return `ph-desktop-shell = { ${parts.join(\", \")} }`;\n }\n const version = source?.version ?? DEFAULT_SHELL_CRATE_VERSION;\n return `ph-desktop-shell = ${JSON.stringify(version)}`;\n}\n\nfunction cargoToml(app: AppJson, binName: string): string {\n return `# 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}\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`;\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\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/. */\nexport const LOADING_LOGO = \"logo.png\";\n\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/. */\nexport const LOADING_SPLASH = \"splash.png\";\n/** Dark-scheme splash (app.json `splashDark`), beside the light one. */\nexport const LOADING_SPLASH_DARK = \"splash-dark.png\";\n/** Corner decoration (app.json `loading.art` / `loading.artDark`). */\nexport const LOADING_ART = \"art\";\n/** The background's layers (app.json `background`): `bg-<n>.<ext>` and\n * `bg-<n>-dark.<ext>` beside the page. */\nexport const LOADING_BG = \"bg\";\n\n/** CSS size of the logo; the 1024² source keeps it crisp up to 8x DPR. */\nconst LOGO_CSS_PX = 128;\n\n/** One layer of the page's background, staged beside the page (or a URL /\n * data URI as given) with the style that places it. */\ntype LoadingLayer = { light: string; dark?: string; style: string };\n\n/** The art the loading page shows: a layered background (app.json\n * `background`) under the centred status line; or, without one, the wide\n * splash (with an optional dark counterpart) else the square logo above the\n * status line, plus an optional corner decoration. */\ntype LoadingArt = {\n main: { kind: \"logo\" | \"splash\"; file: string; dark?: string } | null;\n corner: { file: string; dark?: string } | null;\n background: {\n color: { light: string; dark?: string } | null;\n layers: LoadingLayer[];\n } | null;\n};\n\nfunction loadingHtml(app: AppJson, art: LoadingArt): string {\n const escape = (text: string) =>\n text.replace(/[<&]/g, (c) => (c === \"<\" ? \"&lt;\" : \"&amp;\"));\n const name = escape(app.productName);\n const loading = app.loading;\n const message = loading?.message\n ? escape(loading.message)\n : `Starting ${name}…`;\n // The background's own colour (scheme-aware) beats the loading colours.\n const pageColor = art.background?.color ?? null;\n const background = pageColor?.light ?? loading?.background ?? \"#0f1115\";\n const color = loading?.color ?? \"#e6e8eb\";\n const accent = loading?.accent ?? \"#4ade80\";\n const dark = loading?.dark;\n const darkBackground = pageColor?.dark ?? dark?.background;\n const darkVars =\n dark || darkBackground\n ? `\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 : \"\";\n const attr = (text: string) =>\n text.replace(/&/g, \"&amp;\").replace(/\"/g, \"&quot;\");\n // The background's layers, each placed by the shared layer style (the\n // same declarations Connect's home screen applies), swapped by scheme.\n const layersTag =\n art.background && art.background.layers.length > 0\n ? `<div class=\"layers\" aria-hidden=\"true\">\n ${art.background.layers\n .map((layer) =>\n layer.dark\n ? `<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>`\n : `<img src=\"${attr(layer.light)}\" alt=\"\" style=\"${attr(layer.style)}\" />`,\n )\n .join(\"\\n \")}\n </div>\n `\n : \"\";\n // <picture> swaps the file by color scheme; a plain <img> otherwise.\n const picture = (\n cls: string,\n file: string,\n darkFile: string | undefined,\n attrs = \"\",\n ) =>\n darkFile\n ? `<picture>\n <source srcset=\"./${darkFile}\" media=\"(prefers-color-scheme: dark)\" />\n <img class=\"${cls}\" src=\"./${file}\" alt=\"\"${attrs} />\n </picture>\n `\n : `<img class=\"${cls}\" src=\"./${file}\" alt=\"\"${attrs} />\n `;\n const main = art.main;\n const logoTag =\n main?.kind === \"splash\"\n ? picture(\"splash\", main.file, main.dark)\n : main\n ? picture(\n \"logo\",\n main.file,\n main.dark,\n ` width=\"${LOGO_CSS_PX}\" height=\"${LOGO_CSS_PX}\"`,\n )\n : \"\";\n const cornerTag = art.corner\n ? `<div class=\"corner\" aria-hidden=\"true\">${picture(\"art\", art.corner.file, art.corner.dark)}</div>\n `\n : \"\";\n return `<!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}\n\nfunction tauriConf(input: ProjectShellInput): string {\n const { app } = input;\n const win = app.window ?? {};\n const fileAssociations =\n app.fileAssociations && app.fileAssociations.length > 0\n ? app.fileAssociations.map((fa) => ({\n ext: fa.ext,\n name: fa.name,\n ...(fa.description ? { description: fa.description } : {}),\n ...(fa.mimeType ? { mimeType: fa.mimeType } : {}),\n }))\n : undefined;\n const conf = {\n $schema: \"https://schema.tauri.app/config/2\",\n productName: app.productName,\n version: \"0.1.0\",\n identifier: app.identifier,\n build: { frontendDist: \"./ui\" },\n app: {\n windows: [\n {\n title: win.title ?? app.productName,\n width: win.width ?? 1440,\n height: win.height ?? 900,\n resizable: win.resizable ?? true,\n ...(win.minWidth ? { minWidth: win.minWidth } : {}),\n ...(win.minHeight ? { minHeight: win.minHeight } : {}),\n visible: true,\n dragDropEnabled: false,\n create: false,\n },\n ],\n security: { csp: null },\n },\n bundle: {\n active: true,\n // Cross-platform: nsis (Windows, no WiX), app+dmg (macOS). The runner\n // passes host-appropriate --bundles at build time; tauri skips targets\n // not valid for the build host.\n targets: [\"nsis\", \"app\", \"dmg\"],\n // `tauri icon` generates .ico (Windows) and .icns (macOS) + pngs from\n // the single app-icon.png; the config references the per-platform set.\n icon: [\n \"icons/32x32.png\",\n \"icons/128x128.png\",\n \"icons/128x128@2x.png\",\n \"icons/icon.icns\",\n \"icons/icon.ico\",\n ],\n ...(fileAssociations ? { fileAssociations } : {}),\n externalBin: [\"binaries/node\"],\n resources: { \"./dist-stack\": \"stack\" },\n },\n };\n return JSON.stringify(conf, null, 2) + \"\\n\";\n}\n\nfunction defaultCapability(): string {\n return (\n JSON.stringify(\n {\n $schema: \"../gen/schemas/desktop-schema.json\",\n identifier: \"default\",\n description: \"Lets the shell spawn the bundled node sidecar.\",\n windows: [\"main\"],\n permissions: [\n \"core:default\",\n \"allow-take-launch-files\",\n \"allow-read-launch-file\",\n \"allow-log-from-webview\",\n {\n identifier: \"shell:allow-spawn\",\n allow: [{ name: \"binaries/node\", sidecar: true, args: true }],\n },\n {\n identifier: \"shell:allow-execute\",\n allow: [{ name: \"binaries/node\", sidecar: true, args: true }],\n },\n ],\n },\n null,\n 2,\n ) + \"\\n\"\n );\n}\n\nfunction connectCapability(connectPort: number): string {\n const origin = `http://127.0.0.1:${connectPort}`;\n return (\n JSON.stringify(\n {\n $schema: \"../gen/schemas/desktop-schema.json\",\n identifier: \"connect\",\n description:\n \"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 windows: [\"main\"],\n remote: { urls: [origin, `${origin}/*`] },\n permissions: [\n \"allow-take-launch-files\",\n \"allow-read-launch-file\",\n \"allow-log-from-webview\",\n ],\n },\n null,\n 2,\n ) + \"\\n\"\n );\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`;\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\n/** Write a file only when its content differs; returns whether it changed. */\nfunction writeIfChanged(file: string, content: string): boolean {\n if (fs.existsSync(file) && fs.readFileSync(file, \"utf8\") === content) {\n return false;\n }\n fs.mkdirSync(path.dirname(file), { recursive: true });\n fs.writeFileSync(file, content);\n return true;\n}\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 */\nexport function projectShell(input: ProjectShellInput): ProjectShellResult {\n const { hostDir, app, connectPort } = input;\n const binName = appSlug(app);\n const shellDir = path.join(hostDir, SHELL_DIR);\n const iconSrc = path.resolve(hostDir, app.icon);\n const iconBytes = fs.existsSync(iconSrc) ? fs.readFileSync(iconSrc) : null;\n const readRel = (rel: string | null | undefined): Buffer | null => {\n if (!rel) return null;\n const abs = path.resolve(hostDir, rel);\n return fs.existsSync(abs) ? fs.readFileSync(abs) : null;\n };\n const splashBytes = readRel(app.splash);\n const splashDarkBytes = readRel(app.splashDark);\n const artBytes = readRel(app.loading?.art);\n const artDarkBytes = readRel(app.loading?.artDark);\n const artExt = (rel: string | null | undefined) =>\n rel ? path.extname(rel).toLowerCase() || \".png\" : \".png\";\n const artFile = `${LOADING_ART}${artExt(app.loading?.art)}`;\n const artDarkFile = `${LOADING_ART}-dark${artExt(app.loading?.artDark)}`;\n // The background's layers: a file beside app.json is staged beside the\n // page as bg-<n>[-dark].<ext>; a URL or data URI is used as given; a layer\n // whose light image is missing is dropped (a missing dark one falls back\n // to the light one).\n const background = normalizeBackground(app.background);\n const staged: Array<[string, Buffer]> = [];\n const stage = (ref: string, stem: string): string | undefined => {\n if (isPassthroughImageRef(ref)) return ref;\n const abs = path.resolve(hostDir, ref);\n if (!fs.existsSync(abs)) return undefined;\n const file = `${stem}${artExt(ref)}`;\n staged.push([path.join(shellDir, \"ui\", file), fs.readFileSync(abs)]);\n return `./${file}`;\n };\n const layers = (background?.layers ?? []).flatMap(\n (layer, index): LoadingLayer[] => {\n const variants = imageVariants(layer.src);\n const light = stage(variants.light, `${LOADING_BG}-${index}`);\n if (!light) return [];\n const dark = variants.dark\n ? stage(variants.dark, `${LOADING_BG}-${index}-dark`)\n : undefined;\n return [\n { light, ...(dark ? { dark } : {}), style: layerStyleText(layer) },\n ];\n },\n );\n // A background replaces the splash/logo and the corner art: its layers are\n // the page's decoration, the status line stays centred above them.\n const art: LoadingArt = {\n main: background\n ? null\n : splashBytes\n ? {\n kind: \"splash\",\n file: LOADING_SPLASH,\n ...(splashDarkBytes ? { dark: LOADING_SPLASH_DARK } : {}),\n }\n : iconBytes\n ? { kind: \"logo\", file: LOADING_LOGO }\n : null,\n corner:\n !background && artBytes\n ? { file: artFile, ...(artDarkBytes ? { dark: artDarkFile } : {}) }\n : null,\n background: background\n ? { color: colorVariants(background.color), layers }\n : null,\n };\n const files: Array<[string, string]> = [\n [\"Cargo.toml\", cargoToml(app, binName)],\n [\"src/main.rs\", MAIN_RS],\n [\"build.rs\", BUILD_RS],\n [\"tauri.conf.json\", tauriConf(input)],\n [\"ui/index.html\", loadingHtml(app, art)],\n [\"capabilities/default.json\", defaultCapability()],\n [\"capabilities/connect.json\", connectCapability(connectPort)],\n [\".gitignore\", GITIGNORE],\n [\"dist-stack/README.md\", DIST_STACK_README],\n ];\n let changed = false;\n for (const [rel, content] of files) {\n if (writeIfChanged(path.join(shellDir, rel), content)) changed = true;\n }\n // Stage the icon source next to the shell (tauri icon reads it at build),\n // the same full-resolution source as the loading page's logo, and the\n // splash when app.json names one.\n const copies: Array<[string, Buffer | null]> = [\n [path.join(shellDir, ICON_SOURCE), iconBytes],\n [path.join(shellDir, \"ui\", LOADING_LOGO), iconBytes],\n [path.join(shellDir, \"ui\", LOADING_SPLASH), splashBytes],\n [path.join(shellDir, \"ui\", LOADING_SPLASH_DARK), splashDarkBytes],\n [path.join(shellDir, \"ui\", artFile), artBytes],\n [path.join(shellDir, \"ui\", artDarkFile), artDarkBytes],\n ...staged,\n ];\n for (const [dest, bytes] of copies) {\n if (!bytes) continue;\n if (!fs.existsSync(dest) || !fs.readFileSync(dest).equals(bytes)) {\n fs.mkdirSync(path.dirname(dest), { recursive: true });\n fs.writeFileSync(dest, bytes);\n changed = true;\n }\n }\n return { shellDir, binName, changed };\n}\n","import { execSync, spawnSync } from \"node:child_process\";\nimport fs from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport path from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\n\n/**\n * The native toolchain the generated shell (mode 1) needs to build/run, and\n * the provisioning steps around it. `cargo tauri dev|build` compiles the\n * generated crate — but tauri-build validates two things AT COMPILE TIME that\n * must exist first (both confirmed against a live `cargo check`):\n * - the node sidecar `binaries/node-<triple>` (externalBin), and\n * - `icons/icon.ico` on Windows (the app's Win32 resource).\n * So dev/build provision the sidecar + icon set before invoking tauri, and\n * fail with install guidance when cargo or the Tauri CLI is absent — a\n * missing executable must read as a clear instruction, never a deep cargo\n * stack trace.\n */\n\nexport interface NodeTarget {\n triple: string;\n dist: string;\n /** Path within the extracted archive (POSIX) / \"node.exe\" on Windows. */\n bin: string;\n ext: string;\n}\n\n/** The Node release triple for a build host — the sidecar filename tauri\n * resolves (`node-<triple>`). Pure, so the mapping is unit-tested. */\nexport function nodeSidecarTarget(\n platform: NodeJS.Platform,\n arch: string,\n): NodeTarget {\n const table: Record<string, NodeTarget | undefined> = {\n \"win32 x64\": {\n triple: \"x86_64-pc-windows-msvc\",\n dist: \"win-x64\",\n bin: \"node.exe\",\n ext: \".exe\",\n },\n \"darwin arm64\": {\n triple: \"aarch64-apple-darwin\",\n dist: \"darwin-arm64\",\n bin: \"bin/node\",\n ext: \"\",\n },\n \"darwin x64\": {\n triple: \"x86_64-apple-darwin\",\n dist: \"darwin-x64\",\n bin: \"bin/node\",\n ext: \"\",\n },\n \"linux x64\": {\n triple: \"x86_64-unknown-linux-gnu\",\n dist: \"linux-x64\",\n bin: \"bin/node\",\n ext: \"\",\n },\n };\n const target = table[`${platform} ${arch}`];\n if (!target) {\n throw new Error(\n `No Node sidecar mapping for ${platform} ${arch} — the desktop shell ` +\n `supports win32/x64, darwin/arm64, darwin/x64, linux/x64.`,\n );\n }\n return target;\n}\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). */\nexport function fetchNodeSidecar(\n shellDir: string,\n version: string = process.versions.node,\n platform: NodeJS.Platform = process.platform,\n arch: string = process.arch,\n): string {\n const target = nodeSidecarTarget(platform, arch);\n const binariesDir = path.join(shellDir, \"binaries\");\n fs.mkdirSync(binariesDir, { recursive: true });\n const dest = path.join(binariesDir, `node-${target.triple}${target.ext}`);\n if (fs.existsSync(dest)) return dest;\n\n if (platform === \"win32\") {\n const url = `https://nodejs.org/dist/v${version}/win-x64/node.exe`;\n execSync(`curl -fsSL -o \"${dest}\" \"${url}\"`, { stdio: \"inherit\" });\n } else {\n const name = `node-v${version}-${target.dist}`;\n const url = `https://nodejs.org/dist/v${version}/${name}.tar.gz`;\n execSync(\n `curl -fsSL \"${url}\" | tar -xz -C \"${binariesDir}\" --strip-components=2 ${name}/${target.bin}`,\n { stdio: \"inherit\", shell: \"/bin/sh\" },\n );\n fs.renameSync(path.join(binariesDir, \"node\"), dest);\n fs.chmodSync(dest, 0o755);\n }\n return dest;\n}\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. */\nexport function tauriBundlesForHost(\n platform: NodeJS.Platform = process.platform,\n): string[] {\n switch (platform) {\n case \"darwin\":\n return [\"app\", \"dmg\"];\n case \"win32\":\n return [\"nsis\"];\n default:\n return [\"deb\", \"appimage\"];\n }\n}\n\nexport interface TauriCommand {\n /** The executable to spawn (e.g. \"cargo\" or a node path). */\n cmd: string;\n /** Args that precede the tauri subcommand (e.g. [\"tauri\"] for cargo). */\n prefix: string[];\n /** How the CLI was found — for logging + the preflight message. */\n via: \"cargo-tauri\" | \"node-cli\";\n}\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. */\nexport function tauriSpawn(\n tauri: TauriCommand,\n subcommand: string[],\n): { command: string; args: string[]; shell: boolean } {\n const argv = [...tauri.prefix, ...subcommand];\n if (tauri.cmd === \"cargo\" && process.platform === \"win32\") {\n return { command: [\"cargo\", ...argv].join(\" \"), args: [], shell: true };\n }\n return { command: tauri.cmd, args: argv, shell: false };\n}\n\nfunction probe(cmd: string, args: string[]): boolean {\n const onWin = process.platform === \"win32\";\n try {\n const r = spawnSync(\n onWin ? [cmd, ...args].join(\" \") : cmd,\n onWin ? [] : args,\n { stdio: \"ignore\", shell: onWin },\n );\n return r.status === 0;\n } catch {\n return false;\n }\n}\n\n/** Is a Rust `cargo` on PATH? (needed to compile the shell crate). */\nexport function hasCargo(): boolean {\n return probe(\"cargo\", [\"--version\"]);\n}\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. */\nexport function resolveTauriCommand(projectRoot: string): TauriCommand | null {\n if (probe(\"cargo\", [\"tauri\", \"--version\"])) {\n return { cmd: \"cargo\", prefix: [\"tauri\"], via: \"cargo-tauri\" };\n }\n try {\n const require_ = createRequire(\n pathToFileURL(path.join(projectRoot, \"package.json\")).href,\n );\n // @tauri-apps/cli exposes its binary entry; resolve its package then bin.\n const pkgJson = require_.resolve(\"@tauri-apps/cli/package.json\");\n const pkgDir = path.dirname(pkgJson);\n const pkg = JSON.parse(fs.readFileSync(pkgJson, \"utf8\")) as {\n bin?: string | Record<string, string>;\n };\n const bin = pkg.bin;\n const rel = typeof bin === \"string\" ? bin : bin?.tauri;\n if (rel) {\n return {\n cmd: process.execPath,\n prefix: [path.join(pkgDir, rel)],\n via: \"node-cli\",\n };\n }\n } catch {\n // not installed in the project\n }\n return null;\n}\n\nexport interface Toolchain {\n cargo: boolean;\n tauri: TauriCommand | null;\n}\n\nexport function detectToolchain(projectRoot: string): Toolchain {\n return { cargo: hasCargo(), tauri: resolveTauriCommand(projectRoot) };\n}\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. */\nexport function preflightOrThrow(\n tc: Toolchain,\n hostName: string,\n): TauriCommand {\n const missing: string[] = [];\n if (!tc.cargo) {\n missing.push(\n \" • Rust/cargo — install from https://rustup.rs (then restart your shell)\",\n );\n }\n if (!tc.tauri) {\n missing.push(\n ' • Tauri CLI — `cargo install tauri-cli --version \"^2\"` ' +\n \"(or add @tauri-apps/cli@^2 to your project's devDependencies)\",\n );\n }\n if (missing.length > 0 || !tc.tauri) {\n throw new Error(\n `hosts/${hostName}: the desktop shell needs a native toolchain that is ` +\n `not installed:\\n${missing.join(\"\\n\")}\\n` +\n `Install the above, then re-run \\`ph run ${hostName} dev\\` / ` +\n `\\`ph run ${hostName} build\\`. (The headless stack — \\`ph run ` +\n `${hostName}\\` — needs none of this.)`,\n );\n }\n return tc.tauri;\n}\n\n/** `<tauri> icon <source>` — generates the per-platform icon set (icon.ico +\n * icon.icns + pngs) the bundle references and tauri-build requires. */\nexport function runTauriIcon(\n tauri: TauriCommand,\n shellDir: string,\n iconSource: string,\n): void {\n const { command, args, shell } = tauriSpawn(tauri, [\"icon\", iconSource]);\n const r = spawnSync(command, args, {\n cwd: shellDir,\n stdio: \"inherit\",\n shell,\n });\n if (r.status !== 0) {\n throw new Error(\n `\\`tauri icon ${iconSource}\\` failed (exit ${r.status ?? \"?\"}) in ` +\n `${shellDir} — check that app.icon is a square PNG.`,\n );\n }\n}\n","import { spawn, type ChildProcess } from \"node:child_process\";\nimport fs from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport path from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\n\n/**\n * Shell discovery and launch. The Rust/Tauri shell lives in the\n * ph-win-desktop repo (cargo cannot ride an npm package); the runner locates\n * a checkout via `runner.shell.project` or PH_DESKTOP_SHELL and prefers its\n * BUILT exe (dev config like window title is baked into a build — the\n * `--config` projection below applies to tauri-cli invocations only).\n */\n\nexport interface ShellOptions {\n /** Path to a ph-win-desktop checkout (absolute or project-relative). */\n project?: string;\n window?: { title?: string; width?: number; height?: number };\n tray?: boolean;\n fileAssociations?: string[];\n}\n\nexport interface ResolvedShell {\n projectDir: string;\n /** A built exe when one exists (debug preferred for dev), else undefined →\n * fall back to `pnpm tauri dev`. */\n exe?: string;\n}\n\nexport function resolveShell(\n projectRoot: string,\n options: ShellOptions | undefined,\n env: Record<string, string | undefined>,\n): ResolvedShell {\n const configured = options?.project ?? env.PH_DESKTOP_SHELL;\n if (!configured) {\n throw new Error(\n \"No desktop shell configured: set runner.shell.project in the host file \" +\n \"(path to a ph-win-desktop checkout) or the PH_DESKTOP_SHELL \" +\n \"environment variable. `ph run desktop` (headless stack) needs neither.\",\n );\n }\n const projectDir = path.resolve(projectRoot, configured);\n if (!fs.existsSync(path.join(projectDir, \"src-tauri\"))) {\n throw new Error(\n `Desktop shell not found at ${projectDir} (no src-tauri/) — check ` +\n `runner.shell.project / PH_DESKTOP_SHELL.`,\n );\n }\n const candidates = [\n path.join(projectDir, \"src-tauri\", \"target\", \"debug\", \"ph-win.exe\"),\n path.join(projectDir, \"src-tauri\", \"target\", \"release\", \"ph-win.exe\"),\n path.join(projectDir, \"src-tauri\", \"target\", \"debug\", \"ph-win\"),\n path.join(projectDir, \"src-tauri\", \"target\", \"release\", \"ph-win\"),\n ];\n const exe = candidates.find((c) => fs.existsSync(c));\n return { projectDir, exe };\n}\n\n/** Resolve the project's ph-cli entry from ITS dependency tree — the same\n * resolution `ph run` itself uses. */\nexport function resolvePhCliEntry(projectRoot: string): string {\n const require_ = createRequire(\n pathToFileURL(path.join(projectRoot, \"package.json\")).href,\n );\n const pkgPath = require_.resolve(\"@powerhousedao/ph-cli/package.json\");\n return path.join(path.dirname(pkgPath), \"dist\", \"cli.mjs\");\n}\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. */\nexport function shellEnv(\n projectRoot: string,\n connectPort: number,\n env: Record<string, string | undefined>,\n): Record<string, string> {\n return {\n FEATURE_UNIFORM_RUNNERS_ENABLED: \"1\",\n PH_RUN_PROJECT: projectRoot,\n PH_RUN_CLI: resolvePhCliEntry(projectRoot),\n PH_WIN_CONNECT_PORT: String(connectPort),\n ...(env.PH_USER_DATA_DIR ? { PH_USER_DATA_DIR: env.PH_USER_DATA_DIR } : {}),\n };\n}\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. */\nexport function tauriConfigPatch(\n options: ShellOptions | undefined,\n): Record<string, unknown> | undefined {\n if (!options) return undefined;\n const patch: Record<string, unknown> = {};\n if (options.window) {\n patch.app = {\n windows: [\n {\n ...(options.window.title ? { title: options.window.title } : {}),\n ...(options.window.width ? { width: options.window.width } : {}),\n ...(options.window.height ? { height: options.window.height } : {}),\n },\n ],\n };\n }\n if (options.fileAssociations?.length) {\n patch.bundle = {\n fileAssociations: [\n {\n ext: options.fileAssociations.map((e) => e.replace(/^\\./, \"\")),\n name: \"Powerhouse Document\",\n },\n ],\n };\n }\n return Object.keys(patch).length > 0 ? patch : undefined;\n}\n\nexport function launchShell(\n shell: ResolvedShell,\n envVars: Record<string, string>,\n options: ShellOptions | undefined,\n): ChildProcess {\n if (shell.exe) {\n return spawn(shell.exe, [], {\n cwd: shell.projectDir,\n env: { ...process.env, ...envVars },\n stdio: \"inherit\",\n windowsHide: true,\n });\n }\n // tauri dev (needs cargo); config projection applies here.\n const patch = tauriConfigPatch(options);\n const args = [\"tauri\", \"dev\"];\n if (patch) args.push(\"--config\", JSON.stringify(patch));\n return spawn(\"pnpm\", args, {\n cwd: shell.projectDir,\n env: { ...process.env, ...envVars },\n stdio: \"inherit\",\n shell: true,\n windowsHide: true,\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAcA,MAAM,mBAAmB,EACtB,OAAO,CAAC,CACR,IAAI,CAAC,CAAC,CACN,MACC,qCACA,yFACF;AAEF,MAAM,eAAe,EAClB,aAAa;CACZ,OAAO,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;CAClC,OAAO,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS;CAC5C,QAAQ,EAAE,OAAO,CAAC,CAAC,IAAI,CAA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AAE,CAAC;EAC7D,MAAM;CACR,CACF,EACF;CAEF,OAAO,OAAO,KAAK,KAAK,CAAC,CAAC,SAAS,IAAI,QAAQ,KAAA;AACjD;AAEA,SAAgB,YACd,OACA,SACA,SACc;CACd,IAAI,MAAM,KACR,OAAO,MAAM,MAAM,KAAK,CAAC,GAAG;EAC1B,KAAK,MAAM;EACX,KAAK;GAAE,GAAG,QAAQ;GAAK,GAAG;EAAQ;EAClC,OAAO;EACP,aAAa;CACf,CAAC;CAGH,MAAM,QAAQ,iBAAiB,OAAO;CACtC,MAAM,OAAO,CAAC,SAAS,KAAK;CAC5B,IAAI,OAAO,KAAK,KAAK,YAAY,KAAK,UAAU,KAAK,CAAC;CACtD,OAAO,MAAM,QAAQ,MAAM;EACzB,KAAK,MAAM;EACX,KAAK;GAAE,GAAG,QAAQ;GAAK,GAAG;EAAQ;EAClC,OAAO;EACP,OAAO;EACP,aAAa;CACf,CAAC;AACH"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerhousedao/desktop",
3
- "version": "6.2.3-dev.69",
3
+ "version": "6.2.3-dev.71",
4
4
  "description": "The desktop runner for uniform-runners hosts: the generic compound stack wrapped in a native shell — dev opens the window, build stages the shippable stack.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -30,7 +30,8 @@
30
30
  "./package.json": "./package.json"
31
31
  },
32
32
  "dependencies": {
33
- "@powerhousedao/host-core": "6.2.3-dev.69",
33
+ "@powerhousedao/host-core": "6.2.3-dev.71",
34
+ "@powerhousedao/shared": "6.2.3-dev.71",
34
35
  "zod": "^4.5.4"
35
36
  },
36
37
  "devDependencies": {
@@ -41,6 +42,7 @@
41
42
  "tsc": "tsc",
42
43
  "lint": "cd ../.. && oxlint packages/desktop",
43
44
  "build": "tsdown",
44
- "test": "vitest --run"
45
+ "test": "vitest --run",
46
+ "emit-schemas": "tsx scripts/emit-schemas.ts"
45
47
  }
46
48
  }