@jini-ai/desktop-host 0.6.16 → 0.6.19

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @jini-ai/desktop-host
2
2
 
3
+ ## 0.6.17
4
+
5
+ ### Patch Changes
6
+
7
+ - Version bump only.
8
+
3
9
  ## 0.6.13
4
10
 
5
11
  ### Patch Changes
@@ -56,7 +62,7 @@
56
62
  - Desktop clocks/logging adopt core ports; native updater/navigation ABIs replace custom wrappers. Native macOS speech source remains an explicit runtime export.
57
63
  - Distribution includes runtime output, release documentation and required assets only. Process records and per-job neutrality checks are no longer part of the package surface.
58
64
 
59
- ## Unreleased
65
+ ## 0.6.19
60
66
 
61
67
  - Compile the macOS speech helper through the asynchronous `execFileAsync` port, and await it in availability/transcription. Concurrent first-use calls share compilation so Electron's main thread stays responsive while Swift builds the helper.
62
68
  - **BREAKING:** `ensureHelperCompiled` now returns `Promise<CompileResult>` and requires `execFileAsync`. Its optional legacy `spawnSync` dependency is accepted for source compatibility but never invoked.
@@ -73,4 +73,5 @@ export declare function buildNodeToolchainShims({ electronPath, npmRoot, platfor
73
73
  export declare function writeNodeToolchain(input: WriteNodeToolchainInput): NodeToolchainPaths | null;
74
74
  /** Host-named environment contract; duplicate/invalid names fail loudly. @complexity O(n) in names. */
75
75
  export declare function buildNodeToolchainEnv({ toolchainDir, npmRoot, toolchainEnvName, npmRootEnvName }: BuildNodeToolchainEnvInput): Record<string, string>;
76
+ export { isReadOnlyVolumeRoot, isTransientAppPath, launcherNamesDurableInstall } from "./install-location.js";
76
77
  //# sourceMappingURL=index.d.ts.map
@@ -96,4 +96,5 @@ export function buildNodeToolchainEnv({ toolchainDir, npmRoot, toolchainEnvName,
96
96
  }
97
97
  return { [toolchainEnvName]: toolchainDir, [npmRootEnvName]: npmRoot };
98
98
  }
99
+ export { isReadOnlyVolumeRoot, isTransientAppPath, launcherNamesDurableInstall } from "./install-location.js";
99
100
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Whether `electronPath` lives somewhere that will vanish — so writing it into a durable launcher
3
+ * would, while it is still there, make every site's daemon exec from it (holding the disk image
4
+ * open so it cannot be ejected), and once it is gone, fail with a spawn error naming neither cause.
5
+ *
6
+ * Two macOS cases, both only ever produced by opening the app without installing it:
7
+ *
8
+ * - **A read-only volume under `/Volumes`** — a mounted `.dmg`. Read-only rather than every
9
+ * `/Volumes` path, because an app an operator deliberately installed on a writable external drive
10
+ * is a durable choice of theirs.
11
+ * - **App Translocation** (`.../AppTranslocation/<uuid>/d/Application.app`) — Gatekeeper's randomized
12
+ * read-only mirror of a quarantined app, a new path on every launch.
13
+ *
14
+ * @param options.isReadOnlyVolume asked about `/Volumes/<name>` only; production uses
15
+ * {@link isReadOnlyVolumeRoot}.
16
+ * @returns Whether persisting this executable path would pin a transient installation.
17
+ * @example isTransientAppPath({ executablePath: "/Applications/Sample.app/Contents/MacOS/Sample" });
18
+ * @complexity O(n) in the path length, plus one filesystem probe for a `/Volumes` path.
19
+ */
20
+ export declare function isTransientAppPath({ executablePath: electronPath }: {
21
+ executablePath: string;
22
+ }, { isReadOnlyVolume }?: {
23
+ isReadOnlyVolume?: (volumeRoot: string) => boolean;
24
+ }): boolean;
25
+ /** A mounted disk image refuses write access with `EROFS`; anything else (a writable drive, a
26
+ * permission denial, a path that is gone) is not evidence of one.
27
+ * @param options.accessSync the write probe; production uses `fs.accessSync`, a test passes a fake
28
+ * so the `EROFS` answer can be exercised without mounting a read-only volume.
29
+ * @returns True only for a read-only filesystem; missing paths and access denials return false.
30
+ * @example isReadOnlyVolumeRoot({ volumeRoot: "/Volumes/Installer" });
31
+ * @complexity O(1) — one `access` call. */
32
+ export declare function isReadOnlyVolumeRoot({ volumeRoot }: {
33
+ volumeRoot: string;
34
+ }, { accessSync }?: {
35
+ accessSync?: (target: string, mode: number) => void;
36
+ }): boolean;
37
+ /**
38
+ * Whether the launcher already at `launcherPath` execs an Electron binary that exists at a durable
39
+ * location — i.e. an installed copy's launcher, which a launch from a disk image must leave alone
40
+ * rather than break. The unavailable stub and a launcher naming a transient path both answer false.
41
+ * @returns False on an unreadable launcher, absent executable, or transient installation.
42
+ * @example launcherNamesDurableInstall({ launcherPath: "/tmp/toolchain/bin/node" });
43
+ *
44
+ * @complexity O(n) in the launcher's size.
45
+ */
46
+ export declare function launcherNamesDurableInstall({ launcherPath }: {
47
+ launcherPath: string;
48
+ }, { isReadOnlyVolume }?: {
49
+ isReadOnlyVolume?: (volumeRoot: string) => boolean;
50
+ }): boolean;
51
+ //# sourceMappingURL=install-location.d.ts.map
@@ -0,0 +1,63 @@
1
+ import fs from "node:fs";
2
+ /**
3
+ * Whether `electronPath` lives somewhere that will vanish — so writing it into a durable launcher
4
+ * would, while it is still there, make every site's daemon exec from it (holding the disk image
5
+ * open so it cannot be ejected), and once it is gone, fail with a spawn error naming neither cause.
6
+ *
7
+ * Two macOS cases, both only ever produced by opening the app without installing it:
8
+ *
9
+ * - **A read-only volume under `/Volumes`** — a mounted `.dmg`. Read-only rather than every
10
+ * `/Volumes` path, because an app an operator deliberately installed on a writable external drive
11
+ * is a durable choice of theirs.
12
+ * - **App Translocation** (`.../AppTranslocation/<uuid>/d/Application.app`) — Gatekeeper's randomized
13
+ * read-only mirror of a quarantined app, a new path on every launch.
14
+ *
15
+ * @param options.isReadOnlyVolume asked about `/Volumes/<name>` only; production uses
16
+ * {@link isReadOnlyVolumeRoot}.
17
+ * @returns Whether persisting this executable path would pin a transient installation.
18
+ * @example isTransientAppPath({ executablePath: "/Applications/Sample.app/Contents/MacOS/Sample" });
19
+ * @complexity O(n) in the path length, plus one filesystem probe for a `/Volumes` path.
20
+ */
21
+ export function isTransientAppPath({ executablePath: electronPath }, { isReadOnlyVolume = volumeRoot => isReadOnlyVolumeRoot({ volumeRoot }) } = {}) {
22
+ if (electronPath.includes("/AppTranslocation/"))
23
+ return true;
24
+ const volume = /^\/Volumes\/[^/]+/.exec(electronPath);
25
+ return volume !== null && isReadOnlyVolume(volume[0]);
26
+ }
27
+ /** A mounted disk image refuses write access with `EROFS`; anything else (a writable drive, a
28
+ * permission denial, a path that is gone) is not evidence of one.
29
+ * @param options.accessSync the write probe; production uses `fs.accessSync`, a test passes a fake
30
+ * so the `EROFS` answer can be exercised without mounting a read-only volume.
31
+ * @returns True only for a read-only filesystem; missing paths and access denials return false.
32
+ * @example isReadOnlyVolumeRoot({ volumeRoot: "/Volumes/Installer" });
33
+ * @complexity O(1) — one `access` call. */
34
+ export function isReadOnlyVolumeRoot({ volumeRoot }, { accessSync = fs.accessSync } = {}) {
35
+ try {
36
+ accessSync(volumeRoot, fs.constants.W_OK);
37
+ return false;
38
+ }
39
+ catch (error) {
40
+ return error.code === "EROFS";
41
+ }
42
+ }
43
+ /**
44
+ * Whether the launcher already at `launcherPath` execs an Electron binary that exists at a durable
45
+ * location — i.e. an installed copy's launcher, which a launch from a disk image must leave alone
46
+ * rather than break. The unavailable stub and a launcher naming a transient path both answer false.
47
+ * @returns False on an unreadable launcher, absent executable, or transient installation.
48
+ * @example launcherNamesDurableInstall({ launcherPath: "/tmp/toolchain/bin/node" });
49
+ *
50
+ * @complexity O(n) in the launcher's size.
51
+ */
52
+ export function launcherNamesDurableInstall({ launcherPath }, { isReadOnlyVolume = volumeRoot => isReadOnlyVolumeRoot({ volumeRoot }) } = {}) {
53
+ let existing;
54
+ try {
55
+ existing = fs.readFileSync(launcherPath, "utf8");
56
+ }
57
+ catch {
58
+ return false;
59
+ }
60
+ const electron = /^exec '([^']+)'/m.exec(existing)?.[1];
61
+ return electron !== undefined && !isTransientAppPath({ executablePath: electron }, { isReadOnlyVolume }) && fs.existsSync(electron);
62
+ }
63
+ //# sourceMappingURL=install-location.js.map
@@ -8,7 +8,7 @@ export interface RenderBridgeTimers {
8
8
  clearTimeout(handle: unknown): void;
9
9
  }
