@jini-ai/desktop-host 0.1.2 → 0.4.1

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.
Files changed (185) hide show
  1. package/CHANGELOG.md +113 -0
  2. package/README.md +194 -0
  3. package/dist/bridge-testing.d.ts +2 -2
  4. package/dist/bridge-testing.js +3 -3
  5. package/dist/bridge.d.ts +33 -9
  6. package/dist/bridge.js +18 -17
  7. package/dist/config.d.ts +1 -1
  8. package/dist/config.js +2 -1
  9. package/dist/electron/create-electron-desktop-host.js +5 -5
  10. package/dist/electron/electron-protocol.d.ts +3 -1
  11. package/dist/electron/electron-protocol.js +7 -7
  12. package/dist/electron/electron-render-service.d.ts +3 -1
  13. package/dist/electron/electron-render-service.js +21 -20
  14. package/dist/electron/electron-shell.js +8 -8
  15. package/dist/electron/electron-single-instance.d.ts +3 -1
  16. package/dist/electron/electron-single-instance.js +3 -3
  17. package/dist/electron/electron-surfaces.d.ts +71 -32
  18. package/dist/electron/electron-surfaces.js +3 -10
  19. package/dist/electron/electron-window-lifecycle.d.ts +3 -1
  20. package/dist/electron/electron-window-lifecycle.js +17 -16
  21. package/dist/electron/index.d.ts +17 -0
  22. package/dist/electron/index.js +17 -0
  23. package/dist/electron/navigation-policy/index.d.ts +3 -0
  24. package/dist/electron/navigation-policy/index.js +3 -0
  25. package/dist/electron/navigation-policy/webview-guest-policy.d.ts +32 -0
  26. package/dist/electron/navigation-policy/webview-guest-policy.js +31 -0
  27. package/dist/electron/navigation-policy/window-navigation-policy.d.ts +125 -0
  28. package/dist/electron/navigation-policy/window-navigation-policy.js +138 -0
  29. package/dist/electron/testing.d.ts +8 -6
  30. package/dist/electron/testing.js +22 -22
  31. package/dist/electron/updates/auto-update-controller.d.ts +146 -0
  32. package/dist/electron/updates/auto-update-controller.js +222 -0
  33. package/dist/electron/updates/index.d.ts +4 -0
  34. package/dist/electron/updates/index.js +4 -0
  35. package/dist/electron/updates/instance-presence.d.ts +68 -0
  36. package/dist/electron/updates/instance-presence.js +79 -0
  37. package/dist/electron/updates/update-policy.d.ts +66 -0
  38. package/dist/electron/updates/update-policy.js +65 -0
  39. package/dist/electron/usability/find-in-page-ipc.d.ts +88 -0
  40. package/dist/electron/usability/find-in-page-ipc.js +22 -0
  41. package/dist/electron/usability/find-menu.d.ts +43 -0
  42. package/dist/electron/usability/find-menu.js +22 -0
  43. package/dist/electron/usability/index.d.ts +6 -0
  44. package/dist/electron/usability/index.js +6 -0
  45. package/dist/electron/usability/spellcheck-menu.d.ts +92 -0
  46. package/dist/electron/usability/spellcheck-menu.js +52 -0
  47. package/dist/electron/usability/window-bounds-store.d.ts +76 -0
  48. package/dist/electron/usability/window-bounds-store.js +44 -0
  49. package/dist/electron/usability/zoom-menu.d.ts +41 -0
  50. package/dist/electron/usability/zoom-menu.js +19 -0
  51. package/dist/index.d.ts +8 -16
  52. package/dist/index.js +8 -16
  53. package/dist/logging.d.ts +26 -12
  54. package/dist/logging.js +21 -21
  55. package/dist/node-toolchain/index.d.ts +76 -0
  56. package/dist/node-toolchain/index.js +96 -0
  57. package/dist/paths.d.ts +4 -2
  58. package/dist/paths.js +5 -4
  59. package/dist/protocol.d.ts +20 -5
  60. package/dist/protocol.js +5 -5
  61. package/dist/render-service.d.ts +31 -7
  62. package/dist/render-service.js +10 -10
  63. package/dist/shell.d.ts +15 -7
  64. package/dist/shell.js +3 -3
  65. package/dist/shutdown/index.d.ts +4 -0
  66. package/dist/shutdown/index.js +4 -0
  67. package/dist/shutdown/quit-drain-gate.d.ts +19 -0
  68. package/dist/shutdown/quit-drain-gate.js +15 -0
  69. package/dist/shutdown/quit-signals.d.ts +36 -0
  70. package/dist/shutdown/quit-signals.js +27 -0
  71. package/dist/shutdown/shutdown-tracker.d.ts +19 -0
  72. package/dist/shutdown/shutdown-tracker.js +26 -0
  73. package/dist/sidecar.d.ts +20 -8
  74. package/dist/sidecar.js +39 -22
  75. package/dist/single-instance.d.ts +13 -4
  76. package/dist/single-instance.js +4 -4
  77. package/dist/speech/channels.d.ts +8 -0
  78. package/dist/speech/channels.js +5 -0
  79. package/dist/speech/index.d.ts +5 -0
  80. package/dist/speech/index.js +5 -0
  81. package/dist/speech/macos/index.d.ts +2 -0
  82. package/dist/speech/macos/index.js +2 -0
  83. package/dist/speech/macos/mac-on-device-transcriber.d.ts +98 -0
  84. package/dist/speech/macos/mac-on-device-transcriber.js +127 -0
  85. package/dist/speech/macos/speech-helper.swift +157 -0
  86. package/dist/speech/pcm-wav-encoder.d.ts +22 -0
  87. package/dist/speech/pcm-wav-encoder.js +50 -0
  88. package/dist/speech/speech-bridge.d.ts +33 -0
  89. package/dist/speech/speech-bridge.js +14 -0
  90. package/dist/speech/speech-ipc.d.ts +44 -0
  91. package/dist/speech/speech-ipc.js +50 -0
  92. package/dist/speech/transcription-port.d.ts +42 -0
  93. package/dist/speech/transcription-port.js +14 -0
  94. package/dist/tauri/create-tauri-desktop-host.js +5 -5
  95. package/dist/tauri/index.d.ts +19 -0
  96. package/dist/tauri/index.js +19 -0
  97. package/dist/tauri/not-implemented.d.ts +3 -1
  98. package/dist/tauri/not-implemented.js +1 -1
  99. package/dist/tauri/tauri-protocol.d.ts +1 -1
  100. package/dist/tauri/tauri-protocol.js +2 -2
  101. package/dist/tauri/tauri-render-service.d.ts +1 -1
  102. package/dist/tauri/tauri-render-service.js +2 -2
  103. package/dist/tauri/tauri-shell.js +8 -8
  104. package/dist/tauri/tauri-sidecar.d.ts +3 -1
  105. package/dist/tauri/tauri-sidecar.js +17 -16
  106. package/dist/tauri/tauri-single-instance.d.ts +3 -1
  107. package/dist/tauri/tauri-single-instance.js +3 -3
  108. package/dist/tauri/tauri-surfaces.d.ts +50 -14
  109. package/dist/tauri/tauri-surfaces.js +2 -1
  110. package/dist/tauri/tauri-window-lifecycle.d.ts +3 -1
  111. package/dist/tauri/tauri-window-lifecycle.js +33 -20
  112. package/dist/tauri/testing.d.ts +10 -7
  113. package/dist/tauri/testing.js +30 -23
  114. package/dist/tokens.js +6 -6
  115. package/dist/window-lifecycle.d.ts +10 -4
  116. package/dist/window-lifecycle.js +7 -7
  117. package/dist/windows-registry.d.ts +16 -6
  118. package/dist/windows-registry.js +8 -7
  119. package/package.json +71 -6
  120. package/dist/bridge-testing.d.ts.map +0 -1
  121. package/dist/bridge-testing.js.map +0 -1
  122. package/dist/bridge.d.ts.map +0 -1
  123. package/dist/bridge.js.map +0 -1
  124. package/dist/config.d.ts.map +0 -1
  125. package/dist/config.js.map +0 -1
  126. package/dist/electron/create-electron-desktop-host.d.ts.map +0 -1
  127. package/dist/electron/create-electron-desktop-host.js.map +0 -1
  128. package/dist/electron/electron-protocol.d.ts.map +0 -1
  129. package/dist/electron/electron-protocol.js.map +0 -1
  130. package/dist/electron/electron-render-service.d.ts.map +0 -1
  131. package/dist/electron/electron-render-service.js.map +0 -1
  132. package/dist/electron/electron-shell.d.ts.map +0 -1
  133. package/dist/electron/electron-shell.js.map +0 -1
  134. package/dist/electron/electron-single-instance.d.ts.map +0 -1
  135. package/dist/electron/electron-single-instance.js.map +0 -1
  136. package/dist/electron/electron-surfaces.d.ts.map +0 -1
  137. package/dist/electron/electron-surfaces.js.map +0 -1
  138. package/dist/electron/electron-window-lifecycle.d.ts.map +0 -1
  139. package/dist/electron/electron-window-lifecycle.js.map +0 -1
  140. package/dist/electron/testing.d.ts.map +0 -1
  141. package/dist/electron/testing.js.map +0 -1
  142. package/dist/index.d.ts.map +0 -1
  143. package/dist/index.js.map +0 -1
  144. package/dist/logging.d.ts.map +0 -1
  145. package/dist/logging.js.map +0 -1
  146. package/dist/paths.d.ts.map +0 -1
  147. package/dist/paths.js.map +0 -1
  148. package/dist/ports.d.ts.map +0 -1
  149. package/dist/ports.js.map +0 -1
  150. package/dist/protocol.d.ts.map +0 -1
  151. package/dist/protocol.js.map +0 -1
  152. package/dist/render-service.d.ts.map +0 -1
  153. package/dist/render-service.js.map +0 -1
  154. package/dist/shell.d.ts.map +0 -1
  155. package/dist/shell.js.map +0 -1
  156. package/dist/sidecar.d.ts.map +0 -1
  157. package/dist/sidecar.js.map +0 -1
  158. package/dist/single-instance.d.ts.map +0 -1
  159. package/dist/single-instance.js.map +0 -1
  160. package/dist/tauri/create-tauri-desktop-host.d.ts.map +0 -1
  161. package/dist/tauri/create-tauri-desktop-host.js.map +0 -1
  162. package/dist/tauri/not-implemented.d.ts.map +0 -1
  163. package/dist/tauri/not-implemented.js.map +0 -1
  164. package/dist/tauri/tauri-protocol.d.ts.map +0 -1
  165. package/dist/tauri/tauri-protocol.js.map +0 -1
  166. package/dist/tauri/tauri-render-service.d.ts.map +0 -1
  167. package/dist/tauri/tauri-render-service.js.map +0 -1
  168. package/dist/tauri/tauri-shell.d.ts.map +0 -1
  169. package/dist/tauri/tauri-shell.js.map +0 -1
  170. package/dist/tauri/tauri-sidecar.d.ts.map +0 -1
  171. package/dist/tauri/tauri-sidecar.js.map +0 -1
  172. package/dist/tauri/tauri-single-instance.d.ts.map +0 -1
  173. package/dist/tauri/tauri-single-instance.js.map +0 -1
  174. package/dist/tauri/tauri-surfaces.d.ts.map +0 -1
  175. package/dist/tauri/tauri-surfaces.js.map +0 -1
  176. package/dist/tauri/tauri-window-lifecycle.d.ts.map +0 -1
  177. package/dist/tauri/tauri-window-lifecycle.js.map +0 -1
  178. package/dist/tauri/testing.d.ts.map +0 -1
  179. package/dist/tauri/testing.js.map +0 -1
  180. package/dist/tokens.d.ts.map +0 -1
  181. package/dist/tokens.js.map +0 -1
  182. package/dist/window-lifecycle.d.ts.map +0 -1
  183. package/dist/window-lifecycle.js.map +0 -1
  184. package/dist/windows-registry.d.ts.map +0 -1
  185. package/dist/windows-registry.js.map +0 -1
