clickgo 7.0.0 → 7.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app/demo.cga +0 -0
- package/dist/app/task.cga +0 -0
- package/dist/clickgo.d.ts +14 -0
- package/dist/index.js +1 -1
- package/dist/lib/core.d.ts +15 -1
- package/dist/lib/form.d.ts +14 -0
- package/dist/lib/native/events.d.ts +37 -0
- package/dist/lib/native/update.d.ts +48 -0
- package/dist/lib/native.d.ts +16 -0
- package/doc/clickgo-rag.md +1181 -564
- package/package.json +3 -2
package/dist/lib/core.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ import * as clickgo from '../clickgo';
|
|
|
19
19
|
import * as lForm from './form';
|
|
20
20
|
import * as lControl from './control';
|
|
21
21
|
import type * as lCommand from './command';
|
|
22
|
+
import type * as lNativeEvents from './native/events';
|
|
22
23
|
import * as lCore from './core';
|
|
23
24
|
/**
|
|
24
25
|
* --- 初始化系统级 ID,仅能设置一次 ---
|
|
@@ -29,6 +30,19 @@ export declare function initSysId(id: string): void;
|
|
|
29
30
|
export declare let config: IConfig;
|
|
30
31
|
/** --- App 抽象类 --- */
|
|
31
32
|
export declare abstract class AbstractApp {
|
|
33
|
+
/**
|
|
34
|
+
* --- Native 普通启动及再次启动事件;网页不触发,App/Form 要求 root ---
|
|
35
|
+
* @param event 业务参数、原生工作目录、来源及请求 ID
|
|
36
|
+
* @returns 无;各层级独立收到通知,同一业务动作由应用选择一处执行
|
|
37
|
+
*/
|
|
38
|
+
onNativeLaunch(event: lNativeEvents.INativeLaunchEvent): void | Promise<void>;
|
|
39
|
+
/**
|
|
40
|
+
* --- Native 文件打开全局事件,要求宿主启用 openFiles;App/Form 要求 root ---
|
|
41
|
+
* @param paths 不含 /storage/ 的 ClickGo 绝对文件路径
|
|
42
|
+
* @param info startup、second-instance、association 或 drop 来源及请求 ID
|
|
43
|
+
* @returns 无;各层级独立通知,业务自行确认、保存和打开
|
|
44
|
+
*/
|
|
45
|
+
onNativeOpenFiles(paths: string[], info: lNativeEvents.INativeOpenFilesInfo): void | Promise<void>;
|
|
32
46
|
/** --- 当前 js 文件在包内的完整路径 --- */
|
|
33
47
|
filename: string;
|
|
34
48
|
/** --- 系统会自动设置本项 --- */
|
|
@@ -252,7 +266,7 @@ export interface IAvailArea {
|
|
|
252
266
|
'oheight': number;
|
|
253
267
|
}
|
|
254
268
|
/** --- 全局事件类型 --- */
|
|
255
|
-
export type TGlobalEvent = 'trayCreated' | 'trayChanged' | 'trayRemoved' | 'error' | 'screenResize' | 'configChanged' | 'formCreated' | 'formRemoved' | 'formTitleChanged' | 'formIconChanged' | 'formStateMinChanged' | 'formStateMaxChanged' | 'formShowChanged' | 'formFocused' | 'formBlurred' | 'formFlash' | 'formShowInSystemTaskChange' | 'formHashChange' | 'taskStarted' | 'taskEnded' | 'webMcpStatusChanged' | 'launcherShowChanged' | 'launcherFolderNameChanged' | 'hashChanged' | 'keydown' | 'keyup';
|
|
269
|
+
export type TGlobalEvent = 'nativeLaunch' | 'nativeOpenFiles' | 'trayCreated' | 'trayChanged' | 'trayRemoved' | 'error' | 'screenResize' | 'configChanged' | 'formCreated' | 'formRemoved' | 'formTitleChanged' | 'formIconChanged' | 'formStateMinChanged' | 'formStateMaxChanged' | 'formShowChanged' | 'formFocused' | 'formBlurred' | 'formFlash' | 'formShowInSystemTaskChange' | 'formHashChange' | 'taskStarted' | 'taskEnded' | 'webMcpStatusChanged' | 'launcherShowChanged' | 'launcherFolderNameChanged' | 'hashChanged' | 'keydown' | 'keyup';
|
|
256
270
|
/** --- 现场下载 app 的参数 --- */
|
|
257
271
|
export interface ICoreFetchAppOptions {
|
|
258
272
|
'notify'?: number | {
|
package/dist/lib/form.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import * as lCore from './core';
|
|
|
2
2
|
import * as lCommand from './command';
|
|
3
3
|
import * as lDom from './dom';
|
|
4
4
|
import * as lControl from './control';
|
|
5
|
+
import type * as lNativeEvents from './native/events';
|
|
5
6
|
/**
|
|
6
7
|
* --- 初始化系统级 ID,仅能设置一次 ---
|
|
7
8
|
* @param id 系统级 ID
|
|
@@ -177,6 +178,19 @@ export declare abstract class AbstractComponent extends AbstractCommon {
|
|
|
177
178
|
}
|
|
178
179
|
/** --- 窗体的抽象类 --- */
|
|
179
180
|
export declare abstract class AbstractForm extends AbstractCommon {
|
|
181
|
+
/**
|
|
182
|
+
* --- Native 普通启动及再次启动事件;网页不触发,App/Form 要求 root ---
|
|
183
|
+
* @param event 业务参数、原生工作目录、来源及请求 ID
|
|
184
|
+
* @returns 无;各层级独立收到通知,同一业务动作由应用选择一处执行
|
|
185
|
+
*/
|
|
186
|
+
onNativeLaunch(event: lNativeEvents.INativeLaunchEvent): void | Promise<void>;
|
|
187
|
+
/**
|
|
188
|
+
* --- Native 文件打开全局事件,要求宿主启用 openFiles;App/Form 要求 root ---
|
|
189
|
+
* @param paths 不含 /storage/ 的 ClickGo 绝对文件路径
|
|
190
|
+
* @param info startup、second-instance、association 或 drop 来源及请求 ID
|
|
191
|
+
* @returns 无;各层级独立通知,业务自行确认、保存和打开
|
|
192
|
+
*/
|
|
193
|
+
onNativeOpenFiles(paths: string[], info: lNativeEvents.INativeOpenFilesInfo): void | Promise<void>;
|
|
180
194
|
/** --- 当前是否完全创建完毕 --- */
|
|
181
195
|
isReady: boolean;
|
|
182
196
|
/** --- 是否是 native 下无边框的第一个窗体 --- */
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/** --- 操作系统文件打开请求来源 --- */
|
|
2
|
+
export type TNativeOpenFilesSource = 'startup' | 'second-instance' | 'association' | 'drop';
|
|
3
|
+
/** --- 普通 GUI 启动请求;CLI/stdio 由 Native 单独处理,不投递此事件 --- */
|
|
4
|
+
export interface INativeLaunchEvent {
|
|
5
|
+
/** --- 本进程内请求 ID;同一次启动的文件事件使用相同 ID --- */
|
|
6
|
+
'requestId': number;
|
|
7
|
+
'source': 'startup' | 'second-instance';
|
|
8
|
+
/** --- 去掉可执行文件和开发入口后的业务参数,保留顺序 --- */
|
|
9
|
+
'args': string[];
|
|
10
|
+
/** --- 原生绝对工作目录,参数中的相对路径以此为基准 --- */
|
|
11
|
+
'cwd': string;
|
|
12
|
+
}
|
|
13
|
+
/** --- 文件事件上下文;paths 为不含 /storage/ 的 ClickGo 绝对文件路径 --- */
|
|
14
|
+
export interface INativeOpenFilesInfo {
|
|
15
|
+
'requestId': number;
|
|
16
|
+
'source': TNativeOpenFilesSource;
|
|
17
|
+
}
|
|
18
|
+
/** --- Native 主文档桥接数据;框架内部使用 --- */
|
|
19
|
+
export type TNativeEvent = {
|
|
20
|
+
'type': 'launch';
|
|
21
|
+
'event': INativeLaunchEvent;
|
|
22
|
+
} | {
|
|
23
|
+
'type': 'openFiles';
|
|
24
|
+
'paths': string[];
|
|
25
|
+
'info': INativeOpenFilesInfo;
|
|
26
|
+
};
|
|
27
|
+
/** --- 系统事件传输适配,生命周期与授权由调用方控制 --- */
|
|
28
|
+
export interface INativeEventDispatcherOptions {
|
|
29
|
+
/** --- ClickGo Boot.main 已完成且处于 Native 环境 --- */
|
|
30
|
+
'ready': () => boolean;
|
|
31
|
+
/** --- 读取当前会话未投递请求;旧宿主为 null,失败为 false --- */
|
|
32
|
+
'read': () => Promise<TNativeEvent[] | null | false>;
|
|
33
|
+
/** --- 按事件类型进入框架全局分发 --- */
|
|
34
|
+
'dispatch': (event: TNativeEvent) => Promise<void>;
|
|
35
|
+
/** --- 传输异常报告,不输出业务参数 --- */
|
|
36
|
+
'error': (error: unknown) => void;
|
|
37
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import * as lCore from '../core';
|
|
2
|
+
/** --- 下载进度:百分比 0–100,其余值为字节数或字节/秒 --- */
|
|
3
|
+
export interface IUpdateProgress {
|
|
4
|
+
'percent': number;
|
|
5
|
+
'transferred': number;
|
|
6
|
+
'total': number;
|
|
7
|
+
'bytesPerSecond': number;
|
|
8
|
+
}
|
|
9
|
+
/** --- Native 软件级更新状态,不含更新源、凭据和安装路径 --- */
|
|
10
|
+
export interface IUpdateState {
|
|
11
|
+
'status': 'idle' | 'checking' | 'available' | 'up-to-date' | 'disabled' | 'error' | 'downloading' | 'downloaded' | 'restarting';
|
|
12
|
+
'currentVersion': string;
|
|
13
|
+
'version'?: string;
|
|
14
|
+
'progress'?: IUpdateProgress;
|
|
15
|
+
'reason'?: 'not-enabled' | 'development' | 'portable';
|
|
16
|
+
'errorCode'?: 'check-failed' | 'download-failed' | 'not-ready' | 'install-failed';
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* --- 检测软件更新,主进程须 launcher({ updates: true }) 并配置 build.publish ---
|
|
20
|
+
* @param current 当前 App 或窗体,要求 root 权限
|
|
21
|
+
* @returns 检测状态;开发/便携/未启用返回 disabled,无权限为 false,网页/旧宿主为 null
|
|
22
|
+
*/
|
|
23
|
+
export declare function checkUpdates(current: lCore.TCurrent): Promise<IUpdateState | null | false>;
|
|
24
|
+
/**
|
|
25
|
+
* --- 下载检测到的版本,合并并发下载,由 Native 校验文件 ---
|
|
26
|
+
* @param current 当前 App 或窗体,要求 root 权限,业务须先取得用户确认
|
|
27
|
+
* @returns downloaded 表示校验完成,未就绪/失败为 error;无权限为 false,不支持为 null
|
|
28
|
+
*/
|
|
29
|
+
export declare function downloadUpdate(current: lCore.TCurrent): Promise<IUpdateState | null | false>;
|
|
30
|
+
/**
|
|
31
|
+
* --- 安装本进程已下载的版本并重启,业务须先保存文档并确认 ---
|
|
32
|
+
* @param current 当前 App 或窗体,要求 root 权限
|
|
33
|
+
* @returns restarting 表示安装开始;异步失败由 onUpdateState 通知,无权限为 false,不支持为 null
|
|
34
|
+
*/
|
|
35
|
+
export declare function installUpdate(current: lCore.TCurrent): Promise<IUpdateState | null | false>;
|
|
36
|
+
/**
|
|
37
|
+
* --- 读取 Native 软件级更新状态快照 ---
|
|
38
|
+
* @param current 当前 App 或窗体,要求 root 权限
|
|
39
|
+
* @returns 当前状态,无权限为 false,网页或旧宿主不支持为 null
|
|
40
|
+
*/
|
|
41
|
+
export declare function getUpdateState(current: lCore.TCurrent): Promise<IUpdateState | null | false>;
|
|
42
|
+
/**
|
|
43
|
+
* --- 监听软件级公开状态及下载进度;不包含 URL、凭据或文件路径 ---
|
|
44
|
+
* @param current 当前 App 或窗体,不要求 root;控制更新仍须 root
|
|
45
|
+
* @param handler 状态回调,业务不需要定义 Native 事件名
|
|
46
|
+
* @returns 无返回值;窗体或任务销毁时自动解除,网页/旧宿主不会投递
|
|
47
|
+
*/
|
|
48
|
+
export declare function onUpdateState(current: lCore.TCurrent, handler: (state: IUpdateState) => void | Promise<void>): void;
|
package/dist/lib/native.d.ts
CHANGED
|
@@ -2,11 +2,27 @@ import * as lCore from './core';
|
|
|
2
2
|
import type * as lNativeStorage from './native/storage';
|
|
3
3
|
export * as storage from './native/storage';
|
|
4
4
|
export * as secret from './native/secret';
|
|
5
|
+
export { checkUpdates, downloadUpdate, installUpdate, getUpdateState, onUpdateState } from './native/update';
|
|
6
|
+
export type { IUpdateState, IUpdateProgress } from './native/update';
|
|
7
|
+
export type { INativeLaunchEvent, INativeOpenFilesInfo, TNativeOpenFilesSource } from './native/events';
|
|
5
8
|
/**
|
|
6
9
|
* --- 初始化系统级 ID,仅能设置一次 ---
|
|
7
10
|
* @param id 系统级 ID
|
|
8
11
|
*/
|
|
9
12
|
export declare function initSysId(id: string): void;
|
|
13
|
+
/**
|
|
14
|
+
* --- 完成宿主业务初始化并读取 Native 暂存事件,仅系统入口可调用 ---
|
|
15
|
+
* @param current 系统级 ID
|
|
16
|
+
* @returns 无
|
|
17
|
+
*/
|
|
18
|
+
export declare function ready(current: string): void;
|
|
19
|
+
/**
|
|
20
|
+
* --- 接入固定的软件更新动作,不允许网页提供地址或安装路径 ---
|
|
21
|
+
* @param current 已确认有效的任务
|
|
22
|
+
* @param action 固定更新动作
|
|
23
|
+
* @returns 更新状态;任务失效为 false,旧宿主缺少能力时为 null
|
|
24
|
+
*/
|
|
25
|
+
export declare function invokeUpdate(current: lCore.TCurrent, action: 'check' | 'download' | 'install' | 'state'): Promise<import('./native/update').IUpdateState | null | false>;
|
|
10
26
|
/** --- 本地 MCP 客户端连接设置;仅向已授权 root 的 App 提供 --- */
|
|
11
27
|
export interface IMcpInfo {
|
|
12
28
|
'transport': 'streamable-http';
|