akanjs 3.3.0 → 3.4.0-rc.0

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 (62) hide show
  1. package/common/PipelinePlanSchema.ts +31 -7
  2. package/common/index.ts +6 -0
  3. package/common/pipelinePlan.ts +31 -5
  4. package/index.ts +7 -5
  5. package/package.json +1 -1
  6. package/pipelineConfig.ts +25 -2
  7. package/service/agentLoop/agentLoop.ts +19 -12
  8. package/service/predefinedAdaptor/anthropicTools.ts +8 -2
  9. package/types/common/index.d.ts +1 -1
  10. package/types/common/pipelinePlan.d.ts +35 -6
  11. package/types/index.d.ts +7 -5
  12. package/types/pipelineConfig.d.ts +20 -3
  13. package/types/server/logging/rotatingLogWriter.d.ts +1 -1
  14. package/types/service/predefinedAdaptor/anthropicTools.d.ts +1 -0
  15. package/types/vendor/@akanjs/native/packages/cli/src/api-updates.d.ts +149 -0
  16. package/types/vendor/@akanjs/native/packages/cli/src/api.d.ts +16 -162
  17. package/types/vendor/@akanjs/native/packages/cli/src/config.d.ts +3 -2
  18. package/types/vendor/@akanjs/native/packages/cli/src/lib/api-task.d.ts +79 -0
  19. package/types/vendor/@akanjs/native/packages/cli/src/lib/prepare.d.ts +1 -1
  20. package/types/vendor/@akanjs/native/packages/cli/src/lib/publish.d.ts +17 -5
  21. package/types/vendor/@akanjs/native/packages/cli/src/lib/updates.d.ts +29 -2
  22. package/types/vendor/@akanjs/native/packages/cli/src/platforms/desktop-update.d.ts +36 -0
  23. package/types/vendor/@akanjs/native/packages/cli/src/platforms/linux-install.d.ts +15 -0
  24. package/types/vendor/@akanjs/native/packages/core/src/kernel.d.ts +16 -5
  25. package/types/vendor/@akanjs/native/packages/desktop/src/commands.d.ts +81 -0
  26. package/types/vendor/@akanjs/native/packages/desktop/src/deeplinks.d.ts +5 -1
  27. package/types/vendor/@akanjs/native/packages/desktop/src/dispatcher.d.ts +3 -0
  28. package/types/vendor/@akanjs/native/packages/desktop/src/lifecycle.d.ts +8 -1
  29. package/types/vendor/@akanjs/native/packages/desktop/src/plugin.d.ts +21 -0
  30. package/types/vendor/@akanjs/native/packages/desktop/src/server.d.ts +1 -0
  31. package/types/vendor/@akanjs/native/plugins/updates/src/desktop.d.ts +4 -4
  32. package/types/vendor/@akanjs/native/plugins/updates/src/reports.d.ts +49 -0
  33. package/types/vendor/@akanjs/native/plugins/updates/src/signer.d.ts +21 -0
  34. package/types/vendor/@akanjs/native/plugins/window/src/index.d.ts +55 -3
  35. package/vendor/@akanjs/native/native/desktop/src/lib.rs +209 -54
  36. package/vendor/@akanjs/native/packages/cli/src/api-updates.ts +332 -0
  37. package/vendor/@akanjs/native/packages/cli/src/api.ts +67 -419
  38. package/vendor/@akanjs/native/packages/cli/src/commands/build.ts +4 -1
  39. package/vendor/@akanjs/native/packages/cli/src/config.ts +3 -2
  40. package/vendor/@akanjs/native/packages/cli/src/lib/api-task.ts +223 -0
  41. package/vendor/@akanjs/native/packages/cli/src/lib/prepare.ts +2 -7
  42. package/vendor/@akanjs/native/packages/cli/src/lib/publish.ts +164 -19
  43. package/vendor/@akanjs/native/packages/cli/src/lib/updates.ts +90 -3
  44. package/vendor/@akanjs/native/packages/cli/src/platforms/desktop-update.ts +195 -43
  45. package/vendor/@akanjs/native/packages/cli/src/platforms/linux-appimage.ts +1 -1
  46. package/vendor/@akanjs/native/packages/cli/src/platforms/linux-install.ts +206 -0
  47. package/vendor/@akanjs/native/packages/cli/src/platforms/linux.ts +5 -1
  48. package/vendor/@akanjs/native/packages/core/src/kernel.ts +21 -6
  49. package/vendor/@akanjs/native/packages/core/vectors/updates.json +2 -1
  50. package/vendor/@akanjs/native/packages/desktop/src/commands.ts +380 -0
  51. package/vendor/@akanjs/native/packages/desktop/src/deeplinks.ts +20 -3
  52. package/vendor/@akanjs/native/packages/desktop/src/dispatcher.ts +28 -13
  53. package/vendor/@akanjs/native/packages/desktop/src/host.ts +6 -18
  54. package/vendor/@akanjs/native/packages/desktop/src/lifecycle.ts +8 -1
  55. package/vendor/@akanjs/native/packages/desktop/src/plugin.ts +21 -0
  56. package/vendor/@akanjs/native/packages/desktop/src/server.ts +1 -1
  57. package/vendor/@akanjs/native/plugins/updates/src/desktop.ts +90 -164
  58. package/vendor/@akanjs/native/plugins/updates/src/reports.ts +255 -0
  59. package/vendor/@akanjs/native/plugins/updates/src/signer.ts +133 -0
  60. package/vendor/@akanjs/native/plugins/window/native-plugin.json +6 -1
  61. package/vendor/@akanjs/native/plugins/window/src/desktop.ts +20 -4
  62. package/vendor/@akanjs/native/plugins/window/src/index.ts +55 -3
