clickgo 7.0.0 → 7.1.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/index.js +1 -1
- package/dist/lib/native/update.d.ts +48 -0
- package/dist/lib/native.d.ts +9 -0
- package/doc/clickgo-rag.md +353 -37
- package/package.json +3 -2
|
@@ -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,20 @@ 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';
|
|
5
7
|
/**
|
|
6
8
|
* --- 初始化系统级 ID,仅能设置一次 ---
|
|
7
9
|
* @param id 系统级 ID
|
|
8
10
|
*/
|
|
9
11
|
export declare function initSysId(id: string): void;
|
|
12
|
+
/**
|
|
13
|
+
* --- 接入固定的软件更新动作,不允许网页提供地址或安装路径 ---
|
|
14
|
+
* @param current 已确认有效的任务
|
|
15
|
+
* @param action 固定更新动作
|
|
16
|
+
* @returns 更新状态;任务失效为 false,旧宿主缺少能力时为 null
|
|
17
|
+
*/
|
|
18
|
+
export declare function invokeUpdate(current: lCore.TCurrent, action: 'check' | 'download' | 'install' | 'state'): Promise<import('./native/update').IUpdateState | null | false>;
|
|
10
19
|
/** --- 本地 MCP 客户端连接设置;仅向已授权 root 的 App 提供 --- */
|
|
11
20
|
export interface IMcpInfo {
|
|
12
21
|
'transport': 'streamable-http';
|