@qilin-agent/desktop 0.0.0-stage → 3.1.6
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/LICENSE +21 -0
- package/README.i18n.yaml +79 -0
- package/README.md +383 -2
- package/README.zh.md +384 -0
- package/lib/command-manager-entry.js +554 -0
- package/lib/main.js +11534 -0
- package/lib/types/account-backend.d.ts +37 -0
- package/lib/types/account-types.d.ts +74 -0
- package/lib/types/backend-controller.d.ts +59 -0
- package/lib/types/background-notice.d.ts +29 -0
- package/lib/types/browser-bridge-types.d.ts +26 -0
- package/lib/types/browser-guests.d.ts +33 -0
- package/lib/types/client-metadata.d.ts +15 -0
- package/lib/types/command-installation.d.ts +54 -0
- package/lib/types/command-management.d.ts +46 -0
- package/lib/types/command-manager-entry.d.ts +3 -0
- package/lib/types/core-package-set.d.ts +51 -0
- package/lib/types/crash-report.d.ts +92 -0
- package/lib/types/desktop-home.d.ts +12 -0
- package/lib/types/device-info.d.ts +8 -0
- package/lib/types/directory-picker.d.ts +8 -0
- package/lib/types/duration-env.d.ts +10 -0
- package/lib/types/fatal-recovery.d.ts +37 -0
- package/lib/types/host-process.d.ts +97 -0
- package/lib/types/host-protocol.d.ts +4 -0
- package/lib/types/ipc.d.ts +78 -0
- package/lib/types/keybindings.d.ts +11 -0
- package/lib/types/keyboard.d.ts +40 -0
- package/lib/types/local-auth.d.ts +22 -0
- package/lib/types/locale.d.ts +407 -0
- package/lib/types/login-shell-environment.d.ts +66 -0
- package/lib/types/main.d.ts +2 -0
- package/lib/types/mandatory-update-ipc.d.ts +7 -0
- package/lib/types/mandatory-update-policy.d.ts +83 -0
- package/lib/types/mandatory-update-window.d.ts +90 -0
- package/lib/types/microphone-permissions.d.ts +9 -0
- package/lib/types/node-environment.d.ts +10 -0
- package/lib/types/owned-directory.d.ts +8 -0
- package/lib/types/paths.d.ts +13 -0
- package/lib/types/platform-ipc.d.ts +12 -0
- package/lib/types/platform-view.d.ts +77 -0
- package/lib/types/policy-test-auth.d.ts +49 -0
- package/lib/types/preload-app.d.ts +3 -0
- package/lib/types/preload-browser.d.ts +4 -0
- package/lib/types/preload-mandatory-overlay.d.ts +3 -0
- package/lib/types/preload-mandatory.d.ts +2 -0
- package/lib/types/preload-menu.d.ts +9 -0
- package/lib/types/preload-platform-account.d.ts +2 -0
- package/lib/types/preload-platform.d.ts +13 -0
- package/lib/types/preload-theme.d.ts +12 -0
- package/lib/types/preload-update-dialog.d.ts +2 -0
- package/lib/types/preload-welcome.d.ts +2 -0
- package/lib/types/preload-windows.d.ts +3 -0
- package/lib/types/project-manager.d.ts +39 -0
- package/lib/types/quit-confirmation.d.ts +47 -0
- package/lib/types/release.d.ts +14 -0
- package/lib/types/runtime-tree.d.ts +70 -0
- package/lib/types/settings.d.ts +13 -0
- package/lib/types/single-instance.d.ts +15 -0
- package/lib/types/startup-error.d.ts +11 -0
- package/lib/types/tray.d.ts +24 -0
- package/lib/types/update-attention.d.ts +28 -0
- package/lib/types/update-channel.d.ts +10 -0
- package/lib/types/update-coordinator.d.ts +60 -0
- package/lib/types/update-dialog.d.ts +69 -0
- package/lib/types/update-error.d.ts +14 -0
- package/lib/types/update-http-executor.d.ts +14 -0
- package/lib/types/update-journal.d.ts +35 -0
- package/lib/types/update-overlay.d.ts +23 -0
- package/lib/types/update-presentation.d.ts +16 -0
- package/lib/types/update-schedule.d.ts +47 -0
- package/lib/types/web-document.d.ts +69 -0
- package/lib/types/welcome-api.d.ts +86 -0
- package/lib/types/welcome-backend.d.ts +36 -0
- package/lib/types/welcome-window.d.ts +19 -0
- package/lib/types/windows-layout.d.ts +4 -0
- package/package.json +98 -3
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/** Shell-owned modal policy UI; only explicit actions authorize downloads or browser navigation. */
|
|
2
|
+
import { BrowserWindow } from 'electron';
|
|
3
|
+
import type { DesktopLocale } from './locale.ts';
|
|
4
|
+
import { type DesktopUpdateState } from './ipc.ts';
|
|
5
|
+
import { type DesktopPolicyState } from './mandatory-update-policy.ts';
|
|
6
|
+
import type { DesktopUpdateOverlays } from './update-overlay.ts';
|
|
7
|
+
/** A renderer action never carries a URL or authorizes a different version. */
|
|
8
|
+
export type MandatoryUpdateAction = 'refresh' | 'download' | 'install' | 'later' | 'page' | 'copy';
|
|
9
|
+
/** Combined view rendered as text by the shell-owned page. */
|
|
10
|
+
export interface MandatoryUpdateView {
|
|
11
|
+
readonly locale: DesktopLocale;
|
|
12
|
+
readonly policy: DesktopPolicyState;
|
|
13
|
+
readonly update: DesktopUpdateState;
|
|
14
|
+
readonly error?: string;
|
|
15
|
+
readonly confirmation?: {
|
|
16
|
+
readonly version: string;
|
|
17
|
+
readonly active: boolean;
|
|
18
|
+
readonly revision: number;
|
|
19
|
+
};
|
|
20
|
+
readonly deferred: boolean;
|
|
21
|
+
readonly restart?: 'stopping-tasks' | 'preparing';
|
|
22
|
+
readonly navigation?: {
|
|
23
|
+
readonly page: 'requested' | 'failed';
|
|
24
|
+
readonly copy?: 'copied' | 'failed';
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/** Narrow isolated bridge, absent from product and plugin documents. */
|
|
28
|
+
export interface MandatoryUpdateApi {
|
|
29
|
+
status(): Promise<MandatoryUpdateView>;
|
|
30
|
+
action(action: MandatoryUpdateAction, version?: string, confirmationRevision?: number): Promise<void>;
|
|
31
|
+
subscribe(listener: (state: MandatoryUpdateView) => void): () => void;
|
|
32
|
+
}
|
|
33
|
+
/** Main-process operations owned by the policy client, updater, and application lifecycle. */
|
|
34
|
+
export interface MandatoryUpdateWindowOptions {
|
|
35
|
+
readonly preload: string;
|
|
36
|
+
readonly overlays: Pick<DesktopUpdateOverlays, 'create'>;
|
|
37
|
+
readonly locale: DesktopLocale;
|
|
38
|
+
readonly allowedPageOrigins: readonly string[];
|
|
39
|
+
readonly parent: () => BrowserWindow | undefined;
|
|
40
|
+
readonly policy: () => DesktopPolicyState;
|
|
41
|
+
readonly update: () => DesktopUpdateState;
|
|
42
|
+
readonly refresh: () => Promise<void>;
|
|
43
|
+
readonly download: (version: string) => Promise<DesktopUpdateState>;
|
|
44
|
+
readonly install: (version: string) => Promise<DesktopUpdateState>;
|
|
45
|
+
}
|
|
46
|
+
/** Shell-owned update presentation; Windows embeds it in the main document without a child window. */
|
|
47
|
+
export declare class DesktopMandatoryUpdateWindow {
|
|
48
|
+
private readonly options;
|
|
49
|
+
private readonly embedded;
|
|
50
|
+
private embeddedParent;
|
|
51
|
+
private embeddedBlocking;
|
|
52
|
+
private readonly publishEmbedded;
|
|
53
|
+
private window;
|
|
54
|
+
private closing;
|
|
55
|
+
private disposed;
|
|
56
|
+
private error;
|
|
57
|
+
private action;
|
|
58
|
+
private confirmation;
|
|
59
|
+
private confirmationRevision;
|
|
60
|
+
private deferred;
|
|
61
|
+
private restart;
|
|
62
|
+
private navigation;
|
|
63
|
+
private navigationUrl;
|
|
64
|
+
private navigationEpoch;
|
|
65
|
+
private readonly attention;
|
|
66
|
+
/** @param options - Main-process actions and immutable deployment/navigation settings. */
|
|
67
|
+
constructor(options: MandatoryUpdateWindowOptions);
|
|
68
|
+
/** Active modal used as the owner of shell installation-confirmation dialogs. */
|
|
69
|
+
get confirmationWindow(): BrowserWindow | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* @param version - Updater-owned target, already downloaded and verified.
|
|
72
|
+
* @param active - Fresh Host task inspection; unknown state must fail before calling.
|
|
73
|
+
* @returns Explicit approval from this same modal, or false on deferral, policy clearance, or disposal.
|
|
74
|
+
*/
|
|
75
|
+
confirm(version: string, active: boolean): Promise<boolean>;
|
|
76
|
+
/** @param active - Whether admitted tasks are actually being stopped after installation approval. */
|
|
77
|
+
preparingRestart(active: boolean): void;
|
|
78
|
+
/** Publish current status, create the block immediately, or close it only after policy clearance. */
|
|
79
|
+
sync(): void;
|
|
80
|
+
/** Focus the block instead of opening ordinary product or plugin interactions. */
|
|
81
|
+
focus(): void;
|
|
82
|
+
/** Detach IPC and release the modal during shutdown, including after the main window closes. */
|
|
83
|
+
dispose(): void;
|
|
84
|
+
private view;
|
|
85
|
+
private finishConfirmation;
|
|
86
|
+
private clearNavigation;
|
|
87
|
+
private navigate;
|
|
88
|
+
private assertSender;
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=mandatory-update-window.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Microphone access belongs to the primary application frame and the operating system. */
|
|
2
|
+
import { type Session, type WebContents } from 'electron';
|
|
3
|
+
/**
|
|
4
|
+
* Handle microphone requests from the owned application window; other permissions retain Electron's defaults.
|
|
5
|
+
* @param session - application's browser session.
|
|
6
|
+
* @param primary - current primary window contents, absent while no window is open.
|
|
7
|
+
*/
|
|
8
|
+
export declare function installMicrophonePermissions(session: Pick<Session, 'setPermissionCheckHandler' | 'setPermissionRequestHandler'>, primary: () => WebContents | undefined): void;
|
|
9
|
+
//# sourceMappingURL=microphone-permissions.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Electron Node-mode startup, with private shell launchers scoped to package installation. */
|
|
2
|
+
/**
|
|
3
|
+
* Select Electron's Node mode and the shell launcher used by package scripts.
|
|
4
|
+
* @param executable - Electron executable running the application.
|
|
5
|
+
* @param bin - Directory containing the node shell launcher.
|
|
6
|
+
* @param environment - Caller environment preserved for plugin execution.
|
|
7
|
+
* @returns Environment for a Node-mode child process.
|
|
8
|
+
*/
|
|
9
|
+
export declare function desktopNodeEnvironment(executable: string, bin: string | undefined, environment: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
|
|
10
|
+
//# sourceMappingURL=node-environment.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Desktop transaction cleanup that unlinks directory links without visiting their targets. */
|
|
2
|
+
/**
|
|
3
|
+
* Remove an owned directory and its contents, unlinking root and nested links.
|
|
4
|
+
* Missing roots are ignored; existing roots must be directories or links.
|
|
5
|
+
* @param path - Owned directory or link to remove; link targets are preserved.
|
|
6
|
+
*/
|
|
7
|
+
export declare function removeOwnedDirectory(path: string): void;
|
|
8
|
+
//# sourceMappingURL=owned-directory.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Filesystem ownership for the Electron-managed desktop installation. */
|
|
2
|
+
/** Stable desktop installation paths under the shared Harness home. */
|
|
3
|
+
export interface DesktopPaths {
|
|
4
|
+
readonly profile: string;
|
|
5
|
+
readonly lock: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Resolve every Electron-owned path without changing the shared data roots.
|
|
9
|
+
* @param dshHome - Harness home shared with npm-installed dsh.
|
|
10
|
+
* @returns immutable desktop path set.
|
|
11
|
+
*/
|
|
12
|
+
export declare function resolveDesktopPaths(dshHome?: string): DesktopPaths;
|
|
13
|
+
//# sourceMappingURL=paths.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Shared names for the desktop Platform bridge. */
|
|
2
|
+
/** Private desktop channels; the Platform renderer receives bootstrap and locale updates. */
|
|
3
|
+
export declare const PLATFORM_IPC: {
|
|
4
|
+
readonly bootstrap: "dsh-platform:bootstrap";
|
|
5
|
+
readonly localeChanged: "dsh-platform:locale-changed";
|
|
6
|
+
readonly open: "dsh-platform:open";
|
|
7
|
+
readonly bounds: "dsh-platform:bounds";
|
|
8
|
+
readonly close: "dsh-platform:close";
|
|
9
|
+
};
|
|
10
|
+
/** Resolved Platform language; Desktop resolves the system preference before sending it. */
|
|
11
|
+
export type PlatformLocale = 'en_US' | 'zh_CN';
|
|
12
|
+
//# sourceMappingURL=platform-ipc.d.ts.map
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/** Isolated Platform documents owned by the desktop account lifetime. */
|
|
2
|
+
import type { EventEmitter } from 'node:events';
|
|
3
|
+
import { type View, type WebFrameMain } from 'electron';
|
|
4
|
+
import { type PlatformSession } from './account-types.ts';
|
|
5
|
+
import { type PlatformLocale } from './platform-ipc.ts';
|
|
6
|
+
export { PLATFORM_IPC } from './platform-ipc.ts';
|
|
7
|
+
/** Bounds in desktop content coordinates, supplied by the owned application renderer. */
|
|
8
|
+
export interface PlatformBounds {
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Decode the renderer rectangle before allocating a native view.
|
|
16
|
+
* @param value - IPC payload.
|
|
17
|
+
* @returns finite, nonnegative integer coordinates.
|
|
18
|
+
*/
|
|
19
|
+
export declare function platformBounds(value: unknown): PlatformBounds;
|
|
20
|
+
type PlatformOwner = Pick<EventEmitter, 'on' | 'removeListener'> & {
|
|
21
|
+
webContents: Pick<EventEmitter, 'on' | 'removeListener'>;
|
|
22
|
+
contentView: Pick<View, 'addChildView' | 'removeChildView'>;
|
|
23
|
+
isDestroyed(): boolean;
|
|
24
|
+
};
|
|
25
|
+
type PlatformSender = {
|
|
26
|
+
sender: object;
|
|
27
|
+
senderFrame: Pick<WebFrameMain, 'url'> | null;
|
|
28
|
+
};
|
|
29
|
+
/** Native view and its credential snapshot are discarded together. */
|
|
30
|
+
export declare class DesktopPlatformView {
|
|
31
|
+
private readonly preload;
|
|
32
|
+
private readonly getLocale;
|
|
33
|
+
private readonly platform;
|
|
34
|
+
private account;
|
|
35
|
+
private view;
|
|
36
|
+
private owner;
|
|
37
|
+
private releaseOwner;
|
|
38
|
+
private generation;
|
|
39
|
+
private readonly storageCleanup;
|
|
40
|
+
private disposed;
|
|
41
|
+
/**
|
|
42
|
+
* @param preload - bundled sandboxed Platform preload path.
|
|
43
|
+
* @param getLocale - current resolved Desktop language.
|
|
44
|
+
* @param platform - operating system this shell runs on, reported to Platform.
|
|
45
|
+
*/
|
|
46
|
+
constructor(preload: string, getLocale: () => PlatformLocale, platform: 'darwin' | 'win32');
|
|
47
|
+
/** @param next - private Host credentials; identity enrichment preserves an already open temporary document. */
|
|
48
|
+
setSession(next: PlatformSession | null): void;
|
|
49
|
+
/**
|
|
50
|
+
* Open account-scoped persistent storage, or temporary storage when the account ID is unavailable.
|
|
51
|
+
* @param owner - application window containing the view.
|
|
52
|
+
* @param page - explicit supported Platform page.
|
|
53
|
+
* @param bounds - owned renderer rectangle.
|
|
54
|
+
* @returns when loading finishes, or without a document when superseded or the owner closes or navigates.
|
|
55
|
+
*/
|
|
56
|
+
open(owner: PlatformOwner, page: 'usage' | 'top-up', bounds: PlatformBounds): Promise<void>;
|
|
57
|
+
/** @param bounds - current application viewport rectangle. */
|
|
58
|
+
setBounds(bounds: PlatformBounds): void;
|
|
59
|
+
/**
|
|
60
|
+
* Return prepared credentials and resolved language only to the current Platform main frame.
|
|
61
|
+
* @param event - Electron-provided sender identity.
|
|
62
|
+
* @returns credentials and current language copied into the isolated preload.
|
|
63
|
+
*/
|
|
64
|
+
bootstrap(event: PlatformSender): Pick<PlatformSession, 'origin' | 'token'> & {
|
|
65
|
+
locale: PlatformLocale;
|
|
66
|
+
};
|
|
67
|
+
/** Notify the current document after the Desktop language changes. */
|
|
68
|
+
notifyLocaleChanged(): void;
|
|
69
|
+
/** Destroy the document and clear authentication; account-scoped page preferences survive reopening. */
|
|
70
|
+
close(): void;
|
|
71
|
+
/** Stop accepting documents and await all scheduled authentication cleanup. */
|
|
72
|
+
dispose(): Promise<void>;
|
|
73
|
+
/** Destroy the current document and await authentication cleanup before an installer takes over. */
|
|
74
|
+
closeAndWait(): Promise<void>;
|
|
75
|
+
private cleanStorage;
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=platform-view.d.ts.map
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { BrowserWindow } from 'electron';
|
|
2
|
+
import type { DesktopLocale } from './locale.ts';
|
|
3
|
+
/** Navigation completion is not proof of authentication or a valid update policy. */
|
|
4
|
+
export type DesktopPolicyLoginResult = 'returned' | 'cancelled' | 'failed';
|
|
5
|
+
/** Owns the login window and its nonpersistent Session; no product window shares its cookies or privileges. */
|
|
6
|
+
export declare class DesktopPolicyTestAuth {
|
|
7
|
+
private readonly origin;
|
|
8
|
+
private readonly allowedAuthOrigins;
|
|
9
|
+
private readonly locale;
|
|
10
|
+
private readonly parent;
|
|
11
|
+
private readonly record;
|
|
12
|
+
private readonly browserSession;
|
|
13
|
+
private window;
|
|
14
|
+
private pending;
|
|
15
|
+
private disposed;
|
|
16
|
+
private rejectLogin;
|
|
17
|
+
/** Return to an existing login window without starting another authentication flow. */
|
|
18
|
+
focus(): void;
|
|
19
|
+
/**
|
|
20
|
+
* @param origin Validated HTTPS policy origin; login always starts at its root with fresh gateway state.
|
|
21
|
+
* @param allowedAuthOrigins Validated HTTPS origins for login document navigation.
|
|
22
|
+
* @param locale Shell-owned login title.
|
|
23
|
+
* @param parent Current application or mandatory-update window.
|
|
24
|
+
* @param record Fixed, nonsecret login outcomes for diagnostic evidence.
|
|
25
|
+
*/
|
|
26
|
+
constructor(origin: string, allowedAuthOrigins: readonly string[], locale: DesktopLocale, parent: () => BrowserWindow | undefined, record: (event: 'opened' | DesktopPolicyLoginResult) => void);
|
|
27
|
+
/**
|
|
28
|
+
* Send only the configured policy request through the login Session; redirects remain forbidden.
|
|
29
|
+
* @param input Policy URL supplied by the main-process coordinator.
|
|
30
|
+
* @param init Request headers, credentials, and cancellation owned by that coordinator.
|
|
31
|
+
* @returns Chromium response without exposing cookies to JavaScript.
|
|
32
|
+
*/
|
|
33
|
+
readonly request: typeof fetch;
|
|
34
|
+
/**
|
|
35
|
+
* Open only after a user action; repeated callers focus and join the same login.
|
|
36
|
+
* @returns Navigation, cancellation, or failure; the caller must query policy after returning.
|
|
37
|
+
*/
|
|
38
|
+
login(): Promise<DesktopPolicyLoginResult>;
|
|
39
|
+
/** Close the login and erase session data after the policy coordinator has stopped its requests. */
|
|
40
|
+
dispose(): Promise<void>;
|
|
41
|
+
private allowed;
|
|
42
|
+
/**
|
|
43
|
+
* Recognize the owned placeholder document. Only the request filter and the
|
|
44
|
+
* load-failure handler accept it; navigation events still require {@link allowed},
|
|
45
|
+
* so the remote page cannot steer the window back to a local file.
|
|
46
|
+
*/
|
|
47
|
+
private isLoadingDocument;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=policy-test-auth.d.ts.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { DesktopBrowserBridge } from '@qilin-agent/client-ui-sidebar-browser/types';
|
|
2
|
+
/** @returns browser operations that expose neither IPC nor Electron objects. */
|
|
3
|
+
export declare function createDesktopBrowserBridge(): DesktopBrowserBridge;
|
|
4
|
+
//# sourceMappingURL=preload-browser.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mount the Windows caption menubar without moving focus out of the active editor.
|
|
3
|
+
* @returns Language refresh and document teardown operations.
|
|
4
|
+
*/
|
|
5
|
+
export declare function installWindowsMenu(): {
|
|
6
|
+
update(): void;
|
|
7
|
+
dispose(): void;
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=preload-menu.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Marks the document root with the host platform so shared Web UI CSS can scope desktop-only rules. */
|
|
2
|
+
/**
|
|
3
|
+
* Sets `data-platform` (e.g. `darwin`) on `<html>`, deferring to DOMContentLoaded
|
|
4
|
+
* when the preload runs before the document root exists.
|
|
5
|
+
*/
|
|
6
|
+
export declare function markDocumentPlatform(): void;
|
|
7
|
+
/**
|
|
8
|
+
* Mirrors the window's macOS and Windows fullscreen state onto `<html data-fullscreen>` so
|
|
9
|
+
* CSS drops the clearance for hidden native window controls. The main
|
|
10
|
+
* process sends the state on every transition and after each load.
|
|
11
|
+
*/
|
|
12
|
+
export declare function syncWindowFullscreen(): void;
|
|
13
|
+
//# sourceMappingURL=preload-platform.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Mirrors the Web UI's theme source into Electron's native theme so native chrome and Platform login pages follow the app palette. */
|
|
2
|
+
/**
|
|
3
|
+
* Watches `html[data-ds-theme-source]` and forwards each value to the main
|
|
4
|
+
* process, which sets `nativeTheme.themeSource`. Native chrome and renderer
|
|
5
|
+
* `prefers-color-scheme` queries on every platform then follow the app's
|
|
6
|
+
* theme preference instead of the OS appearance while `system` keeps
|
|
7
|
+
* following the OS; the macOS sidebar vibrancy material is one such consumer.
|
|
8
|
+
* The main process reads the same value back as `shouldUseDarkColors` when a
|
|
9
|
+
* Platform login link needs the resolved palette.
|
|
10
|
+
*/
|
|
11
|
+
export declare function syncNativeTheme(): void;
|
|
12
|
+
//# sourceMappingURL=preload-theme.d.ts.map
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/** Desktop profile initialization and native recovery. */
|
|
2
|
+
import type { DesktopPaths } from './paths.ts';
|
|
3
|
+
import type { DesktopRelease } from './release.ts';
|
|
4
|
+
/** Initializes the Desktop profile and disables third-party bundles during recovery. */
|
|
5
|
+
export declare class DesktopProjectManager {
|
|
6
|
+
readonly paths: DesktopPaths;
|
|
7
|
+
readonly runtime: {
|
|
8
|
+
readonly qilin: string;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* @param paths - Electron-owned package state and reserved desktop profile paths.
|
|
12
|
+
* @param runtime - location of the bundled application runtime.
|
|
13
|
+
*/
|
|
14
|
+
constructor(paths: DesktopPaths, runtime: {
|
|
15
|
+
readonly qilin: string;
|
|
16
|
+
});
|
|
17
|
+
/**
|
|
18
|
+
* Back up the profile patch and disable third-party bundles without loading application resources.
|
|
19
|
+
* The caller must stop the Host first.
|
|
20
|
+
* @returns Backup path after the locked profile write, or undefined if the patch was absent.
|
|
21
|
+
*/
|
|
22
|
+
disableAllPlugins(): Promise<string | undefined>;
|
|
23
|
+
/**
|
|
24
|
+
* Load application metadata and prepare the external plugin profile without installing packages.
|
|
25
|
+
*/
|
|
26
|
+
applyRelease(): Promise<void>;
|
|
27
|
+
private withLock;
|
|
28
|
+
}
|
|
29
|
+
/** Create build-only project metadata for materializing the signed runtime. */
|
|
30
|
+
export declare function createRuntimeProjectMetadata(projectDir: string, release: DesktopRelease): void;
|
|
31
|
+
/**
|
|
32
|
+
* Create metadata for the unpackaged development project that links the current workspace.
|
|
33
|
+
* @param projectDir - Disposable development profile directory.
|
|
34
|
+
* @param release - Release identity shared by the linked CLI package and Electron shell.
|
|
35
|
+
*/
|
|
36
|
+
export declare function createDevelopmentProjectMetadata(projectDir: string, release: DesktopRelease): void;
|
|
37
|
+
/** Create the first external plugin profile without running a package manager. */
|
|
38
|
+
export declare function createPluginProfile(projectDir: string): void;
|
|
39
|
+
//# sourceMappingURL=project-manager.d.ts.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/** Native quit confirmation; quitting proceeds silently only when the Host reports nothing to interrupt. */
|
|
2
|
+
import type { MessageBoxOptions, MessageBoxReturnValue, NativeImage } from 'electron';
|
|
3
|
+
import type { DesktopQuitInspection } from './host-process.ts';
|
|
4
|
+
import type { DesktopLocale, DesktopMessages } from './locale.ts';
|
|
5
|
+
/** Locale key of the explanation shown before quitting, or none when quitting interrupts nothing. */
|
|
6
|
+
export type DesktopQuitPrompt = Extract<keyof DesktopMessages, 'quitActiveTasks' | 'quitScheduledTasks' | 'quitActiveAndScheduledTasks'> | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* Choose the confirmation copy for one inspection result.
|
|
9
|
+
* @param inspection - Host answer, or `unknown` when the inspection failed or missed its deadline.
|
|
10
|
+
* @returns the explanation key; an unknown state warns about running tasks rather than quitting silently.
|
|
11
|
+
*/
|
|
12
|
+
export declare function resolveDesktopQuitPrompt(inspection: DesktopQuitInspection | 'unknown'): DesktopQuitPrompt;
|
|
13
|
+
/** Main-process collaborators of the confirmation. */
|
|
14
|
+
export interface DesktopQuitConfirmationOptions {
|
|
15
|
+
readonly locale: () => DesktopLocale;
|
|
16
|
+
/** Start one Host inspection; undefined while no Host is ready, when nothing can be running and the quit proceeds. */
|
|
17
|
+
readonly inspect: () => Promise<DesktopQuitInspection> | undefined;
|
|
18
|
+
/** Native message box without an owner window: hidden windows stay hidden and the box comes to the front. */
|
|
19
|
+
readonly show: (options: MessageBoxOptions) => Promise<MessageBoxReturnValue>;
|
|
20
|
+
/** Bring the open confirmation to the front when quit is requested again while it is open. */
|
|
21
|
+
readonly focus: () => void;
|
|
22
|
+
readonly platform?: NodeJS.Platform;
|
|
23
|
+
/** Application icon for the Windows task dialog; macOS composes the app icon onto its warning icon itself. */
|
|
24
|
+
readonly icon?: NativeImage;
|
|
25
|
+
}
|
|
26
|
+
/** One quit decision at a time; repeated quit requests join the open confirmation instead of stacking. */
|
|
27
|
+
export declare class DesktopQuitConfirmation {
|
|
28
|
+
private readonly options;
|
|
29
|
+
private pending;
|
|
30
|
+
private disposed;
|
|
31
|
+
/** @param options - Locale, inspection, and native dialog collaborators. */
|
|
32
|
+
constructor(options: DesktopQuitConfirmationOptions);
|
|
33
|
+
/**
|
|
34
|
+
* Decide whether the quit may proceed. The inspection runs once per decision; work that starts or ends
|
|
35
|
+
* while the confirmation is open does not change its copy, and approval never re-inspects.
|
|
36
|
+
* @returns true to quit now, false when the user cancelled.
|
|
37
|
+
*/
|
|
38
|
+
confirm(): Promise<boolean>;
|
|
39
|
+
/**
|
|
40
|
+
* The application is quitting through a path that does not ask: a pending decision resolves to
|
|
41
|
+
* false without opening a box, and later requests do the same. An already open native box has no
|
|
42
|
+
* close API and disappears with the process.
|
|
43
|
+
*/
|
|
44
|
+
dispose(): void;
|
|
45
|
+
private decide;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=quit-confirmation.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Immutable version identity shared by one Electron shell and its bundled qilin runtime. */
|
|
2
|
+
import { DESKTOP_HOST_PROTOCOL_VERSION } from './host-protocol.ts';
|
|
3
|
+
/** Release facts embedded in the bundled runtime descriptor. */
|
|
4
|
+
export interface DesktopRelease {
|
|
5
|
+
readonly schemaVersion: 1;
|
|
6
|
+
/** Exact version used by both Electron and `@qilin-agent/cli`. */
|
|
7
|
+
readonly version: string;
|
|
8
|
+
readonly hostProtocolVersion: typeof DESKTOP_HOST_PROTOCOL_VERSION;
|
|
9
|
+
readonly nodeVersion: string;
|
|
10
|
+
readonly pnpmVersion: string;
|
|
11
|
+
}
|
|
12
|
+
/** Validate release data read from an installed or packaged filesystem resource. */
|
|
13
|
+
export declare function parseDesktopRelease(value: unknown): DesktopRelease;
|
|
14
|
+
//# sourceMappingURL=release.d.ts.map
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/** Relocatable, integrity-recorded production packages carried by one Desktop release. */
|
|
2
|
+
import { type DesktopRelease } from './release.ts';
|
|
3
|
+
/** Descriptor at the root of the immutable Desktop resource tree. */
|
|
4
|
+
export declare const DESKTOP_RUNTIME_FILE = "desktop-runtime.json";
|
|
5
|
+
/** Host-owned package available to external plugins through a directory link. */
|
|
6
|
+
export interface DesktopSharedPackage {
|
|
7
|
+
readonly name: string;
|
|
8
|
+
readonly version: string;
|
|
9
|
+
readonly path: string;
|
|
10
|
+
}
|
|
11
|
+
/** Final bytes and executable permissions of a runtime file. */
|
|
12
|
+
export interface DesktopRuntimeFile {
|
|
13
|
+
readonly path: string;
|
|
14
|
+
readonly bytes: number;
|
|
15
|
+
readonly sha256: string;
|
|
16
|
+
readonly executable: boolean;
|
|
17
|
+
}
|
|
18
|
+
/** One signed application's production dependency tree. */
|
|
19
|
+
export interface DesktopRuntimeDescriptor {
|
|
20
|
+
readonly schemaVersion: 1;
|
|
21
|
+
readonly release: DesktopRelease;
|
|
22
|
+
readonly platform: NodeJS.Platform;
|
|
23
|
+
readonly arch: string;
|
|
24
|
+
readonly sharedPackages: readonly DesktopSharedPackage[];
|
|
25
|
+
readonly files: readonly DesktopRuntimeFile[];
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Resolve one portable resource path without permitting traversal or absolute paths.
|
|
29
|
+
* @param root - Runtime root.
|
|
30
|
+
* @param path - Slash-separated relative path from durable metadata.
|
|
31
|
+
* @returns Absolute resource path.
|
|
32
|
+
*/
|
|
33
|
+
export declare function runtimePath(root: string, path: string): string;
|
|
34
|
+
/**
|
|
35
|
+
* Inventory a materialized runtime without following links or including its descriptor.
|
|
36
|
+
* @param root - Self-contained runtime directory.
|
|
37
|
+
* @returns Sorted final-file inventory; executable permissions are false on Windows.
|
|
38
|
+
*/
|
|
39
|
+
export declare function inventoryDesktopRuntime(root: string): DesktopRuntimeFile[];
|
|
40
|
+
/**
|
|
41
|
+
* Seal the final runtime tree after materialization and native signing.
|
|
42
|
+
* @param root - Runtime output directory.
|
|
43
|
+
* @param release - Matching shell, qilin, Host, and executable versions.
|
|
44
|
+
* @param sharedNames - Release-owned packages supplied to plugins.
|
|
45
|
+
* @param target - Platform and architecture selected by runtime preparation.
|
|
46
|
+
* @returns Descriptor written beside the production packages.
|
|
47
|
+
*/
|
|
48
|
+
export declare function writeDesktopRuntime(root: string, release: DesktopRelease, sharedNames: readonly string[], target?: {
|
|
49
|
+
platform: NodeJS.Platform;
|
|
50
|
+
arch: string;
|
|
51
|
+
}): DesktopRuntimeDescriptor;
|
|
52
|
+
/**
|
|
53
|
+
* Read packaged metadata and check shared package records.
|
|
54
|
+
* @param root - Current application's runtime resources.
|
|
55
|
+
* @returns Runtime metadata whose release compatibility is verified during packaging.
|
|
56
|
+
*/
|
|
57
|
+
export declare function readDesktopRuntime(root: string): DesktopRuntimeDescriptor;
|
|
58
|
+
/**
|
|
59
|
+
* Verify every packaged runtime file against its recorded bytes and permissions at build time.
|
|
60
|
+
* @param root - Materialized runtime resources.
|
|
61
|
+
* @param expectedVersion - Version the bundled runtime must declare: the product version ordinarily,
|
|
62
|
+
* and a rewritten one for installed-update qualification.
|
|
63
|
+
* @param target - Required execution target; defaults to the current process.
|
|
64
|
+
* @returns Validated runtime descriptor.
|
|
65
|
+
*/
|
|
66
|
+
export declare function verifyDesktopRuntime(root: string, expectedVersion: string, target?: {
|
|
67
|
+
platform: NodeJS.Platform;
|
|
68
|
+
arch: string;
|
|
69
|
+
}): Promise<DesktopRuntimeDescriptor>;
|
|
70
|
+
//# sourceMappingURL=runtime-tree.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Resolved shell preferences; absent fields use the defaults without rewriting existing files. */
|
|
2
|
+
export interface DesktopSettings {
|
|
3
|
+
readonly updates: {
|
|
4
|
+
readonly allowTestAuthPopupWindow: boolean;
|
|
5
|
+
};
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Read shell settings, creating the default document exclusively when missing.
|
|
9
|
+
* @param userData - Electron's userData directory, independent of QILIN_HOME.
|
|
10
|
+
* @returns Validated settings, or defaults when reading, creating or validating fails; changes require a restart.
|
|
11
|
+
*/
|
|
12
|
+
export declare function readDesktopSettings(userData: string): DesktopSettings;
|
|
13
|
+
//# sourceMappingURL=settings.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Electron single-instance ownership before any Desktop profile lifecycle begins. */
|
|
2
|
+
/** Minimal Electron application operations needed for instance ownership. */
|
|
3
|
+
export interface DesktopSingleInstanceApplication {
|
|
4
|
+
requestSingleInstanceLock(): boolean;
|
|
5
|
+
quit(): void;
|
|
6
|
+
on(event: 'second-instance', listener: () => void): unknown;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Claim the process-lifetime Desktop lock and route later launches to the owner.
|
|
10
|
+
* @param application - Electron application singleton.
|
|
11
|
+
* @param focusOwner - focus or recreate the primary window after a later launch.
|
|
12
|
+
* @returns true only in the process that may access the Desktop profile.
|
|
13
|
+
*/
|
|
14
|
+
export declare function claimDesktopSingleInstance(application: DesktopSingleInstanceApplication, focusOwner: () => void): boolean;
|
|
15
|
+
//# sourceMappingURL=single-instance.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Serializable Desktop failure diagnostics. */
|
|
2
|
+
/**
|
|
3
|
+
* Preserve nested diagnostics when sending failures to a renderer.
|
|
4
|
+
* @param error - Startup or runtime failure.
|
|
5
|
+
* @returns Serializable error state.
|
|
6
|
+
*/
|
|
7
|
+
export declare function desktopErrorState(error: unknown): {
|
|
8
|
+
phase: 'error';
|
|
9
|
+
message: string;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=startup-error.d.ts.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** Windows system tray: the always-present way back to a hidden window and the explicit quit entry. */
|
|
2
|
+
import type { DesktopLocale } from './locale.ts';
|
|
3
|
+
/** Main-process actions the tray triggers; both run the same paths as the window and application menu. */
|
|
4
|
+
export interface DesktopTrayOptions {
|
|
5
|
+
/** Multi-size ICO rendered by `scripts/render-tray-icon.ts`; Windows picks the bitmap for the display scale. */
|
|
6
|
+
readonly iconPath: string;
|
|
7
|
+
readonly locale: () => DesktopLocale;
|
|
8
|
+
/** Show and focus the primary window. */
|
|
9
|
+
readonly open: () => void;
|
|
10
|
+
/** Request quit through the same confirmation as every other quit entry. */
|
|
11
|
+
readonly quit: () => void;
|
|
12
|
+
}
|
|
13
|
+
/** Tray icon present for the whole run, not only while the window is hidden. */
|
|
14
|
+
export declare class DesktopTray {
|
|
15
|
+
private readonly options;
|
|
16
|
+
private tray;
|
|
17
|
+
/** @param options - Icon path, locale reader, and the open and quit actions. */
|
|
18
|
+
constructor(options: DesktopTrayOptions);
|
|
19
|
+
/** Rebuild the tooltip and context menu in the current locale. */
|
|
20
|
+
relabel(): void;
|
|
21
|
+
/** Remove the icon; called once the quit is confirmed so no dead icon outlives the process. */
|
|
22
|
+
dispose(): void;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=tray.d.ts.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** Best-effort background attention never grants update or task-stop authorization. */
|
|
2
|
+
import { type BrowserWindow } from 'electron';
|
|
3
|
+
import type { DesktopLocale } from './locale.ts';
|
|
4
|
+
/** Owns one reminder per downloaded version until reset for a new download. */
|
|
5
|
+
export declare class DesktopUpdateAttention {
|
|
6
|
+
private readonly locale;
|
|
7
|
+
private readonly platform;
|
|
8
|
+
private version;
|
|
9
|
+
private notification;
|
|
10
|
+
private stop;
|
|
11
|
+
/**
|
|
12
|
+
* @param locale - Shell-owned notification copy.
|
|
13
|
+
* @param platform - Native attention implementation, replaceable for platform tests.
|
|
14
|
+
*/
|
|
15
|
+
constructor(locale: DesktopLocale, platform?: string);
|
|
16
|
+
/**
|
|
17
|
+
* @param version - Prepared target whose confirmation is waiting.
|
|
18
|
+
* @param parent - Taskbar window; never restored or focused by the reminder.
|
|
19
|
+
* @param modal - Existing installation confirmation.
|
|
20
|
+
* @param returnToConfirmation - Rechecks current policy and returns to UI without installing.
|
|
21
|
+
*/
|
|
22
|
+
ready(version: string, parent: BrowserWindow, modal: BrowserWindow, returnToConfirmation: () => void): void;
|
|
23
|
+
/** Release owned native reminders without scheduling another for the same target. */
|
|
24
|
+
clear(): void;
|
|
25
|
+
/** Start a new download episode, or dispose all owned reminders. */
|
|
26
|
+
reset(): void;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=update-attention.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Resolve the update channel sealed into the installed application manifest. */
|
|
2
|
+
/** Installer-owned channel, independent of release version and upload environment. */
|
|
3
|
+
export type DesktopUpdateChannel = 'nightly' | 'latest';
|
|
4
|
+
/**
|
|
5
|
+
* Read the packaged channel; older manifests retain their existing nightly behavior.
|
|
6
|
+
* @param manifest Parsed application manifest.
|
|
7
|
+
* @returns Validated channel. Invalid explicit values reject instead of changing feeds.
|
|
8
|
+
*/
|
|
9
|
+
export declare function desktopUpdateChannel(manifest: unknown): DesktopUpdateChannel;
|
|
10
|
+
//# sourceMappingURL=update-channel.d.ts.map
|