10
10
  /** Start one per launched server. No public bind, browser credentials, redirects or cookies.
11
- * @example const bridge = await startRenderBridge({ capture }); // pass bridge.env to the child
11
+ * @example const bridge = await startRenderBridge({ capture }); // deliver bridge.env over startup IPC
12
12
  * @complexity O(bytes) per capture; one active render, at most 16 MiB of PNG output.
13
13
  */
14
14
  export declare function startRenderBridge({ capture }: {
@@ -22,7 +22,7 @@ export declare function startRenderBridge({ capture }: {
22
22
  }>;
23
23
  /** Detect a complete private bridge contract; a partial/invalid contract fails closed.
24
24
  * No bridge returns null so hosts retain their current browser fallback.
25
- * @example const capture = renderBridgeFromEnv({ env: process.env });
25
+ * @example const capture = renderBridgeFromEnv({ env: privateStartupConfiguration });
26
26
  * @complexity O(1), plus bounded request/PNG bytes per capture.
27
27
  */
28
28
  export declare function renderBridgeFromEnv({ env }: {
@@ -1,5 +1,5 @@
1
- /** Private native-render transport. The capability travels in the launcher environment, never
2
- * a renderer/preload bridge or a boot-token log. Descendant daemons can use the same endpoint.
1
+ /** Private native-render transport. Deliver its configuration over private startup IPC, never
2
+ * a child OS environment, renderer/preload bridge or boot-token log.
3
3
  */
4
4
  import { randomBytes, timingSafeEqual } from 'node:crypto';
5
5
  import { createServer } from 'node:http';
@@ -31,7 +31,7 @@ function authorized({ authorization, token }) {
31
31
  return actual.length === expected.length && timingSafeEqual(actual, expected);
32
32
  }
33
33
  /** Start one per launched server. No public bind, browser credentials, redirects or cookies.
34
- * @example const bridge = await startRenderBridge({ capture }); // pass bridge.env to the child
34
+ * @example const bridge = await startRenderBridge({ capture }); // deliver bridge.env over startup IPC
35
35
  * @complexity O(bytes) per capture; one active render, at most 16 MiB of PNG output.
36
36
  */
37
37
  export async function startRenderBridge({ capture }, { createServer: makeServer = createServer, timers = { setTimeout, clearTimeout } } = {}) {
@@ -112,7 +112,7 @@ async function readCaptureResponse({ response }, _options = {}) {
112
112
  }
113
113
  /** Detect a complete private bridge contract; a partial/invalid contract fails closed.
114
114
  * No bridge returns null so hosts retain their current browser fallback.
115
- * @example const capture = renderBridgeFromEnv({ env: process.env });
115
+ * @example const capture = renderBridgeFromEnv({ env: privateStartupConfiguration });
116
116
  * @complexity O(1), plus bounded request/PNG bytes per capture.
117
117
  */
118
118
  export function renderBridgeFromEnv({ env }, { fetch: send = globalThis.fetch } = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jini-ai/desktop-host",
3
- "version": "0.6.16",
3
+ "version": "0.6.19",
4
4
  "description": "Shell-agnostic desktop-host ports: single-instance lock, window lifecycle, protocol handling, sidecar launch, paths, and config. Electron and Tauri assemblies live behind ./electron and ./tauri.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -113,10 +113,10 @@
113
113
  },
114
114
  "devDependencies": {
115
115
  "@vitest/coverage-v8": "^2.1.9",
116
- "@jini-ai/core": "^0.6.16"
116
+ "@jini-ai/core": "^0.6.19"
117
117
  },
118
118
  "dependencies": {
119
- "@jini-ai/core": "^0.6.16"
119
+ "@jini-ai/core": "^0.6.19"
120
120
  },
121
121
  "peerDependencies": {},
122
122
  "peerDependenciesMeta": {},