@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,37 @@
|
|
|
1
|
+
import type { AccountClientMetadata, AccountView, SignInAttemptId } from './account-types.ts';
|
|
2
|
+
/** Authenticated unary caller shared with native onboarding. */
|
|
3
|
+
export type AccountInvoke = (request: {
|
|
4
|
+
namespace: string;
|
|
5
|
+
method: string;
|
|
6
|
+
args: Record<string, unknown>;
|
|
7
|
+
}) => Promise<unknown>;
|
|
8
|
+
/** Decode the UI-safe state received across HTTP or WebSocket. @param value - wire value. @returns account projection. */
|
|
9
|
+
export declare function accountView(value: unknown): AccountView;
|
|
10
|
+
/** Native account operations and explicitly owned stream lifetime. */
|
|
11
|
+
export interface DesktopAccountBackend {
|
|
12
|
+
/** @returns current account snapshot. */
|
|
13
|
+
state(): Promise<AccountView>;
|
|
14
|
+
/** @param client - this window's identity and current language. @returns new or already-running login attempt. */
|
|
15
|
+
start(client: AccountClientMetadata): Promise<AccountView>;
|
|
16
|
+
/** @param id - attempt to cancel. @returns cancellation or completed commit state. */
|
|
17
|
+
cancel(id: SignInAttemptId): Promise<AccountView>;
|
|
18
|
+
/** @param client - this window's identity. @returns state after local sign-out. */
|
|
19
|
+
signOut(client: AccountClientMetadata): Promise<AccountView>;
|
|
20
|
+
/**
|
|
21
|
+
* @param listener - state recipient.
|
|
22
|
+
* @param failed - stream failure recipient.
|
|
23
|
+
* @param expired - live credential-expiry recipient.
|
|
24
|
+
* @param onAnalyticsEnabledChanged - optional Desktop collection-policy recipient; disconnected streams publish false.
|
|
25
|
+
* @returns stream disposer.
|
|
26
|
+
*/
|
|
27
|
+
watch(listener: (state: AccountView) => void, failed: () => void, expired: () => void, onAnalyticsEnabledChanged?: (enabled: boolean) => void): () => void;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Connect native account operations to the standard authenticated Web backend.
|
|
31
|
+
* @param origin - Host Web origin.
|
|
32
|
+
* @param invoke - validated unary RPC caller.
|
|
33
|
+
* @param cookies - Electron session cookie reader.
|
|
34
|
+
* @returns account operations; watch callers own their subscriptions.
|
|
35
|
+
*/
|
|
36
|
+
export declare function desktopAccountBackend(origin: string, invoke: AccountInvoke, cookies: () => Promise<string>): DesktopAccountBackend;
|
|
37
|
+
//# sourceMappingURL=account-backend.d.ts.map
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Account primitives the desktop assembly consumes.
|
|
3
|
+
*
|
|
4
|
+
* Upstream declares these in its account package, which this repository does not
|
|
5
|
+
* carry: the account stack stays out by policy and the desktop's onboarding and
|
|
6
|
+
* policy surfaces are inert here. The declarations stay exact so the assembly
|
|
7
|
+
* keeps compiling against the same contracts.
|
|
8
|
+
*
|
|
9
|
+
* @module account-types
|
|
10
|
+
*/
|
|
11
|
+
/** Client build facts upstream sends with every platform request. */
|
|
12
|
+
export interface AccountClientMetadata {
|
|
13
|
+
readonly version: string;
|
|
14
|
+
readonly locale: string;
|
|
15
|
+
readonly timezoneOffsetSeconds: number;
|
|
16
|
+
}
|
|
17
|
+
/** One sign-in attempt as the desktop observes it. */
|
|
18
|
+
export interface AccountAttempt {
|
|
19
|
+
readonly id: SignInAttemptId;
|
|
20
|
+
readonly phase: 'initializing' | 'waiting-browser' | 'exchanging' | 'committing' | 'succeeded' | 'cancelled' | 'expired' | 'failed';
|
|
21
|
+
readonly authorizeUrl?: string;
|
|
22
|
+
readonly expiresAt?: number;
|
|
23
|
+
readonly errorCode?: 'no-response' | 'network' | 'protocol' | 'expired' | 'storage';
|
|
24
|
+
}
|
|
25
|
+
/** Account links the desktop may open in a browser. */
|
|
26
|
+
export interface AccountLinks {
|
|
27
|
+
readonly usageUrl: string;
|
|
28
|
+
readonly topUpUrl: string;
|
|
29
|
+
}
|
|
30
|
+
/** One account as the desktop observes it. */
|
|
31
|
+
export interface AccountView {
|
|
32
|
+
readonly status: string;
|
|
33
|
+
readonly links: AccountLinks;
|
|
34
|
+
readonly attempt: AccountAttempt | null;
|
|
35
|
+
}
|
|
36
|
+
/** Platform credentials bound to one account provider lifetime. */
|
|
37
|
+
export interface PlatformSession {
|
|
38
|
+
readonly userId: string;
|
|
39
|
+
readonly token: string;
|
|
40
|
+
readonly cookies: readonly string[];
|
|
41
|
+
readonly origin: string;
|
|
42
|
+
readonly requestHeaders: Readonly<Record<string, string>>;
|
|
43
|
+
readonly embeddedPageDist: string | null;
|
|
44
|
+
}
|
|
45
|
+
/** Identifier for one sign-in attempt. */
|
|
46
|
+
export type SignInAttemptId = string & {
|
|
47
|
+
readonly __signInAttempt: unique symbol;
|
|
48
|
+
};
|
|
49
|
+
export declare function platformClientHeaders(platform: string, client: AccountClientMetadata): Record<string, string>;
|
|
50
|
+
/**
|
|
51
|
+
* Merge one request's cookie header with cookies a platform session injects.
|
|
52
|
+
* @param current - Cookie header the request already carries.
|
|
53
|
+
* @param injected - Cookie header the platform session adds.
|
|
54
|
+
* @returns The merged cookie header, without empty parts.
|
|
55
|
+
*/
|
|
56
|
+
export declare function mergePlatformCookies(current: string, injected: string): string;
|
|
57
|
+
/** Path the remote stream mux answers on. */
|
|
58
|
+
export declare const REMOTE_STREAM_MUX_PATH = "/api/remote-stream";
|
|
59
|
+
/** One frame of the remote stream. */
|
|
60
|
+
export interface RemoteStreamFrame {
|
|
61
|
+
/** Stream this frame belongs to. */
|
|
62
|
+
readonly streamId: string;
|
|
63
|
+
/** Frame kind. */
|
|
64
|
+
readonly type: string;
|
|
65
|
+
/** Frame payload. */
|
|
66
|
+
readonly value?: unknown;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Parse one server message from the remote stream.
|
|
70
|
+
* @param raw - Raw message text.
|
|
71
|
+
* @returns The parsed message.
|
|
72
|
+
*/
|
|
73
|
+
export declare function parseRemoteStreamServerMessage(raw: string): RemoteStreamFrame;
|
|
74
|
+
//# sourceMappingURL=account-types.d.ts.map
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/** Owns one backend startup and its quiescent teardown independently of windows. */
|
|
2
|
+
/** Backend availability presented by the desktop window. */
|
|
3
|
+
export type DesktopBackendState = {
|
|
4
|
+
readonly phase: 'starting';
|
|
5
|
+
} | {
|
|
6
|
+
readonly phase: 'ready';
|
|
7
|
+
}
|
|
8
|
+
/** `message` is the rendered text; `failure` is the original error so a crash report keeps its stack, properties, and cause. */
|
|
9
|
+
| {
|
|
10
|
+
readonly phase: 'error';
|
|
11
|
+
readonly message: string;
|
|
12
|
+
readonly failure: unknown;
|
|
13
|
+
};
|
|
14
|
+
/** Child lifecycle owned by the desktop backend controller. */
|
|
15
|
+
export interface DesktopBackendHost {
|
|
16
|
+
/** @returns Readiness after the child accepts application requests. */
|
|
17
|
+
start(): Promise<unknown>;
|
|
18
|
+
/** @returns Completion of child exit. */
|
|
19
|
+
stop(): Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
/** Serializes retries and prevents children from outliving a closed window. */
|
|
22
|
+
export declare class DesktopBackendController<Host extends DesktopBackendHost> {
|
|
23
|
+
private readonly createHost;
|
|
24
|
+
private readonly publish;
|
|
25
|
+
private current;
|
|
26
|
+
private attempt;
|
|
27
|
+
private pending;
|
|
28
|
+
private stopping;
|
|
29
|
+
private closed;
|
|
30
|
+
/**
|
|
31
|
+
* @param createHost - Allocate a child and route its fatal failures to the supplied callback.
|
|
32
|
+
* @param publish - Receive availability changes until the controller closes.
|
|
33
|
+
*/
|
|
34
|
+
constructor(createHost: (onFailure: (error: Error) => void) => Host, publish: (state: DesktopBackendState) => void);
|
|
35
|
+
/** Current availability, including the last startup or child failure. */
|
|
36
|
+
get state(): DesktopBackendState;
|
|
37
|
+
/** Child available to application requests; absent during startup and teardown. */
|
|
38
|
+
get host(): Host | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* Prepare the profile and start one child; concurrent callers share the attempt.
|
|
41
|
+
* @param prepare - Profile preparation that must finish before spawning.
|
|
42
|
+
* @returns Completion of startup, rejecting on preparation, startup, or cleanup failure.
|
|
43
|
+
*/
|
|
44
|
+
start(prepare: () => Promise<void>): Promise<void>;
|
|
45
|
+
/**
|
|
46
|
+
* Stop pending preparation and the child before allowing another start.
|
|
47
|
+
* @returns Completion of pending work and child exit; rejects if cleanup fails.
|
|
48
|
+
*/
|
|
49
|
+
stop(): Promise<void>;
|
|
50
|
+
/**
|
|
51
|
+
* Permanently prevent startup and suppress further availability notifications.
|
|
52
|
+
* @returns Completion of pending work and child exit; rejects if cleanup fails.
|
|
53
|
+
*/
|
|
54
|
+
close(): Promise<void>;
|
|
55
|
+
private cleanup;
|
|
56
|
+
private failed;
|
|
57
|
+
private update;
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=backend-controller.d.ts.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** One-time Windows confirmation before hiding the application in the tray. */
|
|
2
|
+
import type { MessageBoxOptions, MessageBoxReturnValue } from 'electron';
|
|
3
|
+
import type { DesktopLocale } from './locale.ts';
|
|
4
|
+
/** Persistent acknowledgement and the shared shell dialog. */
|
|
5
|
+
export interface DesktopBackgroundNoticeOptions {
|
|
6
|
+
/** Acknowledgement under Electron userData; updates retain it and uninstall removes it. */
|
|
7
|
+
readonly markerPath: string;
|
|
8
|
+
readonly locale: () => DesktopLocale;
|
|
9
|
+
readonly show: (options: MessageBoxOptions) => Promise<MessageBoxReturnValue>;
|
|
10
|
+
readonly focus: () => void;
|
|
11
|
+
}
|
|
12
|
+
/** Only an explicit acknowledgement permits the first hide; cancelled prompts remain eligible. */
|
|
13
|
+
export declare class DesktopBackgroundNotice {
|
|
14
|
+
private readonly options;
|
|
15
|
+
private acknowledged;
|
|
16
|
+
private pending;
|
|
17
|
+
private disposed;
|
|
18
|
+
/** @param options - Marker path, localized copy, and shell dialog actions. */
|
|
19
|
+
constructor(options: DesktopBackgroundNoticeOptions);
|
|
20
|
+
/**
|
|
21
|
+
* Request a window hide, prompting until acknowledged and coalescing repeated requests.
|
|
22
|
+
* @param hide - Hide the still-owned window after acknowledgement, or immediately when already recorded.
|
|
23
|
+
*/
|
|
24
|
+
close(hide: () => void): void;
|
|
25
|
+
/** Ignore late dialog responses after application shutdown begins. */
|
|
26
|
+
dispose(): void;
|
|
27
|
+
private confirm;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=background-notice.d.ts.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Desktop browser bridge contract.
|
|
3
|
+
*
|
|
4
|
+
* Upstream declares these in its sidebar browser client package. This repository's
|
|
5
|
+
* client ships no desktop-browser surface, so the desktop keeps the declarations
|
|
6
|
+
* here and its guest operations stay inert.
|
|
7
|
+
*
|
|
8
|
+
* @module browser-bridge-types
|
|
9
|
+
*/
|
|
10
|
+
/** Identifier of one main-issued browser lease. */
|
|
11
|
+
export type DesktopBrowserLeaseId = string & {
|
|
12
|
+
readonly __desktopBrowserLease: unique symbol;
|
|
13
|
+
};
|
|
14
|
+
/** One approved request to open a browser guest. */
|
|
15
|
+
export interface DesktopBrowserOpenRequest {
|
|
16
|
+
readonly url: string;
|
|
17
|
+
readonly partition?: string;
|
|
18
|
+
readonly lease: DesktopBrowserLeaseId;
|
|
19
|
+
}
|
|
20
|
+
/** Reservation held while a guest is attached. */
|
|
21
|
+
export interface DesktopBrowserReservation {
|
|
22
|
+
readonly lease: DesktopBrowserLeaseId;
|
|
23
|
+
readonly partition: string;
|
|
24
|
+
readonly attached?: boolean;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=browser-bridge-types.d.ts.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type BrowserWindow, type WebContents } from 'electron';
|
|
2
|
+
import type { DesktopBrowserLeaseId, DesktopBrowserReservation } from './browser-bridge-types.ts';
|
|
3
|
+
/** Owns workspace storage partitions independently from individual tab guests. */
|
|
4
|
+
export declare class DesktopBrowserGuests {
|
|
5
|
+
private readonly hostUrl;
|
|
6
|
+
private readonly partitions;
|
|
7
|
+
private readonly leases;
|
|
8
|
+
/** @param hostUrl - current authenticated QILIN Host, which guests cannot request. */
|
|
9
|
+
constructor(hostUrl: () => string | undefined);
|
|
10
|
+
/**
|
|
11
|
+
* Reserve one guest in a workspace's process-lifetime partition.
|
|
12
|
+
* @param owner - authenticated primary application WebContents.
|
|
13
|
+
* @param workspace - workspace identity received over IPC.
|
|
14
|
+
* @returns opaque lease and the partition approved for it.
|
|
15
|
+
*/
|
|
16
|
+
acquire(owner: WebContents, workspace: unknown): DesktopBrowserReservation;
|
|
17
|
+
/**
|
|
18
|
+
* Release only a lease issued to this application window; workspace storage survives.
|
|
19
|
+
* @param owner - authenticated IPC sender.
|
|
20
|
+
* @param id - lease received over IPC.
|
|
21
|
+
*/
|
|
22
|
+
release(owner: WebContents, id: unknown): Promise<void>;
|
|
23
|
+
/**
|
|
24
|
+
* Install attachment checks before the application document can create a webview.
|
|
25
|
+
* @param window - primary application window.
|
|
26
|
+
* @param attachInput - attaches native input after guest ownership is verified and returns its disposer.
|
|
27
|
+
*/
|
|
28
|
+
bind(window: BrowserWindow, attachInput: (guest: WebContents, name: DesktopBrowserLeaseId) => () => void): void;
|
|
29
|
+
private configureSession;
|
|
30
|
+
private allowedNavigation;
|
|
31
|
+
private isApplicationHost;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=browser-guests.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Desktop client identity for one Platform account call. */
|
|
2
|
+
import type { AccountClientMetadata } from './account-types.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Read the client build version inlined by the Desktop build.
|
|
5
|
+
* @returns the version embedded in this application build.
|
|
6
|
+
* @throws Error when the build carries no client version, instead of reporting a guessed one.
|
|
7
|
+
*/
|
|
8
|
+
export declare function desktopClientVersion(): string;
|
|
9
|
+
/**
|
|
10
|
+
* Sample the Desktop client identity for one Platform request.
|
|
11
|
+
* @param locale - current resolved Desktop language.
|
|
12
|
+
* @returns this call's build version, the raw active language, and the UTC offset in whole seconds east.
|
|
13
|
+
*/
|
|
14
|
+
export declare function desktopClientMetadata(locale: string): AccountClientMetadata;
|
|
15
|
+
//# sourceMappingURL=client-metadata.d.ts.map
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/** Reversible command-link ownership; operations never follow or overwrite a changed command entry. */
|
|
2
|
+
/** Fixed installation locations supplied by the Desktop shell. */
|
|
3
|
+
export interface FileCommandInstallation {
|
|
4
|
+
readonly destination: string;
|
|
5
|
+
readonly launcher: string;
|
|
6
|
+
readonly linkHelper: string;
|
|
7
|
+
}
|
|
8
|
+
type Entry = {
|
|
9
|
+
readonly kind: 'symlink';
|
|
10
|
+
readonly fingerprint: string;
|
|
11
|
+
readonly target: string;
|
|
12
|
+
} | {
|
|
13
|
+
readonly kind: 'missing' | 'file' | 'unsupported';
|
|
14
|
+
readonly fingerprint: string;
|
|
15
|
+
};
|
|
16
|
+
/** State displayed before a command-management operation. */
|
|
17
|
+
export interface CommandInspection {
|
|
18
|
+
readonly fingerprint: string;
|
|
19
|
+
readonly destination: string;
|
|
20
|
+
readonly launcher: string;
|
|
21
|
+
readonly kind: Entry['kind'];
|
|
22
|
+
readonly managed: boolean;
|
|
23
|
+
readonly available: boolean;
|
|
24
|
+
readonly target?: string;
|
|
25
|
+
readonly backup?: string;
|
|
26
|
+
readonly preservedBackup?: string;
|
|
27
|
+
}
|
|
28
|
+
/** A declined stale operation or a command entry outside this installer's ownership. */
|
|
29
|
+
export declare class CommandInstallationError extends Error {
|
|
30
|
+
readonly code: string;
|
|
31
|
+
constructor(code: string, message: string);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Read the command and receipt without changing either.
|
|
35
|
+
* @param options - Fixed command destination and current installed launcher.
|
|
36
|
+
* @returns A fingerprint to bind a later user decision to the observed entries.
|
|
37
|
+
*/
|
|
38
|
+
export declare function inspectFileCommand(options: FileCommandInstallation): Promise<CommandInspection>;
|
|
39
|
+
/**
|
|
40
|
+
* Install or repair a link, keeping the previous launcher available for removal.
|
|
41
|
+
* @param options - Fixed command destination and current installed launcher.
|
|
42
|
+
* @param expected - Fingerprint displayed in the user's confirmation.
|
|
43
|
+
* @returns Updated state and any older backup preserved after an external command replacement.
|
|
44
|
+
*/
|
|
45
|
+
export declare function installFileCommand(options: FileCommandInstallation, expected: string): Promise<CommandInspection>;
|
|
46
|
+
/**
|
|
47
|
+
* Remove only a recorded Desktop link and restore its unchanged previous entry.
|
|
48
|
+
* @param options - Fixed command destination and current installed launcher.
|
|
49
|
+
* @param expected - Fingerprint displayed when removal was requested.
|
|
50
|
+
* @returns State after removal; an externally replaced command remains untouched.
|
|
51
|
+
*/
|
|
52
|
+
export declare function removeFileCommand(options: FileCommandInstallation, expected: string): Promise<CommandInspection>;
|
|
53
|
+
export {};
|
|
54
|
+
//# sourceMappingURL=command-installation.d.ts.map
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/** Native command-management dialogs; only fixed installation locations reach the worker. */
|
|
2
|
+
import type { MessageBoxOptions, MessageBoxReturnValue } from 'electron';
|
|
3
|
+
import type { DesktopMessages } from './locale.ts';
|
|
4
|
+
import type { UpdateDialogOptions } from './update-dialog.ts';
|
|
5
|
+
/** Data required to render one command-management decision. */
|
|
6
|
+
export interface CommandPresentation {
|
|
7
|
+
readonly managed: boolean;
|
|
8
|
+
readonly available: boolean;
|
|
9
|
+
readonly destination: string;
|
|
10
|
+
readonly activeCommand?: string;
|
|
11
|
+
readonly target?: string;
|
|
12
|
+
readonly selectionUnknown?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/** Shell-owned access to installed resources, locale and native dialogs. */
|
|
15
|
+
export interface CommandManagerOptions {
|
|
16
|
+
readonly resources: string;
|
|
17
|
+
readonly isPackaged: boolean;
|
|
18
|
+
readonly isInstalledLocation: () => boolean;
|
|
19
|
+
readonly isInstalling: () => boolean;
|
|
20
|
+
readonly isQuitting: () => boolean;
|
|
21
|
+
readonly messages: () => DesktopMessages;
|
|
22
|
+
readonly show: (options: UpdateDialogOptions) => Promise<MessageBoxReturnValue>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Describe installation state using Desktop-owned copy.
|
|
26
|
+
* @param state - Observed link or PATH selection.
|
|
27
|
+
* @param messages - Current Desktop locale.
|
|
28
|
+
* @param platform - Command lookup semantics of the host operating system.
|
|
29
|
+
* @returns Native dialog with stable Close/Repair/Remove or Install/Cancel indices.
|
|
30
|
+
*/
|
|
31
|
+
export declare function presentCommandManagement(state: CommandPresentation, messages: DesktopMessages, platform: NodeJS.Platform): MessageBoxOptions;
|
|
32
|
+
/** One visible operation; updater preparation waits for its started worker to finish. */
|
|
33
|
+
export declare class DesktopCommandManager {
|
|
34
|
+
private readonly options;
|
|
35
|
+
private operation;
|
|
36
|
+
/** @param options - Installed resources and shell-owned UI callbacks. */
|
|
37
|
+
constructor(options: CommandManagerOptions);
|
|
38
|
+
/** Open or join the command-management operation. */
|
|
39
|
+
show(): Promise<void>;
|
|
40
|
+
/** Wait for a command operation already started by the user. */
|
|
41
|
+
idle(): Promise<void>;
|
|
42
|
+
private worker;
|
|
43
|
+
private inspect;
|
|
44
|
+
private run;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=command-management.d.ts.map
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/** Signed local npm package set that supplies the Desktop-owned qilin runtime and private Host. */
|
|
2
|
+
/** Descriptor copied beside every Desktop profile's local core tarballs. */
|
|
3
|
+
export declare const DESKTOP_PACKAGE_SET_FILE = "desktop-packages.json";
|
|
4
|
+
/** Profile-relative directory containing immutable core npm tarballs. */
|
|
5
|
+
export declare const DESKTOP_PACKAGES_DIR = "desktop-packages";
|
|
6
|
+
/** Private package installed beside qilin to boot the Desktop Host process. */
|
|
7
|
+
export declare const DESKTOP_HOST_PACKAGE = "@qilin-agent/desktop-host";
|
|
8
|
+
/** Package-relative Desktop Host files required before a profile can boot. */
|
|
9
|
+
export declare const DESKTOP_HOST_RUNTIME_FILES: readonly ["lib/index.js", "lib/cli.js"];
|
|
10
|
+
/** One immutable npm tarball in the Desktop core package set. */
|
|
11
|
+
export interface DesktopCorePackageRecord {
|
|
12
|
+
readonly name: string;
|
|
13
|
+
readonly version: string;
|
|
14
|
+
readonly file: string;
|
|
15
|
+
readonly bytes: number;
|
|
16
|
+
readonly integrity: string;
|
|
17
|
+
}
|
|
18
|
+
/** Complete union of the first-party package closures rooted at qilin and its private Desktop Host. */
|
|
19
|
+
export interface DesktopCorePackageSet {
|
|
20
|
+
readonly schemaVersion: 1;
|
|
21
|
+
readonly packages: readonly DesktopCorePackageRecord[];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Validate package-set data read from a release artifact or active profile.
|
|
25
|
+
* @param value - Parsed descriptor JSON.
|
|
26
|
+
* @param expectedReleaseVersion - Required qilin and Desktop Host version when validating one release.
|
|
27
|
+
* @returns The normalized package set in deterministic name order.
|
|
28
|
+
*/
|
|
29
|
+
export declare function parseDesktopCorePackageSet(value: unknown, expectedReleaseVersion?: string): DesktopCorePackageSet;
|
|
30
|
+
/** Read and structurally validate one profile's core package descriptor. */
|
|
31
|
+
export declare function readDesktopCorePackageSet(projectDir: string, expectedReleaseVersion?: string): DesktopCorePackageSet;
|
|
32
|
+
/** Return the project-relative `file:` spec for one local core tarball. */
|
|
33
|
+
export declare function desktopCorePackageSpec(record: DesktopCorePackageRecord): string;
|
|
34
|
+
/** Return the exact pnpm override map that keeps every core package off registries. */
|
|
35
|
+
export declare function desktopCorePackageOverrides(packageSet: DesktopCorePackageSet): Record<string, string>;
|
|
36
|
+
/** Return the local direct dependency spec for the qilin package. */
|
|
37
|
+
export declare function desktopDshPackageSpec(packageSet: DesktopCorePackageSet): string;
|
|
38
|
+
/**
|
|
39
|
+
* Verify every local tarball and reject extra package files before pnpm executes them.
|
|
40
|
+
* @param projectDir - Build directory containing the package set.
|
|
41
|
+
* @param expectedReleaseVersion - Exact qilin and Desktop Host version bound to Electron.
|
|
42
|
+
* @returns The verified package set.
|
|
43
|
+
*/
|
|
44
|
+
export declare function verifyDesktopCorePackageSet(projectDir: string, expectedReleaseVersion: string): DesktopCorePackageSet;
|
|
45
|
+
/**
|
|
46
|
+
* Reject a lockfile that resolved any packaged core name through a registry version.
|
|
47
|
+
* @param lockfile - Generated pnpm lockfile text.
|
|
48
|
+
* @param packageSet - Verified local core package set.
|
|
49
|
+
*/
|
|
50
|
+
export declare function verifyDesktopCoreLockfile(lockfile: string, packageSet: DesktopCorePackageSet): void;
|
|
51
|
+
//# sourceMappingURL=core-package-set.d.ts.map
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Crash report files: the complete diagnostic of one fatal Desktop failure,
|
|
3
|
+
* written before the recovery dialog so the dialog can name the file. The
|
|
4
|
+
* dialog itself shows only the last lines of the error; the file holds the
|
|
5
|
+
* whole error, its enumerable properties and cause chain, the process facts,
|
|
6
|
+
* and the renderer's recent error-level console output.
|
|
7
|
+
*/
|
|
8
|
+
/** Where a fatal failure surfaced. */
|
|
9
|
+
export type CrashReportSource = 'host' | 'web-boot' | 'renderer' | 'main';
|
|
10
|
+
/** Whether the backend had reached ready when the failure surfaced. */
|
|
11
|
+
export type CrashReportPhase = 'startup' | 'running';
|
|
12
|
+
/** Facts about the running application recorded in every report header. */
|
|
13
|
+
export interface CrashReportApp {
|
|
14
|
+
readonly name: string;
|
|
15
|
+
readonly version: string;
|
|
16
|
+
readonly platform: string;
|
|
17
|
+
readonly arch: string;
|
|
18
|
+
readonly electron: string;
|
|
19
|
+
readonly node: string;
|
|
20
|
+
readonly locale: string;
|
|
21
|
+
}
|
|
22
|
+
/** Inputs of {@link renderCrashReport} and {@link writeCrashReport}. */
|
|
23
|
+
export interface CrashReportInput {
|
|
24
|
+
readonly source: CrashReportSource;
|
|
25
|
+
readonly phase: CrashReportPhase;
|
|
26
|
+
readonly error: unknown;
|
|
27
|
+
/** The Host's own inspected error when it reported the failure over IPC before exiting. */
|
|
28
|
+
readonly hostDiagnostic?: string;
|
|
29
|
+
/** Recent renderer console lines at error level, oldest first. */
|
|
30
|
+
readonly rendererConsole: readonly string[];
|
|
31
|
+
readonly app: CrashReportApp;
|
|
32
|
+
readonly time: Date;
|
|
33
|
+
}
|
|
34
|
+
/** File name prefix every report shares. */
|
|
35
|
+
export declare const CRASH_REPORT_PREFIX = "crash-";
|
|
36
|
+
/** Reports kept after pruning, newest first by file name. */
|
|
37
|
+
export declare const CRASH_REPORTS_RETAINED = 10;
|
|
38
|
+
/** Retained bytes of renderer error-level console output. */
|
|
39
|
+
export declare const RENDERER_CONSOLE_MAX_BYTES: number;
|
|
40
|
+
/** Upper bound of the rendered error section; a Host exit error already carries a 64 KiB stderr tail in its message. */
|
|
41
|
+
export declare const ERROR_SECTION_MAX_CHARS: number;
|
|
42
|
+
/**
|
|
43
|
+
* Bounded tail of renderer error-level console lines. Lines are dropped from
|
|
44
|
+
* the head once the retained byte total exceeds the cap; one oversized line is
|
|
45
|
+
* kept whole so a long stack is never cut mid-line.
|
|
46
|
+
*/
|
|
47
|
+
export declare class RendererConsoleTail {
|
|
48
|
+
private readonly maxBytes;
|
|
49
|
+
private readonly lines;
|
|
50
|
+
private bytes;
|
|
51
|
+
/** @param maxBytes - retained byte cap across all lines. */
|
|
52
|
+
constructor(maxBytes?: number);
|
|
53
|
+
/**
|
|
54
|
+
* Append one console line.
|
|
55
|
+
* @param line - the formatted console message.
|
|
56
|
+
*/
|
|
57
|
+
push(line: string): void;
|
|
58
|
+
/** @returns the retained lines, oldest first. */
|
|
59
|
+
snapshot(): readonly string[];
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* The report file name: sortable by time, then the source.
|
|
63
|
+
* @param time - failure time.
|
|
64
|
+
* @param source - where the failure surfaced.
|
|
65
|
+
* @returns `crash-<ISO time with ':' and '.' as '-'>-<source>.log`.
|
|
66
|
+
*/
|
|
67
|
+
export declare function crashReportFileName(time: Date, source: CrashReportSource): string;
|
|
68
|
+
/**
|
|
69
|
+
* Render one report as plain text: a header of facts, the inspected error,
|
|
70
|
+
* the Host's own diagnostic when it reported one, and the renderer console tail.
|
|
71
|
+
* @param input - the failure and its context.
|
|
72
|
+
* @returns the complete file content.
|
|
73
|
+
*/
|
|
74
|
+
export declare function renderCrashReport(input: CrashReportInput): string;
|
|
75
|
+
/**
|
|
76
|
+
* Write one report into `directory`, creating it when absent. Failure is
|
|
77
|
+
* reported to `console.error` and yields `undefined`: the recovery dialog
|
|
78
|
+
* proceeds without a file rather than failing over a diagnostic aid.
|
|
79
|
+
* @param directory - the application logs directory.
|
|
80
|
+
* @param input - the failure and its context.
|
|
81
|
+
* @returns the written file path, or `undefined` when writing failed.
|
|
82
|
+
*/
|
|
83
|
+
export declare function writeCrashReport(directory: string, input: CrashReportInput): Promise<string | undefined>;
|
|
84
|
+
/**
|
|
85
|
+
* Delete the oldest reports beyond `retained`, judged by file name order, and
|
|
86
|
+
* leave every other file in the directory alone. Failure is reported to
|
|
87
|
+
* `console.error`; a missing directory is not a failure.
|
|
88
|
+
* @param directory - the application logs directory.
|
|
89
|
+
* @param retained - reports to keep.
|
|
90
|
+
*/
|
|
91
|
+
export declare function pruneCrashReports(directory: string, retained?: number): Promise<void>;
|
|
92
|
+
//# sourceMappingURL=crash-report.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** The Desktop's own Harness home, kept apart from a Web deployment's shared home. */
|
|
2
|
+
/**
|
|
3
|
+
* Point the Harness at the Desktop's own home.
|
|
4
|
+
*
|
|
5
|
+
* A Web deployment shares `~/.qilin` and exports its QILIN_HOME into every child it starts, so
|
|
6
|
+
* the Desktop does not defer to that value: it always names `~/.qilin-desktop`, or the directory
|
|
7
|
+
* QILIN_DESKTOP_HOME selects. Electron's userData directory keeps only the shell's own
|
|
8
|
+
* preferences and Chromium state.
|
|
9
|
+
* @param environment - environment to update in place; the Host and every child inherit it.
|
|
10
|
+
*/
|
|
11
|
+
export declare function adoptDesktopHome(environment?: NodeJS.ProcessEnv): void;
|
|
12
|
+
//# sourceMappingURL=desktop-home.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read the local machine description attached to a Desktop feedback submission.
|
|
3
|
+
* Fields are `name=value` pairs separated by `; `, in platform, os, app_arch, cpu and
|
|
4
|
+
* memory_gib order; memory is total physical memory in GiB with one decimal.
|
|
5
|
+
* @returns the machine description, with unavailable fields omitted.
|
|
6
|
+
*/
|
|
7
|
+
export declare function readDeviceInfo(): string;
|
|
8
|
+
//# sourceMappingURL=device-info.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Window-owned workspace directory dialogs for the local Desktop renderer. */
|
|
2
|
+
import { type BrowserWindow } from 'electron';
|
|
3
|
+
/**
|
|
4
|
+
* Install the application-lifetime directory picker IPC handler.
|
|
5
|
+
* @param getWindow - Current local application window; shell pages and subframes cannot open dialogs.
|
|
6
|
+
*/
|
|
7
|
+
export declare function installDesktopDirectoryPicker(getWindow: () => BrowserWindow | undefined): void;
|
|
8
|
+
//# sourceMappingURL=directory-picker.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Millisecond settings read from the Desktop process environment. */
|
|
2
|
+
/**
|
|
3
|
+
* Read a duration that `setTimeout` accepts without clamping.
|
|
4
|
+
* @param env - Desktop process environment.
|
|
5
|
+
* @param name - Variable to read; the validation error names it.
|
|
6
|
+
* @param fallback - Value used when the variable is unset.
|
|
7
|
+
* @returns Integer milliseconds from 1000 through 2147483647.
|
|
8
|
+
*/
|
|
9
|
+
export declare function resolveDurationMs(env: NodeJS.ProcessEnv, name: string, fallback: number): number;
|
|
10
|
+
//# sourceMappingURL=duration-env.d.ts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/** Native recovery for the first fatal failure in one Desktop process. */
|
|
2
|
+
import type { MessageBoxOptions, MessageBoxReturnValue } from 'electron';
|
|
3
|
+
import type { CrashReportSource } from './crash-report.ts';
|
|
4
|
+
import { type DesktopMessages } from './locale.ts';
|
|
5
|
+
interface RecoveryOperations {
|
|
6
|
+
messages(): DesktopMessages;
|
|
7
|
+
show(options: MessageBoxOptions): Promise<MessageBoxReturnValue>;
|
|
8
|
+
stop(): Promise<void>;
|
|
9
|
+
disablePlugins(): Promise<void>;
|
|
10
|
+
exit(): void;
|
|
11
|
+
restart(): void;
|
|
12
|
+
/** Persist the complete diagnostic; resolves with the file path, or `undefined` when nothing was written. */
|
|
13
|
+
writeReport(error: unknown, source: CrashReportSource): Promise<string | undefined>;
|
|
14
|
+
}
|
|
15
|
+
/** Upper bound on waiting for the crash report before the dialog opens. */
|
|
16
|
+
export declare const CRASH_REPORT_WAIT_MS = 1000;
|
|
17
|
+
/** Deduplicates fatal reports while keeping explicit recovery-operation failures actionable. */
|
|
18
|
+
export declare class DesktopFatalRecovery {
|
|
19
|
+
private readonly operations;
|
|
20
|
+
private reported;
|
|
21
|
+
/** @param operations - Native presentation, report persistence, and application-owned shutdown operations. */
|
|
22
|
+
constructor(operations: RecoveryOperations);
|
|
23
|
+
/** Whether this process requires a native recovery action before further plugin changes. */
|
|
24
|
+
get active(): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Show the first fatal error; later reports cannot replace it or open another dialog.
|
|
27
|
+
* The crash report is written first, bounded by {@link CRASH_REPORT_WAIT_MS}, so the dialog can name it;
|
|
28
|
+
* a slow or failed write shows the dialog without a path.
|
|
29
|
+
* @param error - Fatal failure, including nested diagnostic causes.
|
|
30
|
+
* @param source - Where the failure surfaced, recorded in the report.
|
|
31
|
+
* @returns Completion of the user's recovery action; duplicate reports resolve immediately.
|
|
32
|
+
*/
|
|
33
|
+
report(error: unknown, source: CrashReportSource): Promise<void>;
|
|
34
|
+
private persist;
|
|
35
|
+
}
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=fatal-recovery.d.ts.map
|