@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.
package/dist/index.d.mts CHANGED
@@ -1,4 +1,49 @@
1
+ import { z } from "zod";
1
2
  import { ChildProcess } from "node:child_process";
3
+ //#region src/app-json.d.ts
4
+ export declare const appJsonSchema: z.ZodObject<{
5
+ identifier: z.ZodString;
6
+ productName: z.ZodString;
7
+ /** Single source image (square PNG, 1024×1024 recommended); the icon set
8
+ * for every platform is generated from it via `tauri icon`. */
9
+ icon: z.ZodString;
10
+ window: z.ZodOptional<z.ZodObject<{
11
+ title: z.ZodOptional<z.ZodString>;
12
+ width: z.ZodOptional<z.ZodNumber>;
13
+ height: z.ZodOptional<z.ZodNumber>;
14
+ resizable: z.ZodOptional<z.ZodBoolean>;
15
+ }, z.core.$strict>>;
16
+ fileAssociations: z.ZodOptional<z.ZodArray<z.ZodObject<{
17
+ /** Extensions WITHOUT the leading dot ("phd", not ".phd"). */
18
+ ext: z.ZodArray<z.ZodString>;
19
+ name: z.ZodString;
20
+ description: z.ZodOptional<z.ZodString>;
21
+ mimeType: z.ZodOptional<z.ZodString>;
22
+ }, z.core.$strict>>>;
23
+ shell: z.ZodOptional<z.ZodObject<{
24
+ /** Local checkout for shell development (the lab points here). */
25
+ path: z.ZodOptional<z.ZodString>;
26
+ /** Git source, pinned to a tag/rev, for pre-publication consumption. */
27
+ git: z.ZodOptional<z.ZodString>;
28
+ tag: z.ZodOptional<z.ZodString>;
29
+ rev: z.ZodOptional<z.ZodString>;
30
+ /** crates.io version requirement (default DEFAULT_SHELL_CRATE_VERSION). */
31
+ version: z.ZodOptional<z.ZodString>;
32
+ }, z.core.$strict>>;
33
+ }, z.core.$strict>;
34
+ type AppJson = z.infer<typeof appJsonSchema>;
35
+ type AppJsonShellSource = NonNullable<AppJson["shell"]>;
36
+ /** Default crates.io version requirement for the shell crate (D7.b: the flip
37
+ * to crates.io default once published — the crate is live). */
38
+ export declare const DEFAULT_SHELL_CRATE_VERSION = "0.1";
39
+ export declare const APP_JSON_FILE = "app.json";
40
+ /** Read + validate hosts/<host>/app.json. Throws with the field named on a
41
+ * bad value, and a clear message when the file is absent. */
42
+ export declare function loadAppJson(hostDir: string): AppJson;
43
+ /** A filesystem/crate-safe slug of the product name — the generated binary
44
+ * and Cargo package name. Falls back to the identifier's last segment. */
45
+ export declare function appSlug(app: AppJson): string;
46
+ //#endregion
2
47
  //#region src/bundle-stack.d.ts
3
48
  /**
4
49
  * P6.3 — stage the shippable STACK into the shell project: everything the
@@ -34,6 +79,9 @@ interface BundleStackOptions {
34
79
  /** The connect member's port — written into the stack's shell.json so the
35
80
  * shell knows where to probe/navigate with no environment at all. */
36
81
  connectPort?: number;
82
+ /** Absolute paths to skip when staging `hosts/` — in mode 1 the generated
83
+ * shell dir sits under `hosts/` and must not be copied into itself. */
84
+ excludeDirs?: string[];
37
85
  logger?: (message: string) => void;
38
86
  }
