@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,60 @@
|
|
|
1
|
+
/** User-authorized downloads and separate installation of one version-bound Desktop release. */
|
|
2
|
+
import { type AppUpdater } from 'electron-updater';
|
|
3
|
+
import type { DesktopUpdateState } from './ipc.ts';
|
|
4
|
+
/** Owns one updater target until its download and installation settle. */
|
|
5
|
+
export declare class DesktopUpdateCoordinator {
|
|
6
|
+
private readonly publish;
|
|
7
|
+
private readonly beforeRestart;
|
|
8
|
+
private readonly updater;
|
|
9
|
+
private readonly enabled;
|
|
10
|
+
private readonly currentVersion;
|
|
11
|
+
private readonly downloadResult?;
|
|
12
|
+
private readonly channel;
|
|
13
|
+
private current;
|
|
14
|
+
private candidate;
|
|
15
|
+
private downloaded;
|
|
16
|
+
private disposed;
|
|
17
|
+
private checkOperation;
|
|
18
|
+
private downloadOperation;
|
|
19
|
+
private installOperation;
|
|
20
|
+
private readonly onProgress;
|
|
21
|
+
private readonly onDownloaded;
|
|
22
|
+
private readonly onError;
|
|
23
|
+
/**
|
|
24
|
+
* @param publish - Receives observable states for every Desktop window.
|
|
25
|
+
* @param beforeRestart - Completes task authorization, admission locking, and owned-process shutdown.
|
|
26
|
+
* @param updater - Process-owned Electron updater, replaceable at the network/platform test boundary.
|
|
27
|
+
* @param enabled - Whether this process has a packaged update source.
|
|
28
|
+
* @param currentVersion - Actual installed application version.
|
|
29
|
+
* @param channel - Installed package channel; omitted test/local callers retain nightly.
|
|
30
|
+
* @param downloadResult - Once per completed download attempt, including platform preparation failures.
|
|
31
|
+
*/
|
|
32
|
+
constructor(publish: (state: DesktopUpdateState) => DesktopUpdateState, beforeRestart: () => Promise<boolean>, updater?: AppUpdater, enabled?: () => boolean, currentVersion?: () => string, downloadResult?: ((success: boolean, reason?: string) => void) | undefined, channel?: 'nightly' | 'latest');
|
|
33
|
+
/** Latest observable state; complete download identity remains main-process-owned. */
|
|
34
|
+
get state(): DesktopUpdateState;
|
|
35
|
+
/**
|
|
36
|
+
* Check metadata without downloading, joining any current check.
|
|
37
|
+
* @param manual - Whether a failed check must remain visible in the status indicator.
|
|
38
|
+
* @returns The check result, including a silent automatic failure when applicable.
|
|
39
|
+
*/
|
|
40
|
+
check(manual?: boolean): Promise<DesktopUpdateState>;
|
|
41
|
+
/**
|
|
42
|
+
* @param version - Version shown in the user's download confirmation.
|
|
43
|
+
* @returns Download readiness or failure, without authorizing installation.
|
|
44
|
+
*/
|
|
45
|
+
download(version: string): Promise<DesktopUpdateState>;
|
|
46
|
+
/**
|
|
47
|
+
* Install a prepared target after a separate user confirmation.
|
|
48
|
+
* @param version - Exact version displayed in the confirmation, never a renderer-selected URL.
|
|
49
|
+
* @returns Installation handoff or a recoverable preparation error.
|
|
50
|
+
*/
|
|
51
|
+
install(version: string): Promise<DesktopUpdateState>;
|
|
52
|
+
/** Remove owned listeners and prevent pending library operations from publishing into closed UI. */
|
|
53
|
+
dispose(): void;
|
|
54
|
+
private assertLive;
|
|
55
|
+
private setState;
|
|
56
|
+
private failure;
|
|
57
|
+
private target;
|
|
58
|
+
private doCheck;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=update-coordinator.d.ts.map
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/** Main-owned update confirmations; closing or replacing a dialog never grants installation permission. */
|
|
2
|
+
import { type BrowserWindow, type MessageBoxOptions, type MessageBoxReturnValue } from 'electron';
|
|
3
|
+
import type { DesktopLocale } from './locale.ts';
|
|
4
|
+
import type { DesktopUpdateOverlays } from './update-overlay.ts';
|
|
5
|
+
/** Channels available only to the isolated update-dialog document. */
|
|
6
|
+
export declare const UPDATE_DIALOG_IPC: {
|
|
7
|
+
readonly status: "dsh-update-dialog:status";
|
|
8
|
+
readonly changed: "dsh-update-dialog:changed";
|
|
9
|
+
readonly respond: "dsh-update-dialog:respond";
|
|
10
|
+
};
|
|
11
|
+
/** Text and choices supplied by the main process, never by product documents. */
|
|
12
|
+
export interface UpdateDialogView {
|
|
13
|
+
/** Identifies the displayed choices; a response from an older prompt is rejected. */
|
|
14
|
+
readonly revision: number;
|
|
15
|
+
readonly locale: string;
|
|
16
|
+
readonly title: string;
|
|
17
|
+
readonly message: string;
|
|
18
|
+
readonly detail: string;
|
|
19
|
+
readonly buttons: readonly string[];
|
|
20
|
+
readonly cancelId: number;
|
|
21
|
+
readonly closeLabel: string;
|
|
22
|
+
readonly technicalDetails: string;
|
|
23
|
+
readonly technicalDetailsLabel: string;
|
|
24
|
+
}
|
|
25
|
+
/** Electron message options with separately expandable, main-owned diagnostics. */
|
|
26
|
+
export interface UpdateDialogOptions extends MessageBoxOptions {
|
|
27
|
+
readonly technicalDetails?: string;
|
|
28
|
+
}
|
|
29
|
+
/** The document can select only a displayed response index. */
|
|
30
|
+
export interface UpdateDialogApi {
|
|
31
|
+
status(): Promise<UpdateDialogView | null>;
|
|
32
|
+
respond(revision: number, index: number): Promise<void>;
|
|
33
|
+
subscribe(listener: (view: UpdateDialogView | null) => void): () => void;
|
|
34
|
+
}
|
|
35
|
+
/** One fading backdrop with replaceable confirmation content; aborted checks and mandatory policy cancel ordinary prompts. */
|
|
36
|
+
export declare class DesktopUpdateDialog {
|
|
37
|
+
private readonly preload;
|
|
38
|
+
private readonly locale;
|
|
39
|
+
private readonly overlays;
|
|
40
|
+
private disposed;
|
|
41
|
+
private revision;
|
|
42
|
+
private window;
|
|
43
|
+
private parent;
|
|
44
|
+
private closing;
|
|
45
|
+
private active;
|
|
46
|
+
/** Focus the current explanation or confirmation without replacing it or granting permission. */
|
|
47
|
+
focus(): void;
|
|
48
|
+
/** Whether a shell prompt is awaiting a response. */
|
|
49
|
+
get isOpen(): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* @param preload - Bundled isolated preload.
|
|
52
|
+
* @param locale - Shell-owned copy or a reader of the current UI language.
|
|
53
|
+
* @param overlays - Application-owned overlay creation and input tracking.
|
|
54
|
+
*/
|
|
55
|
+
constructor(preload: string, locale: DesktopLocale | (() => DesktopLocale), overlays: Pick<DesktopUpdateOverlays, 'create'>);
|
|
56
|
+
/**
|
|
57
|
+
* @param parent - Window blocked by this confirmation.
|
|
58
|
+
* @param options - Main-owned localized content, response choices, and optional cancellation signal.
|
|
59
|
+
* @returns A displayed response, or cancellation on replacement, abort, close, or load failure; backdrop dismissal fades independently.
|
|
60
|
+
*/
|
|
61
|
+
show(parent: BrowserWindow, options: UpdateDialogOptions): Promise<MessageBoxReturnValue>;
|
|
62
|
+
/** Cancel the displayed prompt without authorizing any operation. */
|
|
63
|
+
cancel(): void;
|
|
64
|
+
/** Close the document and detach its private IPC handlers. */
|
|
65
|
+
dispose(): void;
|
|
66
|
+
private close;
|
|
67
|
+
private owned;
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=update-dialog.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Localized update preparation failures with separately displayed diagnostics. */
|
|
2
|
+
import type { DesktopUpdatePreparationFailureKind } from './ipc.ts';
|
|
3
|
+
/** Only explicitly safe main-process facts may be exposed as technical details. */
|
|
4
|
+
export declare class DesktopUpdatePreparationError extends Error {
|
|
5
|
+
readonly kind: DesktopUpdatePreparationFailureKind;
|
|
6
|
+
readonly technicalDetails?: string | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* @param kind - Stable preparation cause shared by native and Web presentations.
|
|
9
|
+
* @param message - Locale-owned recovery guidance.
|
|
10
|
+
* @param technicalDetails - Main-owned facts, excluding raw subprocess output and credentials.
|
|
11
|
+
*/
|
|
12
|
+
constructor(kind: DesktopUpdatePreparationFailureKind, message: string, technicalDetails?: string | undefined);
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=update-error.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Electron-native inactivity deadlines for updater checks, full downloads, and blockmap requests. */
|
|
2
|
+
import { ElectronHttpExecutor } from 'electron-updater/out/electronHttpExecutor.js';
|
|
3
|
+
import type { ClientRequest } from 'electron';
|
|
4
|
+
/** Retains electron-updater transport and proxy handling while bounding silent connections. */
|
|
5
|
+
export declare class DesktopUpdateHttpExecutor extends ElectronHttpExecutor {
|
|
6
|
+
private readonly idleTimeoutMs;
|
|
7
|
+
/**
|
|
8
|
+
* @param idleTimeoutMs - Maximum silence before headers or between response chunks, not a total download deadline.
|
|
9
|
+
* @param proxyLogin - Existing updater login event forwarding.
|
|
10
|
+
*/
|
|
11
|
+
constructor(idleTimeoutMs: number, proxyLogin?: ConstructorParameters<typeof ElectronHttpExecutor>[0]);
|
|
12
|
+
addErrorAndTimeoutHandlers(request: ClientRequest, reject: (error: Error) => void): void;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=update-http-executor.d.ts.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { DesktopUpdateState } from './ipc.ts';
|
|
2
|
+
/** User and process milestones that connect update states across application restarts. */
|
|
3
|
+
export type DesktopUpdateJournalAction = 'started' | 'workspace-ready' | 'workspace-failed' | 'check-requested' | 'download-requested' | 'install-confirmed' | 'quit-requested' | 'policy-login-opened' | 'policy-login-returned' | 'policy-login-cancelled' | 'policy-login-failed';
|
|
4
|
+
/**
|
|
5
|
+
* Whitelist one update state for disk; neither error text nor unexpected object fields survive.
|
|
6
|
+
* @param state Main-process-owned update state.
|
|
7
|
+
* @returns Only phase, target version, integer progress, operation, and a fixed error classification.
|
|
8
|
+
*/
|
|
9
|
+
export declare function desktopUpdateJournalState(state: DesktopUpdateState): object;
|
|
10
|
+
/** Process-owned JSONL evidence; each append is flushed before the caller continues. */
|
|
11
|
+
export declare class DesktopUpdateJournal {
|
|
12
|
+
private readonly version;
|
|
13
|
+
readonly path: string;
|
|
14
|
+
private sequence;
|
|
15
|
+
private previousState;
|
|
16
|
+
/**
|
|
17
|
+
* @param directory Absolute evidence directory, retained across installs; creation errors stop qualification.
|
|
18
|
+
* @param version Installed application version, not a version supplied by the feed.
|
|
19
|
+
*/
|
|
20
|
+
constructor(directory: string, version: string);
|
|
21
|
+
/**
|
|
22
|
+
* Append a fixed action; failures propagate so incomplete qualification is never reported as traced.
|
|
23
|
+
* @param action Update operation or process milestone; no free-text fields are accepted.
|
|
24
|
+
* @returns Nothing after the record has been flushed.
|
|
25
|
+
*/
|
|
26
|
+
action(action: DesktopUpdateJournalAction): void;
|
|
27
|
+
/**
|
|
28
|
+
* Retain state changes and integer progress increments without raw errors, URLs, or request data.
|
|
29
|
+
* @param state Main-process-owned update state.
|
|
30
|
+
* @returns Nothing after the changed state has been flushed; duplicate states add no record.
|
|
31
|
+
*/
|
|
32
|
+
state(state: DesktopUpdateState): void;
|
|
33
|
+
private append;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=update-journal.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** Shell-owned modal windows cover the parent's content without replacing its native window controls. */
|
|
2
|
+
import { BrowserWindow } from 'electron';
|
|
3
|
+
/** Tracks application-owned update overlays and their parent input state. */
|
|
4
|
+
export declare class DesktopUpdateOverlays {
|
|
5
|
+
private readonly inputStates;
|
|
6
|
+
/**
|
|
7
|
+
* @param parent - Product window whose input may belong to an update dialog.
|
|
8
|
+
* @returns Current blocking state; its revision changes whenever an overlay opens or closes.
|
|
9
|
+
*/
|
|
10
|
+
input(parent: BrowserWindow): {
|
|
11
|
+
readonly revision: number;
|
|
12
|
+
readonly blocked: boolean;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* @param parent - Product window whose content is blocked while the overlay is open.
|
|
16
|
+
* @param preload - Isolated shell-only preload.
|
|
17
|
+
* @param title - Localized window title.
|
|
18
|
+
* @param nativeModal - Use a native modal; false keeps overlays out of macOS sheets.
|
|
19
|
+
* @returns A transparent child that follows its parent's bounds and visibility after loading and releases its listeners on close.
|
|
20
|
+
*/
|
|
21
|
+
create(parent: BrowserWindow, preload: string, title: string, nativeModal?: boolean): BrowserWindow;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=update-overlay.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** Semantic content for the Web-localized optional Desktop status indicator. */
|
|
2
|
+
import type { DesktopUpdatePresentation, DesktopUpdateState } from './ipc.ts';
|
|
3
|
+
import type { DesktopMessages } from './locale.ts';
|
|
4
|
+
/**
|
|
5
|
+
* Select user-facing error copy independently of raw updater diagnostics.
|
|
6
|
+
* @param state Update failure and its operation.
|
|
7
|
+
* @param messages Selected shell locale.
|
|
8
|
+
* @returns Localized summary suitable for both a dialog and a tooltip.
|
|
9
|
+
*/
|
|
10
|
+
export declare function desktopUpdateErrorSummary(state: DesktopUpdateState, messages: DesktopMessages): string;
|
|
11
|
+
/**
|
|
12
|
+
* @param state - Main-process updater state.
|
|
13
|
+
* @returns Semantic status without localized copy, diagnostics, or installation controls.
|
|
14
|
+
*/
|
|
15
|
+
export declare function presentDesktopUpdate(state: DesktopUpdateState): DesktopUpdatePresentation;
|
|
16
|
+
//# sourceMappingURL=update-presentation.d.ts.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/** Ordinary feed polling; policy queries and user-authorized transfers keep their own lifetimes. */
|
|
2
|
+
import type { DesktopUpdateCoordinator } from './update-coordinator.ts';
|
|
3
|
+
import type { DesktopUpdateState } from './ipc.ts';
|
|
4
|
+
/** Validated polling delays; maxBackoffMs caps the final randomized delay. */
|
|
5
|
+
export interface DesktopUpdateScheduleConfig {
|
|
6
|
+
readonly intervalMs: number;
|
|
7
|
+
readonly maxBackoffMs: number;
|
|
8
|
+
readonly jitter: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Resolve ordinary-update polling settings without changing mandatory-policy scheduling.
|
|
12
|
+
* @param env - Desktop process environment.
|
|
13
|
+
* @returns Validated durations and fractional jitter.
|
|
14
|
+
*/
|
|
15
|
+
export declare function resolveDesktopUpdateScheduleConfig(env: NodeJS.ProcessEnv): DesktopUpdateScheduleConfig;
|
|
16
|
+
/** One completion-based deadline shared by periodic, foreground, resume, and explicit checks. */
|
|
17
|
+
export declare class DesktopUpdateSchedule {
|
|
18
|
+
private readonly updates;
|
|
19
|
+
private readonly config;
|
|
20
|
+
private readonly random;
|
|
21
|
+
private readonly now;
|
|
22
|
+
private timer;
|
|
23
|
+
private pending;
|
|
24
|
+
private activeChecks;
|
|
25
|
+
private disposed;
|
|
26
|
+
private nextCheck;
|
|
27
|
+
private delay;
|
|
28
|
+
/**
|
|
29
|
+
* @param updates - Coordinator that joins network checks and retains prepared packages.
|
|
30
|
+
* @param config - Validated polling options.
|
|
31
|
+
* @param random - Instance-local uniform sample in [0, 1).
|
|
32
|
+
* @param now - Monotonic milliseconds, independent of wall-clock corrections.
|
|
33
|
+
*/
|
|
34
|
+
constructor(updates: Pick<DesktopUpdateCoordinator, 'check' | 'state'>, config: DesktopUpdateScheduleConfig, random?: () => number, now?: () => number);
|
|
35
|
+
/**
|
|
36
|
+
* Start immediately when due; explicit requests bypass the deadline and share in-flight work.
|
|
37
|
+
* @param manual - Whether a check failure must be visible, including when joining an automatic request.
|
|
38
|
+
* @param force - Whether policy arrival or explicit intent bypasses the automatic deadline.
|
|
39
|
+
* @returns Current state when not due, otherwise the coordinator result. Disposal rejects new work.
|
|
40
|
+
*/
|
|
41
|
+
check(manual?: boolean, force?: boolean): Promise<DesktopUpdateState>;
|
|
42
|
+
/** Stop timers and prevent late completion from rearming; the coordinator owns pending network teardown. */
|
|
43
|
+
dispose(): void;
|
|
44
|
+
private complete;
|
|
45
|
+
private schedule;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=update-schedule.d.ts.map
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read an application-owned static asset; the index waits for asynchronous Host injections.
|
|
3
|
+
* @param request - Local application request.
|
|
4
|
+
* @param root - Packaged Web dist directory.
|
|
5
|
+
* @returns Static response, or a missing/invalid path response.
|
|
6
|
+
*/
|
|
7
|
+
export declare function serveWebDocument(request: Request, root: string): Promise<Response>;
|
|
8
|
+
/**
|
|
9
|
+
* Exchange the Host launch URL for an authority-bound browser cookie.
|
|
10
|
+
* @param url - Authenticated URL reported by the owned Host process.
|
|
11
|
+
* @returns Cookie header for requests forwarded to that Host.
|
|
12
|
+
*/
|
|
13
|
+
export declare function authenticateWebHost(url: string): Promise<string>;
|
|
14
|
+
/** Name prefix of the account-session cookie the Host's `/api/auth` endpoints issue (`accounts-local`). */
|
|
15
|
+
export declare const ACCOUNT_SESSION_COOKIE_PREFIX = "qilin-session-";
|
|
16
|
+
/** One account-session cookie a Host response set or cleared. */
|
|
17
|
+
export interface WebSessionCookie {
|
|
18
|
+
/** Cookie name; hashes the request authority, so it changes when the Host port does. */
|
|
19
|
+
readonly name: string;
|
|
20
|
+
/** Cookie value; empty on a cleared cookie. */
|
|
21
|
+
readonly value: string;
|
|
22
|
+
/** Epoch seconds after which the cookie stops being sent; absent when the Host set no lifetime. */
|
|
23
|
+
readonly expiresAt?: number;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Parse one Set-Cookie value into an account-session cookie, or undefined for
|
|
27
|
+
* every other cookie: the shell stores only the session the Host's
|
|
28
|
+
* account-session gate verifies, never arbitrary Host cookies. Max-Age
|
|
29
|
+
* overrides Expires (RFC 6265).
|
|
30
|
+
* @param setCookie - one Set-Cookie header value.
|
|
31
|
+
* @returns the cookie facts; a cleared cookie carries an empty value or a past `expiresAt`.
|
|
32
|
+
*/
|
|
33
|
+
export declare function accountSessionCookie(setCookie: string): WebSessionCookie | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Cookie header of a forwarded request: the stored account session first, then
|
|
36
|
+
* the device cookie the launch exchange issued.
|
|
37
|
+
* @param accountSession - account session captured from an earlier response, when one is stored.
|
|
38
|
+
* @param deviceCookie - `name=value` pair from `authenticateWebHost`.
|
|
39
|
+
* @returns the Cookie header value to forward.
|
|
40
|
+
*/
|
|
41
|
+
export declare function webCookieHeader(accountSession: WebSessionCookie | undefined, deviceCookie: string): string;
|
|
42
|
+
/** Header naming the authority account sessions belong to; it wins over the Host header (`accounts-local`). */
|
|
43
|
+
export declare const DEPLOYMENT_AUTHORITY_HEADER = "x-qilin-deployment-authority";
|
|
44
|
+
/**
|
|
45
|
+
* The desktop's stable session authority. The Host listens on a port chosen per launch while the
|
|
46
|
+
* account-session cookie is named for its authority, so the shell names this portless loopback
|
|
47
|
+
* authority on every request it forwards or sends: sessions survive Host restarts instead of
|
|
48
|
+
* dying with the port.
|
|
49
|
+
*/
|
|
50
|
+
export declare const DESKTOP_AUTHORITY = "127.0.0.1";
|
|
51
|
+
/**
|
|
52
|
+
* Cookie name the Host's account-session gate looks up for one authority (`accounts-local` hashes it).
|
|
53
|
+
* @param authority - authority the session belongs to.
|
|
54
|
+
* @returns the exact cookie name to store, restore, and clear.
|
|
55
|
+
*/
|
|
56
|
+
export declare function accountSessionCookieName(authority?: string): string;
|
|
57
|
+
/**
|
|
58
|
+
* Forward local application requests to its authenticated Host, preserving streaming and cancellation.
|
|
59
|
+
* Plugin bundle responses lose their `cache-control` for `no-store`: the Host marks them immutable
|
|
60
|
+
* under a revision that changes every launch, so Chromium's disk cache would only accumulate bundles
|
|
61
|
+
* no later launch can reuse.
|
|
62
|
+
* @param request - Request from the application origin.
|
|
63
|
+
* @param host - Owned Host URL.
|
|
64
|
+
* @param cookie - Cookie header forwarded to the Host.
|
|
65
|
+
* @param onAccountSession - sink for the account-session cookie each response sets, before withholding.
|
|
66
|
+
* @returns Host response without connection-level headers.
|
|
67
|
+
*/
|
|
68
|
+
export declare function forwardWebRequest(request: Request, host: string, cookie: string, onAccountSession?: (session: WebSessionCookie) => void): Promise<Response>;
|
|
69
|
+
//# sourceMappingURL=web-document.d.ts.map
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/** Operations available to the isolated native welcome renderer. */
|
|
2
|
+
import type { AccountView, SignInAttemptId } from './account-types.ts';
|
|
3
|
+
import type { ProductEventMap } from '@qilin-agent/client-product-analytics/types';
|
|
4
|
+
import type { DesktopLocale } from './locale.ts';
|
|
5
|
+
/** Private native welcome channels, installed only while its window exists. */
|
|
6
|
+
export declare const WELCOME_IPC: {
|
|
7
|
+
readonly saveApiKey: "dsh-welcome:save-api-key";
|
|
8
|
+
readonly analytics: "dsh-welcome:analytics";
|
|
9
|
+
readonly analyticsEnabled: "dsh-welcome:analytics-enabled";
|
|
10
|
+
readonly skip: "dsh-welcome:skip";
|
|
11
|
+
readonly start: "dsh-welcome:start";
|
|
12
|
+
readonly cancel: "dsh-welcome:cancel";
|
|
13
|
+
readonly copyLink: "dsh-welcome:copy-link";
|
|
14
|
+
readonly state: "dsh-welcome:state";
|
|
15
|
+
readonly takeNotice: "dsh-welcome:take-notice";
|
|
16
|
+
readonly logIn: "qilin-welcome:log-in";
|
|
17
|
+
readonly register: "qilin-welcome:register";
|
|
18
|
+
};
|
|
19
|
+
/** Local account outcome: accepted, or refused with the Host's own reason code. */
|
|
20
|
+
export interface WelcomeAuthResult {
|
|
21
|
+
readonly ok: boolean;
|
|
22
|
+
readonly reason?: string;
|
|
23
|
+
}
|
|
24
|
+
/** Credential writes return a safe outcome without exposing Host diagnostics. */
|
|
25
|
+
export type WelcomeSaveResult = {
|
|
26
|
+
readonly ok: true;
|
|
27
|
+
} | {
|
|
28
|
+
readonly ok: false;
|
|
29
|
+
};
|
|
30
|
+
/** One-time notification retained by the main process until Welcome receives it. */
|
|
31
|
+
export type WelcomeNotice = 'session-expired';
|
|
32
|
+
type WelcomeEventName = 'auth_page_view' | 'auth_page_click' | 'api_key_save_click';
|
|
33
|
+
/** Host-owned operations used by the welcome window. */
|
|
34
|
+
export interface WelcomeOperations {
|
|
35
|
+
/** @param eventName - allowed welcome event. @param attributes - approved fields without credentials. */
|
|
36
|
+
analytics?<K extends WelcomeEventName>(eventName: K, attributes: ProductEventMap[K]): Promise<void>;
|
|
37
|
+
/** @returns the Host's current effective collection policy. */
|
|
38
|
+
analyticsEnabled(): Promise<boolean>;
|
|
39
|
+
/** @param username - local account name. @param password - submitted secret. @returns the Host outcome for a local sign-in. */
|
|
40
|
+
logIn(username: string, password: string): Promise<WelcomeAuthResult>;
|
|
41
|
+
/**
|
|
42
|
+
* Create a local account.
|
|
43
|
+
* @param username - new account name.
|
|
44
|
+
* @param email - optional address.
|
|
45
|
+
* @param password - submitted secret.
|
|
46
|
+
* @returns the Host outcome for a local registration.
|
|
47
|
+
*/
|
|
48
|
+
register(username: string, email: string, password: string): Promise<WelcomeAuthResult>;
|
|
49
|
+
/** @returns the pending notification, clearing it before another renderer can receive it. */
|
|
50
|
+
takeNotice(): Promise<WelcomeNotice | undefined>;
|
|
51
|
+
/** @returns account state after starting a login attempt. */
|
|
52
|
+
startSignIn(): Promise<AccountView>;
|
|
53
|
+
/** @param id - attempt to cancel. @returns the settled state. */
|
|
54
|
+
cancelSignIn(id: SignInAttemptId): Promise<AccountView>;
|
|
55
|
+
/** @param id - current waiting attempt whose authorization URL is copied to the system clipboard. */
|
|
56
|
+
copySignInLink(id: SignInAttemptId): Promise<void>;
|
|
57
|
+
/**
|
|
58
|
+
* Store the official provider's key before entering the workspace.
|
|
59
|
+
* @param value - validated, trimmed API key.
|
|
60
|
+
* @returns whether the write completed, without private error details.
|
|
61
|
+
*/
|
|
62
|
+
saveApiKey(value: string): Promise<WelcomeSaveResult>;
|
|
63
|
+
/**
|
|
64
|
+
* Enter the workspace without writing an onboarding-completion setting.
|
|
65
|
+
* @returns completion after the workspace opens.
|
|
66
|
+
*/
|
|
67
|
+
skip(): Promise<void>;
|
|
68
|
+
}
|
|
69
|
+
/** The renderer receives localized copy, login operations, and safe account snapshots. */
|
|
70
|
+
export type WelcomeApi = DesktopLocale & WelcomeOperations & {
|
|
71
|
+
/** @param listener - safe account snapshot recipient. @returns subscription disposer. */
|
|
72
|
+
onAccountState(listener: (state: AccountView) => void): () => void;
|
|
73
|
+
};
|
|
74
|
+
/** Authentication facts supplied at cold start or after a completed sign-out. */
|
|
75
|
+
export interface WelcomeAuthentication {
|
|
76
|
+
readonly loggedIn: boolean;
|
|
77
|
+
readonly hasApiKey: boolean;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Decide whether a startup or sign-out requires the welcome entry.
|
|
81
|
+
* @param authentication - current account and independently stored API-key facts.
|
|
82
|
+
* @returns true only when neither authentication route is configured.
|
|
83
|
+
*/
|
|
84
|
+
export declare function needsWelcome(authentication: WelcomeAuthentication): boolean;
|
|
85
|
+
export {};
|
|
86
|
+
//# sourceMappingURL=welcome-api.d.ts.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ProductEvent } from '@qilin-agent/client-product-analytics/types';
|
|
2
|
+
import { type DesktopAccountBackend } from './account-backend.ts';
|
|
3
|
+
/** Metadata needed before the native entry or workspace becomes visible. */
|
|
4
|
+
export interface WelcomeState {
|
|
5
|
+
readonly loggedIn: boolean;
|
|
6
|
+
readonly hasApiKey: boolean;
|
|
7
|
+
readonly writable: boolean;
|
|
8
|
+
readonly localePreference: string | null;
|
|
9
|
+
}
|
|
10
|
+
/** Narrow operations available to the native welcome flow. */
|
|
11
|
+
export interface DesktopWelcomeBackend {
|
|
12
|
+
/** @returns the current Host policy; every read observes live configuration. */
|
|
13
|
+
analyticsEnabled(): Promise<boolean>;
|
|
14
|
+
readonly account: DesktopAccountBackend;
|
|
15
|
+
/** @param event - desktop-owned fields. @returns after local Host intake. */
|
|
16
|
+
report(event: ProductEvent): Promise<void>;
|
|
17
|
+
/** @returns Configured-key presence and the shared language preference, without credential values. */
|
|
18
|
+
read(): Promise<WelcomeState>;
|
|
19
|
+
/** @returns The saved UI language without account or provider requests. */
|
|
20
|
+
readLocalePreference(): Promise<string | null>;
|
|
21
|
+
/**
|
|
22
|
+
* @param apiKey - User-entered official provider key.
|
|
23
|
+
* @returns A safe write outcome without provider diagnostics.
|
|
24
|
+
*/
|
|
25
|
+
save(apiKey: string): Promise<{
|
|
26
|
+
ok: boolean;
|
|
27
|
+
}>;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Authenticate the native HTTP client through the Web application's launch URL.
|
|
31
|
+
* @param authenticatedUrl - URL supplied by the running Desktop Host.
|
|
32
|
+
* @param send - Electron session fetch, retaining the Web authentication cookie.
|
|
33
|
+
* @returns metadata reads and write-only credential operations over standard RPC.
|
|
34
|
+
*/
|
|
35
|
+
export declare function connectDesktopWelcome(authenticatedUrl: string, send: (input: string, init?: RequestInit) => Promise<Response>, cookies?: () => Promise<string>): Promise<DesktopWelcomeBackend>;
|
|
36
|
+
//# sourceMappingURL=welcome-backend.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { BrowserWindow, type BrowserWindowConstructorOptions } from 'electron';
|
|
2
|
+
import type { DesktopLocale } from './locale.ts';
|
|
3
|
+
import { type WelcomeOperations } from './welcome-api.ts';
|
|
4
|
+
/**
|
|
5
|
+
* Resolve the fixed-size welcome window's native material and controls.
|
|
6
|
+
* @param platform - operating system hosting Electron.
|
|
7
|
+
* @param locale - shell-owned localized copy.
|
|
8
|
+
* @returns sandboxed window options with a locale-only preload.
|
|
9
|
+
*/
|
|
10
|
+
export declare function welcomeWindowOptions(platform: NodeJS.Platform, locale: DesktopLocale): BrowserWindowConstructorOptions;
|
|
11
|
+
/**
|
|
12
|
+
* Open the process's sole welcome window with desktop-owned operations.
|
|
13
|
+
* Replaces IPC ownership immediately; the caller closes the previous native window.
|
|
14
|
+
* @param locale - shell-owned localized copy.
|
|
15
|
+
* @param operations - credential write and this-launch-only skip actions.
|
|
16
|
+
* @returns the visible window; a failed load destroys it before rejecting.
|
|
17
|
+
*/
|
|
18
|
+
export declare function openWelcomeWindow(locale: DesktopLocale, operations: WelcomeOperations): Promise<BrowserWindow>;
|
|
19
|
+
//# sourceMappingURL=welcome-window.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,101 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qilin-agent/desktop",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"description": "Electron desktop shell for a bundled qilin runtime and external plugins",
|
|
4
|
+
"version": "3.1.6",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "lib/main.js",
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"electron-updater": "^6.8.9",
|
|
10
|
+
"semver": "^7.8.5",
|
|
11
|
+
"ws": "^8.21.3",
|
|
12
|
+
"@qilin-agent/kylin": "~4.0.5",
|
|
13
|
+
"@qilin-agent/api-gateway": "3.1.6"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@electron/get": "^5.1.0",
|
|
17
|
+
"@electron/notarize": "2.5.0",
|
|
18
|
+
"@types/js-yaml": "^4.0.9",
|
|
19
|
+
"@types/node": "^22.20.1",
|
|
20
|
+
"@types/semver": "^7.8.0",
|
|
21
|
+
"@types/ws": "^8.18.1",
|
|
22
|
+
"app-builder-lib": "26.17.0",
|
|
23
|
+
"cos-nodejs-sdk-v5": "3.0.0",
|
|
24
|
+
"electron": "^44.7.0",
|
|
25
|
+
"electron-builder": "^26.17.0",
|
|
26
|
+
"extract-zip": "^2.0.1",
|
|
27
|
+
"js-yaml": "^4.3.2",
|
|
28
|
+
"koffi": "3.1.1",
|
|
29
|
+
"pnpm": "11.7.0",
|
|
30
|
+
"react": "^18.2.0",
|
|
31
|
+
"react-dom": "^18.2.0",
|
|
32
|
+
"sharp": "0.35.5",
|
|
33
|
+
"typescript": "^6.0.3",
|
|
34
|
+
"vite": "^6.4.3",
|
|
35
|
+
"@qilin-agent/app-boot": "3.1.6",
|
|
36
|
+
"@qilin-agent/client-product-analytics": "3.1.6",
|
|
37
|
+
"@qilin-agent/atomic-write": "3.1.6",
|
|
38
|
+
"@qilin-agent/client-shortcuts": "3.1.6",
|
|
39
|
+
"@qilin-agent/client-ui-primitives": "3.1.6",
|
|
40
|
+
"@qilin-agent/client-ui-settings-general": "3.1.6",
|
|
41
|
+
"@qilin-agent/client-ui-sidebar-browser": "3.1.6",
|
|
42
|
+
"@qilin-agent/client-ui-theme": "3.1.6",
|
|
43
|
+
"@qilin-agent/node-addon-system": "~0.1.2",
|
|
44
|
+
"@qilin-agent/home-paths": "3.1.6"
|
|
45
|
+
},
|
|
46
|
+
"peerDependencies": {},
|
|
47
|
+
"optionalDependencies": {},
|
|
48
|
+
"productName": "QiLin Desktop",
|
|
49
|
+
"publishConfig": {
|
|
50
|
+
"access": "public"
|
|
51
|
+
},
|
|
52
|
+
"repository": {
|
|
53
|
+
"type": "git",
|
|
54
|
+
"url": "git+https://github.com/kkutysllb/QiLin.git",
|
|
55
|
+
"directory": "apps/desktop"
|
|
56
|
+
},
|
|
57
|
+
"engines": {
|
|
58
|
+
"node": "^22.19.0 || >=24.0.0"
|
|
59
|
+
},
|
|
60
|
+
"files": [
|
|
61
|
+
"lib/*.js",
|
|
62
|
+
"lib/types/*.d.ts"
|
|
63
|
+
],
|
|
64
|
+
"scripts": {
|
|
65
|
+
"build": "tsc -b && pnpm run bundle",
|
|
66
|
+
"bundle": "tsdown --config-loader native",
|
|
67
|
+
"cache:windows-signatures": "node scripts/manage-windows-signature-cache.mjs",
|
|
68
|
+
"check:package": "tsx scripts/package-target.ts --check",
|
|
69
|
+
"dev": "tsx scripts/dev.ts",
|
|
70
|
+
"package": "tsx scripts/package-target.ts",
|
|
71
|
+
"package:dir": "tsx scripts/package-target.ts --dir",
|
|
72
|
+
"package:mac:arm64": "tsx scripts/package-target.ts mac-arm64",
|
|
73
|
+
"package:mac:arm64:dir": "tsx scripts/package-target.ts mac-arm64 --dir",
|
|
74
|
+
"package:mac:arm64:unsigned": "tsx scripts/package-target.ts mac-arm64 --unsigned",
|
|
75
|
+
"package:mac:x64": "tsx scripts/package-target.ts mac-x64",
|
|
76
|
+
"package:mac:x64:dir": "tsx scripts/package-target.ts mac-x64 --dir",
|
|
77
|
+
"package:mac:x64:unsigned": "tsx scripts/package-target.ts mac-x64 --unsigned",
|
|
78
|
+
"package:win:x64": "tsx scripts/package-target.ts win-x64",
|
|
79
|
+
"package:win:x64:dir": "tsx scripts/package-target.ts win-x64 --dir",
|
|
80
|
+
"package:win:x64:unsigned": "tsx scripts/package-target.ts win-x64 --unsigned",
|
|
81
|
+
"prepare:qilin": "tsx scripts/prepare-qilin.ts",
|
|
82
|
+
"prepare:package": "tsx scripts/package-target.ts --prepare-only",
|
|
83
|
+
"prepare:packages": "tsx scripts/prepare-package-set.ts",
|
|
84
|
+
"prepare:primary-runtime": "tsx scripts/prepare-primary-runtime.ts",
|
|
85
|
+
"prepare:runtime": "tsx scripts/prepare-runtime.ts",
|
|
86
|
+
"render:tray-icon": "tsx scripts/render-tray-icon.ts",
|
|
87
|
+
"restore:mac-proxy": "tsx scripts/macos-notarization-proxy.ts",
|
|
88
|
+
"sign:primary-runtime": "tsx scripts/sign-primary-runtime.ts",
|
|
89
|
+
"start": "tsx scripts/dev.ts --skip-build",
|
|
90
|
+
"test:installer": "node scripts/test-windows-installer.mjs",
|
|
91
|
+
"test:updates:local": "pnpm run build && node scripts/test-local-updater.mjs",
|
|
92
|
+
"upload:latest:mac:arm64": "tsx scripts/upload-target.ts mac-arm64 --latest",
|
|
93
|
+
"upload:latest:mac:x64": "tsx scripts/upload-target.ts mac-x64 --latest",
|
|
94
|
+
"upload:latest:win:x64": "tsx scripts/upload-target.ts win-x64 --latest",
|
|
95
|
+
"upload:mac:arm64": "tsx scripts/upload-target.ts mac-arm64",
|
|
96
|
+
"upload:mac:x64": "tsx scripts/upload-target.ts mac-x64",
|
|
97
|
+
"upload:win:x64": "tsx scripts/upload-target.ts win-x64",
|
|
98
|
+
"verify:mac-signature": "node scripts/verify-macos-signature.mjs",
|
|
99
|
+
"test": "vitest run --config vitest.config.ts"
|
|
100
|
+
}
|
|
6
101
|
}
|