clickgo 6.9.0 → 6.10.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/AGENTS.md +16 -0
- package/README.md +4 -0
- package/dist/app/demo.cga +0 -0
- package/dist/app/task.cga +0 -0
- package/dist/clickgo.d.ts +2 -1
- package/dist/index.js +1 -1
- package/dist/lib/command/native.d.ts +18 -0
- package/dist/lib/command/palette.d.ts +10 -0
- package/dist/lib/command/schema.d.ts +31 -0
- package/dist/lib/command.d.ts +218 -0
- package/dist/lib/native.d.ts +12 -0
- package/dist/lib/task.d.ts +2 -0
- package/doc/clickgo-rag.md +2376 -537
- package/package.json +9 -3
- package/test/core-module-loading.mjs +0 -169
- package/test/desktop.mjs +0 -715
- package/test/dock-lifecycle.mjs +0 -280
- package/test/dom-style.mjs +0 -261
- package/test/form-launcher.mjs +0 -177
- package/test/form-modal-layer.mjs +0 -75
- package/test/form-native-regions.mjs +0 -115
- package/test/form-native-style.mjs +0 -80
- package/test/form-native.mjs +0 -68
- package/test/form-notify-animation.mjs +0 -102
- package/test/form-notify.mjs +0 -90
- package/test/form-viewport.mjs +0 -127
- package/test/iconview.mjs +0 -70
- package/test/jodit-lifecycle.mjs +0 -212
- package/test/locale-integrity.mjs +0 -189
- package/test/pop-max-size.mjs +0 -66
- package/test/rtl-archive.mjs +0 -440
- package/test/rtl-direction.mjs +0 -193
- package/test/scroll.mjs +0 -145
- package/test/select.mjs +0 -885
- package/test/sidebar-toggle.mjs +0 -75
- package/test/task-package-loading.mjs +0 -94
- package/test/task-start.mjs +0 -141
- package/test/task-tray.mjs +0 -331
- package/test/tool-assets.mjs +0 -64
- package/test/tool-clone.mjs +0 -42
- package/test/toolbox.mjs +0 -88
- package/test/tuieditor-locale.mjs +0 -175
- package/test/vflow.mjs +0 -122
- package/test/web-drag-mask.mjs +0 -96
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as lCommand from '../command';
|
|
2
|
+
/** --- 主进程只发送这四种操作,不接受任意代码或函数名 --- */
|
|
3
|
+
export interface IRequest {
|
|
4
|
+
'method': 'listTasks' | 'list' | 'execute' | 'cancel';
|
|
5
|
+
'id': string;
|
|
6
|
+
'taskId'?: string;
|
|
7
|
+
'name'?: string;
|
|
8
|
+
'args'?: Record<string, lCommand.TJson>;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* --- 接收 Native MCP 请求,按目标 taskId 直接读取或执行公开命令 ---
|
|
12
|
+
* @param request 主进程发来的操作
|
|
13
|
+
* @returns 共享命令结果或发现列表
|
|
14
|
+
*/
|
|
15
|
+
export declare function invoke(request: IRequest): Promise<lCommand.TResult | {
|
|
16
|
+
'ok': true;
|
|
17
|
+
'data': lCommand.IInfo[] | ReturnType<typeof lCommand.listTasks>;
|
|
18
|
+
}>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as lForm from '../form';
|
|
2
|
+
/**
|
|
3
|
+
* --- 打开原生命令调试面板,也可作为界面操作型代理的可选入口 ---
|
|
4
|
+
* @param current 发起操作的 Form,创建阶段使用其原生 Loading
|
|
5
|
+
* @param options 是否只显示应用允许代理调用的命令,默认显示全部内部命令
|
|
6
|
+
* @returns 面板关闭后完成;所属实例失效或正在创建时直接返回
|
|
7
|
+
*/
|
|
8
|
+
export declare function showPalette(current: lForm.AbstractForm, options?: {
|
|
9
|
+
'exposedOnly'?: boolean;
|
|
10
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ISchema, TJson } from '../command';
|
|
2
|
+
/**
|
|
3
|
+
* --- 检查可序列化值,拒绝循环、非有限数和类实例;限制嵌套深度 ---
|
|
4
|
+
* @param value 待检查值
|
|
5
|
+
* @param seen 当前路径上的对象
|
|
6
|
+
* @param depth 当前深度
|
|
7
|
+
* @returns 是否为合法 JSON
|
|
8
|
+
*/
|
|
9
|
+
export declare function isJson(value: unknown, seen?: Set<object>, depth?: number): value is TJson;
|
|
10
|
+
/**
|
|
11
|
+
* --- 注册时检查 schema,错误约束不能静默放行 ---
|
|
12
|
+
* @param schema 当前 schema
|
|
13
|
+
* @param root 根 schema
|
|
14
|
+
* @param seen 已检查的节点
|
|
15
|
+
* @returns 错误说明,合法时返回 null
|
|
16
|
+
*/
|
|
17
|
+
export declare function check(schema: ISchema | boolean, root?: ISchema, seen?: Set<ISchema>): string | null;
|
|
18
|
+
/**
|
|
19
|
+
* --- 校验数据,不转换类型、不补默认值、不删除额外参数 ---
|
|
20
|
+
* @param value 待校验数据
|
|
21
|
+
* @param schema 当前 schema
|
|
22
|
+
* @param root 根 schema
|
|
23
|
+
* @param path 错误字段路径
|
|
24
|
+
* @param depth 递归深度
|
|
25
|
+
* @param ancestors 当前校验路径上的 schema,防止不推进数据的循环引用
|
|
26
|
+
* @returns 错误说明,匹配时返回 null
|
|
27
|
+
*/
|
|
28
|
+
export declare function validate(value: TJson, schema: ISchema | boolean, root?: ISchema, path?: string, depth?: number, ancestors?: Array<{
|
|
29
|
+
'schema': ISchema;
|
|
30
|
+
'path': string;
|
|
31
|
+
}>): string | null;
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import type * as lCore from './core';
|
|
2
|
+
export { showPalette } from './command/palette';
|
|
3
|
+
/** --- 命令输入与输出可跨浏览器、Native 和协议传输的 JSON 值 --- */
|
|
4
|
+
export type TJson = null | boolean | number | string | TJson[] | {
|
|
5
|
+
[key: string]: TJson;
|
|
6
|
+
};
|
|
7
|
+
/** --- JSON Schema 2020-12 的命令校验子集;不支持的关键字在注册时拒绝 --- */
|
|
8
|
+
export interface ISchema {
|
|
9
|
+
'$schema'?: string;
|
|
10
|
+
'$ref'?: string;
|
|
11
|
+
'$defs'?: Record<string, ISchema | boolean>;
|
|
12
|
+
'title'?: string;
|
|
13
|
+
'description'?: string;
|
|
14
|
+
'default'?: TJson;
|
|
15
|
+
'examples'?: TJson[];
|
|
16
|
+
'type'?: 'object' | 'array' | 'string' | 'number' | 'integer' | 'boolean' | 'null';
|
|
17
|
+
'properties'?: Record<string, ISchema | boolean>;
|
|
18
|
+
'required'?: string[];
|
|
19
|
+
'additionalProperties'?: ISchema | boolean;
|
|
20
|
+
'items'?: ISchema | boolean;
|
|
21
|
+
'minItems'?: number;
|
|
22
|
+
'maxItems'?: number;
|
|
23
|
+
'uniqueItems'?: boolean;
|
|
24
|
+
'minLength'?: number;
|
|
25
|
+
'maxLength'?: number;
|
|
26
|
+
'pattern'?: string;
|
|
27
|
+
'minimum'?: number;
|
|
28
|
+
'maximum'?: number;
|
|
29
|
+
'exclusiveMinimum'?: number;
|
|
30
|
+
'exclusiveMaximum'?: number;
|
|
31
|
+
'enum'?: TJson[];
|
|
32
|
+
'const'?: TJson;
|
|
33
|
+
'allOf'?: Array<ISchema | boolean>;
|
|
34
|
+
'anyOf'?: Array<ISchema | boolean>;
|
|
35
|
+
'oneOf'?: Array<ISchema | boolean>;
|
|
36
|
+
'not'?: ISchema | boolean;
|
|
37
|
+
}
|
|
38
|
+
/** --- 所有入口共用的结果;错误码用于程序判断,message 用于说明 --- */
|
|
39
|
+
export type TResult<T extends TJson = TJson> = {
|
|
40
|
+
'ok': true;
|
|
41
|
+
'data': T;
|
|
42
|
+
} | {
|
|
43
|
+
'ok': false;
|
|
44
|
+
'error': {
|
|
45
|
+
'code': string;
|
|
46
|
+
'message': string;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
/** --- 执行来源仅用于展示与记录,不是授权凭证 --- */
|
|
50
|
+
export interface IContext {
|
|
51
|
+
'taskId': string;
|
|
52
|
+
'formId': string;
|
|
53
|
+
'panelId': string;
|
|
54
|
+
'source': 'user' | 'agent';
|
|
55
|
+
'signal': AbortSignal;
|
|
56
|
+
}
|
|
57
|
+
/** --- 与 MCP 工具描述对齐的公开命令元数据 --- */
|
|
58
|
+
export interface IMetadata {
|
|
59
|
+
'name': string;
|
|
60
|
+
'title'?: string;
|
|
61
|
+
'description': string;
|
|
62
|
+
'inputSchema': ISchema & {
|
|
63
|
+
'type': 'object';
|
|
64
|
+
};
|
|
65
|
+
'outputSchema'?: ISchema;
|
|
66
|
+
/** --- 行为说明,不代替校验或授权 --- */
|
|
67
|
+
'annotations'?: {
|
|
68
|
+
'readOnlyHint'?: boolean;
|
|
69
|
+
'destructiveHint'?: boolean;
|
|
70
|
+
'idempotentHint'?: boolean;
|
|
71
|
+
'openWorldHint'?: boolean;
|
|
72
|
+
/** --- WebMCP 的重要或不可逆现实效果说明 --- */
|
|
73
|
+
'consequentialHint'?: boolean;
|
|
74
|
+
'untrustedContentHint'?: boolean;
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/** --- 应用声明一次,界面、浏览器代理和 Native 适配器共享执行函数 --- */
|
|
78
|
+
export interface IDefinition<T extends Record<string, TJson> = Record<string, TJson>> extends IMetadata {
|
|
79
|
+
/** --- 明确允许代理发现并调用;默认只允许应用内部调用 --- */
|
|
80
|
+
'exposed'?: boolean;
|
|
81
|
+
/** --- 默认拒绝同一命令并发;业务确认可并行时才开启 --- */
|
|
82
|
+
'concurrent'?: boolean;
|
|
83
|
+
/** --- 必须已经取得的框架权限;执行入口不弹授权窗 --- */
|
|
84
|
+
'permissions'?: string[];
|
|
85
|
+
/** --- true 为可用,false 或原因文本为不可用;每次执行重新检查 --- */
|
|
86
|
+
'enabled'?: () => boolean | string;
|
|
87
|
+
'execute': (args: T, context: IContext) => TResult | Promise<TResult>;
|
|
88
|
+
}
|
|
89
|
+
/** --- 不包含函数或内部对象的独立快照 --- */
|
|
90
|
+
export interface IInfo extends IMetadata {
|
|
91
|
+
'taskId': string;
|
|
92
|
+
'formId': string;
|
|
93
|
+
'panelId': string;
|
|
94
|
+
'exposed': boolean;
|
|
95
|
+
'enabled': boolean;
|
|
96
|
+
'disabledReason': string;
|
|
97
|
+
'running': number;
|
|
98
|
+
}
|
|
99
|
+
/** --- 绑定一个应用实例,只能调用该实例明确公开的命令 --- */
|
|
100
|
+
export interface IBridge {
|
|
101
|
+
'taskId': string;
|
|
102
|
+
'list': () => IInfo[];
|
|
103
|
+
'execute': (name: string, args?: Record<string, TJson>, options?: {
|
|
104
|
+
'signal'?: AbortSignal;
|
|
105
|
+
}) => Promise<TResult>;
|
|
106
|
+
}
|
|
107
|
+
/** --- 框架向网页发布的统一入口;按任务选择应用,只访问明确公开的命令 --- */
|
|
108
|
+
export interface IPageBridge {
|
|
109
|
+
'listTasks': () => Array<{
|
|
110
|
+
'id': string;
|
|
111
|
+
'name': string;
|
|
112
|
+
}>;
|
|
113
|
+
'list': (taskId: string) => IInfo[];
|
|
114
|
+
'execute': (taskId: string, name: string, args?: Record<string, TJson>, options?: {
|
|
115
|
+
'signal'?: AbortSignal;
|
|
116
|
+
}) => Promise<TResult>;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* --- 构造成功结果 ---
|
|
120
|
+
* @param data 可跨入口传输的 JSON 数据
|
|
121
|
+
* @returns 成功结果
|
|
122
|
+
*/
|
|
123
|
+
export declare function success<T extends TJson>(data: T): TResult<T>;
|
|
124
|
+
/**
|
|
125
|
+
* --- 构造业务失败结果,不抛异常 ---
|
|
126
|
+
* @param code 稳定的业务错误码
|
|
127
|
+
* @param message 可公开的错误说明
|
|
128
|
+
* @returns 失败结果
|
|
129
|
+
*/
|
|
130
|
+
export declare function failure(code: string, message: string): TResult<never>;
|
|
131
|
+
/**
|
|
132
|
+
* --- 注册命令;重复名称、不支持的 schema 或已销毁的实例返回 false ---
|
|
133
|
+
* @param current 所属任务/Form/Panel;销毁时自动移除其命令
|
|
134
|
+
* @param definition 元数据、可用条件与唯一业务执行函数
|
|
135
|
+
* @returns 是否注册成功
|
|
136
|
+
*/
|
|
137
|
+
export declare function register<T extends Record<string, TJson>>(current: lCore.TCurrent, definition: IDefinition<T>): boolean;
|
|
138
|
+
/**
|
|
139
|
+
* --- 取消尚在执行的命令并解除注册;取消是协作式,不回滚已产生的业务效果 ---
|
|
140
|
+
* @param current 所属任务/Form/Panel
|
|
141
|
+
* @param name 命令名称
|
|
142
|
+
* @returns 是否找到并移除命令
|
|
143
|
+
*/
|
|
144
|
+
export declare function unregister(current: lCore.TCurrent, name: string): boolean;
|
|
145
|
+
/**
|
|
146
|
+
* --- 清理所属 Panel、Form 或整个任务的命令 ---
|
|
147
|
+
* @param current 所属任务/Form/Panel
|
|
148
|
+
* @returns 无返回值
|
|
149
|
+
*/
|
|
150
|
+
export declare function clear(current: lCore.TCurrent): void;
|
|
151
|
+
/**
|
|
152
|
+
* --- 框架生命周期使用的按所属范围清理入口 ---
|
|
153
|
+
* @internal
|
|
154
|
+
* @param taskId 所属任务
|
|
155
|
+
* @param formId 所属 Form,不传时清理任务
|
|
156
|
+
* @param panelId 所属 Panel,不传时清理整个 Form
|
|
157
|
+
* @returns 无返回值
|
|
158
|
+
*/
|
|
159
|
+
export declare function clearOwner(taskId: string, formId?: string, panelId?: string): void;
|
|
160
|
+
/**
|
|
161
|
+
* --- 获取独立元数据和当前状态,不导出业务函数 ---
|
|
162
|
+
* @param current 所属应用
|
|
163
|
+
* @returns 命令列表
|
|
164
|
+
*/
|
|
165
|
+
export declare function list(current: lCore.TCurrent): IInfo[];
|
|
166
|
+
/**
|
|
167
|
+
* --- 获取仍可调用的 App 标识与名称,供网页及 Native 代理发现目标 ---
|
|
168
|
+
* @returns 未开始退出的 App 列表
|
|
169
|
+
*/
|
|
170
|
+
export declare function listTasks(): Array<{
|
|
171
|
+
'id': string;
|
|
172
|
+
'name': string;
|
|
173
|
+
}>;
|
|
174
|
+
/**
|
|
175
|
+
* --- 应用界面直接执行已注册的业务命令 ---
|
|
176
|
+
* @param current 所属任务/Form
|
|
177
|
+
* @param name 命令名称
|
|
178
|
+
* @param args 参数,默认空对象
|
|
179
|
+
* @param options 取消信号
|
|
180
|
+
* @returns 业务结果
|
|
181
|
+
*/
|
|
182
|
+
export declare function execute(current: lCore.TCurrent, name: string, args?: Record<string, TJson>, options?: {
|
|
183
|
+
'signal'?: AbortSignal;
|
|
184
|
+
}): Promise<TResult>;
|
|
185
|
+
/**
|
|
186
|
+
* --- 代理直接按 taskId 执行公开命令,与界面共用校验和业务执行器 ---
|
|
187
|
+
* @param taskId 目标 App
|
|
188
|
+
* @param name 命令名称
|
|
189
|
+
* @param args 参数,默认空对象
|
|
190
|
+
* @param options 取消信号
|
|
191
|
+
* @returns 结构化结果;未公开或不存在的命令返回 not-found
|
|
192
|
+
*/
|
|
193
|
+
export declare function executeAgent(taskId: string, name: string, args?: Record<string, TJson>, options?: {
|
|
194
|
+
'signal'?: AbortSignal;
|
|
195
|
+
}): Promise<TResult>;
|
|
196
|
+
/**
|
|
197
|
+
* --- 创建绑定单个 App 的可复用代理接口,调用方无需反复传入 taskId ---
|
|
198
|
+
* @param current 所属应用
|
|
199
|
+
* @returns 不可修改的桥接接口
|
|
200
|
+
*/
|
|
201
|
+
export declare function createBridge(current: lCore.TCurrent): IBridge;
|
|
202
|
+
/**
|
|
203
|
+
* --- 网页入口直接读取框架的任务及命令状态,无需应用或宿主重复发布与清理 ---
|
|
204
|
+
* @returns 不可修改的网页命令接口
|
|
205
|
+
*/
|
|
206
|
+
export declare function createPageBridge(): IPageBridge;
|
|
207
|
+
/**
|
|
208
|
+
* --- 按能力检测接入当前 WebMCP API;没有 API 或注册失败时返回 false ---
|
|
209
|
+
* @param current 所属应用
|
|
210
|
+
* @returns 是否同步成功
|
|
211
|
+
*/
|
|
212
|
+
export declare function connectWebMcp(current: lCore.TCurrent): Promise<boolean>;
|
|
213
|
+
/**
|
|
214
|
+
* --- 解除 WebMCP 适配器;内部命令继续可用 ---
|
|
215
|
+
* @param current 所属应用
|
|
216
|
+
* @returns 无返回值
|
|
217
|
+
*/
|
|
218
|
+
export declare function disconnectWebMcp(current: lCore.TCurrent): void;
|
package/dist/lib/native.d.ts
CHANGED
|
@@ -4,6 +4,18 @@ import * as lCore from './core';
|
|
|
4
4
|
* @param id 系统级 ID
|
|
5
5
|
*/
|
|
6
6
|
export declare function initSysId(id: string): void;
|
|
7
|
+
/** --- 本地 MCP 客户端连接设置;仅向已授权 root 的 App 提供 --- */
|
|
8
|
+
export interface IMcpInfo {
|
|
9
|
+
'transport': 'streamable-http';
|
|
10
|
+
'url': string;
|
|
11
|
+
'token': string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* --- 读取 Native 主进程启用的 MCP 连接设置 ---
|
|
15
|
+
* @param current 当前 App
|
|
16
|
+
* @returns 连接设置;未启用为 null,无权限为 false
|
|
17
|
+
*/
|
|
18
|
+
export declare function getMcpInfo(current: lCore.TCurrent): Promise<IMcpInfo | null | false>;
|
|
7
19
|
/**
|
|
8
20
|
* --- 监听 native 传输过来的事件 ---
|
|
9
21
|
* @param current 当前任务 ID
|
package/dist/lib/task.d.ts
CHANGED