@qilin-agent/desktop 0.0.0-stage → 3.1.7
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 +99 -3
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/** Electron Node-mode child lifecycle for the shared Web application. */
|
|
2
|
+
/** What quitting now would affect, as reported by the Host. */
|
|
3
|
+
export interface DesktopQuitInspection {
|
|
4
|
+
readonly activeTasks: boolean;
|
|
5
|
+
readonly scheduledTasks: boolean;
|
|
6
|
+
}
|
|
7
|
+
/** Quit inspection deadline; a slower Host counts as unknown work and the shell asks before quitting. */
|
|
8
|
+
export declare const QUIT_INSPECTION_DEADLINE_MS = 2000;
|
|
9
|
+
/** Browser authentication URL reported by the running Web application. */
|
|
10
|
+
export interface DesktopHostReady {
|
|
11
|
+
readonly url: string;
|
|
12
|
+
readonly injections?: readonly unknown[] | undefined;
|
|
13
|
+
}
|
|
14
|
+
/** The child has exited, but task teardown did not finish successfully. */
|
|
15
|
+
export declare class DesktopHostUncleanExitError extends Error {
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A Host failure reported over IPC before the process exited. `message` is what
|
|
19
|
+
* the Host chose to show; `diagnostic` is its complete inspected error, kept
|
|
20
|
+
* separately so a crash report can print it verbatim instead of a string escaped
|
|
21
|
+
* inside another error's properties.
|
|
22
|
+
*/
|
|
23
|
+
export declare class DesktopHostFatalError extends Error {
|
|
24
|
+
#private;
|
|
25
|
+
/**
|
|
26
|
+
* @param message - The Host's failure message.
|
|
27
|
+
* @param diagnostic - The Host's inspected error, when the Host supplied one.
|
|
28
|
+
*/
|
|
29
|
+
constructor(message: string, diagnostic: string | undefined);
|
|
30
|
+
/** The Host's inspected error; a getter so `util.inspect` of this error does not repeat it as an escaped property. */
|
|
31
|
+
get diagnostic(): string | undefined;
|
|
32
|
+
}
|
|
33
|
+
/** One Web backend running under the Electron executable in Node mode. */
|
|
34
|
+
export declare class DesktopHostProcess {
|
|
35
|
+
private readonly node;
|
|
36
|
+
private readonly runtimeDir;
|
|
37
|
+
private readonly projectDir;
|
|
38
|
+
private readonly inspectPort?;
|
|
39
|
+
private readonly environment;
|
|
40
|
+
private readonly onFailure?;
|
|
41
|
+
private readonly primaryRuntime?;
|
|
42
|
+
private readonly packageManager?;
|
|
43
|
+
private child;
|
|
44
|
+
private readyResolve;
|
|
45
|
+
private readyReject;
|
|
46
|
+
private readonly readyPromise;
|
|
47
|
+
private exitPromise;
|
|
48
|
+
private stderr;
|
|
49
|
+
private failureReported;
|
|
50
|
+
private stopping;
|
|
51
|
+
private shutdownCompleted;
|
|
52
|
+
private nextControlId;
|
|
53
|
+
private readonly controlRequests;
|
|
54
|
+
/**
|
|
55
|
+
* @param node - Absolute Electron executable in Node mode.
|
|
56
|
+
* @param runtimeDir - Immutable packages carried by the current application.
|
|
57
|
+
* @param projectDir - Desktop plugin profile and child working directory.
|
|
58
|
+
* @param inspectPort - Optional loopback inspector port for workspace development.
|
|
59
|
+
* @param environment - Environment inherited by the Host and its plugin subprocesses.
|
|
60
|
+
* @param onFailure - Receives the first unexpected child failure, including after readiness.
|
|
61
|
+
* @param primaryRuntime - Optional bundled dependency payload; when supplied, missing sibling
|
|
62
|
+
* `office-skills` resources fail Host startup.
|
|
63
|
+
* @param packageManager - Bundled pnpm entry and Node launcher directory, scoped to package operations.
|
|
64
|
+
*/
|
|
65
|
+
constructor(node: string, runtimeDir: string, projectDir: string, inspectPort?: number | undefined, environment?: NodeJS.ProcessEnv, onFailure?: ((error: Error) => void) | undefined, primaryRuntime?: string | undefined, packageManager?: {
|
|
66
|
+
readonly pnpm: string;
|
|
67
|
+
readonly nodeBin: string;
|
|
68
|
+
} | undefined);
|
|
69
|
+
/**
|
|
70
|
+
* Start this child once and await its Web application URL.
|
|
71
|
+
* @returns Ready facts supplied by the child after application startup.
|
|
72
|
+
*/
|
|
73
|
+
start(): Promise<DesktopHostReady>;
|
|
74
|
+
/**
|
|
75
|
+
* Inspect active work or lock request admission for update handoff.
|
|
76
|
+
* @param action - Read-only inspection, admission lock, or recovery unlock.
|
|
77
|
+
* @returns Whether live tasks would be affected. Locking drains admitted API requests before inspecting tasks;
|
|
78
|
+
* an unanswered drain fails at the control-request deadline without authorizing installation.
|
|
79
|
+
*/
|
|
80
|
+
updateTasks(action: 'inspect' | 'lock' | 'unlock'): Promise<boolean>;
|
|
81
|
+
/**
|
|
82
|
+
* Ask the Host what quitting now would interrupt.
|
|
83
|
+
* @returns Active tasks and armed scheduled reminders; rejects when the Host is unavailable or misses
|
|
84
|
+
* {@link QUIT_INSPECTION_DEADLINE_MS}, and the shell then asks before quitting.
|
|
85
|
+
*/
|
|
86
|
+
inspectQuit(): Promise<DesktopQuitInspection>;
|
|
87
|
+
private control;
|
|
88
|
+
/**
|
|
89
|
+
* Request teardown and await child exit, escalating termination when needed.
|
|
90
|
+
* @param requireGraceful - Reject update handoff after forced termination or unsuccessful child exit.
|
|
91
|
+
* @returns Completion of owned process teardown. DesktopHostUncleanExitError confirms exit but refuses installation;
|
|
92
|
+
* other failures do not confirm exit.
|
|
93
|
+
*/
|
|
94
|
+
stop(requireGraceful?: boolean): Promise<void>;
|
|
95
|
+
private fail;
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=host-process.d.ts.map
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/** Typed preload operations exposed only by the Electron shell. */
|
|
2
|
+
import type { DesktopKeyboardApi, DesktopShortcutsApi } from '@qilin-agent/client-shortcuts/protocol';
|
|
3
|
+
import type { IpcMainInvokeEvent } from 'electron';
|
|
4
|
+
/** IPC channel names kept private to the desktop application bundle. */
|
|
5
|
+
export declare const DESKTOP_IPC: {
|
|
6
|
+
readonly shortcutsInput: "qilin-desktop:shortcuts-input";
|
|
7
|
+
readonly shortcutsCloseWindow: "qilin-desktop:shortcuts-close-window";
|
|
8
|
+
readonly shortcutsGet: "qilin-desktop:shortcuts-get";
|
|
9
|
+
readonly shortcutsEdit: "qilin-desktop:shortcuts-edit";
|
|
10
|
+
readonly shortcutsChanged: "qilin-desktop:shortcuts-changed";
|
|
11
|
+
readonly shortcutsRecording: "qilin-desktop:shortcuts-recording";
|
|
12
|
+
readonly boot: "qilin-desktop:boot";
|
|
13
|
+
readonly enterWorkspace: "qilin-desktop:enter-workspace";
|
|
14
|
+
readonly onboardingActive: "qilin-desktop:onboarding-active";
|
|
15
|
+
readonly onboardingApiKey: "qilin-desktop:onboarding-api-key";
|
|
16
|
+
readonly bootFailed: "qilin-desktop:boot-failed";
|
|
17
|
+
readonly browserAcquire: "qilin-desktop:browser-acquire";
|
|
18
|
+
readonly browserRelease: "qilin-desktop:browser-release";
|
|
19
|
+
readonly browserOpenRequested: "qilin-desktop:browser-open-requested";
|
|
20
|
+
readonly directoryPick: "qilin-desktop:directory-pick";
|
|
21
|
+
readonly deviceInfo: "qilin-desktop:device-info";
|
|
22
|
+
readonly localeBootstrap: "qilin-desktop:locale-bootstrap";
|
|
23
|
+
readonly localeChanged: "qilin-desktop:locale-changed";
|
|
24
|
+
readonly updatesStatus: "qilin-desktop:updates-status";
|
|
25
|
+
readonly updatesOpen: "qilin-desktop:updates-open";
|
|
26
|
+
readonly updatesPresentation: "qilin-desktop:updates-presentation";
|
|
27
|
+
readonly nativeThemeSet: "qilin-desktop:native-theme-set";
|
|
28
|
+
readonly windowFullscreen: "qilin-desktop:window-fullscreen";
|
|
29
|
+
readonly windowsAppearance: "qilin-desktop:windows-appearance";
|
|
30
|
+
readonly windowsMenu: "qilin-desktop:windows-menu";
|
|
31
|
+
};
|
|
32
|
+
/** Desktop release update state rendered by desktop-owned UI. */
|
|
33
|
+
export type DesktopUpdatePreparationFailureKind = 'stop-failed' | 'tasks-changed' | 'tasks-unavailable';
|
|
34
|
+
export interface DesktopUpdateState {
|
|
35
|
+
readonly phase: 'idle' | 'checking' | 'available' | 'downloading' | 'verifying' | 'installing' | 'ready' | 'error';
|
|
36
|
+
readonly version?: string;
|
|
37
|
+
readonly message?: string;
|
|
38
|
+
/** Main-owned diagnostics without subprocess output or credentials; hidden until expanded. */
|
|
39
|
+
readonly technicalDetails?: string;
|
|
40
|
+
readonly percent?: number;
|
|
41
|
+
readonly failedOperation?: 'check' | 'download' | 'install';
|
|
42
|
+
/** Main-owned preparation cause; UI wording is selected by the active locale. */
|
|
43
|
+
readonly preparationFailure?: DesktopUpdatePreparationFailureKind;
|
|
44
|
+
}
|
|
45
|
+
/** Classified failure copy selected by the Web locale without exposing raw updater diagnostics. */
|
|
46
|
+
export type DesktopUpdateFailureKind = 'check' | 'check-network' | 'download' | 'download-network' | 'install' | 'install-network' | 'stop-failed' | 'tasks-changed' | 'tasks-unavailable';
|
|
47
|
+
/** Semantic status content; actions open main-process confirmation dialogs only. */
|
|
48
|
+
export interface DesktopUpdatePresentation {
|
|
49
|
+
readonly phase: DesktopUpdateState['phase'];
|
|
50
|
+
readonly version?: string;
|
|
51
|
+
readonly percent?: number;
|
|
52
|
+
readonly failure?: DesktopUpdateFailureKind;
|
|
53
|
+
}
|
|
54
|
+
/** Product documents cannot supply update versions, package URLs, or installation authorization. */
|
|
55
|
+
export interface QilinDesktopProductApi {
|
|
56
|
+
readonly protocolVersion: 1;
|
|
57
|
+
readonly keyboard: DesktopKeyboardApi;
|
|
58
|
+
readonly shortcuts: DesktopShortcutsApi;
|
|
59
|
+
/**
|
|
60
|
+
* Local machine description for the feedback questionnaire.
|
|
61
|
+
* @returns `name=value` fields separated by `; `, with no hostname, user name, or serial number.
|
|
62
|
+
*/
|
|
63
|
+
deviceInfo(): Promise<string>;
|
|
64
|
+
readonly updates: {
|
|
65
|
+
status(): Promise<DesktopUpdatePresentation>;
|
|
66
|
+
open(): Promise<void>;
|
|
67
|
+
subscribe(listener: (state: DesktopUpdatePresentation) => void): () => void;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
/** Scheme of Desktop-owned application documents. */
|
|
71
|
+
export declare const SCHEME = "qilin-app";
|
|
72
|
+
/**
|
|
73
|
+
* Reject IPC outside the allowed Desktop document origins.
|
|
74
|
+
* @param event - IPC caller whose frame URL supplies the origin.
|
|
75
|
+
* @param hostnames - Desktop document hosts allowed for this operation.
|
|
76
|
+
*/
|
|
77
|
+
export declare function assertDesktopSender(event: IpcMainInvokeEvent, hostnames: readonly string[]): void;
|
|
78
|
+
//# sourceMappingURL=ipc.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ShortcutPersistence } from '@qilin-agent/client-shortcuts/protocol';
|
|
2
|
+
import type { ShortcutConfigSnapshot, ShortcutPlatform } from '@qilin-agent/client-shortcuts/protocol';
|
|
3
|
+
/**
|
|
4
|
+
* Open the device configuration with atomic replacement.
|
|
5
|
+
* @param userData - Electron-owned userData directory, never a Renderer-supplied path.
|
|
6
|
+
* @param platform - local input platform.
|
|
7
|
+
* @param publish - updates the native binding index and trusted product page after commit.
|
|
8
|
+
* @returns the single-writer transaction coordinator.
|
|
9
|
+
*/
|
|
10
|
+
export declare function desktopKeybindings(userData: string, platform: ShortcutPlatform, publish: (snapshot: ShortcutConfigSnapshot) => void): ShortcutPersistence;
|
|
11
|
+
//# sourceMappingURL=keybindings.d.ts.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/** Product-window preference IPC and native menu interception during physical-key dispatch/recording. */
|
|
2
|
+
import { type BrowserWindow, type MenuItemConstructorOptions, type WebContents } from 'electron';
|
|
3
|
+
import type { ShortcutPlatform } from '@qilin-agent/client-shortcuts/protocol';
|
|
4
|
+
/** Name a sidebar browser lease carries in the main process, declared here because the client package ships no such type. */
|
|
5
|
+
import type { DesktopBrowserLeaseId } from './browser-bridge-types.ts';
|
|
6
|
+
/**
|
|
7
|
+
* Install application-owned configuration handlers and attach each product window's input lifecycle.
|
|
8
|
+
* @param getWindow - current product window.
|
|
9
|
+
* @param userData - Electron-resolved device preference directory.
|
|
10
|
+
* @param platform - local device platform.
|
|
11
|
+
* @param updateMenu - rebuild the application menu when the close accelerator or availability changes.
|
|
12
|
+
* @param overlayInput - Current shell-owned input blocking state for the product window.
|
|
13
|
+
* @returns menu construction, editor key delivery, window attachment, and teardown operations.
|
|
14
|
+
*/
|
|
15
|
+
export declare function installDesktopShortcuts(getWindow: () => BrowserWindow | undefined, userData: string, platform: ShortcutPlatform, updateMenu: () => void, overlayInput: (window: BrowserWindow) => {
|
|
16
|
+
readonly revision: number;
|
|
17
|
+
readonly blocked: boolean;
|
|
18
|
+
}): {
|
|
19
|
+
fileMenu(labels: {
|
|
20
|
+
fileMenu: string;
|
|
21
|
+
closePage: string;
|
|
22
|
+
}): MenuItemConstructorOptions;
|
|
23
|
+
/**
|
|
24
|
+
* Send a native Edit action to the editor without matching user shortcuts.
|
|
25
|
+
* @param keyCode - edit key.
|
|
26
|
+
* @param modifiers - edit modifiers.
|
|
27
|
+
*/
|
|
28
|
+
sendEditingKey(keyCode: string, modifiers: Array<'control'>): void;
|
|
29
|
+
attach(window: BrowserWindow): void;
|
|
30
|
+
/**
|
|
31
|
+
* Intercept an approved browser guest's keys until its lease ends.
|
|
32
|
+
* @param window - owning product window.
|
|
33
|
+
* @param guest - approved browser contents.
|
|
34
|
+
* @param name - main-issued lease used as the webview element name.
|
|
35
|
+
* @returns idempotent listener disposer.
|
|
36
|
+
*/
|
|
37
|
+
attachGuest(window: BrowserWindow, guest: WebContents, name: DesktopBrowserLeaseId): () => void;
|
|
38
|
+
dispose(): void;
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=keyboard.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** Local account operations the Desktop welcome window drives. */
|
|
2
|
+
import { type WebSessionCookie } from './web-document.ts';
|
|
3
|
+
/** Outcome of one local account request. */
|
|
4
|
+
export interface LocalAuthResult {
|
|
5
|
+
readonly ok: boolean;
|
|
6
|
+
/** Server-provided reason code when the request was refused. */
|
|
7
|
+
readonly reason?: string;
|
|
8
|
+
/** Account session the Host minted with the acceptance, for the shell to store and forward. */
|
|
9
|
+
readonly session?: WebSessionCookie;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Submit one local account request to the Host that owns this Desktop.
|
|
13
|
+
* @param origin - Host origin serving the local account routes.
|
|
14
|
+
* @param kind - login or registration.
|
|
15
|
+
* @param body - submitted fields; never logged.
|
|
16
|
+
* @param send - Electron session fetch, carrying the Host device cookie.
|
|
17
|
+
* @returns whether the Host accepted the submission, with its refusal reason when it did not, and
|
|
18
|
+
* the account session the acceptance minted. The response cookie reaches no cookie jar on this
|
|
19
|
+
* path, so the shell stores and forwards it itself.
|
|
20
|
+
*/
|
|
21
|
+
export declare function submitLocalAccount(origin: string, kind: 'login' | 'setup', body: Readonly<Record<string, string>>, send: (input: string, init?: RequestInit) => Promise<Response>): Promise<LocalAuthResult>;
|
|
22
|
+
//# sourceMappingURL=local-auth.d.ts.map
|