@@ -13,11 +13,11 @@ import { createTauriShellPort } from './tauri-shell.js';
13
13
  */
14
14
  export function createTauriDesktopHost(surfaces, overrides = {}) {
15
15
  const ports = {
16
- singleInstance: overrides.singleInstance ?? createTauriSingleInstanceLockPort(surfaces.singleInstance),
17
- windowLifecycle: overrides.windowLifecycle ?? createTauriWindowLifecyclePort(surfaces.createWindow),
18
- protocolHandler: overrides.protocolHandler ?? createTauriProtocolHandlerPort(),
19
- sidecarLauncher: overrides.sidecarLauncher ?? createTauriSidecarLauncher(surfaces.sidecarCommands),
20
- renderService: overrides.renderService ?? createTauriRenderService(),
16
+ singleInstance: overrides.singleInstance ?? createTauriSingleInstanceLockPort({ api: surfaces.singleInstance }),
17
+ windowLifecycle: overrides.windowLifecycle ?? createTauriWindowLifecyclePort({ createTauriWindow: surfaces.createWindow }),
18
+ protocolHandler: overrides.protocolHandler ?? createTauriProtocolHandlerPort({}),
19
+ sidecarLauncher: overrides.sidecarLauncher ?? createTauriSidecarLauncher({ api: surfaces.sidecarCommands }),
20
+ renderService: overrides.renderService ?? createTauriRenderService({}),
21
21
  shell: overrides.shell ?? createTauriShellPort({ shell: surfaces.shell, fs: surfaces.fs, dialog: surfaces.dialog }),
22
22
  };
23
23
  return { backend: 'tauri', ports };
@@ -0,0 +1,19 @@
1
+ /**
2
+ * `@jini-ai/desktop-host/tauri` — the full Tauri shell assembly. Split from the package's main
3
+ * `.` entry point (2026-07-29) so a Tauri app doesn't statically import the equally-full Electron
4
+ * assembly it will never call, and vice versa — mirrors `@jini-ai/agentic`'s `.`/`./dom` subpath
5
+ * precedent. The shared, shell-agnostic port types/utilities
6
+ * (`single-instance.ts`/`window-lifecycle.ts`/`protocol.ts`/`sidecar.ts`/`shell.ts`/`ports.ts`/etc.)
7
+ * stay at the package's main entry point; only the concrete Tauri implementation lives here.
8
+ */
9
+ export * from './tauri-surfaces.js';
10
+ export * from './tauri-single-instance.js';
11
+ export * from './tauri-window-lifecycle.js';
12
+ export * from './tauri-protocol.js';
13
+ export * from './tauri-render-service.js';
14
+ export * from './tauri-shell.js';
15
+ export * from './tauri-sidecar.js';
16
+ export * from './create-tauri-desktop-host.js';
17
+ export * from './not-implemented.js';
18
+ export * from './testing.js';
19
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,19 @@
1
+ /**
2
+ * `@jini-ai/desktop-host/tauri` — the full Tauri shell assembly. Split from the package's main
3
+ * `.` entry point (2026-07-29) so a Tauri app doesn't statically import the equally-full Electron
4
+ * assembly it will never call, and vice versa — mirrors `@jini-ai/agentic`'s `.`/`./dom` subpath
5
+ * precedent. The shared, shell-agnostic port types/utilities
6
+ * (`single-instance.ts`/`window-lifecycle.ts`/`protocol.ts`/`sidecar.ts`/`shell.ts`/`ports.ts`/etc.)
7
+ * stay at the package's main entry point; only the concrete Tauri implementation lives here.
8
+ */
9
+ export * from './tauri-surfaces.js';
10
+ export * from './tauri-single-instance.js';
11
+ export * from './tauri-window-lifecycle.js';
12
+ export * from './tauri-protocol.js';
13
+ export * from './tauri-render-service.js';
14
+ export * from './tauri-shell.js';
15
+ export * from './tauri-sidecar.js';
16
+ export * from './create-tauri-desktop-host.js';
17
+ export * from './not-implemented.js';
18
+ export * from './testing.js';
19
+ //# sourceMappingURL=index.js.map
@@ -1,5 +1,7 @@
1
1
  /** Shared marker error for the Tauri adapter's explicitly-out-of-scope port methods (RenderService, ProtocolHandlerPort — see each file's header comment for why). */
2
2
  export declare class NotImplementedError extends Error {
3
- constructor(message: string);
3
+ constructor({ message }: {
4
+ message: string;
5
+ });
4
6
  }
5
7
  //# sourceMappingURL=not-implemented.d.ts.map
@@ -1,6 +1,6 @@
1
1
  /** Shared marker error for the Tauri adapter's explicitly-out-of-scope port methods (RenderService, ProtocolHandlerPort — see each file's header comment for why). */
2
2
  export class NotImplementedError extends Error {
3
- constructor(message) {
3
+ constructor({ message }) {
4
4
  super(message);
5
5
  this.name = 'NotImplementedError';
6
6
  }
@@ -1,3 +1,3 @@
1
1
  import type { ProtocolHandlerPort } from '../protocol.js';
2
- export declare function createTauriProtocolHandlerPort(): ProtocolHandlerPort;
2
+ export declare function createTauriProtocolHandlerPort(_requiredArgs: Record<string, never>): ProtocolHandlerPort;
3
3
  //# sourceMappingURL=tauri-protocol.d.ts.map
@@ -10,10 +10,10 @@
10
10
  * `tauri-render-service.ts`.
11
11
  */
12
12
  import { NotImplementedError } from './not-implemented.js';
13
- export function createTauriProtocolHandlerPort() {
13
+ export function createTauriProtocolHandlerPort(_requiredArgs) {
14
14
  return {
15
15
  registerSchemeProxy() {
16
- throw new NotImplementedError('ProtocolHandlerPort.registerSchemeProxy is not implemented by the Tauri adapter — custom scheme registration is a Rust/tauri.conf.json-time concern with no JS-callable equivalent, and is out of scope for the C7 narrow spike');
16
+ throw new NotImplementedError({ message: 'ProtocolHandlerPort.registerSchemeProxy is not implemented by the Tauri adapter — custom scheme registration is a Rust/tauri.conf.json-time concern with no JS-callable equivalent, and is out of scope for the C7 narrow spike' });
17
17
  },
18
18
  };
19
19
  }
@@ -13,5 +13,5 @@
13
13
  import type { RenderService } from '../render-service.js';
14
14
  import { NotImplementedError } from './not-implemented.js';
15
15
  export { NotImplementedError };
16
- export declare function createTauriRenderService(): RenderService;
16
+ export declare function createTauriRenderService(_requiredArgs: Record<string, never>): RenderService;
17
17
  //# sourceMappingURL=tauri-render-service.d.ts.map
@@ -1,9 +1,9 @@
1
1
  import { NotImplementedError } from './not-implemented.js';
2
2
  export { NotImplementedError };
3
3
  function notImplemented(method) {
4
- throw new NotImplementedError(`RenderService.${method} is not implemented by the Tauri adapter — out of scope for the C7 narrow spike (sidecar/window/shutdown/single-instance/shell only)`);
4
+ throw new NotImplementedError({ message: `RenderService.${method} is not implemented by the Tauri adapter — out of scope for the C7 narrow spike (sidecar/window/shutdown/single-instance/shell only)` });
5
5
  }
6
- export function createTauriRenderService() {
6
+ export function createTauriRenderService(_requiredArgs) {
7
7
  return {
8
8
  async renderToPdf() {
9
9
  return notImplemented('renderToPdf');
@@ -1,19 +1,19 @@
1
1
  import { NotImplementedError } from './not-implemented.js';
2
2
  function notImplemented(method) {
3
- throw new NotImplementedError(`ShellPort.${method} is not implemented by the Tauri adapter — Tauri has no recent-documents API equivalent to Electron's app.getRecentDocuments() (see shell.ts's module doc)`);
3
+ throw new NotImplementedError({ message: `ShellPort.${method} is not implemented by the Tauri adapter — Tauri has no recent-documents API equivalent to Electron's app.getRecentDocuments() (see shell.ts's module doc)` });
4
4
  }
5
5
  export function createTauriShellPort(surfaces) {
6
6
  return {
7
- openExternal: (url) => surfaces.shell.openUrl(url),
8
- openPath: (path) => surfaces.shell.openPath(path),
9
- async dirExists(path) {
7
+ openExternal: ({ url }) => surfaces.shell.openUrl({ url }),
8
+ openPath: ({ path }) => surfaces.shell.openPath({ path }),
9
+ async dirExists({ path }) {
10
10
  // ShellPort.dirExists documents "never throws" — a permission error, or the path vanishing
11
11
  // between exists() and stat(), must resolve false, matching the Electron adapter.
12
12
  try {
13
- const exists = await surfaces.fs.exists(path);
13
+ const exists = await surfaces.fs.exists({ path });
14
14
  if (!exists)
15
15
  return false;
16
- const info = await surfaces.fs.stat(path);
16
+ const info = await surfaces.fs.stat({ path });
17
17
  return info.isDirectory;
18
18
  }
19
19
  catch {
@@ -30,8 +30,8 @@ export function createTauriShellPort(surfaces) {
30
30
  async recentDirs() {
31
31
  return notImplemented('recentDirs');
32
32
  },
33
- async openFolderDialog(options) {
34
- const result = await surfaces.dialog.open({
33
+ async openFolderDialog(_requiredArgs, options) {
34
+ const result = await surfaces.dialog.open({}, {
35
35
  directory: true,
36
36
  ...(options?.defaultPath !== undefined ? { defaultPath: options.defaultPath } : {}),
37
37
  });
@@ -1,4 +1,6 @@
1
1
  import type { SidecarLauncherPort } from '../sidecar.js';
2
2
  import type { TauriSidecarCommandApi } from './tauri-surfaces.js';
3
- export declare function createTauriSidecarLauncher(api: TauriSidecarCommandApi): SidecarLauncherPort;
3
+ export declare function createTauriSidecarLauncher({ api }: {
4
+ api: TauriSidecarCommandApi;
5
+ }): SidecarLauncherPort;
4
6
  //# sourceMappingURL=tauri-sidecar.d.ts.map
@@ -16,10 +16,10 @@ const DEFAULT_GRACEFUL_SHUTDOWN_TIMEOUT_MS = 5_000;
16
16
  async function waitForProcessExit(child, timeoutMs) {
17
17
  return await new Promise((resolve) => {
18
18
  let exited = false;
19
- child.onExit(() => {
20
- exited = true;
21
- resolve(true);
22
- });
19
+ child.onExit({ listener: () => {
20
+ exited = true;
21
+ resolve(true);
22
+ } });
23
23
  setTimeout(() => {
24
24
  if (!exited)
25
25
  resolve(false);
@@ -32,9 +32,9 @@ async function waitUntilReady(child, options) {
32
32
  const startedAt = Date.now();
33
33
  let lastError;
34
34
  let exited = null;
35
- child.onExit((code, signal) => {
36
- exited = { code, signal };
37
- });
35
+ child.onExit({ listener: ({ code, signal }) => {
36
+ exited = { code, signal };
37
+ } });
38
38
  while (Date.now() - startedAt < timeoutMs) {
39
39
  if (exited !== null) {
40
40
  const info = exited;
@@ -42,7 +42,7 @@ async function waitUntilReady(child, options) {
42
42
  }
43
43
  try {
44
44
  const status = await options.probe();
45
- if (options.isReady(status))
45
+ if (options.isReady({ status }))
46
46
  return status;
47
47
  }
48
48
  catch (error) {
@@ -64,23 +64,24 @@ async function shutdownChild(child, options = {}) {
64
64
  const gracefulTimeoutMs = options.gracefulTimeoutMs ?? DEFAULT_GRACEFUL_SHUTDOWN_TIMEOUT_MS;
65
65
  if (await waitForProcessExit(child, gracefulTimeoutMs))
66
66
  return;
67
- child.kill('SIGKILL');
67
+ child.kill({}, { signal: 'SIGKILL' });
68
68
  await waitForProcessExit(child, gracefulTimeoutMs);
69
69
  }
70
- export function createTauriSidecarLauncher(api) {
70
+ export function createTauriSidecarLauncher({ api }) {
71
71
  return {
72
- async launch(options) {
73
- const child = await api.spawnSidecar(options.command, options.args ?? [], options.env);
72
+ async launch(requiredArgs, optionalArgs = {}) {
73
+ const options = { ...optionalArgs, ...requiredArgs };
74
+ const child = await api.spawnSidecar({ binaryName: options.command, args: options.args ?? [] }, { env: options.env });
74
75
  const processHandle = {
75
76
  pid: child.pid,
76
- onExit: (listener) => child.onExit(listener),
77
- kill: (signal) => child.kill(signal),
77
+ onExit: ({ listener }) => child.onExit({ listener: ({ code, signal }) => listener({ code, signal }) }),
78
+ kill: (_requiredArgs, { signal } = {}) => child.kill({}, { signal }),
78
79
  };
79
80
  return {
80
81
  process: processHandle,
81
82
  logPath: null,
82
- waitUntilReady: (readyOptions) => waitUntilReady(child, readyOptions),
83
- shutdown: (shutdownOptions) => shutdownChild(child, shutdownOptions),
83
+ waitUntilReady: (requiredArgs, optionalArgs = {}) => waitUntilReady(child, { ...optionalArgs, ...requiredArgs }),
84
+ shutdown: (_requiredArgs, shutdownOptions) => shutdownChild(child, shutdownOptions),
84
85
  };
85
86
  },
86
87
  };
@@ -7,5 +7,7 @@ import type { TauriSingleInstanceApi } from './tauri-surfaces.js';
7
7
  * `true`, since by construction this JS is only running because the lock
8
8
  * was already granted.
9
9
  */
10
- export declare function createTauriSingleInstanceLockPort(api: TauriSingleInstanceApi): SingleInstanceLockPort;
10
+ export declare function createTauriSingleInstanceLockPort({ api }: {
11
+ api: TauriSingleInstanceApi;
12
+ }): SingleInstanceLockPort;
11
13
  //# sourceMappingURL=tauri-single-instance.d.ts.map
@@ -5,10 +5,10 @@
5
5
  * `true`, since by construction this JS is only running because the lock
6
6
  * was already granted.
7
7
  */
8
- export function createTauriSingleInstanceLockPort(api) {
8
+ export function createTauriSingleInstanceLockPort({ api }) {
9
9
  return {
10
- claim(onSecondInstance) {
11
- api.onSecondInstance(() => onSecondInstance());
10
+ claim({ onSecondInstance }) {
11
+ api.onSecondInstance({ listener: () => onSecondInstance() });
12
12
  return true;
13
13
  },
14
14
  };
@@ -3,7 +3,8 @@
3
3
  * `@tauri-apps/plugin-*` shapes this package's Tauri adapter uses. Like
4
4
  * `../electron/electron-surfaces.ts`, no real `@tauri-apps/*` package is a
5
5
  * dependency here — a consumer running inside a real Tauri webview passes
6
- * the real plugin functions, which structurally satisfy these interfaces.
6
+ * object-argument bindings around the real plugin functions. Native plugin
7
+ * functions no longer structurally satisfy these interfaces.
7
8
  *
8
9
  * Tauri's single-instance model is fundamentally different from
9
10
  * Electron's: the `tauri-plugin-single-instance` Rust plugin enforces the
@@ -16,16 +17,29 @@
16
17
  * settled.
17
18
  */
18
19
  export interface TauriSingleInstanceApi {
19
- onSecondInstance(listener: (args: string[], cwd: string) => void): () => void;
20
+ onSecondInstance({ listener }: {
21
+ listener: (args: {
22
+ args: string[];
23
+ cwd: string;
24
+ }) => void;
25
+ }): () => void;
20
26
  }
21
27
  export interface TauriWindowLike {
22
28
  show(): Promise<void>;
23
29
  hide(): Promise<void>;
24
30
  setFocus(): Promise<void>;
25
31
  close(): Promise<void>;
26
- navigate(url: string): Promise<void>;
32
+ navigate({ url }: {
33
+ url: string;
34
+ }): Promise<void>;
27
35
  isClosed(): boolean;
28
- onCloseRequested(listener: () => void): () => void;
36
+ onCloseRequested({ listener }: {
37
+ listener: () => void;
38
+ }): () => void;
39
+ /** Bind the native destruction event; notify after closure, never for a cancelable request. */
40
+ onClosed?({ listener }: {
41
+ listener: () => void;
42
+ }): () => void;
29
43
  }
30
44
  export interface TauriWindowCreateOptions {
31
45
  label: string;
@@ -34,10 +48,14 @@ export interface TauriWindowCreateOptions {
34
48
  height?: number;
35
49
  visible?: boolean;
36
50
  }
37
- export type TauriWindowFactory = (options: TauriWindowCreateOptions) => Promise<TauriWindowLike>;
51
+ export type TauriWindowFactory = (requiredArgs: Pick<TauriWindowCreateOptions, 'label' | 'url'>, optionalArgs?: Omit<TauriWindowCreateOptions, 'label' | 'url'>) => Promise<TauriWindowLike>;
38
52
  export interface TauriShellApi {
39
- openUrl(url: string): Promise<void>;
40
- openPath(path: string): Promise<void>;
53
+ openUrl({ url }: {
54
+ url: string;
55
+ }): Promise<void>;
56
+ openPath({ path }: {
57
+ path: string;
58
+ }): Promise<void>;
41
59
  }
42
60
  /** A `@tauri-apps/plugin-fs` `FileInfo`'s relevant subset — `isDirectory` is a plain boolean property on the real plugin's returned struct (a JSON-esque value crossing the Rust/JS boundary), not a method the way Node's `fs.Stats.isDirectory()` is. */
43
61
  export interface TauriFileInfo {
@@ -46,9 +64,13 @@ export interface TauriFileInfo {
46
64
  /** Structural subset of `@tauri-apps/plugin-fs` this package's `ShellPort.dirExists` backs. No real `@tauri-apps/plugin-fs` import — see module doc. */
47
65
  export interface TauriFsApi {
48
66
  /** Real plugin: `exists(path)`. */
49
- exists(path: string): Promise<boolean>;
67
+ exists({ path }: {
68
+ path: string;
69
+ }): Promise<boolean>;
50
70
  /** Real plugin: `stat(path)`. */
51
- stat(path: string): Promise<TauriFileInfo>;
71
+ stat({ path }: {
72
+ path: string;
73
+ }): Promise<TauriFileInfo>;
52
74
  }
53
75
  export interface TauriOpenDialogOptions {
54
76
  readonly directory?: boolean;
@@ -56,15 +78,29 @@ export interface TauriOpenDialogOptions {
56
78
  }
57
79
  /** Structural subset of `@tauri-apps/plugin-dialog` this package's `ShellPort.openFolderDialog` backs. Real plugin: `open(options)` resolves `null` on cancel, a single `string` for a single selection, or `string[]` when `multiple: true` is requested (this port never sets `multiple`, but the return type still reflects the plugin's real signature). */
58
80
  export interface TauriDialogApi {
59
- open(options: TauriOpenDialogOptions): Promise<string | string[] | null>;
81
+ open(requiredArgs: Record<string, never>, optionalArgs?: TauriOpenDialogOptions): Promise<string | string[] | null>;
60
82
  }
61
83
  export interface TauriChildProcessLike {
62
84
  pid: number | undefined;
63
- onExit(listener: (code: number | null, signal: NodeJS.Signals | null) => void): void;
64
- kill(signal?: NodeJS.Signals): boolean;
65
- write?(data: string): Promise<void>;
85
+ onExit({ listener }: {
86
+ listener: (args: {
87
+ code: number | null;
88
+ signal: NodeJS.Signals | null;
89
+ }) => void;
90
+ }): void;
91
+ kill(requiredArgs: Record<string, never>, optionalArgs?: {
92
+ signal?: NodeJS.Signals | undefined;
93
+ }): boolean;
94
+ write?({ data }: {
95
+ data: string;
96
+ }): Promise<void>;
66
97
  }
67
98
  export interface TauriSidecarCommandApi {
68
- spawnSidecar(binaryName: string, args: string[], env?: Record<string, string>): Promise<TauriChildProcessLike>;
99
+ spawnSidecar({ binaryName, args }: {
100
+ binaryName: string;
101
+ args: string[];
102
+ }, optionalArgs?: {
103
+ env?: Record<string, string> | undefined;
104
+ }): Promise<TauriChildProcessLike>;
69
105
  }
70
106
  //# sourceMappingURL=tauri-surfaces.d.ts.map
@@ -3,7 +3,8 @@
3
3
  * `@tauri-apps/plugin-*` shapes this package's Tauri adapter uses. Like
4
4
  * `../electron/electron-surfaces.ts`, no real `@tauri-apps/*` package is a
5
5
  * dependency here — a consumer running inside a real Tauri webview passes
6
- * the real plugin functions, which structurally satisfy these interfaces.
6
+ * object-argument bindings around the real plugin functions. Native plugin
7
+ * functions no longer structurally satisfy these interfaces.
7
8
  *
8
9
  * Tauri's single-instance model is fundamentally different from
9
10
  * Electron's: the `tauri-plugin-single-instance` Rust plugin enforces the
@@ -1,4 +1,6 @@
1
1
  import { type WindowLifecyclePort } from '../window-lifecycle.js';
2
2
  import type { TauriWindowFactory } from './tauri-surfaces.js';
3
- export declare function createTauriWindowLifecyclePort(createTauriWindow: TauriWindowFactory): WindowLifecyclePort;
3
+ export declare function createTauriWindowLifecyclePort({ createTauriWindow }: {
4
+ createTauriWindow: TauriWindowFactory;
5
+ }): WindowLifecyclePort;
4
6
  //# sourceMappingURL=tauri-window-lifecycle.d.ts.map
@@ -6,33 +6,46 @@ function nextWindowLabel() {
6
6
  }
7
7
  function toWindowHandle(win) {
8
8
  return {
9
- async loadUrl(url) {
10
- await win.navigate(url);
9
+ async loadUrl({ url }) {
10
+ await win.navigate({ url });
11
11
  },
12
12
  show: () => void win.show(),
13
13
  hide: () => void win.hide(),
14
14
  focus: () => void win.setFocus(),
15
15
  close: () => void win.close(),
16
16
  isDestroyed: () => win.isClosed(),
17
- onClosed: (listener) => win.onCloseRequested(listener),
17
+ onClosed: ({ listener }) => {
18
+ if (win.onClosed != null)
19
+ return win.onClosed({ listener });
20
+ // Legacy bindings expose only a cancelable request. Observe confirmed closure instead;
21
+ // a request can be prevented, or its native destruction can complete asynchronously.
22
+ const observeClosed = () => {
23
+ if (win.isClosed()) {
24
+ listener();
25
+ return;
26
+ }
27
+ const timer = setTimeout(observeClosed, 50);
28
+ timer.unref?.();
29
+ };
30
+ observeClosed();
31
+ },
18
32
  };
19
33
  }
20
- export function createTauriWindowLifecyclePort(createTauriWindow) {
21
- return withMainWindowTracking(async (options) => {
22
- const win = await createTauriWindow({
23
- label: nextWindowLabel(),
24
- url: options.url,
25
- visible: options.show ?? true,
26
- ...(options.width == null ? {} : { width: options.width }),
27
- ...(options.height == null ? {} : { height: options.height }),
28
- });
29
- const handle = toWindowHandle(win);
30
- // Redundant with the `url` passed to createTauriWindow above (Tauri's
31
- // real WebviewWindow constructor loads it immediately) but explicit,
32
- // so WindowHandle.loadUrl is a real, exercised "URL load" capability
33
- // matching the Electron adapter's shape rather than a dead method.
34
- await handle.loadUrl(options.url);
35
- return handle;
36
- });
34
+ export function createTauriWindowLifecyclePort({ createTauriWindow }) {
35
+ return withMainWindowTracking({ createWindowImpl: async (requiredArgs, optionalArgs = {}) => {
36
+ const options = { ...optionalArgs, ...requiredArgs };
37
+ const win = await createTauriWindow({ label: nextWindowLabel(), url: options.url }, {
38
+ visible: options.show ?? true,
39
+ ...(options.width == null ? {} : { width: options.width }),
40
+ ...(options.height == null ? {} : { height: options.height }),
41
+ });
42
+ const handle = toWindowHandle(win);
43
+ // Redundant with the `url` passed to createTauriWindow above (Tauri's
44
+ // real WebviewWindow constructor loads it immediately) but explicit,
45
+ // so WindowHandle.loadUrl is a real, exercised "URL load" capability
46
+ // matching the Electron adapter's shape rather than a dead method.
47
+ await handle.loadUrl({ url: options.url });
48
+ return handle;
49
+ } });
37
50
  }
38
51
  //# sourceMappingURL=tauri-window-lifecycle.js.map
@@ -1,22 +1,25 @@
1
1
  /** Fake Tauri surfaces for tests — never a real `@tauri-apps/*` import (see `tauri-surfaces.ts`). */
2
2
  import type { TauriDialogApi, TauriFsApi, TauriShellApi, TauriSidecarCommandApi, TauriSingleInstanceApi, TauriWindowFactory, TauriWindowLike } from './tauri-surfaces.js';
3
- export declare function createFakeTauriSingleInstanceApi(): TauriSingleInstanceApi & {
4
- emitSecondInstance(args: string[], cwd: string): void;
3
+ export declare function createFakeTauriSingleInstanceApi(_requiredArgs: Record<string, never>): TauriSingleInstanceApi & {
4
+ emitSecondInstance({ args, cwd }: {
5
+ args: string[];
6
+ cwd: string;
7
+ }): void;
5
8
  };
6
- export declare function createFakeTauriWindowFactory(): {
9
+ export declare function createFakeTauriWindowFactory(_requiredArgs: Record<string, never>): {
7
10
  factory: TauriWindowFactory;
8
11
  windows: TauriWindowLike[];
9
12
  };
10
- export declare function createFakeTauriShellApi(): TauriShellApi & {
13
+ export declare function createFakeTauriShellApi(_requiredArgs: Record<string, never>): TauriShellApi & {
11
14
  openedUrls: string[];
12
15
  openedPaths: string[];
13
16
  };
14
17
  /** `directories`/`files` are absolute-path allow-lists the fake checks `exists`/`stat` against — no real filesystem I/O, matching this module's own "never a real @tauri-apps/* import" convention (and, transitively, no real `node:fs` either). */
15
- export declare function createFakeTauriFsApi(seed?: {
18
+ export declare function createFakeTauriFsApi(_requiredArgs: Record<string, never>, seed?: {
16
19
  directories?: string[];
17
20
  files?: string[];
18
21
  }): TauriFsApi;
19
- export declare function createFakeTauriDialogApi(script?: {
22
+ export declare function createFakeTauriDialogApi(_requiredArgs: Record<string, never>, script?: {
20
23
  openResult?: string | string[] | null;
21
24
  }): TauriDialogApi & {
22
25
  lastOpenOptions: unknown;
@@ -26,7 +29,7 @@ export interface FakeTauriSidecarScript {
26
29
  readyAfterProbes?: number;
27
30
  ignoresGracefulShutdown?: boolean;
28
31
  }
29
- export declare function createFakeTauriSidecarCommandApi(script?: FakeTauriSidecarScript): TauriSidecarCommandApi & {
32
+ export declare function createFakeTauriSidecarCommandApi(_requiredArgs: Record<string, never>, script?: FakeTauriSidecarScript): TauriSidecarCommandApi & {
30
33
  spawned: Array<{
31
34
  binaryName: string;
32
35
  args: string[];