@@ -194,21 +194,30 @@ export declare function checkUpdateEnvelope(envelope: {
194
194
  export declare const RESERVED_CHANNELS: readonly string[];
195
195
  /** A channel the publisher can make: a file name in the release folder and a string an app's config compares. */
196
196
  export declare const isChannelName: (s: string) => boolean;
197
- /** What became of a release on a phone, posted to updates.report.url (vectors/updates.json `reports`). */
197
+ /** What became of a release on a phone or a desktop app, posted to updates.report.url (vectors/updates.json `reports`). */
198
198
  export declare const UPDATE_REPORT_EVENTS: readonly ["downloaded", "applied", "confirmed", "rolledBack", "failed"];
199
199
  export type UpdateReportEvent = (typeof UPDATE_REPORT_EVENTS)[number];
200
200
  /** Why: rolledBack for timeout, relaunch, hang or verify; failed for download, verify, disk, signature or manifest. */
201
201
  export declare const UPDATE_REPORT_REASONS: readonly ["timeout", "relaunch", "hang", "verify", "download", "disk", "signature", "manifest"];
202
202
  export type UpdateReportReason = (typeof UPDATE_REPORT_REASONS)[number];
203
+ /**
204
+ * The reasons only a desktop app gives, beside the phones': `signer` fails a release the installed app's team or
205
+ * Authenticode signer did not sign; `server` fails one that adds or drops the carried server, and rolls back one whose
206
+ * server did not come up.
207
+ */
208
+ export declare const UPDATE_REPORT_DESKTOP_REASONS: readonly ["signer", "server"];
209
+ export type UpdateReportDesktopReason = (typeof UPDATE_REPORT_DESKTOP_REASONS)[number];
203
210
  export interface UpdateReportEntry {
204
211
  /** Counts up for as long as the install lasts, so a receiver can drop a batch it already took. */
205
212
  id: number;
206
213
  event: UpdateReportEvent;
207
214
  bundle: string;
208
215
  sequence: number | null;
209
- reason: UpdateReportReason | null;
216
+ reason: UpdateReportReason | UpdateReportDesktopReason | null;
210
217
  /** updateReportTime: UTC, always three fraction digits. */
211
218
  at: string;
219
+ /** A desktop app: the key that signed the release, or that a refused envelope names; left out when it knows none. */
220
+ keyId?: string;
212
221
  }
213
222
  /** One request to updates.report.url, with no credentials. */
214
223
  export interface UpdateReportBody {
@@ -219,16 +228,18 @@ export interface UpdateReportBody {
219
228
  installId: string;
220
229
  nativeApi: string;
221
230
  appVersion: string;
222
- /** "iOS 18.1", "Android 15". */
231
+ /** "iOS 18.1", "Android 15", "macOS 15.5", "Windows 10.0.26200", "Linux Ubuntu 24.04.1 LTS". */
223
232
  os: string;
233
+ /** A desktop app's CPU, "arm64" or "x64": its releases are per OS and CPU. A phone sends none. */
234
+ arch?: string;
224
235
  events: UpdateReportEntry[];
225
236
  }
226
- /** The events a phone keeps waiting, the oldest dropped first. */
237
+ /** The events an app keeps waiting, the oldest dropped first. */
227
238
  export declare const UPDATE_REPORT_LIMIT = 100;
228
239
  /** The events one request carries. */
229
240
  export declare const UPDATE_REPORT_BATCH = 20;
230
241
  /** An event is kept once per release and reason: a check that fails at every launch is one failure. */
231
- export declare const updateReportKey: (event: UpdateReportEvent, bundle: string, reason: UpdateReportReason | null) => string;
242
+ export declare const updateReportKey: (event: UpdateReportEvent, bundle: string, reason: UpdateReportReason | UpdateReportDesktopReason | null) => string;
232
243
  export type UpdateReportOutcome = "sent" | "dropped" | "kept";
233
244
  /**
234
245
  * What the answer to a report request does to its batch: a 2xx sends it, and a 400, 413 or 422 drops it, since the
@@ -0,0 +1,81 @@
1
+ import type { DocumentScope } from "./plugin.ts";
2
+ export interface ResolvedCommand {
3
+ path: string;
4
+ /** Windows: a `.cmd` or `.bat` file, which only cmd.exe runs. ctx.spawn does that itself. */
5
+ shell: boolean;
6
+ }
7
+ export interface DesktopSpawnOptions {
8
+ cwd?: string;
9
+ /**
10
+ * The child's whole environment, nothing added. Default: the app's own, with the app's bin folder and then the
11
+ * user's PATH (userPath) as its PATH.
12
+ */
13
+ env?: Record<string, string | undefined>;
14
+ /** "pipe": `stdin` writes to the child. Default "ignore". */
15
+ stdin?: "pipe" | "ignore";
16
+ /** Reads the child's output line by line; `stdout` and `stderr` are null then. */
17
+ onLine?(line: string, stream: "stdout" | "stderr"): void;
18
+ /** `ctx.document`: the child also ends when that page does (a reload, a navigation, its window closed). */
19
+ document?: DocumentScope;
20
+ }
21
+ export interface DesktopProcessInput {
22
+ write(chunk: string | Uint8Array): void;
23
+ end(): void;
24
+ }
25
+ export interface DesktopProcess {
26
+ readonly pid: number;
27
+ /** The exit code; 128 + the signal's number when a signal ended it. */
28
+ readonly exited: Promise<number>;
29
+ readonly stdin: DesktopProcessInput | null;
30
+ readonly stdout: ReadableStream<Uint8Array> | null;
31
+ readonly stderr: ReadableStream<Uint8Array> | null;
32
+ /** Signals the child and what it started (macOS, Linux: its process group; Windows: its tree, ended outright). */
33
+ kill(signal?: NodeJS.Signals): void;
34
+ }
35
+ export interface DesktopCommands {
36
+ userPath(): Promise<string>;
37
+ resolveCommand(name: string): Promise<ResolvedCommand | null>;
38
+ spawn(cmd: string[], options?: DesktopSpawnOptions): Promise<DesktopProcess>;
39
+ }
40
+ export interface CommandsOptions {
41
+ /** The app's own executables (desktop.bin), searched first. */
42
+ binDir: string | null;
43
+ platform?: NodeJS.Platform;
44
+ env?: Record<string, string | undefined>;
45
+ /** The user's shell; the account's by default. */
46
+ shell?: string;
47
+ probeTimeout?: number;
48
+ reapGrace?: number;
49
+ }
50
+ /** A login shell with a heavy profile takes seconds (5 s measured for bash with nvm and conda). */
51
+ export declare const PROBE_TIMEOUT = 10000;
52
+ /** What a child gets between SIGTERM and SIGKILL when its page or the app ends. */
53
+ export declare const REAP_GRACE = 2000;
54
+ /** The app's bin folder first on this process's PATH, under one name; null when the app carries none. */
55
+ export declare function appBinFirst(resources: string): string | null;
56
+ /**
57
+ * `name` in `dirs`, the first hit. Windows tries each PATHEXT ending unless the name already has one of them. A name
58
+ * with a folder in it is looked up as that path alone.
59
+ */
60
+ export declare function findCommand(name: string, dirs: readonly string[], { platform, pathExt }?: {
61
+ platform?: NodeJS.Platform;
62
+ pathExt?: string;
63
+ }): ResolvedCommand | null;
64
+ /**
65
+ * A command line cmd.exe hands to a batch file unchanged: each argument quoted as CommandLineToArgvW reads it, then
66
+ * every character cmd.exe gives a meaning escaped with `^`, twice for the arguments, which the batch file's own line
67
+ * (`node "%~dp0\…" %*`) puts through cmd.exe again.
68
+ */
69
+ export declare function batchCommandLine(file: string, args: readonly string[]): string;
70
+ /** The user's shell's PATH: as an interactive login shell first, then as a login shell only; null when neither told. */
71
+ export declare function loginShellPath(env: Record<string, string | undefined>, { shell, timeout }?: {
72
+ shell?: string;
73
+ timeout?: number;
74
+ }): Promise<string | null>;
75
+ /**
76
+ * Where a user's own tools usually are, for a shell that did not tell its PATH (a profile slower than the timeout on a
77
+ * loaded machine): after the app's own PATH, and only the folders that exist. Homebrew, the per-user bin folders and
78
+ * the shims of the version managers that put one folder on PATH.
79
+ */
80
+ export declare function usualToolDirs(home: string | undefined): string[];
81
+ export declare function createCommands(options: CommandsOptions): DesktopCommands;
@@ -7,9 +7,13 @@ type Runner = (argv: string[]) => Promise<{
7
7
  export declare function linkArguments(args: readonly string[], schemes: readonly string[]): string[];
8
8
  /** Exec= of a desktop entry: the path quoted, with the characters the spec reserves escaped. */
9
9
  export declare function desktopExec(exe: string): string;
10
- export declare function desktopEntry(name: string, exe: string, schemes: readonly string[], { id, icon }?: {
10
+ /** What marks the launcher entry install.sh wrote (packages/cli/src/platforms/linux-install.ts). */
11
+ export declare const INSTALLED_MARKER = "X-AkanNative-Installed=true";
12
+ /** `categories`: the entry is install.sh's launcher entry, and stays one with these Categories. */
13
+ export declare function desktopEntry(name: string, exe: string, schemes: readonly string[], { id, icon, categories }?: {
11
14
  id?: string;
12
15
  icon?: boolean;
16
+ categories?: string;
13
17
  }): string;
14
18
  /** mimeapps.list with `x-scheme-handler/<scheme>=<desktop file>` set in [Default Applications]. */
15
19
  export declare function withDefaults(list: string, desktopFile: string, schemes: readonly string[]): string;
@@ -1,5 +1,6 @@
1
1
  import type { AppInfo, FileRef, ResolvedAcl } from "../../core/src/index.ts";
2
2
  import { type BridgeEvent, type BridgeRequest, type BridgeResponse } from "../../core/src/protocol.ts";
3
+ import { type DesktopCommands } from "./commands.ts";
3
4
  import type { Lifecycle } from "./lifecycle.ts";
4
5
  import type { DesktopPlugin, DesktopServerStatus, Launch, NativeEvent } from "./plugin.ts";
5
6
  /** How long the window waits for one plugin's setup. */
@@ -22,6 +23,8 @@ export interface HostServices {
22
23
  appLocalDataDir?: string;
23
24
  /** desktop.bin in the app's resources, or null. */
24
25
  binDir?: string | null;
26
+ /** ctx.userPath, resolveCommand and spawn; made for `binDir` when not given. */
27
+ commands?: DesktopCommands;
25
28
  /** The carried server (resources/server.json), or null. */
26
29
  server?: DesktopServerStatus | null;
27
30
  /** Sends an event (numbered for its document) to a window's page. */
@@ -11,7 +11,10 @@ export interface LifecycleOptions {
11
11
  hideWindow(window: number): Promise<unknown>;
12
12
  /** Destroys a window that is not the last one. */
13
13
  destroyWindow?(window: number): Promise<unknown>;
14
- /** The windows that exist, hidden ones included. Default: only the one being closed. */
14
+ /**
15
+ * The app's windows, hidden ones included and auxiliary ones left out: a companion window does not keep the app from
16
+ * quitting or hiding with its last window. Default: only the one being closed.
17
+ */
15
18
  windows?(): Promise<number[]>;
16
19
  /** How long quit() waits for the onQuit hooks, all together. Default QUIT_HOOK_TIMEOUT. */
17
20
  quitHookTimeout?: number;
@@ -37,4 +40,8 @@ export interface Lifecycle {
37
40
  quit(code?: number): Promise<void>;
38
41
  }
39
42
  export declare const QUIT_HOOK_TIMEOUT = 2000;
43
+ export declare function appWindows(list: {
44
+ id: number;
45
+ auxiliary?: boolean;
46
+ }[]): number[];
40
47
  export declare function createLifecycle(options: LifecycleOptions): Lifecycle;
@@ -1,5 +1,7 @@
1
1
  import type { AppInfo, CallScope, FileRef } from "../../core/src/index.ts";
2
+ import type { DesktopProcess, DesktopSpawnOptions, ResolvedCommand } from "./commands.ts";
2
3
  import type { QuitReason, Veto } from "./lifecycle.ts";
4
+ export type { DesktopProcess, DesktopProcessInput, DesktopSpawnOptions, ResolvedCommand } from "./commands.ts";
3
5
  export type { QuitReason, Veto } from "./lifecycle.ts";
4
6
  export { createPageVeto, type PageVeto } from "./page-veto.ts";
5
7
  /**
@@ -52,6 +54,25 @@ export interface DesktopContext {
52
54
  * Bun.which without `env` reads the environment the app started with, so name a file here or pass the env.
53
55
  */
54
56
  readonly binDir: string | null;
57
+ /**
58
+ * The PATH of the user's own shell, without the app's bin folder: an app started from the Finder or a launcher has
59
+ * only the session's. Read from the user's login shell at the first call and kept; that call takes as long as the
60
+ * shell's profile does (seconds, 10 at most), so a plugin that will need it asks in its setup without waiting. A
61
+ * shell that does not answer leaves the PATH the app started with, then the usual tool folders (Homebrew's,
62
+ * ~/.local/bin, ~/.bun/bin and the like). Windows: the PATH the app started with.
63
+ */
64
+ userPath(): Promise<string>;
65
+ /**
66
+ * The file `name` runs: in the app's bin folder first, then on the user's PATH; null when it is in neither. Windows
67
+ * follows PATHEXT, and `shell` says the file is a `.cmd` or `.bat`.
68
+ */
69
+ resolveCommand(name: string): Promise<ResolvedCommand | null>;
70
+ /**
71
+ * Starts a program the user installed (or one in binDir) as a child that ends with the app however the app ends, a
72
+ * crash or a kill included; with `document: ctx.document`, also when the calling page does. A bare name is looked up
73
+ * as resolveCommand does, on the PATH the child gets. Rejects NOT_FOUND when there is no such program.
74
+ */
75
+ spawn(cmd: string[], options?: DesktopSpawnOptions): Promise<DesktopProcess>;
55
76
  /**
56
77
  * The server the app carries (desktop.server), or null. `ready` settles once per session: true when the server
57
78
  * first answered ready, false when it could not start or gave up before that; `state` and `onState` follow it after.
@@ -120,4 +120,5 @@ export declare function jwtSecret(dataDir: string): string;
120
120
  export declare function restartDelay(failures: number, paced?: boolean): number;
121
121
  /** The port the last session's server was ready on (`<server data>/port`), if any. */
122
122
  export declare function lastPort(dataDir: string): number | undefined;
123
+ export declare const pipeLines: (stream: ReadableStream<Uint8Array>, onLine: (line: string) => void) => Promise<void>;
123
124
  export declare function createDesktopServer(options: DesktopServerOptions): DesktopServer;
@@ -1,6 +1,7 @@
1
1
  import { type DesktopPlugin } from "../../../packages/desktop/src/plugin.ts";
2
2
  import { type RelaunchOptions } from "../../../packages/desktop/src/relaunch.ts";
3
3
  import type { UpdatesApi, UpdatesEvents } from "./index.ts";
4
+ import { type SignatureTool } from "./signer.ts";
4
5
  export interface UpdatesConfig {
5
6
  app: string;
6
7
  platform: string;
@@ -21,6 +22,8 @@ export interface UpdatesConfig {
21
22
  automatic?: boolean;
22
23
  /** Windows (updates.windowsSigners): SHA-1 thumbprints a release's Authenticode certificate must be one of. */
23
24
  windowsSigners?: string[];
25
+ /** updates.report.url: where what became of each release is posted (reports.ts). */
26
+ reportUrl?: string;
24
27
  }
25
28
  /**
26
29
  * How long a new release's carried server may take to answer ready before its trial clock starts anyway: a first
@@ -49,10 +52,7 @@ export interface DesktopUpdatesOptions {
49
52
  autoCheckDelay?: number;
50
53
  autoCheckInterval?: number;
51
54
  /** Runs codesign (macOS) or PowerShell (Windows) on a signature; runSignatureTool by default. */
52
- signatureTool?(cmd: string[], env?: Record<string, string>): Promise<{
53
- code: number;
54
- output: string;
55
- }>;
55
+ signatureTool?: SignatureTool;
56
56
  }
57
57
  export declare function createDesktopUpdates(options?: DesktopUpdatesOptions): DesktopPlugin<UpdatesApi, UpdatesEvents>;
58
58
  declare const _default: DesktopPlugin<UpdatesApi, UpdatesEvents>;
@@ -0,0 +1,49 @@
1
+ import { type UpdateReportDesktopReason, type UpdateReportEvent, type UpdateReportReason } from "../../../packages/core/src/kernel.ts";
2
+ export type ReportReason = UpdateReportReason | UpdateReportDesktopReason;
3
+ /** The release an event names: an entry of state.json, a manifest, or what a refused envelope claims. */
4
+ export interface ReportedRelease {
5
+ bundle?: unknown;
6
+ sequence?: unknown;
7
+ keyId?: unknown;
8
+ }
9
+ export interface ReportingApp {
10
+ /** The folder of state.json. */
11
+ dir: string;
12
+ /** A debug build posts in cleartext to any host, as its page loads from one. */
13
+ dev: boolean;
14
+ appVersion: string;
15
+ /** updates.json as it stands when a batch is sent: setChannel() changes the channel. */
16
+ config(): {
17
+ app: string;
18
+ platform: string;
19
+ channel: string;
20
+ nativeApi: string | null;
21
+ };
22
+ }
23
+ export interface UpdateReportsOptions {
24
+ /** updates.json `reportUrl`; without one nothing is kept. */
25
+ url: string | undefined;
26
+ platform?: NodeJS.Platform;
27
+ fetch?: typeof fetch;
28
+ /** Unix seconds. */
29
+ now?: () => number;
30
+ retryInterval?: number;
31
+ }
32
+ export interface UpdateReports {
33
+ start(app: ReportingApp): void;
34
+ /** Kept once per release and reason; a release without a bundle id is not kept. */
35
+ record(event: UpdateReportEvent, release: ReportedRelease, reason?: ReportReason): void;
36
+ /** A download that threw: `failed` under `reason`, unless the page or the app called it off. */
37
+ failed(error: unknown, release: ReportedRelease | undefined, reason: ReportReason): void;
38
+ flush(): Promise<void>;
39
+ }
40
+ /** A kept batch goes again at the next event or start, and this often in an app left running. */
41
+ export declare const RETRY_INTERVAL: number;
42
+ /** "macOS 15.5", "Windows 10.0.26200", "Linux Ubuntu 24.04.1 LTS": printable ASCII, 64 characters at most. */
43
+ export declare function osLabel(platform?: NodeJS.Platform): string;
44
+ /**
45
+ * The release a refused envelope claims, read without trusting it and only to say which release failed: a forged name
46
+ * can at worst count against a release the server already published for this app.
47
+ */
48
+ export declare function claimedRelease(manifest: string, keyId: string): ReportedRelease;
49
+ export declare function createUpdateReports(options: UpdateReportsOptions): UpdateReports;
@@ -0,0 +1,21 @@
1
+ export type SignatureTool = (cmd: string[], env?: Record<string, string>) => Promise<{
2
+ code: number;
3
+ output: string;
4
+ }>;
5
+ export interface SignerCheck {
6
+ mac: boolean;
7
+ windows: boolean;
8
+ /** Runs codesign (macOS) or PowerShell (Windows) on a signature. */
9
+ tool: SignatureTool;
10
+ /** updates.windowsSigners. */
11
+ pins: string[];
12
+ /** The executable inside an app with the running one's name. */
13
+ executableIn(app: string): string;
14
+ }
15
+ /** A signature tool's exit code and what it printed; -1 when it could not start. */
16
+ export declare function runSignatureTool(cmd: string[], env?: Record<string, string>): Promise<{
17
+ code: number;
18
+ output: string;
19
+ }>;
20
+ export declare function signerRefusal(check: SignerCheck, staged: string, app: string): Promise<string | null>;
21
+ export declare function codesignProblem(check: SignerCheck, staged: string): Promise<string | null>;
@@ -15,8 +15,12 @@ export interface WindowState {
15
15
  /** A window and its id (SH-6: 1 is the window the app opened; others come from createWindow). */
16
16
  export interface WindowInfo extends WindowState {
17
17
  id: number;
18
+ auxiliary: boolean;
18
19
  }
19
- /** Where a new window opens. Sizes and positions are logical pixels; x and y are the frame's top-left corner. */
20
+ /**
21
+ * Where a new window opens. Sizes and positions are logical pixels; x and y are the frame's top-left corner. A Wayland
22
+ * session places every window itself: x, y and `setPosition` are not followed there.
23
+ */
20
24
  export interface CreateWindowOptions {
21
25
  /** App path the window loads, e.g. "/settings" (the SPA router sees it). Default "/". */
22
26
  path?: string;
@@ -29,6 +33,40 @@ export interface CreateWindowOptions {
29
33
  y?: number;
30
34
  /** No title bar or border, from the first frame: a kiosk drawn at an exact size. */
31
35
  frameless?: boolean;
36
+ /**
37
+ * The smallest inner size, from creation: both or neither. Default 320×240, and a `width` or `height` below the
38
+ * minimum is raised to it, so a smaller window names its minimum here.
39
+ */
40
+ minWidth?: number;
41
+ minHeight?: number;
42
+ /**
43
+ * Nothing is drawn behind the page, the theme colour included: with `html, body { background: transparent }` the
44
+ * desktop shows through. Linux needs a compositing window manager; without one the window is opaque.
45
+ */
46
+ transparent?: boolean;
47
+ /**
48
+ * The window's shadow. Default: the system's, and none for a transparent window. macOS, and a frameless window on
49
+ * Windows; on Linux the window manager decides.
50
+ */
51
+ shadow?: boolean;
52
+ alwaysOnTop?: boolean;
53
+ /** No taskbar button and no Alt+Tab entry (Windows, Linux). macOS has no taskbar. */
54
+ skipTaskbar?: boolean;
55
+ /** False: the window stays hidden after its page has loaded, until `show()`, so the page can place it first. */
56
+ visible?: boolean;
57
+ /**
58
+ * False: a click does not make it the window that takes the keyboard. On macOS a click may still bring the app
59
+ * forward, since the window is not a non-activating panel.
60
+ */
61
+ focusable?: boolean;
62
+ /** On every Space or virtual desktop (macOS, Linux). Windows has no such window, so there it is left out. */
63
+ visibleOnAllWorkspaces?: boolean;
64
+ /**
65
+ * A companion to the app's windows rather than one of them: closing the last other window quits or hides as if this
66
+ * one were not there, the Dock and a second launch bring forward another window, and macOS leaves it out of the
67
+ * Window menu.
68
+ */
69
+ auxiliary?: boolean;
32
70
  }
33
71
  /** A display of `screen.getDisplays()` and where on it the window goes. */
34
72
  export interface PlaceOnDisplayOptions {
@@ -88,6 +126,18 @@ export interface WindowApi {
88
126
  setCursorVisible(args: {
89
127
  value: boolean;
90
128
  } & On): Promise<WindowState>;
129
+ /**
130
+ * True: clicks and the pointer pass through the whole window to what is under it, and the page gets no mouse event
131
+ * until it is false again, so the page turns it off from a `screen.getCursorPoint()` poll, which Wayland does not
132
+ * answer.
133
+ */
134
+ setIgnoreCursorEvents(args: {
135
+ value: boolean;
136
+ } & On): Promise<WindowState>;
137
+ /** On every Space or virtual desktop. UNSUPPORTED on Windows. */
138
+ setVisibleOnAllWorkspaces(args: {
139
+ value: boolean;
140
+ } & On): Promise<WindowState>;
91
141
  /**
92
142
  * The smallest inner size, logical pixels: both or neither (none); one alone is INVALID_ARGS. The default is
93
143
  * 320×240, which an LED board drawn at its device size (640×128 ÷ the display's `scale`) is below.
@@ -107,7 +157,7 @@ export interface WindowApi {
107
157
  /**
108
158
  * Closes the window without asking onCloseRequested handlers. While another window exists it
109
159
  * is destroyed; the last window makes the app quit (asking app.onBeforeQuit handlers), or only
110
- * hides if desktop.quitOnLastWindowClosed is false.
160
+ * hides if desktop.quitOnLastWindowClosed is false. An auxiliary window is not counted as another.
111
161
  */
112
162
  close(args?: On): Promise<void>;
113
163
  /** Moves the window with the mouse; call it from a mousedown on a custom title bar. */
@@ -193,6 +243,8 @@ export interface WindowHandle {
193
243
  setAlwaysOnTop(value: boolean): Promise<WindowState>;
194
244
  setDecorations(value: boolean): Promise<WindowState>;
195
245
  setCursorVisible(value: boolean): Promise<WindowState>;
246
+ setIgnoreCursorEvents(value: boolean): Promise<WindowState>;
247
+ setVisibleOnAllWorkspaces(value: boolean): Promise<WindowState>;
196
248
  /** Both left out: no minimum. One alone is INVALID_ARGS. */
197
249
  setMinSize(width?: number, height?: number): Promise<WindowState>;
198
250
  placeOnDisplay(options: PlaceOnDisplayOptions): Promise<WindowState>;
@@ -211,7 +263,7 @@ export declare function windowHandle(id: number): WindowHandle;
211
263
  export declare function getCurrentWindow(): WindowHandle;
212
264
  /**
213
265
  * Opens another window that loads `path` of this app (desktop). It stays hidden until its page
214
- * has loaded, like the first window. UNSUPPORTED on web, iOS and Android. Pages of different
266
+ * has loaded, like the first window, or until `show()` with `visible: false`. UNSUPPORTED on web, iOS and Android. Pages of different
215
267
  * windows share storage (localStorage, IndexedDB) and can talk through BroadcastChannel.
216
268
  */
217
269
  export declare function createWindow(options?: CreateWindowOptions): Promise<WindowHandle>;