39
87
  interface BundleStackResult {
@@ -42,6 +90,129 @@ interface BundleStackResult {
42
90
  }
43
91
  export declare function bundleStack(options: BundleStackOptions): BundleStackResult;
44
92
  //#endregion
93
+ //#region src/shell-project.d.ts
94
+ /**
95
+ * P7.3 — project `hosts/desktop/app.json` into a generated `tauri-shell/`:
96
+ * a STANDALONE tauri crate that depends on the published `ph-desktop-shell`
97
+ * library, carries the builder's identity, and is built/run by the desktop
98
+ * runner's dev/build verbs. The builder never writes Rust.
99
+ *
100
+ * Everything here mirrors the known-good reference app
101
+ * (ph-desktop-shell/apps/powerhouse-desktop): the tauri plumbing (main.rs,
102
+ * build.rs, capabilities, the loading page, externalBin + icon mechanics) is
103
+ * copied verbatim; only identity/port fields are projected from app.json. The
104
+ * projection is idempotent and stale-detected — a file is rewritten only when
105
+ * its content changes, so Cargo.lock, the generated icon set, and tauri-build
106
+ * output are never disturbed by a regen with an unchanged app.json.
107
+ */
108
+ export declare const SHELL_DIR = "tauri-shell";
109
+ /** The icon source the runner feeds to `tauri icon` (copied from app.icon). */
110
+ export declare const ICON_SOURCE = "app-icon.png";
111
+ interface ProjectShellInput {
112
+ /** hosts/<host>/ — where app.json lives and tauri-shell/ is written. */
113
+ hostDir: string;
114
+ app: AppJson;
115
+ /** The connect member's port — baked into the remote capability so the
116
+ * served Connect origin can reach the shell's launch-queue commands. */
117
+ connectPort: number;
118
+ }
119
+ interface ProjectShellResult {
120
+ shellDir: string;
121
+ /** The crate/bin name (and the built exe stem the runner looks for). */
122
+ binName: string;
123
+ /** True when any projected file was created or changed this call. */
124
+ changed: boolean;
125
+ }
126
+ /**
127
+ * Materialize/refresh `<hostDir>/tauri-shell/` from app.json. Idempotent:
128
+ * unchanged app.json rewrites nothing. Does NOT run `tauri icon` or fetch the
129
+ * node binary — those are toolchain steps the runner performs at dev/build.
130
+ */
131
+ export declare function projectShell(input: ProjectShellInput): ProjectShellResult;
132
+ //#endregion
133
+ //#region src/scaffold.d.ts
134
+ /**
135
+ * P7.5 — scaffold a builder-owned desktop identity: `hosts/desktop/app.json`
136
+ * (the ONE file a builder edits), a placeholder square icon source, and a
137
+ * `.gitignore` for the generated shell. `ph generate desktop-shell` calls
138
+ * this; the runner's dev/build then project app.json into `tauri-shell/`.
139
+ */
140
+ interface ScaffoldDesktopShellOptions {
141
+ /** Reverse-DNS app identifier (e.g. com.acme.app). */
142
+ identifier: string;
143
+ /** Human product name (the window title + macOS app name). */
144
+ productName: string;
145
+ /** Overwrite an existing app.json (default: refuse, to protect edits). */
146
+ force?: boolean;
147
+ }
148
+ interface ScaffoldResult {
149
+ hostDir: string;
150
+ /** Files created this call (absolute paths). */
151
+ created: string[];
152
+ /** Files already present and left untouched. */
153
+ skipped: string[];
154
+ }
155
+ /** Minimal PNG encoder — a solid square so `tauri icon` always has a valid
156
+ * source. Pure Node (zlib); no binary asset ships in the package. The builder
157
+ * replaces it with their real 1024×1024 artwork. */
158
+ export declare function solidPng(size: number, rgba: [number, number, number, number]): Buffer;
159
+ export declare function scaffoldDesktopShell(hostDir: string, options: ScaffoldDesktopShellOptions): ScaffoldResult;
160
+ //#endregion
161
+ //#region src/shell-toolchain.d.ts
162
+ /**
163
+ * The native toolchain the generated shell (mode 1) needs to build/run, and
164
+ * the provisioning steps around it. `cargo tauri dev|build` compiles the
165
+ * generated crate — but tauri-build validates two things AT COMPILE TIME that
166
+ * must exist first (both confirmed against a live `cargo check`):
167
+ * - the node sidecar `binaries/node-<triple>` (externalBin), and
168
+ * - `icons/icon.ico` on Windows (the app's Win32 resource).
169
+ * So dev/build provision the sidecar + icon set before invoking tauri, and
170
+ * fail with install guidance when cargo or the Tauri CLI is absent — a
171
+ * missing executable must read as a clear instruction, never a deep cargo
172
+ * stack trace.
173
+ */
174
+ interface NodeTarget {
175
+ triple: string;
176
+ dist: string;
177
+ /** Path within the extracted archive (POSIX) / "node.exe" on Windows. */
178
+ bin: string;
179
+ ext: string;
180
+ }
181
+ /** The Node release triple for a build host — the sidecar filename tauri
182
+ * resolves (`node-<triple>`). Pure, so the mapping is unit-tested. */
183
+ export declare function nodeSidecarTarget(platform: NodeJS.Platform, arch: string): NodeTarget;
184
+ /** Fetch the stock Node the shell ships as its sidecar into `<shellDir>/
185
+ * binaries`, named per target triple. No-op when already present. Ported from
186
+ * the reference repo's fetch-node.mjs (the builder has no such script). */
187
+ export declare function fetchNodeSidecar(shellDir: string, version?: string, platform?: NodeJS.Platform, arch?: string): string;
188
+ /** Default bundle targets for the build host (`cargo tauri build --bundles`).
189
+ * macOS gets app+dmg, Windows nsis, Linux deb+appimage — a host only builds
190
+ * installers it can produce. */
191
+ export declare function tauriBundlesForHost(platform?: NodeJS.Platform): string[];
192
+ interface TauriCommand {
193
+ /** The executable to spawn (e.g. "cargo" or a node path). */
194
+ cmd: string;
195
+ /** Args that precede the tauri subcommand (e.g. ["tauri"] for cargo). */
196
+ prefix: string[];
197
+ /** How the CLI was found — for logging + the preflight message. */
198
+ via: "cargo-tauri" | "node-cli";
199
+ }
200
+ /** Resolve a Tauri CLI: a global `cargo tauri`, else a `@tauri-apps/cli`
201
+ * resolvable from the project. Returns null when neither is available. */
202
+ export declare function resolveTauriCommand(projectRoot: string): TauriCommand | null;
203
+ interface Toolchain {
204
+ cargo: boolean;
205
+ tauri: TauriCommand | null;
206
+ }
207
+ export declare function detectToolchain(projectRoot: string): Toolchain;
208
+ /** Throw a clear, actionable error when the native toolchain is incomplete —
209
+ * the desktop verbs call this before any cargo work so a missing executable
210
+ * is an instruction, not a stack trace. */
211
+ export declare function preflightOrThrow(tc: Toolchain, hostName: string): TauriCommand;
212
+ /** `<tauri> icon <source>` — generates the per-platform icon set (icon.ico +
213
+ * icon.icns + pngs) the bundle references and tauri-build requires. */
214
+ export declare function runTauriIcon(tauri: TauriCommand, shellDir: string, iconSource: string): void;
215
+ //#endregion
45
216
  //#region src/shell.d.ts
46
217
  /**
47
218
  * Shell discovery and launch. The Rust/Tauri shell lives in the
@@ -80,6 +251,6 @@ export declare function shellEnv(projectRoot: string, connectPort: number, env:
80
251
  export declare function tauriConfigPatch(options: ShellOptions | undefined): Record<string, unknown> | undefined;
81
252
  export declare function launchShell(shell: ResolvedShell, envVars: Record<string, string>, options: ShellOptions | undefined): ChildProcess;
82
253
  //#endregion
83
- export type { BundleStackOptions, BundleStackResult, ResolvedShell, ShellOptions };
254
+ export type { AppJson, AppJsonShellSource, BundleStackOptions, BundleStackResult, NodeTarget, ProjectShellInput, ProjectShellResult, ResolvedShell, ScaffoldDesktopShellOptions, ScaffoldResult, ShellOptions, TauriCommand, Toolchain };
84
255
  export {};
85
256
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/bundle-stack.ts","../src/shell.ts"],"mappings":";;;;;;;;;;;;;;;;;;;UAqBiB;EACf;EACA;;;EAGA;;;;;EAKA;;;EAGA;;;EAGA;EACA,UAAU;;UAGK;EACf;EACA;;wBASc,YAAY,SAAS,qBAAqB;;;;;;;;;;UCtCzC;;EAEf;EACA;IAAW;IAAgB;IAAgB;;EAC3C;EACA;;UAGe;EACf;;;EAGA;;wBAGc,aACd,qBACA,SAAS,0BACT,KAAK,qCACJ;;;wBA4Ba,kBAAkB;;;wBAUlB,SACd,qBACA,qBACA,KAAK,qCACJ;;;;wBAaa,iBACd,SAAS,2BACR;wBA2Ba,YACd,OAAO,eACP,SAAS,wBACT,SAAS,2BACR"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/app-json.ts","../src/bundle-stack.ts","../src/shell-project.ts","../src/scaffold.ts","../src/shell-toolchain.ts","../src/shell.ts"],"mappings":";;;qBAuDa,eAAa,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GASxB,EAAA,KAAA;KAEU,UAAU,EAAE,aAAa;KACzB,qBAAqB,YAAY;;;qBAIhC;qBAEA;;;wBAIG,YAAY,kBAAkB;;;wBA2B9B,QAAQ,KAAK;;;;;;;;;;;;;;;;;;;;UCnFZ;EACf;EACA;;;EAGA;;;;;EAKA;;;EAGA;;;EAGA;;;EAGA;EACA,UAAU;;UAGK;EACf;EACA;;wBAwCc,YAAY,SAAS,qBAAqB;;;;;;;;;;;;;;;;;qBC9D7C;;qBAEA;UAEI;;EAEf;EACA,KAAK;;;EAGL;;UAGe;EACf;;EAEA;;EAEA;;;;;;;wBAqPc,aAAa,OAAO,oBAAoB;;;;;;;;;UCnRvC;;EAEf;;EAEA;;EAEA;;UAGe;EACf;;EAEA;;EAEA;;;;;wBAMc,SACd,cACA,yCACC;wBAoEa,qBACd,iBACA,SAAS,8BACR;;;;;;;;;;;;;;;UCvFc;EACf;EACA;;EAEA;EACA;;;;wBAKc,kBACd,UAAU,OAAO,UACjB,eACC;;;;wBAwCa,iBACd,kBACA,kBACA,WAAU,OAAO,UACjB;;;;wBA2Bc,oBACd,WAAU,OAAO;UAYF;;EAEf;;EAEA;;EAEA;;;;wBAuCc,oBAAoB,sBAAsB;UA6BzC;EACf;EACA,OAAO;;wBAGO,gBAAgB,sBAAsB;;;;wBAOtC,iBACd,IAAI,WACJ,mBACC;;;wBA2Ba,aACd,OAAO,cACP,kBACA;;;;;;;;;;UC7Ne;;EAEf;EACA;IAAW;IAAgB;IAAgB;;EAC3C;EACA;;UAGe;EACf;;;EAGA;;wBAGc,aACd,qBACA,SAAS,0BACT,KAAK,qCACJ;;;wBA4Ba,kBAAkB;;;wBAUlB,SACd,qBACA,qBACA,KAAK,qCACJ;;;;wBAaa,iBACd,SAAS,2BACR;wBA2Ba,YACd,OAAO,eACP,SAAS,wBACT,SAAS,2BACR"}
package/dist/index.mjs CHANGED
@@ -1,2 +1,132 @@
1
- import { a as tauriConfigPatch, i as shellEnv, n as resolvePhCliEntry, o as bundleStack, r as resolveShell, t as launchShell } from "./shell-DcBLVLVz.mjs";
2
- export { bundleStack, launchShell, resolvePhCliEntry, resolveShell, shellEnv, tauriConfigPatch };
1
+ import { S as loadAppJson, _ as bundleStack, a as tauriConfigPatch, b as appJsonSchema, c as nodeSidecarTarget, d as runTauriIcon, f as tauriBundlesForHost, g as projectShell, h as SHELL_DIR, i as shellEnv, l as preflightOrThrow, m as ICON_SOURCE, n as resolvePhCliEntry, o as detectToolchain, r as resolveShell, s as fetchNodeSidecar, t as launchShell, u as resolveTauriCommand, v as APP_JSON_FILE, x as appSlug, y as DEFAULT_SHELL_CRATE_VERSION } from "./shell-BL61-fyi.mjs";
2
+ import fs from "node:fs";
3
+ import path from "node:path";
4
+ import { deflateSync } from "node:zlib";
5
+ //#region src/scaffold.ts
6
+ /** Minimal PNG encoder — a solid square so `tauri icon` always has a valid
7
+ * source. Pure Node (zlib); no binary asset ships in the package. The builder
8
+ * replaces it with their real 1024×1024 artwork. */
9
+ function solidPng(size, rgba) {
10
+ const [r, g, b, a] = rgba;
11
+ const row = Buffer.alloc(1 + size * 4);
12
+ for (let x = 0; x < size; x++) {
13
+ const o = 1 + x * 4;
14
+ row[o] = r;
15
+ row[o + 1] = g;
16
+ row[o + 2] = b;
17
+ row[o + 3] = a;
18
+ }
19
+ const raw = Buffer.concat(Array.from({ length: size }, () => row));
20
+ const idat = deflateSync(raw);
21
+ const chunk = (type, data) => {
22
+ const len = Buffer.alloc(4);
23
+ len.writeUInt32BE(data.length, 0);
24
+ const typeBuf = Buffer.from(type, "ascii");
25
+ const body = Buffer.concat([typeBuf, data]);
26
+ const crc = Buffer.alloc(4);
27
+ crc.writeUInt32BE(crc32(body) >>> 0, 0);
28
+ return Buffer.concat([
29
+ len,
30
+ body,
31
+ crc
32
+ ]);
33
+ };
34
+ const ihdr = Buffer.alloc(13);
35
+ ihdr.writeUInt32BE(size, 0);
36
+ ihdr.writeUInt32BE(size, 4);
37
+ ihdr[8] = 8;
38
+ ihdr[9] = 6;
39
+ ihdr[10] = 0;
40
+ ihdr[11] = 0;
41
+ ihdr[12] = 0;
42
+ return Buffer.concat([
43
+ Buffer.from([
44
+ 137,
45
+ 80,
46
+ 78,
47
+ 71,
48
+ 13,
49
+ 10,
50
+ 26,
51
+ 10
52
+ ]),
53
+ chunk("IHDR", ihdr),
54
+ chunk("IDAT", idat),
55
+ chunk("IEND", Buffer.alloc(0))
56
+ ]);
57
+ }
58
+ let crcTable;
59
+ function crc32(buf) {
60
+ if (!crcTable) {
61
+ crcTable = [];
62
+ for (let n = 0; n < 256; n++) {
63
+ let c = n;
64
+ for (let k = 0; k < 8; k++) c = c & 1 ? 3988292384 ^ c >>> 1 : c >>> 1;
65
+ crcTable[n] = c;
66
+ }
67
+ }
68
+ let crc = 4294967295;
69
+ for (let i = 0; i < buf.length; i++) crc = crcTable[(crc ^ buf[i]) & 255] ^ crc >>> 8;
70
+ return crc ^ 4294967295;
71
+ }
72
+ const GITIGNORE = `# Generated tauri shell — only Cargo.lock and app-icon.png are tracked.
73
+ /tauri-shell/target
74
+ /tauri-shell/gen
75
+ /tauri-shell/icons
76
+ /tauri-shell/dist-stack
77
+ /tauri-shell/binaries
78
+ `;
79
+ function scaffoldDesktopShell(hostDir, options) {
80
+ const created = [];
81
+ const skipped = [];
82
+ fs.mkdirSync(hostDir, { recursive: true });
83
+ const iconFile = "icon.png";
84
+ const app = {
85
+ identifier: options.identifier,
86
+ productName: options.productName,
87
+ icon: `./${iconFile}`,
88
+ window: {
89
+ title: options.productName,
90
+ width: 1440,
91
+ height: 900
92
+ },
93
+ fileAssociations: [{
94
+ ext: ["phd"],
95
+ name: "Powerhouse Document",
96
+ mimeType: "application/vnd.powerhouse.document+zip"
97
+ }]
98
+ };
99
+ appJsonSchema.parse(app);
100
+ const appJsonPath = path.join(hostDir, APP_JSON_FILE);
101
+ if (fs.existsSync(appJsonPath) && !options.force) skipped.push(appJsonPath);
102
+ else {
103
+ fs.writeFileSync(appJsonPath, `${JSON.stringify(app, null, 2)}\n`);
104
+ created.push(appJsonPath);
105
+ }
106
+ const iconPath = path.join(hostDir, iconFile);
107
+ if (fs.existsSync(iconPath)) skipped.push(iconPath);
108
+ else {
109
+ fs.writeFileSync(iconPath, solidPng(1024, [
110
+ 79,
111
+ 70,
112
+ 229,
113
+ 255
114
+ ]));
115
+ created.push(iconPath);
116
+ }
117
+ const gitignorePath = path.join(hostDir, ".gitignore");
118
+ if (fs.existsSync(gitignorePath)) skipped.push(gitignorePath);
119
+ else {
120
+ fs.writeFileSync(gitignorePath, GITIGNORE);
121
+ created.push(gitignorePath);
122
+ }
123
+ return {
124
+ hostDir,
125
+ created,
126
+ skipped
127
+ };
128
+ }
129
+ //#endregion
130
+ export { APP_JSON_FILE, DEFAULT_SHELL_CRATE_VERSION, ICON_SOURCE, SHELL_DIR, appJsonSchema, appSlug, bundleStack, detectToolchain, fetchNodeSidecar, launchShell, loadAppJson, nodeSidecarTarget, preflightOrThrow, projectShell, resolvePhCliEntry, resolveShell, resolveTauriCommand, runTauriIcon, scaffoldDesktopShell, shellEnv, solidPng, tauriBundlesForHost, tauriConfigPatch };
131
+
132
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/scaffold.ts"],"sourcesContent":["import { deflateSync } from \"node:zlib\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { appJsonSchema, APP_JSON_FILE, type AppJson } from \"./app-json.js\";\n\n/**\n * P7.5 — scaffold a builder-owned desktop identity: `hosts/desktop/app.json`\n * (the ONE file a builder edits), a placeholder square icon source, and a\n * `.gitignore` for the generated shell. `ph generate desktop-shell` calls\n * this; the runner's dev/build then project app.json into `tauri-shell/`.\n */\n\nexport interface ScaffoldDesktopShellOptions {\n /** Reverse-DNS app identifier (e.g. com.acme.app). */\n identifier: string;\n /** Human product name (the window title + macOS app name). */\n productName: string;\n /** Overwrite an existing app.json (default: refuse, to protect edits). */\n force?: boolean;\n}\n\nexport interface ScaffoldResult {\n hostDir: string;\n /** Files created this call (absolute paths). */\n created: string[];\n /** Files already present and left untouched. */\n skipped: string[];\n}\n\n/** Minimal PNG encoder — a solid square so `tauri icon` always has a valid\n * source. Pure Node (zlib); no binary asset ships in the package. The builder\n * replaces it with their real 1024×1024 artwork. */\nexport function solidPng(\n size: number,\n rgba: [number, number, number, number],\n): Buffer {\n const [r, g, b, a] = rgba;\n // raw image: each row is a filter byte (0) + size*4 RGBA bytes\n const row = Buffer.alloc(1 + size * 4);\n for (let x = 0; x < size; x++) {\n const o = 1 + x * 4;\n row[o] = r;\n row[o + 1] = g;\n row[o + 2] = b;\n row[o + 3] = a;\n }\n const raw = Buffer.concat(Array.from({ length: size }, () => row));\n const idat = deflateSync(raw);\n\n const chunk = (type: string, data: Buffer): Buffer => {\n const len = Buffer.alloc(4);\n len.writeUInt32BE(data.length, 0);\n const typeBuf = Buffer.from(type, \"ascii\");\n const body = Buffer.concat([typeBuf, data]);\n const crc = Buffer.alloc(4);\n crc.writeUInt32BE(crc32(body) >>> 0, 0);\n return Buffer.concat([len, body, crc]);\n };\n\n const ihdr = Buffer.alloc(13);\n ihdr.writeUInt32BE(size, 0);\n ihdr.writeUInt32BE(size, 4);\n ihdr[8] = 8; // bit depth\n ihdr[9] = 6; // color type RGBA\n ihdr[10] = 0; // compression\n ihdr[11] = 0; // filter\n ihdr[12] = 0; // interlace\n\n return Buffer.concat([\n Buffer.from([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]),\n chunk(\"IHDR\", ihdr),\n chunk(\"IDAT\", idat),\n chunk(\"IEND\", Buffer.alloc(0)),\n ]);\n}\n\nlet crcTable: number[] | undefined;\nfunction crc32(buf: Buffer): number {\n if (!crcTable) {\n crcTable = [];\n for (let n = 0; n < 256; n++) {\n let c = n;\n for (let k = 0; k < 8; k++) {\n c = c & 1 ? 0xedb88320 ^ (c >>> 1) : c >>> 1;\n }\n crcTable[n] = c;\n }\n }\n let crc = 0xffffffff;\n for (let i = 0; i < buf.length; i++) {\n crc = crcTable[(crc ^ buf[i]) & 0xff] ^ (crc >>> 8);\n }\n return crc ^ 0xffffffff;\n}\n\nconst GITIGNORE = `# Generated tauri shell — only Cargo.lock and app-icon.png are tracked.\n/tauri-shell/target\n/tauri-shell/gen\n/tauri-shell/icons\n/tauri-shell/dist-stack\n/tauri-shell/binaries\n`;\n\nexport function scaffoldDesktopShell(\n hostDir: string,\n options: ScaffoldDesktopShellOptions,\n): ScaffoldResult {\n const created: string[] = [];\n const skipped: string[] = [];\n fs.mkdirSync(hostDir, { recursive: true });\n\n const iconFile = \"icon.png\";\n const app: AppJson = {\n identifier: options.identifier,\n productName: options.productName,\n icon: `./${iconFile}`,\n window: { title: options.productName, width: 1440, height: 900 },\n fileAssociations: [\n {\n ext: [\"phd\"],\n name: \"Powerhouse Document\",\n mimeType: \"application/vnd.powerhouse.document+zip\",\n },\n ],\n };\n // Fail fast if we ever emit something the loader would reject.\n appJsonSchema.parse(app);\n\n const appJsonPath = path.join(hostDir, APP_JSON_FILE);\n if (fs.existsSync(appJsonPath) && !options.force) {\n skipped.push(appJsonPath);\n } else {\n fs.writeFileSync(appJsonPath, `${JSON.stringify(app, null, 2)}\\n`);\n created.push(appJsonPath);\n }\n\n const iconPath = path.join(hostDir, iconFile);\n if (fs.existsSync(iconPath)) {\n skipped.push(iconPath);\n } else {\n // 1024² indigo placeholder — a real, square, replaceable source icon.\n fs.writeFileSync(iconPath, solidPng(1024, [79, 70, 229, 255]));\n created.push(iconPath);\n }\n\n const gitignorePath = path.join(hostDir, \".gitignore\");\n if (fs.existsSync(gitignorePath)) {\n skipped.push(gitignorePath);\n } else {\n fs.writeFileSync(gitignorePath, GITIGNORE);\n created.push(gitignorePath);\n }\n\n return { hostDir, created, skipped };\n}\n"],"mappings":"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"}
package/dist/runner.d.mts CHANGED
@@ -1,20 +1,24 @@
1
1
  import { HostDefinition, RunnerContext } from "@powerhousedao/host-core";
