weapp-ide-cli 6.1.9 → 6.3.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/README.md +74 -0
- package/dist/automator-BOe32upt.js +822 -0
- package/dist/automator-VSjgHujY.js +1 -0
- package/dist/automator-session-VOB03glx.js +186 -0
- package/dist/automatorProject-DjYLqMj6.js +881 -0
- package/dist/{cli-2sY1sAVq.js → cli-CFlqFpIw.js} +1552 -74
- package/dist/cli.js +3 -3
- package/dist/commands-DmirGBy4.js +1 -0
- package/dist/commands-mslf7-sP.js +529 -0
- package/dist/devtoolsProjectOwnership-BMfSAg4n.js +2022 -0
- package/dist/index.d.ts +420 -76
- package/dist/index.js +8 -5
- package/dist/managed-B04Xo9U_.js +264 -0
- package/dist/run-mcp-83-VKZVA.js +1 -0
- package/dist/{run-mcp-LqaWlQJ_.js → run-mcp-Ni139Z5C.js} +28 -9
- package/package.json +13 -12
- package/dist/automator-session-fbanL2eW.js +0 -1362
- package/dist/commands-DpMG1w04.js +0 -2
- package/dist/commands-__RJ552L.js +0 -1359
- package/dist/run-mcp-C2SQ_hRJ.js +0 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,22 +1,127 @@
|
|
|
1
|
+
import { AutomatorElement, AutomatorMiniProgram, AutomatorPage, DevtoolsConnectionInput, DevtoolsContext, DevtoolsElementSnapshot, DevtoolsPageSnapshot, DevtoolsRuntimeSessionOptions, DevtoolsToolResult, MachineE2ELeaseRecoveryScope, MiniProgramEventMap, closeSharedMiniProgram, getSharedMiniProgramSessionCount, readDevtoolsElementSnapshot as readElementSnapshot, releaseSharedMiniProgram, resolveDevtoolsProjectPath as resolveProjectPath, toDevtoolsSerializableValue as toSerializableValue } from "@weapp-vite/devtools-runtime";
|
|
1
2
|
import { Buffer } from "node:buffer";
|
|
2
|
-
import {
|
|
3
|
+
import { OperationLifecycle } from "@weapp-vite/miniprogram-automator/operation";
|
|
4
|
+
import { MiniProgram } from "@weapp-vite/miniprogram-automator";
|
|
3
5
|
import { McpServer } from "@modelcontextprotocol/server";
|
|
4
|
-
//#region src/
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
//#region src/devtoolsTarget/metadata.d.ts
|
|
7
|
+
interface WechatDevtoolsMetadata {
|
|
8
|
+
version?: string;
|
|
9
|
+
channel?: 'stable' | 'rc' | 'nightly' | 'unknown';
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region src/devtoolsTarget/profile.d.ts
|
|
13
|
+
interface WechatDevtoolsProfileOptions {
|
|
14
|
+
homeDir?: string;
|
|
15
|
+
localAppDataDir?: string;
|
|
16
|
+
platform?: NodeJS.Platform;
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/devtoolsTarget/types.d.ts
|
|
20
|
+
type WechatDevtoolsChannel = 'stable' | 'rc' | 'nightly';
|
|
21
|
+
interface ResolvedWechatDevtoolsTarget extends WechatDevtoolsMetadata {
|
|
22
|
+
cliPath: string;
|
|
23
|
+
installationId: string;
|
|
24
|
+
appPath: string;
|
|
25
|
+
profileDir: string;
|
|
26
|
+
}
|
|
27
|
+
interface WechatDevtoolsSelectionOptions {
|
|
28
|
+
cliPath?: string;
|
|
29
|
+
target?: ResolvedWechatDevtoolsTarget;
|
|
30
|
+
devtoolsChannel?: WechatDevtoolsChannel;
|
|
31
|
+
devtoolsVersion?: string;
|
|
32
|
+
requireOfficialLatest?: boolean;
|
|
33
|
+
}
|
|
34
|
+
interface ResolveWechatDevtoolsTargetOptions extends WechatDevtoolsProfileOptions, WechatDevtoolsSelectionOptions {
|
|
35
|
+
searchRoots?: string[];
|
|
36
|
+
registryPath?: string;
|
|
37
|
+
}
|
|
38
|
+
interface WechatDevtoolsInstallation {
|
|
39
|
+
cliPath: string;
|
|
40
|
+
target?: ResolvedWechatDevtoolsTarget;
|
|
41
|
+
error?: string;
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
//#region src/devtoolsTarget/discovery.d.ts
|
|
45
|
+
/** 产品版本按数字段比较,避免日期版本的字符串排序漂移。 */
|
|
46
|
+
export declare function compareWechatDevtoolsVersions(a: string, b: string): number;
|
|
47
|
+
/** 只扫描已知安装根,不递归遍历磁盘,也不执行候选应用。 */
|
|
48
|
+
export declare function listWechatDevtoolsInstallations(options?: ResolveWechatDevtoolsTargetOptions): Promise<WechatDevtoolsInstallation[]>;
|
|
49
|
+
//#endregion
|
|
50
|
+
//#region src/devtoolsTarget/host.d.ts
|
|
51
|
+
interface WechatDevtoolsHostInspectionOptions {
|
|
52
|
+
platform?: NodeJS.Platform;
|
|
53
|
+
signal?: AbortSignal;
|
|
7
54
|
timeout?: number;
|
|
55
|
+
}
|
|
56
|
+
/** 启动前验证共享宿主身份;无活跃宿主可以继续,其他安装不得被隐式接管。 */
|
|
57
|
+
export declare function assertWechatDevtoolsHost(target: ResolvedWechatDevtoolsTarget, options?: WechatDevtoolsHostInspectionOptions): Promise<void>;
|
|
58
|
+
/** HTTP 与 WebSocket 的显式端口均需由所选安装持有,端口号本身不是宿主身份。 */
|
|
59
|
+
export declare function assertWechatDevtoolsPort(target: ResolvedWechatDevtoolsTarget, port: number, options?: WechatDevtoolsHostInspectionOptions): Promise<void>;
|
|
60
|
+
//#endregion
|
|
61
|
+
//#region src/devtoolsTarget/official.d.ts
|
|
62
|
+
export declare const WECHAT_DEVTOOLS_OFFICIAL_CHANNELS_URL = "https://devtools.wxqcloud.qq.com.cn/WechatWebDev/nightly/versions/config.json";
|
|
63
|
+
/** 官方查询只提供版本证据,默认选择不依赖网络可用性。 */
|
|
64
|
+
export declare function readOfficialWechatDevtoolsVersion(channel?: WechatDevtoolsChannel): Promise<{
|
|
65
|
+
version: string;
|
|
66
|
+
source: string;
|
|
67
|
+
queriedAt: string;
|
|
68
|
+
}>;
|
|
69
|
+
/** 仅显式严格模式要求所选安装匹配官方渠道最新版本。 */
|
|
70
|
+
export declare function assertOfficialWechatDevtoolsVersion(target: ResolvedWechatDevtoolsTarget): Promise<{
|
|
71
|
+
version: string;
|
|
72
|
+
source: string;
|
|
73
|
+
queriedAt: string;
|
|
74
|
+
}>;
|
|
75
|
+
//#endregion
|
|
76
|
+
//#region src/devtoolsTarget/registry.d.ts
|
|
77
|
+
/** 校验安装后登记真实 CLI 路径,不更改默认选择或登录数据。 */
|
|
78
|
+
export declare function registerWechatDevtoolsInstallation(cliPath: string, registryPath?: string): Promise<ResolvedWechatDevtoolsTarget>;
|
|
79
|
+
/** 允许移除已经失效的登记;不会删除应用或用户配置。 */
|
|
80
|
+
export declare function unregisterWechatDevtoolsInstallation(cliPath: string, registryPath?: string): Promise<void>;
|
|
81
|
+
//#endregion
|
|
82
|
+
//#region src/devtoolsTarget/index.d.ts
|
|
83
|
+
export declare function validateWechatDevtoolsSelection(options: WechatDevtoolsSelectionOptions): void;
|
|
84
|
+
export declare function readWechatDevtoolsSelectionEnvironment(env?: NodeJS.ProcessEnv): WechatDevtoolsSelectionOptions;
|
|
85
|
+
/** 每次操作只解析一次安装,显式选择覆盖继承的配置但不写回全局设置。 */
|
|
86
|
+
export declare function resolveWechatDevtoolsTarget(options?: ResolveWechatDevtoolsTargetOptions): Promise<ResolvedWechatDevtoolsTarget>;
|
|
87
|
+
/** 命令的所有异步阶段复用同一安装,彼此并发的调用不会污染环境变量。 */
|
|
88
|
+
export declare function withWechatDevtoolsSelection<T>(options: ResolveWechatDevtoolsTargetOptions, runner: (target: ResolvedWechatDevtoolsTarget) => Promise<T>): Promise<T>;
|
|
89
|
+
/** 读取当前操作固定的安装;没有活动选择时不触发发现或启动。 */
|
|
90
|
+
export declare function getActiveWechatDevtoolsTarget(): ResolvedWechatDevtoolsTarget | undefined;
|
|
91
|
+
//#endregion
|
|
92
|
+
//#region src/cli/agentStart.d.ts
|
|
93
|
+
export interface StartWechatIdeAgentOptions {
|
|
94
|
+
projectPath: string;
|
|
95
|
+
port: number;
|
|
8
96
|
cliPath?: string;
|
|
9
|
-
|
|
10
|
-
sessionId?: string;
|
|
97
|
+
target?: ResolvedWechatDevtoolsTarget;
|
|
11
98
|
trustProject?: boolean;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
99
|
+
timeout?: number;
|
|
100
|
+
signal?: AbortSignal;
|
|
101
|
+
/** 预检完成后、命令派发前登记启动意图;钩子开始后取消仍按派发结果未知处理。 */
|
|
102
|
+
onBeforeDispatch?: () => void | Promise<void>;
|
|
103
|
+
/** 官方回执验证后先登记窗口所有权,再检查取消状态。 */
|
|
104
|
+
onStarted?: (result: StartWechatIdeAgentResult) => void | Promise<void>;
|
|
105
|
+
}
|
|
106
|
+
export interface StartWechatIdeAgentResult {
|
|
107
|
+
autoPort: number;
|
|
108
|
+
openedProjectWindow: boolean;
|
|
109
|
+
version: string;
|
|
15
110
|
}
|
|
16
|
-
/**
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
111
|
+
/** 使用所选安装的官方 agent start,并保留其窗口复用和端口冲突语义。 */
|
|
112
|
+
export declare function startWechatIdeAgent(options: StartWechatIdeAgentOptions): Promise<StartWechatIdeAgentResult>;
|
|
113
|
+
//#endregion
|
|
114
|
+
//#region src/cli/automator/context.d.ts
|
|
115
|
+
interface AutomatorInstallationOptions extends DevtoolsRuntimeSessionOptions, WechatDevtoolsSelectionOptions {
|
|
116
|
+
target?: ResolvedWechatDevtoolsTarget;
|
|
117
|
+
signal?: AbortSignal;
|
|
118
|
+
}
|
|
119
|
+
/** 在连接与共享缓存入口固定安装选择;headless 不读取或修改 IDE 状态。 */
|
|
120
|
+
export declare function resolveAutomatorSessionOptions<T extends AutomatorInstallationOptions>(options: T): Promise<T & AutomatorInstallationOptions & {
|
|
121
|
+
installationId: string;
|
|
122
|
+
}>;
|
|
123
|
+
//#endregion
|
|
124
|
+
//#region src/cli/automator/errors.d.ts
|
|
20
125
|
/**
|
|
21
126
|
* @description 判断错误是否属于开发者工具服务端口不可用。
|
|
22
127
|
*/
|
|
@@ -53,17 +158,42 @@ export declare function isAutomatorLoginError(error: unknown): boolean;
|
|
|
53
158
|
* @description 格式化开发者工具登录失效错误,便于终端展示。
|
|
54
159
|
*/
|
|
55
160
|
export declare function formatAutomatorLoginError(error: unknown): string;
|
|
161
|
+
//#endregion
|
|
162
|
+
//#region src/cli/automator.d.ts
|
|
163
|
+
export interface AutomatorOptions extends AutomatorInstallationOptions {
|
|
164
|
+
projectPath: string;
|
|
165
|
+
timeout?: number;
|
|
166
|
+
signal?: AbortSignal;
|
|
167
|
+
cliPath?: string;
|
|
168
|
+
port?: number;
|
|
169
|
+
sessionId?: string;
|
|
170
|
+
trustProject?: boolean;
|
|
171
|
+
preferOpenedSession?: boolean;
|
|
172
|
+
preserveProjectRoot?: boolean;
|
|
173
|
+
persistAsDefaultSession?: boolean;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* @description 为项目路径派生稳定的 DevTools automator 端口,避免多个 dev:open 项目抢占默认端口。
|
|
177
|
+
*/
|
|
178
|
+
export declare function resolveProjectAutomatorPort(projectPath: string): number;
|
|
56
179
|
/**
|
|
57
180
|
* @description 基于当前配置解析 CLI 路径,并通过现代化 automator 入口启动会话。
|
|
58
181
|
*/
|
|
59
182
|
export declare function launchAutomator(options: AutomatorOptions): Promise<any>;
|
|
60
183
|
/**
|
|
61
|
-
* @description
|
|
184
|
+
* @description 登记由外部 automator bridge 创建的会话,供 CLI 子进程安全复用。
|
|
62
185
|
*/
|
|
63
|
-
export declare function
|
|
186
|
+
export declare function persistOpenedAutomatorSession(options: AutomatorOptions & {
|
|
187
|
+
wsEndpoint: string;
|
|
188
|
+
}): Promise<void>;
|
|
189
|
+
/**
|
|
190
|
+
* @description 只读连接当前项目已打开的自动化会话;失败不证明缓存过期,也不删除其他操作持有的会话记录。
|
|
191
|
+
*/
|
|
192
|
+
export declare function connectOpenedAutomator(options: AutomatorOptions): Promise<MiniProgram>;
|
|
64
193
|
//#endregion
|
|
65
194
|
//#region src/cli/automator-argv.d.ts
|
|
66
195
|
export interface ParsedAutomatorArgs {
|
|
196
|
+
cliPath?: string;
|
|
67
197
|
projectPath: string;
|
|
68
198
|
timeout?: number;
|
|
69
199
|
port?: number;
|
|
@@ -93,7 +223,10 @@ export declare function removeOption(argv: readonly string[], optionName: string
|
|
|
93
223
|
type MiniProgramLike = AutomatorMiniProgram;
|
|
94
224
|
type MiniProgramPage = AutomatorPage;
|
|
95
225
|
type MiniProgramElement = AutomatorElement;
|
|
96
|
-
interface AutomatorSessionOptions extends DevtoolsRuntimeSessionOptions {
|
|
226
|
+
interface AutomatorSessionOptions extends DevtoolsRuntimeSessionOptions, WechatDevtoolsSelectionOptions {
|
|
227
|
+
signal?: AbortSignal;
|
|
228
|
+
target?: ResolvedWechatDevtoolsTarget;
|
|
229
|
+
}
|
|
97
230
|
/** 建立交互式会话,并报告最终连接错误。 */
|
|
98
231
|
export declare function connectMiniProgram(options: AutomatorSessionOptions): Promise<MiniProgramLike>;
|
|
99
232
|
/**
|
|
@@ -246,8 +379,19 @@ export declare function parseCompareArgs(argv: string[]): CompareOptions;
|
|
|
246
379
|
*/
|
|
247
380
|
export declare function handleConfigCommand(argv: string[]): Promise<void>;
|
|
248
381
|
//#endregion
|
|
382
|
+
//#region src/cli/devtoolsSelection.d.ts
|
|
383
|
+
/** 包装参数不会透传官方 CLI,选项值和双横线后的内容保持原样。 */
|
|
384
|
+
export declare function splitWechatDevtoolsSelectionArgs(argv: readonly string[]): {
|
|
385
|
+
args: string[];
|
|
386
|
+
selection: WechatDevtoolsSelectionOptions;
|
|
387
|
+
};
|
|
388
|
+
/** 显式选择在任何 helper 或 CLI 回退之前固定,避免入口间选版漂移。 */
|
|
389
|
+
export declare function withWechatDevtoolsSelectionArgs<T>(argv: readonly string[], runner: (args: string[]) => Promise<T>): Promise<T>;
|
|
390
|
+
//#endregion
|
|
249
391
|
//#region src/cli/http.d.ts
|
|
250
|
-
export interface WechatDevtoolsHttpCommandOptions {
|
|
392
|
+
export interface WechatDevtoolsHttpCommandOptions extends WechatDevtoolsSelectionOptions {
|
|
393
|
+
cliPath?: string;
|
|
394
|
+
target?: ResolvedWechatDevtoolsTarget;
|
|
251
395
|
port?: number;
|
|
252
396
|
signal?: AbortSignal;
|
|
253
397
|
timeoutMs?: number;
|
|
@@ -264,9 +408,10 @@ export interface PollWechatIdeEngineBuildResult extends WechatDevtoolsEngineBuil
|
|
|
264
408
|
done: boolean;
|
|
265
409
|
failed: boolean;
|
|
266
410
|
}
|
|
411
|
+
/** 请求期间持有机器租约,避免 E2E 与另一入口同时更改共享宿主。 */
|
|
267
412
|
export declare function requestWechatDevtoolsHttp(pathname: string, query: Record<string, string>, options?: WechatDevtoolsHttpCommandOptions): Promise<string>;
|
|
268
413
|
/**
|
|
269
|
-
* @description
|
|
414
|
+
* @description 请求微信开发者工具打开项目并返回原始响应;目标 runtime 状态仍需通过会话或界面确认。
|
|
270
415
|
*/
|
|
271
416
|
export declare function openWechatIdeProjectByHttp(projectPath: string, options?: WechatDevtoolsHttpCommandOptions): Promise<string>;
|
|
272
417
|
/**
|
|
@@ -297,17 +442,19 @@ export interface RunWechatIdeEngineBuildByHttpOptions extends WechatDevtoolsHttp
|
|
|
297
442
|
}
|
|
298
443
|
export interface RunWechatIdeEngineBuildOptions extends RunWechatIdeEngineBuildByHttpOptions {
|
|
299
444
|
fallbackToCli?: boolean;
|
|
445
|
+
/** 避免 CLI 诊断污染协议标准输出。 */
|
|
446
|
+
quiet?: boolean;
|
|
300
447
|
logPath?: string;
|
|
301
448
|
}
|
|
302
449
|
export declare function isWechatIdeEngineBuildEndpointMissingError(error: unknown): boolean;
|
|
303
|
-
/**
|
|
304
|
-
* @description 通过开发者工具 HTTP 服务端口执行 engine build,并轮询直到构建结束。
|
|
305
|
-
*/
|
|
450
|
+
/** 固定安装上下文后完整持有 HTTP 构建与轮询期间的租约。 */
|
|
306
451
|
export declare function runWechatIdeEngineBuildByHttp(projectPath: string, options?: RunWechatIdeEngineBuildByHttpOptions): Promise<PollWechatIdeEngineBuildResult>;
|
|
307
|
-
/**
|
|
308
|
-
* @description 以更接近官方 CLI 的方式执行 engine build,并支持将构建日志写入文件。
|
|
309
|
-
*/
|
|
452
|
+
/** HTTP、轮询与 CLI 回退沿用同一次解析的安装。 */
|
|
310
453
|
export declare function runWechatIdeEngineBuild(projectPath: string, options?: RunWechatIdeEngineBuildOptions): Promise<void | PollWechatIdeEngineBuildResult>;
|
|
454
|
+
/** 在验收交互前等待 IDE 消费产物,并沿用该会话选择的安装。 */
|
|
455
|
+
export declare function prepareAcceptanceProject(projectPath: string, signal: AbortSignal, options?: WechatDevtoolsHttpCommandOptions & {
|
|
456
|
+
runtimeProvider?: 'headless' | 'devtools';
|
|
457
|
+
}): Promise<void | PollWechatIdeEngineBuildResult>;
|
|
311
458
|
//#endregion
|
|
312
459
|
//#region src/cli/forwardConsole.d.ts
|
|
313
460
|
export type ForwardConsoleLogLevel = 'debug' | 'log' | 'info' | 'warn' | 'error';
|
|
@@ -344,6 +491,7 @@ export interface SharedInputSession {
|
|
|
344
491
|
suspend: () => void;
|
|
345
492
|
}
|
|
346
493
|
export interface ExclusiveKeypressOptions<T> {
|
|
494
|
+
signal?: AbortSignal;
|
|
347
495
|
ignoreInitialMs?: number;
|
|
348
496
|
timeoutMs?: number;
|
|
349
497
|
onKeypress: (str: string, key: {
|
|
@@ -355,6 +503,20 @@ export declare function createSharedInputSession(options: SharedInputSessionOpti
|
|
|
355
503
|
export declare function waitForExclusiveKeypress<T>(options: ExclusiveKeypressOptions<T>): Promise<T | 'timeout'>;
|
|
356
504
|
export declare function runWithSuspendedSharedInput<T>(runner: () => Promise<T>): Promise<T>;
|
|
357
505
|
//#endregion
|
|
506
|
+
//#region src/cli/loginQuery.d.ts
|
|
507
|
+
export type WechatIdeLoginQueryResult = {
|
|
508
|
+
status: 'success';
|
|
509
|
+
login: boolean;
|
|
510
|
+
} | {
|
|
511
|
+
status: 'unknown';
|
|
512
|
+
reason: 'timeout' | 'command-failed' | 'invalid-response' | 'installation-mismatch' | 'runtime-busy';
|
|
513
|
+
};
|
|
514
|
+
/** 显式调用指定 CLI 查询登录语义,不重试、不提示登录;原生 CLI 可能启动 IDE。 */
|
|
515
|
+
export declare function queryWechatIdeLogin(cliPath: string, options?: {
|
|
516
|
+
timeout?: number;
|
|
517
|
+
signal?: AbortSignal;
|
|
518
|
+
}): Promise<WechatIdeLoginQueryResult>;
|
|
519
|
+
//#endregion
|
|
358
520
|
//#region src/cli/minidev.d.ts
|
|
359
521
|
/**
|
|
360
522
|
* @description 运行支付宝小程序 CLI(minidev)
|
|
@@ -378,6 +540,7 @@ export declare function resolveCliPath(): Promise<{
|
|
|
378
540
|
//#endregion
|
|
379
541
|
//#region src/cli/retry.d.ts
|
|
380
542
|
export interface RetryKeypressOptions {
|
|
543
|
+
signal?: AbortSignal;
|
|
381
544
|
timeoutMs?: number;
|
|
382
545
|
}
|
|
383
546
|
export interface RetryPromptOptions extends RetryKeypressOptions {
|
|
@@ -391,6 +554,7 @@ export interface RetryLogger {
|
|
|
391
554
|
warn: (message: string) => void;
|
|
392
555
|
}
|
|
393
556
|
export interface WechatIdeLoginRetryOptions {
|
|
557
|
+
signal?: AbortSignal;
|
|
394
558
|
allowRetry?: boolean;
|
|
395
559
|
cancelLevel?: 'info' | 'warn';
|
|
396
560
|
error: unknown;
|
|
@@ -447,9 +611,7 @@ export declare function promptWechatIdeLoginRetry(options: WechatIdeLoginRetryOp
|
|
|
447
611
|
* @description 基于 cac 注册顶层命令,用于统一识别入口。
|
|
448
612
|
*/
|
|
449
613
|
export declare function createCli(): import("cac").CAC;
|
|
450
|
-
/**
|
|
451
|
-
* @description CLI 入口解析与分发。
|
|
452
|
-
*/
|
|
614
|
+
/** 在分发前剥离公共选择参数并固定本次安装。 */
|
|
453
615
|
export declare function parse(argv: string[]): Promise<void>;
|
|
454
616
|
//#endregion
|
|
455
617
|
//#region src/cli/run-automator.d.ts
|
|
@@ -468,32 +630,35 @@ export declare function getAutomatorCommandHelp(command: string): string | undef
|
|
|
468
630
|
export declare function runAutomatorCommand(command: string, argv: string[]): Promise<void>;
|
|
469
631
|
//#endregion
|
|
470
632
|
//#region src/cli/run-login.d.ts
|
|
471
|
-
export interface RunWechatCliWithRetryOptions {
|
|
633
|
+
export interface RunWechatCliWithRetryOptions extends WechatDevtoolsSelectionOptions {
|
|
634
|
+
target?: ResolvedWechatDevtoolsTarget;
|
|
472
635
|
silent?: boolean;
|
|
473
636
|
timeout?: number;
|
|
637
|
+
signal?: AbortSignal;
|
|
474
638
|
}
|
|
475
|
-
/**
|
|
476
|
-
* @description 运行微信开发者工具 CLI,并在登录失效时允许按键重试。
|
|
477
|
-
*/
|
|
639
|
+
/** 原生 CLI 可能启动或改变共享宿主,完整命令与有限重试共用机器租约。 */
|
|
478
640
|
export declare function runWechatCliWithRetry(cliPath: string, argv: string[], options?: RunWechatCliWithRetryOptions): Promise<void>;
|
|
479
641
|
//#endregion
|
|
480
642
|
//#region src/cli/run-login-executor.d.ts
|
|
481
643
|
export interface RetryableCommandExecutorOptions<TResult, TPromptResult> {
|
|
644
|
+
timeout?: number;
|
|
645
|
+
signal?: AbortSignal;
|
|
646
|
+
maxAttempts?: number;
|
|
647
|
+
disposeLate?: (result: TResult) => void | Promise<void>;
|
|
482
648
|
createCancelError: (result: TResult) => Error;
|
|
483
|
-
execute: () => Promise<TResult>;
|
|
649
|
+
execute: (operation: OperationLifecycle) => Promise<TResult>;
|
|
484
650
|
isRetryableResult: (result: TResult) => boolean;
|
|
485
651
|
onCancel?: (result: TResult) => void;
|
|
486
652
|
onRetry?: () => void;
|
|
487
|
-
promptRetry: (result: TResult, retryCount: number) => Promise<TPromptResult>;
|
|
653
|
+
promptRetry: (result: TResult, retryCount: number, operation: OperationLifecycle) => Promise<TPromptResult>;
|
|
488
654
|
shouldRetry: (result: TPromptResult) => boolean;
|
|
489
655
|
}
|
|
490
|
-
/**
|
|
491
|
-
* @description 执行可重试命令循环,并将“是否可重试”与“如何提示重试”交给调用方定义。
|
|
492
|
-
*/
|
|
656
|
+
/** 命令、登录提示和有限重试共用一个 deadline,取消信号由执行边界传入 I/O。 */
|
|
493
657
|
export declare function runRetryableCommand<TResult, TPromptResult>(options: RetryableCommandExecutorOptions<TResult, TPromptResult>): Promise<TResult>;
|
|
494
658
|
//#endregion
|
|
495
659
|
//#region src/cli/run-mcp.d.ts
|
|
496
660
|
export interface McpCommandOptions {
|
|
661
|
+
cliPath?: string;
|
|
497
662
|
workspaceRoot?: string;
|
|
498
663
|
}
|
|
499
664
|
export declare function runMcpCommand(argv: string[]): Promise<void>;
|
|
@@ -515,24 +680,24 @@ export declare function parseScreenshotArgs(argv: string[]): ScreenshotOptions;
|
|
|
515
680
|
export declare function validateWechatCliCommandArgs(argv: readonly string[]): void;
|
|
516
681
|
//#endregion
|
|
517
682
|
//#region src/cli/wechat-commands.d.ts
|
|
518
|
-
export interface LoginWechatIdeOptions {
|
|
683
|
+
export interface LoginWechatIdeOptions extends WechatDevtoolsSelectionOptions {
|
|
519
684
|
qrFormat?: 'base64' | 'image' | 'terminal';
|
|
520
685
|
qrOutput?: string;
|
|
521
686
|
qrSize?: string;
|
|
522
687
|
resultOutput?: string;
|
|
523
688
|
}
|
|
524
|
-
export interface OpenWechatIdeOptions {
|
|
689
|
+
export interface OpenWechatIdeOptions extends WechatDevtoolsSelectionOptions {
|
|
525
690
|
appid?: string;
|
|
526
691
|
extAppid?: string;
|
|
527
692
|
platform?: string;
|
|
528
693
|
projectPath?: string;
|
|
529
694
|
trustProject?: boolean;
|
|
530
695
|
}
|
|
531
|
-
export interface BuildWechatIdeNpmOptions {
|
|
696
|
+
export interface BuildWechatIdeNpmOptions extends WechatDevtoolsSelectionOptions {
|
|
532
697
|
compileType?: string;
|
|
533
698
|
projectPath?: string;
|
|
534
699
|
}
|
|
535
|
-
export interface PreviewWechatIdeOptions {
|
|
700
|
+
export interface PreviewWechatIdeOptions extends WechatDevtoolsSelectionOptions {
|
|
536
701
|
appid?: string;
|
|
537
702
|
compileCondition?: string;
|
|
538
703
|
extAppid?: string;
|
|
@@ -542,14 +707,14 @@ export interface PreviewWechatIdeOptions {
|
|
|
542
707
|
qrOutput?: string;
|
|
543
708
|
qrSize?: string;
|
|
544
709
|
}
|
|
545
|
-
export interface AutoPreviewWechatIdeOptions {
|
|
710
|
+
export interface AutoPreviewWechatIdeOptions extends WechatDevtoolsSelectionOptions {
|
|
546
711
|
appid?: string;
|
|
547
712
|
compileCondition?: string;
|
|
548
713
|
extAppid?: string;
|
|
549
714
|
infoOutput?: string;
|
|
550
715
|
projectPath?: string;
|
|
551
716
|
}
|
|
552
|
-
export interface UploadWechatIdeOptions {
|
|
717
|
+
export interface UploadWechatIdeOptions extends WechatDevtoolsSelectionOptions {
|
|
553
718
|
appid?: string;
|
|
554
719
|
desc: string;
|
|
555
720
|
extAppid?: string;
|
|
@@ -557,7 +722,7 @@ export interface UploadWechatIdeOptions {
|
|
|
557
722
|
projectPath?: string;
|
|
558
723
|
version: string;
|
|
559
724
|
}
|
|
560
|
-
export interface AutoWechatIdeOptions {
|
|
725
|
+
export interface AutoWechatIdeOptions extends WechatDevtoolsSelectionOptions {
|
|
561
726
|
account?: string;
|
|
562
727
|
appid?: string;
|
|
563
728
|
extAppid?: string;
|
|
@@ -567,7 +732,7 @@ export interface AutoWechatIdeOptions {
|
|
|
567
732
|
ticket?: string;
|
|
568
733
|
trustProject?: boolean;
|
|
569
734
|
}
|
|
570
|
-
export interface AutoReplayWechatIdeOptions {
|
|
735
|
+
export interface AutoReplayWechatIdeOptions extends WechatDevtoolsSelectionOptions {
|
|
571
736
|
account?: string;
|
|
572
737
|
appid?: string;
|
|
573
738
|
extAppid?: string;
|
|
@@ -579,16 +744,21 @@ export interface AutoReplayWechatIdeOptions {
|
|
|
579
744
|
ticket?: string;
|
|
580
745
|
trustProject?: boolean;
|
|
581
746
|
}
|
|
582
|
-
export interface OpenWechatIdeOtherProjectOptions {
|
|
747
|
+
export interface OpenWechatIdeOtherProjectOptions extends WechatDevtoolsSelectionOptions {
|
|
748
|
+
projectPath?: string;
|
|
749
|
+
}
|
|
750
|
+
export interface CloseWechatIdeProjectOptions extends WechatDevtoolsSelectionOptions {
|
|
583
751
|
projectPath?: string;
|
|
752
|
+
cliPath?: string;
|
|
753
|
+
target?: ResolvedWechatDevtoolsTarget;
|
|
584
754
|
}
|
|
585
|
-
export interface ClearWechatIdeCacheOptions {
|
|
755
|
+
export interface ClearWechatIdeCacheOptions extends WechatDevtoolsSelectionOptions {
|
|
586
756
|
clean: 'all' | 'auth' | 'compile' | 'file' | 'network' | 'session' | 'storage';
|
|
587
757
|
}
|
|
588
|
-
export interface ResetWechatIdeFileUtilsOptions {
|
|
758
|
+
export interface ResetWechatIdeFileUtilsOptions extends WechatDevtoolsSelectionOptions {
|
|
589
759
|
projectPath: string;
|
|
590
760
|
}
|
|
591
|
-
export interface WechatIdeAutomatorSessionOptions {
|
|
761
|
+
export interface WechatIdeAutomatorSessionOptions extends WechatDevtoolsSelectionOptions {
|
|
592
762
|
port?: number;
|
|
593
763
|
preferOpenedSession?: boolean;
|
|
594
764
|
preserveProjectRoot?: boolean;
|
|
@@ -606,7 +776,7 @@ export interface ClearWechatIdeCacheByAutomatorOptions extends WechatIdeAutomato
|
|
|
606
776
|
export interface SetWechatIdeTicketOptions extends WechatIdeAutomatorSessionOptions {
|
|
607
777
|
ticket: string;
|
|
608
778
|
}
|
|
609
|
-
export interface BuildWechatIdeApkOptions {
|
|
779
|
+
export interface BuildWechatIdeApkOptions extends WechatDevtoolsSelectionOptions {
|
|
610
780
|
desc?: string;
|
|
611
781
|
isUploadResourceBundle?: boolean;
|
|
612
782
|
keyAlias: string;
|
|
@@ -618,7 +788,7 @@ export interface BuildWechatIdeApkOptions {
|
|
|
618
788
|
storePass: string;
|
|
619
789
|
useAab?: boolean;
|
|
620
790
|
}
|
|
621
|
-
export interface BuildWechatIdeIpaOptions {
|
|
791
|
+
export interface BuildWechatIdeIpaOptions extends WechatDevtoolsSelectionOptions {
|
|
622
792
|
certificateName?: string;
|
|
623
793
|
isDistribute: boolean;
|
|
624
794
|
isRemoteBuild?: boolean;
|
|
@@ -635,9 +805,7 @@ export interface BuildWechatIdeIpaOptions {
|
|
|
635
805
|
versionDesc?: string;
|
|
636
806
|
versionName?: string;
|
|
637
807
|
}
|
|
638
|
-
/**
|
|
639
|
-
* @description 调用微信开发者工具 open 命令。
|
|
640
|
-
*/
|
|
808
|
+
/** 打开与兼容回退在同一机器租约内沿用固定安装,禁止重新选择宿主。 */
|
|
641
809
|
export declare function openWechatIde(options?: OpenWechatIdeOptions): Promise<void>;
|
|
642
810
|
/**
|
|
643
811
|
* @description 调用微信开发者工具 login 命令。
|
|
@@ -649,7 +817,7 @@ export declare function loginWechatIde(options?: LoginWechatIdeOptions): Promise
|
|
|
649
817
|
export declare function isWechatIdeLoggedIn(options?: {
|
|
650
818
|
nonInteractive?: boolean;
|
|
651
819
|
silent?: boolean;
|
|
652
|
-
}): Promise<void>;
|
|
820
|
+
} & WechatDevtoolsSelectionOptions): Promise<void>;
|
|
653
821
|
/**
|
|
654
822
|
* @description 调用微信开发者工具 build-npm 命令。
|
|
655
823
|
*/
|
|
@@ -677,11 +845,11 @@ export declare function uploadWechatIde(options: UploadWechatIdeOptions): Promis
|
|
|
677
845
|
/**
|
|
678
846
|
* @description 调用微信开发者工具 close 命令。
|
|
679
847
|
*/
|
|
680
|
-
export declare function closeWechatIdeProject(): Promise<void>;
|
|
848
|
+
export declare function closeWechatIdeProject(options?: CloseWechatIdeProjectOptions): Promise<void>;
|
|
681
849
|
/**
|
|
682
850
|
* @description 调用微信开发者工具 quit 命令。
|
|
683
851
|
*/
|
|
684
|
-
export declare function quitWechatIde(): Promise<void>;
|
|
852
|
+
export declare function quitWechatIde(options?: WechatDevtoolsSelectionOptions): Promise<void>;
|
|
685
853
|
/**
|
|
686
854
|
* @description 调用微信开发者工具 cache 命令。
|
|
687
855
|
*/
|
|
@@ -689,7 +857,7 @@ export declare function clearWechatIdeCache(options: ClearWechatIdeCacheOptions)
|
|
|
689
857
|
/**
|
|
690
858
|
* @description 调用微信开发者工具 open-other 命令。
|
|
691
859
|
*/
|
|
692
|
-
export declare function openWechatIdeOtherProject(
|
|
860
|
+
export declare function openWechatIdeOtherProject(options?: OpenWechatIdeOtherProjectOptions): Promise<void>;
|
|
693
861
|
/**
|
|
694
862
|
* @description 通过微信开发者工具 HTTP 服务端口重置指定项目的 fileutils 状态。
|
|
695
863
|
*/
|
|
@@ -738,14 +906,15 @@ export declare function buildWechatIdeIpa(options: BuildWechatIdeIpaOptions): Pr
|
|
|
738
906
|
export declare function dispatchWechatCliCommand(argv: string[]): Promise<boolean>;
|
|
739
907
|
//#endregion
|
|
740
908
|
//#region src/cli/wechatDevtoolsRuntimePort.d.ts
|
|
909
|
+
type PortTarget = Pick<ResolvedWechatDevtoolsTarget, 'installationId'>;
|
|
741
910
|
/**
|
|
742
|
-
* @description
|
|
911
|
+
* @description 标记所选安装检测到的服务端口;无身份的旧调用仅保留在独立兼容槽中。
|
|
743
912
|
*/
|
|
744
|
-
export declare function setRuntimeWechatDevtoolsServicePort(port: number | undefined): void;
|
|
913
|
+
export declare function setRuntimeWechatDevtoolsServicePort(port: number | undefined, target?: PortTarget): void;
|
|
745
914
|
/**
|
|
746
|
-
* @description
|
|
915
|
+
* @description 只读取所选安装的服务端口,不借用其他安装或无身份的旧记录。
|
|
747
916
|
*/
|
|
748
|
-
export declare function getRuntimeWechatDevtoolsServicePort(): number | undefined;
|
|
917
|
+
export declare function getRuntimeWechatDevtoolsServicePort(target?: PortTarget): number | undefined;
|
|
749
918
|
//#endregion
|
|
750
919
|
//#region src/cli/wechatDevtoolsSettings.d.ts
|
|
751
920
|
export interface WechatDevtoolsSecuritySettings {
|
|
@@ -758,10 +927,8 @@ export interface DetectedWechatDevtoolsServicePortSettings {
|
|
|
758
927
|
enabled?: boolean;
|
|
759
928
|
port?: number;
|
|
760
929
|
}
|
|
761
|
-
export interface DetectWechatDevtoolsServicePortOptions {
|
|
762
|
-
|
|
763
|
-
localAppDataDir?: string;
|
|
764
|
-
platform?: NodeJS.Platform;
|
|
930
|
+
export interface DetectWechatDevtoolsServicePortOptions extends ResolveWechatDevtoolsTargetOptions {
|
|
931
|
+
target?: ResolvedWechatDevtoolsTarget;
|
|
765
932
|
}
|
|
766
933
|
export interface DetectWechatDevtoolsServicePortResult {
|
|
767
934
|
touchedInstanceCount: number;
|
|
@@ -799,7 +966,7 @@ interface BaseConfig {
|
|
|
799
966
|
/**
|
|
800
967
|
* @description 配置来源
|
|
801
968
|
*/
|
|
802
|
-
type ConfigSource = 'custom' | 'default' | 'missing';
|
|
969
|
+
type ConfigSource = 'custom' | 'default' | 'environment' | 'missing';
|
|
803
970
|
/**
|
|
804
971
|
* @description 解析后的配置
|
|
805
972
|
*/
|
|
@@ -869,7 +1036,7 @@ export declare function resolveDevtoolsAutomationDefaults(config: {
|
|
|
869
1036
|
autoTrustProject: boolean;
|
|
870
1037
|
};
|
|
871
1038
|
/**
|
|
872
|
-
* @description 读取并解析 CLI
|
|
1039
|
+
* @description 读取并解析 CLI 配置(进程选择优先,其次用户配置与平台默认)
|
|
873
1040
|
*/
|
|
874
1041
|
export declare function getConfig(): Promise<ResolvedConfig>;
|
|
875
1042
|
/**
|
|
@@ -877,8 +1044,189 @@ export declare function getConfig(): Promise<ResolvedConfig>;
|
|
|
877
1044
|
*/
|
|
878
1045
|
export declare function getConfiguredLocale(): Promise<"zh" | "en" | undefined>;
|
|
879
1046
|
//#endregion
|
|
1047
|
+
//#region src/devtoolsProjectOwnership/types.d.ts
|
|
1048
|
+
interface ManagedWechatHostIdentity {
|
|
1049
|
+
pid: number;
|
|
1050
|
+
executable: string;
|
|
1051
|
+
started: string;
|
|
1052
|
+
}
|
|
1053
|
+
type ManagedWechatProjectState = 'starting' | 'unconfirmed' | 'owned' | 'borrowed' | 'closing' | 'failed' | 'released';
|
|
1054
|
+
interface ManagedWechatInstallationExitEvidence {
|
|
1055
|
+
protocol: 'wechat-devtools-installation-exit-v1';
|
|
1056
|
+
recoveredAt: string;
|
|
1057
|
+
recoveryScopeId: string;
|
|
1058
|
+
journalScopeId: string;
|
|
1059
|
+
journalRootPath: string;
|
|
1060
|
+
installationId: string;
|
|
1061
|
+
profileDir: string;
|
|
1062
|
+
previous: {
|
|
1063
|
+
state: 'starting' | 'unconfirmed' | 'failed' | 'borrowed';
|
|
1064
|
+
error?: string;
|
|
1065
|
+
updatedAt: string;
|
|
1066
|
+
recordSha256: string;
|
|
1067
|
+
};
|
|
1068
|
+
stoppedOwnerPids: number[];
|
|
1069
|
+
closedPorts: number[];
|
|
1070
|
+
processInspection: {
|
|
1071
|
+
platform: 'darwin';
|
|
1072
|
+
installationRoot: string;
|
|
1073
|
+
checkedAt: string;
|
|
1074
|
+
inspectedProcessCount: number;
|
|
1075
|
+
kernelPathProcessCount: number;
|
|
1076
|
+
textImageProcessCount: number;
|
|
1077
|
+
exitedProcessCount: number;
|
|
1078
|
+
zombieProcessCount: number;
|
|
1079
|
+
selectedProcessCount: 0;
|
|
1080
|
+
};
|
|
1081
|
+
}
|
|
1082
|
+
interface ManagedWechatWindowLogCursor {
|
|
1083
|
+
name: string;
|
|
1084
|
+
identity: string;
|
|
1085
|
+
offset: number;
|
|
1086
|
+
anchor: string;
|
|
1087
|
+
skipPartialLine: boolean;
|
|
1088
|
+
}
|
|
1089
|
+
interface ManagedWechatWindowCloseCall {
|
|
1090
|
+
fileIdentity: string;
|
|
1091
|
+
winId: string;
|
|
1092
|
+
browserWindowId: number;
|
|
1093
|
+
calledAt: string;
|
|
1094
|
+
cancelled?: boolean;
|
|
1095
|
+
}
|
|
1096
|
+
interface ManagedWechatWindowCloseEvidence {
|
|
1097
|
+
protocol: 'wechat-devtools-window-close-trace-v1';
|
|
1098
|
+
profileDir: string;
|
|
1099
|
+
productVersion: string;
|
|
1100
|
+
capturedAt: string;
|
|
1101
|
+
/** 活动日志按文件句柄捕获时,绑定实际持有日志的主进程身份。 */
|
|
1102
|
+
mainHost?: ManagedWechatHostIdentity;
|
|
1103
|
+
/** 关闭意图先于 CLI 落盘;未知执行结果不能再次按路径关闭窗口。 */
|
|
1104
|
+
dispatchedAt?: string;
|
|
1105
|
+
cursors: ManagedWechatWindowLogCursor[];
|
|
1106
|
+
calls: ManagedWechatWindowCloseCall[];
|
|
1107
|
+
window?: ManagedWechatWindowCloseCall & {
|
|
1108
|
+
runtimeId: string;
|
|
1109
|
+
requestedAt: string;
|
|
1110
|
+
nativeClosedAt?: string;
|
|
1111
|
+
webContentsDestroyedAt?: string;
|
|
1112
|
+
};
|
|
1113
|
+
failure?: string;
|
|
1114
|
+
/** 旧整目录门禁恢复时保留原失败和游标,不重新捕获偏移或重复关窗。 */
|
|
1115
|
+
logInventoryRecovery?: {
|
|
1116
|
+
failure: string;
|
|
1117
|
+
cursors: ManagedWechatWindowLogCursor[];
|
|
1118
|
+
};
|
|
1119
|
+
}
|
|
1120
|
+
interface ManagedWechatProjectSnapshot {
|
|
1121
|
+
protocol: 'wechat-devtools-project-snapshot-v1';
|
|
1122
|
+
sourceProjectPath: string;
|
|
1123
|
+
token: string;
|
|
1124
|
+
state: 'reserved' | 'ready' | 'removed';
|
|
1125
|
+
directoryIdentity?: {
|
|
1126
|
+
dev: string;
|
|
1127
|
+
ino: string;
|
|
1128
|
+
};
|
|
1129
|
+
dispatchedAt?: string;
|
|
1130
|
+
cleanupStartedAt?: string;
|
|
1131
|
+
removedAt?: string;
|
|
1132
|
+
cleanupError?: string;
|
|
1133
|
+
}
|
|
1134
|
+
interface ManagedWechatProjectRecord {
|
|
1135
|
+
schemaVersion: 1;
|
|
1136
|
+
id: string;
|
|
1137
|
+
generation: string;
|
|
1138
|
+
journalPath: string;
|
|
1139
|
+
ownerToken: string;
|
|
1140
|
+
ownerPid: number;
|
|
1141
|
+
target: ResolvedWechatDevtoolsTarget;
|
|
1142
|
+
projectPath: string;
|
|
1143
|
+
state: ManagedWechatProjectState;
|
|
1144
|
+
openedProjectWindow?: boolean;
|
|
1145
|
+
port?: number;
|
|
1146
|
+
/** 自动化端口的监听进程身份,可能是 backend;不能当作主宿主或窗口身份。 */
|
|
1147
|
+
host?: ManagedWechatHostIdentity;
|
|
1148
|
+
createdAt: string;
|
|
1149
|
+
updatedAt: string;
|
|
1150
|
+
closeAcknowledgedAt?: string;
|
|
1151
|
+
/** 端口退出不是窗口退出;保存所选 profile 的增量销毁证据供父任务恢复。 */
|
|
1152
|
+
windowClose?: ManagedWechatWindowCloseEvidence;
|
|
1153
|
+
releasedReason?: 'borrowed' | 'project-closed' | 'installation-exited' | 'not-started';
|
|
1154
|
+
/** 显式恢复只终结已退出安装的活资源;原启动失败与归属缺口仍保留。 */
|
|
1155
|
+
installationExitRecovery?: ManagedWechatInstallationExitEvidence;
|
|
1156
|
+
error?: string;
|
|
1157
|
+
snapshot?: ManagedWechatProjectSnapshot;
|
|
1158
|
+
}
|
|
1159
|
+
interface BeginManagedWechatProjectOptions {
|
|
1160
|
+
target: ResolvedWechatDevtoolsTarget;
|
|
1161
|
+
projectPath: string;
|
|
1162
|
+
generation?: string;
|
|
1163
|
+
port?: number;
|
|
1164
|
+
journalPath?: string;
|
|
1165
|
+
/** 当前任务根作用域最多持有一个窗口;双项目验收须显式指定两个。 */
|
|
1166
|
+
maxOwnedWindows?: 1 | 2;
|
|
1167
|
+
/** 将输入项目的布局快照持久绑定当前任务 owner。 */
|
|
1168
|
+
snapshotProject?: boolean;
|
|
1169
|
+
}
|
|
1170
|
+
interface ManagedWechatProjectIntent {
|
|
1171
|
+
id: string;
|
|
1172
|
+
journalPath: string;
|
|
1173
|
+
projectPath: string;
|
|
1174
|
+
prepareSnapshot: (populate: (projectPath: string) => Promise<void>) => Promise<void>;
|
|
1175
|
+
markLaunchDispatched: () => Promise<void>;
|
|
1176
|
+
confirm: (result: {
|
|
1177
|
+
openedProjectWindow: boolean;
|
|
1178
|
+
port: number;
|
|
1179
|
+
}) => Promise<void>;
|
|
1180
|
+
fail: (error: unknown) => Promise<void>;
|
|
1181
|
+
close: () => Promise<void>;
|
|
1182
|
+
}
|
|
1183
|
+
interface CleanupManagedWechatProjectsOptions {
|
|
1184
|
+
journalPath?: string;
|
|
1185
|
+
scope?: 'process' | 'journal';
|
|
1186
|
+
}
|
|
1187
|
+
//#endregion
|
|
1188
|
+
//#region src/devtoolsProjectOwnership/installationExit/index.d.ts
|
|
1189
|
+
export interface RecoverManagedWechatProjectsAfterInstallationExitOptions {
|
|
1190
|
+
target: ResolvedWechatDevtoolsTarget;
|
|
1191
|
+
recoveryScope: MachineE2ELeaseRecoveryScope;
|
|
1192
|
+
}
|
|
1193
|
+
export interface ManagedWechatInstallationExitRecoveryResult {
|
|
1194
|
+
recoveredRecordIds: string[];
|
|
1195
|
+
}
|
|
1196
|
+
/** 在精确恢复租约中终结已退出安装的未知启动或失败关窗;保留原证据,不补造销毁事件。 */
|
|
1197
|
+
export declare function recoverManagedWechatProjectsAfterInstallationExit(options: RecoverManagedWechatProjectsAfterInstallationExitOptions): Promise<ManagedWechatInstallationExitRecoveryResult>;
|
|
1198
|
+
//#endregion
|
|
1199
|
+
//#region src/devtoolsProjectOwnership/journal/constants.d.ts
|
|
1200
|
+
/** 受管项目日志的环境变量名称;基础设施预检可在构建包之前读取。 */
|
|
1201
|
+
export declare const MANAGED_PROJECT_JOURNAL_ENV = "WEAPP_IDE_MANAGED_PROJECT_JOURNAL";
|
|
1202
|
+
/** 仅供显式受管任务声明双项目窗口验收;不允许无限扩大并行窗口。 */
|
|
1203
|
+
export declare const MANAGED_PROJECT_MAX_WINDOWS_ENV = "WEAPP_IDE_MANAGED_PROJECT_MAX_WINDOWS";
|
|
1204
|
+
//#endregion
|
|
1205
|
+
//#region src/devtoolsProjectOwnership/journal.d.ts
|
|
1206
|
+
/** 仅递归当前任务明确传递的 children;不扫描用户缓存,不跟随符号链接。 */
|
|
1207
|
+
export declare function readManagedWechatProjectRecords(journalPath?: string): Promise<ManagedWechatProjectRecord[]>;
|
|
1208
|
+
//#endregion
|
|
1209
|
+
//#region src/devtoolsProjectOwnership/snapshot/index.d.ts
|
|
1210
|
+
/** 窗口已经释放不代表本任务快照也已回收。 */
|
|
1211
|
+
export declare function isManagedWechatProjectFullyReleased(record: {
|
|
1212
|
+
state: ManagedWechatProjectRecord['state'];
|
|
1213
|
+
snapshot?: Pick<NonNullable<ManagedWechatProjectRecord['snapshot']>, 'state'>;
|
|
1214
|
+
}): boolean;
|
|
1215
|
+
//#endregion
|
|
1216
|
+
//#region src/devtoolsProjectOwnership/index.d.ts
|
|
1217
|
+
/** 窗口销毁与连接断开分别验证;失败保留登记供后续继续观察。 */
|
|
1218
|
+
export declare function closeManagedWechatProject(options: {
|
|
1219
|
+
journalPath?: string;
|
|
1220
|
+
id: string;
|
|
1221
|
+
}): Promise<void>;
|
|
1222
|
+
/** 未启用受管日志时不改变公共共享会话;意图登记本身没有项目关闭权。 */
|
|
1223
|
+
export declare function beginManagedWechatProject(options: BeginManagedWechatProjectOptions): Promise<ManagedWechatProjectIntent | undefined>;
|
|
1224
|
+
/** 父进程可回收已退出工作进程的确认所有权;未知启动结果严格阻止后续任务。 */
|
|
1225
|
+
export declare function cleanupManagedWechatProjects(options?: CleanupManagedWechatProjectsOptions): Promise<void>;
|
|
1226
|
+
//#endregion
|
|
880
1227
|
//#region src/mcp/runtime.d.ts
|
|
881
1228
|
export interface StartWeappIdeMcpServerOptions {
|
|
1229
|
+
cliPath?: string;
|
|
882
1230
|
workspaceRoot?: string;
|
|
883
1231
|
}
|
|
884
1232
|
export declare function startWeappIdeMcpServer(options?: StartWeappIdeMcpServerOptions): Promise<{
|
|
@@ -890,14 +1238,7 @@ interface ToolRegistrar {
|
|
|
890
1238
|
registerTool: McpServer['registerTool'];
|
|
891
1239
|
}
|
|
892
1240
|
export interface WeappIdeMcpRuntimeHooks {
|
|
893
|
-
withMiniProgram: <T>(options:
|
|
894
|
-
preferOpenedSession?: boolean;
|
|
895
|
-
port?: number;
|
|
896
|
-
projectPath: string;
|
|
897
|
-
sharedSession?: boolean;
|
|
898
|
-
sessionId?: string;
|
|
899
|
-
timeout?: number;
|
|
900
|
-
}, runner: (miniProgram: MiniProgramLike) => Promise<T>) => Promise<T>;
|
|
1241
|
+
withMiniProgram: <T>(options: AutomatorSessionOptions, runner: (miniProgram: MiniProgramLike) => Promise<T>) => Promise<T>;
|
|
901
1242
|
}
|
|
902
1243
|
export interface WeappIdeMcpServerOptions {
|
|
903
1244
|
runtimeHooks: WeappIdeMcpRuntimeHooks;
|
|
@@ -962,12 +1303,15 @@ interface ExecuteOptions {
|
|
|
962
1303
|
pipeStdout?: boolean;
|
|
963
1304
|
pipeStderr?: boolean;
|
|
964
1305
|
timeout?: number;
|
|
1306
|
+
signal?: AbortSignal;
|
|
965
1307
|
}
|
|
966
1308
|
/**
|
|
967
1309
|
* @description 执行 CLI 命令并透传输出
|
|
968
1310
|
*/
|
|
969
1311
|
export declare function execute(cliPath: string, argv: string[], options?: ExecuteOptions): Promise<import("execa").Result<{
|
|
970
1312
|
timeout: number | undefined;
|
|
1313
|
+
cancelSignal: AbortSignal | undefined;
|
|
1314
|
+
forceKillAfterDelay: number;
|
|
971
1315
|
}>>;
|
|
972
1316
|
//#endregion
|
|
973
1317
|
//#region src/utils/path.d.ts
|
|
@@ -976,4 +1320,4 @@ export declare function execute(cliPath: string, argv: string[], options?: Execu
|
|
|
976
1320
|
*/
|
|
977
1321
|
export declare function resolvePath(filePath: string): string;
|
|
978
1322
|
//#endregion
|
|
979
|
-
export { type AutomatorSessionOptions, type BaseConfig, type ConfigSource, type DevtoolsConnectionInput, type DevtoolsContext, type DevtoolsElementSnapshot, type DevtoolsPageSnapshot, type DevtoolsToolResult, type MiniProgramElement, type MiniProgramEventMap, type MiniProgramLike, type MiniProgramPage, type ResolvedConfig, closeSharedMiniProgram, getSharedMiniProgramSessionCount, readElementSnapshot, releaseSharedMiniProgram, resolveProjectPath, toSerializableValue };
|
|
1323
|
+
export { type AutomatorSessionOptions, type BaseConfig, type BeginManagedWechatProjectOptions, type CleanupManagedWechatProjectsOptions, type ConfigSource, type DevtoolsConnectionInput, type DevtoolsContext, type DevtoolsElementSnapshot, type DevtoolsPageSnapshot, type DevtoolsToolResult, type ManagedWechatHostIdentity, type ManagedWechatInstallationExitEvidence, type ManagedWechatProjectIntent, type ManagedWechatProjectRecord, type ManagedWechatProjectSnapshot, type ManagedWechatProjectState, type ManagedWechatWindowCloseCall, type ManagedWechatWindowCloseEvidence, type ManagedWechatWindowLogCursor, type MiniProgramElement, type MiniProgramEventMap, type MiniProgramLike, type MiniProgramPage, type ResolveWechatDevtoolsTargetOptions, type ResolvedConfig, type ResolvedWechatDevtoolsTarget, type WechatDevtoolsChannel, type WechatDevtoolsHostInspectionOptions, type WechatDevtoolsInstallation, type WechatDevtoolsSelectionOptions, closeSharedMiniProgram, getSharedMiniProgramSessionCount, readElementSnapshot, releaseSharedMiniProgram, resolveProjectPath, toSerializableValue };
|