2
2
  //#region src/runner.d.ts
3
3
  /**
4
- * @powerhousedao/desktop/runner (phase 6): the desktop host productized.
4
+ * @powerhousedao/desktop/runner.
5
5
  *
6
6
  * - `run`/`serve`: the headless stack — byte-identical delegation to
7
7
  * host-core's generic compound (phase-3 semantics unchanged).
8
- * - `dev`: the NATIVE window — resolves the shell (runner.shell.project /
9
- * PH_DESKTOP_SHELL), wires the env trio itself (PH_RUN_PROJECT, PH_RUN_CLI,
10
- * PH_WIN_CONNECT_PORT, + userData/flag) and launches the built exe when one
11
- * exists, else `pnpm tauri dev` with the shell-config projection (D6.d).
12
- * - `build`: the PACKAGING verb — forwards `build` to members that export it
13
- * (skipping the rest WITH a log line: packaging builds what is buildable,
14
- * unlike the generic compound's uniform fail-loud forwarding), then stages
15
- * the shippable stack into the shell project (bundle-stack: hosts + config
16
- * + built Connect + vendored ph-cli) so the installed app runs with no
17
- * environment at all (D6.c).
8
+ * - `dev`: the NATIVE window. Mode 1 (phase 7) is the default — a builder
9
+ * ships under THEIR identity by editing `hosts/<host>/app.json` and never
10
+ * writing Rust: the runner projects app.json into a generated `tauri-shell/`
11
+ * that depends on the published `ph-desktop-shell` crate, provisions the
12
+ * native toolchain's compile-time inputs (node sidecar + icon set), and runs
13
+ * `cargo tauri dev`. An explicit `runner.shell.project` (or PH_DESKTOP_SHELL)
14
+ * still selects a prebuilt/hand-maintained shell instead.
15
+ * - `build`: the PACKAGING verb — members' builds (where exported), then the
16
+ * shippable stack staged into the shell + `cargo tauri build` with
17
+ * host-appropriate installer targets (nsis / app+dmg / deb+appimage).
18
+ *
19
+ * The native toolchain is required ONLY for dev/build; a missing cargo or
20
+ * Tauri CLI fails with install guidance (see shell-toolchain). `ph run <host>`
21
+ * (headless) needs none of it.
18
22
  */
19
23
  export declare const kind = "compound";
20
24
  export declare const hostSchema: import("zod").ZodObject<{
@@ -136,14 +140,17 @@ export declare const hostSchema: import("zod").ZodObject<{
136
140
  }, import("zod/v4/core").$loose>;
137
141
  export declare function run(host: HostDefinition, ctx: RunnerContext): Promise<import("@powerhousedao/host-core").RunCompoundResult>;
138
142
  export declare const serve: typeof run;
139
- /** dev = the native window around the live stack, zero manual env. */
140
143
  export interface ShellHandle {
141
144
  /** Resolves when the shell window exits — the runner's keep-alive. */
142
145
  ready: Promise<void>;
143
146
  shutdown: () => void;
144
147
  }
148
+ /** Which shell backs this host's native window (D7.d source order):
149
+ * an explicit `runner.shell.project`, else the app.json-generated shell,
150
+ * else the PH_DESKTOP_SHELL escape hatch. */
151
+ export declare function shellMode(host: HostDefinition, ctx: RunnerContext): "external-project" | "generated" | "external-env" | "none";
145
152
  export declare function dev(host: HostDefinition, ctx: RunnerContext): Promise<ShellHandle>;
146
- /** build = members' builds (where exported) + the shippable stack staging. */
153
+ /** build = members' builds + the shippable stack + the native installer. */
147
154
  export declare function build(host: HostDefinition, ctx: RunnerContext): Promise<void>;
148
155
  //#endregion
149
156
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"runner.d.mts","names":[],"sources":["../src/runner.ts"],"mappings":";;;;;;;;;;;;;;;;;;qBAkCa;qBAEA,0BAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBAAqB;wBA0CtB,IAAI,MAAM,gBAAgB,KAAK,gBAAa,2CAAA;qBAKrD,cAAK;;iBAGD;;EAEf,OAAO;EACP;;wBAGoB,IACpB,MAAM,gBACN,KAAK,gBACJ,QAAQ;;wBA8BW,MACpB,MAAM,gBACN,KAAK,gBACJ"}
1
+ {"version":3,"file":"runner.d.mts","names":[],"sources":["../src/runner.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;qBAoDa;qBAEA,0BAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBAAqB;wBA+CtB,IAAI,MAAM,gBAAgB,KAAK,gBAAa,2CAAA;qBAKrD,cAAK;iBAED;;EAEf,OAAO;EACP;;;;;wBAMc,UACd,MAAM,gBACN,KAAK;wBA6Ce,IACpB,MAAM,gBACN,KAAK,gBACJ,QAAQ;;wBAkGW,MACpB,MAAM,gBACN,KAAK,gBACJ"}
package/dist/runner.mjs CHANGED
@@ -1,27 +1,38 @@
1
- import { i as shellEnv, o as bundleStack, r as resolveShell, t as launchShell } from "./shell-DcBLVLVz.mjs";
1
+ import { S as loadAppJson, _ as bundleStack, d as runTauriIcon, f as tauriBundlesForHost, g as projectShell, i as shellEnv, l as preflightOrThrow, m as ICON_SOURCE, o as detectToolchain, p as tauriSpawn, r as resolveShell, s as fetchNodeSidecar, t as launchShell, v as APP_JSON_FILE } from "./shell-BL61-fyi.mjs";
2
+ import fs from "node:fs";
3
+ import path from "node:path";
4
+ import { spawn, spawnSync } from "node:child_process";
2
5
  import { compoundHostSchema, getVerb, loadHost, resolveRunnerModule, validateHost } from "@powerhousedao/host-core";
3
6
  //#region src/runner.ts
4
7
  /**
5
- * @powerhousedao/desktop/runner (phase 6): the desktop host productized.
8
+ * @powerhousedao/desktop/runner.
6
9
  *
7
10
  * - `run`/`serve`: the headless stack — byte-identical delegation to
8
11
  * host-core's generic compound (phase-3 semantics unchanged).
9
- * - `dev`: the NATIVE window — resolves the shell (runner.shell.project /
10
- * PH_DESKTOP_SHELL), wires the env trio itself (PH_RUN_PROJECT, PH_RUN_CLI,
11
- * PH_WIN_CONNECT_PORT, + userData/flag) and launches the built exe when one
12
- * exists, else `pnpm tauri dev` with the shell-config projection (D6.d).
13
- * - `build`: the PACKAGING verb — forwards `build` to members that export it
14
- * (skipping the rest WITH a log line: packaging builds what is buildable,
15
- * unlike the generic compound's uniform fail-loud forwarding), then stages
16
- * the shippable stack into the shell project (bundle-stack: hosts + config
17
- * + built Connect + vendored ph-cli) so the installed app runs with no
18
- * environment at all (D6.c).
12
+ * - `dev`: the NATIVE window. Mode 1 (phase 7) is the default — a builder
13
+ * ships under THEIR identity by editing `hosts/<host>/app.json` and never
14
+ * writing Rust: the runner projects app.json into a generated `tauri-shell/`
15
+ * that depends on the published `ph-desktop-shell` crate, provisions the
16
+ * native toolchain's compile-time inputs (node sidecar + icon set), and runs
17
+ * `cargo tauri dev`. An explicit `runner.shell.project` (or PH_DESKTOP_SHELL)
18
+ * still selects a prebuilt/hand-maintained shell instead.
19
+ * - `build`: the PACKAGING verb — members' builds (where exported), then the
20
+ * shippable stack staged into the shell + `cargo tauri build` with
21
+ * host-appropriate installer targets (nsis / app+dmg / deb+appimage).
22
+ *
23
+ * The native toolchain is required ONLY for dev/build; a missing cargo or
24
+ * Tauri CLI fails with install guidance (see shell-toolchain). `ph run <host>`
25
+ * (headless) needs none of it.
19
26
  */
20
27
  const kind = "compound";
21
28
  const hostSchema = compoundHostSchema;
22
29
  async function compoundModule() {
23
30
  return import("@powerhousedao/host-core/runners/compound");
24
31
  }
32
+ /** hosts/<host>/ — where app.json lives and the generated shell is written. */
33
+ function hostDirOf(host, ctx) {
34
+ return path.join(ctx.projectRoot, "hosts", host.name);
35
+ }
25
36
  /** The connect member's port — the shell's readiness probe and window URL. */
26
37
  async function connectPort(host, ctx) {
27
38
  const children = host.children ?? {};
@@ -37,11 +48,67 @@ async function run(host, ctx) {
37
48
  return (await compoundModule()).run(host, ctx);
38
49
  }
39
50
  const serve = run;
51
+ /** Which shell backs this host's native window (D7.d source order):
52
+ * an explicit `runner.shell.project`, else the app.json-generated shell,
53
+ * else the PH_DESKTOP_SHELL escape hatch. */
54
+ function shellMode(host, ctx) {
55
+ if (host.runner.shell?.project) return "external-project";
56
+ if (fs.existsSync(path.join(hostDirOf(host, ctx), "app.json"))) return "generated";
57
+ if (ctx.env.PH_DESKTOP_SHELL) return "external-env";
58
+ return "none";
59
+ }
60
+ /** Fetch the node sidecar + (re)generate the icon set — both are tauri-build
61
+ * COMPILE-TIME inputs (externalBin; icon.ico for the Windows resource),
62
+ * confirmed against a live cargo check. Icon regen only when app-icon.png
63
+ * changed or the set is absent. */
64
+ function provisionShell(shellDir, tauri, iconChanged) {
65
+ fetchNodeSidecar(shellDir);
66
+ const iconIco = path.join(shellDir, "icons", "icon.ico");
67
+ if (iconChanged || !fs.existsSync(iconIco)) runTauriIcon(tauri, shellDir, ICON_SOURCE);
68
+ }
69
+ /** Spawn a `<tauri> <subcommand>` in the generated shell with the uniform-
70
+ * runners env trio wired in. */
71
+ function spawnTauri(tauri, subcommand, shellDir, envVars) {
72
+ const { command, args, shell } = tauriSpawn(tauri, subcommand);
73
+ return spawn(command, args, {
74
+ cwd: shellDir,
75
+ env: {
76
+ ...process.env,
77
+ ...envVars
78
+ },
79
+ stdio: "inherit",
80
+ shell,
81
+ windowsHide: true
82
+ });
83
+ }
40
84
  async function dev(host, ctx) {
41
- const options = host.runner;
42
- const shell = resolveShell(ctx.projectRoot, options.shell, ctx.env);
85
+ const mode = shellMode(host, ctx);
86
+ if (mode === "none") throw new Error(`hosts/${host.name}: no desktop shell to run — add ${APP_JSON_FILE} (run \`ph generate desktop-shell\`) for a builder-owned identity, set runner.shell.project to a prebuilt shell, or export PH_DESKTOP_SHELL.`);
43
87
  const port = await connectPort(host, ctx);
44
88
  const envVars = shellEnv(ctx.projectRoot, port, ctx.env);
89
+ if (mode === "generated") {
90
+ const hostDir = hostDirOf(host, ctx);
91
+ const app = loadAppJson(hostDir);
92
+ const { shellDir, binName, changed } = projectShell({
93
+ hostDir,
94
+ app,
95
+ connectPort: port
96
+ });
97
+ const tauri = preflightOrThrow(detectToolchain(ctx.projectRoot), host.name);
98
+ provisionShell(shellDir, tauri, changed);
99
+ console.log(`[${host.name}] launching the generated desktop shell '${binName}' (${tauri.via}: cargo tauri dev) — stack via ph run ${host.name}, window at http://127.0.0.1:${port}/`);
100
+ const child = spawnTauri(tauri, ["dev"], shellDir, envVars);
101
+ return {
102
+ ready: new Promise((resolve) => child.once("exit", () => resolve())),
103
+ shutdown: () => {
104
+ try {
105
+ child.kill();
106
+ } catch {}
107
+ }
108
+ };
109
+ }
110
+ const options = host.runner;
111
+ const shell = resolveShell(ctx.projectRoot, options.shell, ctx.env);
45
112
  console.log(`[${host.name}] launching the desktop shell (${shell.exe ? shell.exe : "pnpm tauri dev"}) — stack via ph run ${host.name}, window at http://127.0.0.1:${port}/`);
46
113
  const child = launchShell(shell, envVars, options.shell);
47
114
  return {
@@ -53,8 +120,9 @@ async function dev(host, ctx) {
53
120
  }
54
121
  };
55
122
  }
56
- /** build = members' builds (where exported) + the shippable stack staging. */
57
- async function build(host, ctx) {
123
+ /** Forward `build` to members that export it (packaging builds what is
124
+ * buildable — unlike the generic compound's uniform fail-loud forwarding). */
125
+ async function buildMembers(host, ctx) {
58
126
  const children = host.children ?? {};
59
127
  for (const [name, wrapper] of Object.entries(children)) {
60
128
  const member = await loadHost(ctx.projectRoot, wrapper.host);
@@ -72,9 +140,47 @@ async function build(host, ctx) {
72
140
  verb: "build"
73
141
  });
74
142
  }
143
+ }
144
+ /** build = members' builds + the shippable stack + the native installer. */
145
+ async function build(host, ctx) {
146
+ await buildMembers(host, ctx);
75
147
  const runnerOptions = host.runner;
76
- if (!runnerOptions.shell?.project && !ctx.env.PH_DESKTOP_SHELL) {
77
- console.log(`[${host.name}] build: no shell configured — members built; stack staging skipped (set runner.shell.project to stage the shippable stack).`);
148
+ const mode = shellMode(host, ctx);
149
+ const port = await connectPort(host, ctx);
150
+ if (mode === "generated") {
151
+ const hostDir = hostDirOf(host, ctx);
152
+ const app = loadAppJson(hostDir);
153
+ const { shellDir, binName, changed } = projectShell({
154
+ hostDir,
155
+ app,
156
+ connectPort: port
157
+ });
158
+ const tauri = preflightOrThrow(detectToolchain(ctx.projectRoot), host.name);
159
+ provisionShell(shellDir, tauri, changed);
160
+ console.log(`[${host.name}] staging the stack into ${shellDir}…`);
161
+ const staged = bundleStack({
162
+ projectRoot: ctx.projectRoot,
163
+ shellProjectDir: shellDir,
164
+ vendor: runnerOptions.vendorStack,
165
+ phCliVersion: runnerOptions.phCliVersion,
166
+ phCliSpec: runnerOptions.phCliSpec ?? ctx.env.PH_DESKTOP_PHCLI_SPEC,
167
+ connectPort: port,
168
+ excludeDirs: [shellDir]
169
+ });
170
+ console.log(`[${host.name}] stack staged at ${staged.stackDir}${staged.vendored ? " (ph-cli vendored)" : ""}.`);
171
+ const bundles = tauriBundlesForHost();
172
+ console.log(`[${host.name}] building '${binName}' (${tauri.via}: cargo tauri build --bundles ${bundles.join(",")})…`);
173
+ const result = spawnSyncTauri(tauri, [
174
+ "build",
175
+ "--bundles",
176
+ bundles.join(",")
177
+ ], shellDir);
178
+ if (result !== 0) throw new Error(`hosts/${host.name}: \`cargo tauri build\` failed (exit ${result}).`);
179
+ console.log(`[${host.name}] desktop app built — installers under ${path.join(shellDir, "target", "release", "bundle")}.`);
180
+ return;
181
+ }
182
+ if (mode === "none") {
183
+ console.log(`[${host.name}] build: no shell configured — members built; shell packaging skipped (add ${APP_JSON_FILE} or set runner.shell.project).`);
78
184
  return;
79
185
  }
80
186
  const shell = resolveShell(ctx.projectRoot, runnerOptions.shell, ctx.env);
@@ -85,11 +191,22 @@ async function build(host, ctx) {
85
191
  vendor: runnerOptions.vendorStack,
86
192
  phCliVersion: runnerOptions.phCliVersion,
87
193
  phCliSpec: runnerOptions.phCliSpec ?? ctx.env.PH_DESKTOP_PHCLI_SPEC,
88
- connectPort: await connectPort(host, ctx)
194
+ connectPort: port
89
195
  });
90
196
  console.log(`[${host.name}] stack staged at ${result.stackDir}${result.vendored ? " (ph-cli vendored)" : ""} — the shell runs it with no environment (resources fallback).`);
91
197
  }
198
+ /** Synchronous `<tauri> <subcommand>` — build blocks until the installer is
199
+ * produced. Returns the exit code. */
200
+ function spawnSyncTauri(tauri, subcommand, shellDir) {
201
+ const { command, args, shell } = tauriSpawn(tauri, subcommand);
202
+ return spawnSync(command, args, {
203
+ cwd: shellDir,
204
+ stdio: "inherit",
205
+ shell,
206
+ windowsHide: true
207
+ }).status ?? 1;
208
+ }
92
209
  //#endregion
93
- export { build, dev, hostSchema, kind, run, serve };
210
+ export { build, dev, hostSchema, kind, run, serve, shellMode };
94
211
 
95
212
  //# sourceMappingURL=runner.mjs.map