ms-vite-plugin 1.1.1 → 1.1.3

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.
Files changed (94) hide show
  1. package/dist/build.js +6 -0
  2. package/dist/cli.js +98 -8
  3. package/dist/mcp/device-config.d.ts +55 -0
  4. package/dist/mcp/device-config.js +183 -0
  5. package/dist/mcp/docs-service.d.ts +65 -0
  6. package/dist/mcp/docs-service.js +168 -0
  7. package/dist/mcp/project.d.ts +16 -0
  8. package/dist/mcp/project.js +74 -0
  9. package/dist/mcp/tools.d.ts +18 -0
  10. package/dist/mcp/tools.js +825 -0
  11. package/dist/mcp/types.d.ts +32 -0
  12. package/dist/mcp/types.js +11 -0
  13. package/dist/mcp-server.d.ts +2 -0
  14. package/dist/mcp-server.js +86 -0
  15. package/dist/project.d.ts +89 -0
  16. package/dist/project.js +306 -0
  17. package/dist/version.d.ts +12 -0
  18. package/dist/version.js +63 -0
  19. package/docs/api/action.md +922 -0
  20. package/docs/api/appleocr.md +229 -0
  21. package/docs/api/config.md +122 -0
  22. package/docs/api/cryptoUtils.md +232 -0
  23. package/docs/api/device.md +374 -0
  24. package/docs/api/file.md +516 -0
  25. package/docs/api/global.md +617 -0
  26. package/docs/api/hid.md +1032 -0
  27. package/docs/api/hotUpdate.md +166 -0
  28. package/docs/api/http.md +548 -0
  29. package/docs/api/image.md +907 -0
  30. package/docs/api/ime.md +290 -0
  31. package/docs/api/logger.md +324 -0
  32. package/docs/api/media.md +248 -0
  33. package/docs/api/mysql.md +441 -0
  34. package/docs/api/netCard.md +200 -0
  35. package/docs/api/node.md +353 -0
  36. package/docs/api/paddleocr.md +246 -0
  37. package/docs/api/pip.md +242 -0
  38. package/docs/api/system.md +572 -0
  39. package/docs/api/thread.md +269 -0
  40. package/docs/api/tomatoocr.md +425 -0
  41. package/docs/api/tts.md +334 -0
  42. package/docs/api/ui.md +947 -0
  43. package/docs/api/utils.md +265 -0
  44. package/docs/api/yolo.md +310 -0
  45. package/docs/apicn/action.md +919 -0
  46. package/docs/apicn/appleocr.md +233 -0
  47. package/docs/apicn/config.md +120 -0
  48. package/docs/apicn/device.md +385 -0
  49. package/docs/apicn/file.md +511 -0
  50. package/docs/apicn/global.md +613 -0
  51. package/docs/apicn/hid.md +1033 -0
  52. package/docs/apicn/hotUpdate.md +170 -0
  53. package/docs/apicn/http.md +672 -0
  54. package/docs/apicn/image.md +924 -0
  55. package/docs/apicn/ime.md +290 -0
  56. package/docs/apicn/logger.md +332 -0
  57. package/docs/apicn/media.md +252 -0
  58. package/docs/apicn/mysql.md +445 -0
  59. package/docs/apicn/netCard.md +200 -0
  60. package/docs/apicn/node.md +362 -0
  61. package/docs/apicn/paddleocr.md +255 -0
  62. package/docs/apicn/pip.md +242 -0
  63. package/docs/apicn/system.md +575 -0
  64. package/docs/apicn/thread.md +269 -0
  65. package/docs/apicn/tts.md +338 -0
  66. package/docs/apicn/ui.md +933 -0
  67. package/docs/apicn/utils.md +265 -0
  68. package/docs/apicn/yolo.md +314 -0
  69. package/docs/apipython/action.md +901 -0
  70. package/docs/apipython/appleocr.md +226 -0
  71. package/docs/apipython/config.md +126 -0
  72. package/docs/apipython/cryptoUtils.md +246 -0
  73. package/docs/apipython/device.md +365 -0
  74. package/docs/apipython/file.md +476 -0
  75. package/docs/apipython/g.md +154 -0
  76. package/docs/apipython/hid.md +1059 -0
  77. package/docs/apipython/hotUpdate.md +154 -0
  78. package/docs/apipython/image.md +938 -0
  79. package/docs/apipython/ime.md +306 -0
  80. package/docs/apipython/logger.md +330 -0
  81. package/docs/apipython/media.md +221 -0
  82. package/docs/apipython/mysql.md +432 -0
  83. package/docs/apipython/netCard.md +219 -0
  84. package/docs/apipython/node.md +331 -0
  85. package/docs/apipython/overview.md +66 -0
  86. package/docs/apipython/paddleocr.md +211 -0
  87. package/docs/apipython/pip.md +231 -0
  88. package/docs/apipython/system.md +458 -0
  89. package/docs/apipython/tomatoocr.md +444 -0
  90. package/docs/apipython/tts.md +331 -0
  91. package/docs/apipython/ui.md +949 -0
  92. package/docs/apipython/utils.md +284 -0
  93. package/docs/apipython/yolo.md +281 -0
  94. package/package.json +8 -4
@@ -0,0 +1,200 @@
1
+ # 卡密模块 (NetCard)
2
+
3
+ 卡密模块提供了卡密验证、备注设置以及键值对存储功能,用于管理网络卡密相关的操作。
4
+
5
+ ## 功能概览
6
+
7
+ - **卡密验证**: 验证卡密的有效性
8
+ - **备注管理**: 设置和管理卡密备注信息
9
+ - **云变量存储**: 提供键值对形式的数据存储和读取功能
10
+
11
+ ## 注意事项
12
+
13
+ 1. **卡密安全**: 卡密信息应当妥善保管,避免在日志中明文输出
14
+ 2. **API 调用顺序**: 验证卡密后,其他 api 才能调用
15
+
16
+ ## API 参考
17
+
18
+ ### 卡密验证
19
+
20
+ #### verify - 验证卡密
21
+
22
+ ```typescript
23
+ function verify(cardNo: string): boolean;
24
+ ```
25
+
26
+ **参数说明:**
27
+
28
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
29
+ | -------- | ------ | -------- | ------ | -------------------- |
30
+ | `cardNo` | string | 是 | | 需要验证的卡密字符串 |
31
+
32
+ **返回值:**
33
+
34
+ | 类型 | 描述 |
35
+ | --------- | ----------------------------------------------- |
36
+ | `boolean` | 验证结果,true 表示验证成功,false 表示验证失败 |
37
+
38
+ **示例 1:**
39
+
40
+ ```typescript
41
+ // 验证卡密
42
+ const cardNo = "ABC123456789";
43
+ const isValid = netCard.verify(cardNo);
44
+
45
+ if (isValid) {
46
+ logi("卡密验证成功");
47
+ } else {
48
+ logger.error("卡密验证失败");
49
+ // 注意卡密验证失败退出程序
50
+ exit();
51
+ }
52
+ ```
53
+
54
+ **示例 2:**
55
+
56
+ ```typescript
57
+ // 验证卡密 从配置中获取卡密
58
+ const cardNo = config.get("cardNo");
59
+ const isValid = netCard.verify(cardNo);
60
+
61
+ if (isValid) {
62
+ logi("卡密验证成功");
63
+ } else {
64
+ logger.error("卡密验证失败");
65
+ // 注意卡密验证失败退出程序
66
+ exit();
67
+ }
68
+ ```
69
+
70
+ ### 获取卡密信息
71
+
72
+ #### getCardInfo - 获取卡密信息
73
+
74
+ ```typescript
75
+ function getCardInfo(): CardInfo | null;
76
+ ```
77
+
78
+ **返回值:**
79
+
80
+ | 类型 | 描述 |
81
+ | ---------- | ------------------------------------ |
82
+ | `CardInfo` | 卡密信息对象,包含卡密及备注和时间等 |
83
+
84
+ `CardInfo` 字段:
85
+
86
+ - `cardNo`: 卡密号码
87
+ - `batchCard`: 批量码
88
+ - `remark`: 备注
89
+ - `activeTime`: 激活时间
90
+ - `expireTime`: 过期时间
91
+
92
+ **示例:**
93
+
94
+ ```typescript
95
+ // 获取卡密信息
96
+ const cardInfo = netCard.getCardInfo();
97
+ logi(JSON.stringify(cardInfo));
98
+ ```
99
+
100
+ ### 备注管理
101
+
102
+ #### setCardRemark - 设置卡密备注
103
+
104
+ ```typescript
105
+ function setCardRemark(remark: string): boolean;
106
+ ```
107
+
108
+ **参数说明:**
109
+
110
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
111
+ | -------- | ------ | -------- | ------ | -------------- |
112
+ | `remark` | string | 是 | | 备注信息字符串 |
113
+
114
+ **返回值:**
115
+
116
+ | 类型 | 描述 |
117
+ | --------- | ----------------------------------------------- |
118
+ | `boolean` | 设置结果,true 表示设置成功,false 表示设置失败 |
119
+
120
+ **示例:**
121
+
122
+ ```typescript
123
+ // 设置卡密备注
124
+ const remark = "测试用户卡密";
125
+ const success = netCard.setCardRemark(remark);
126
+
127
+ if (success) {
128
+ logi("备注设置成功");
129
+ } else {
130
+ logger.error("备注设置失败");
131
+ }
132
+ ```
133
+
134
+ ### 云变量
135
+
136
+ #### setValue - 设置键值对
137
+
138
+ ```typescript
139
+ function setValue(key: string, value: string): string;
140
+ ```
141
+
142
+ **参数说明:**
143
+
144
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
145
+ | ------- | ------ | -------- | ------ | ---------- |
146
+ | `key` | string | 是 | | 存储的键名 |
147
+ | `value` | string | 是 | | 存储的值 |
148
+
149
+ **返回值:**
150
+
151
+ | 类型 | 描述 |
152
+ | -------- | --------------------------------------------- |
153
+ | `string` | 成功时返回设置的 value 值,失败时返回空字符串 |
154
+
155
+ **示例:**
156
+
157
+ ```typescript
158
+ // 设置键值对
159
+ const key = "userConfig";
160
+ const value = "enableNotification";
161
+ const result = netCard.setValue(key, value);
162
+
163
+ if (result === value) {
164
+ logi(`成功设置 ${key}: ${value}`);
165
+ } else {
166
+ logger.error("设置失败");
167
+ }
168
+ ```
169
+
170
+ #### getValue - 获取键值对
171
+
172
+ ```typescript
173
+ function getValue(key: string): string;
174
+ ```
175
+
176
+ **参数说明:**
177
+
178
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
179
+ | ------ | ------ | -------- | ------ | ------------ |
180
+ | `key` | string | 是 | | 要获取的键名 |
181
+
182
+ **返回值:**
183
+
184
+ | 类型 | 描述 |
185
+ | -------- | ------------------------------------------------ |
186
+ | `string` | 成功时返回对应的值,失败或键不存在时返回空字符串 |
187
+
188
+ **示例:**
189
+
190
+ ```typescript
191
+ // 获取键值对
192
+ const key = "userConfig";
193
+ const value = netCard.getValue(key);
194
+
195
+ if (value) {
196
+ logi(`获取到配置: ${key} = ${value}`);
197
+ } else {
198
+ logw(`配置 ${key} 不存在或获取失败");
199
+ }
200
+ ```
@@ -0,0 +1,353 @@
1
+ # 节点模块 (Node)
2
+
3
+ 节点模块提供了强大的 UI 元素访问和操作功能,可以通过各种条件选择和操作界面元素。
4
+
5
+ **注意事项**
6
+
7
+ - 此模块仅支持 快点 Agent 模式使用
8
+ - 节点用完需要调用 `releaseNode` 方法释放内存,找完节点就能释放,不需要点击后释放
9
+
10
+ ## 节点选择器 (NodeSelector)
11
+
12
+ 节点选择器是访问 UI 元素的核心工具,提供了灵活的筛选和查找机制。
13
+
14
+ ### 创建节点选择器
15
+
16
+ #### createNodeSelector - 创建节点选择器
17
+
18
+ 创建一个新的节点选择器实例。
19
+
20
+ ```typescript
21
+ function createNodeSelector(params?: {
22
+ maxDepth?: number; // 最大层级深度,默认 50
23
+ }): NodeSelector;
24
+ ```
25
+
26
+ **参数说明:**
27
+
28
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
29
+ | ---------- | ------ | -------- | ------ | --------------------------- |
30
+ | `maxDepth` | number | 否 | 50 | 遍历的最大层级深度,默认 50 |
31
+
32
+ **返回值:**
33
+
34
+ | 类型 | 描述 |
35
+ | -------------- | ---------------------- |
36
+ | `NodeSelector` | 新创建的节点选择器实例 |
37
+
38
+ **示例:**
39
+
40
+ ```typescript
41
+ // 创建选择器
42
+ const selector = createNodeSelector({
43
+ maxDepth: 20, // 最大20层深度
44
+ });
45
+ ```
46
+
47
+ ### 节点信息接口
48
+
49
+ #### NodeBoundsInfo - 节点边界信息。
50
+
51
+ ```typescript
52
+ interface NodeBoundsInfo {
53
+ x: number; // x坐标
54
+ y: number; // y坐标
55
+ width: number; // 宽度
56
+ height: number; // 高度
57
+ centerX: number; // 中心点x坐标
58
+ centerY: number; // 中心点y坐标
59
+ }
60
+ ```
61
+
62
+ #### NodeInfo - 节点详细信息。
63
+
64
+ ```typescript
65
+ interface NodeInfo {
66
+ id: string; // 节点ID
67
+ identifier: string; // 节点标识符
68
+ label: string; // 节点标签
69
+ type: string; // 节点类型
70
+ value: string; // 节点值
71
+ placeholderValue: string; // 节点占位符值
72
+ title: string; // 节点名称
73
+ visible: boolean; // 是否可见
74
+ enabled: boolean; // 是否启用
75
+ bounds: NodeBoundsInfo; // 边界信息
76
+ depth: number; // 层级深度
77
+ index: number; // 索引
78
+ parentId: string; // 父节点ID
79
+ childCount: number; // 子节点数量
80
+
81
+ // 操作方法
82
+ clickCenter(): boolean; // 点击中心
83
+ clickRandom(): boolean; // 随机点击
84
+ hittable(): boolean; // 节点是否可接收事件,用于判断节点是否在屏幕可见
85
+ parent(): NodeInfo | null; // 获取父节点
86
+ child(index: number): NodeInfo | null; // 获取子节点
87
+ allChildren(): NodeInfo[]; // 获取所有子节点
88
+ siblings(): NodeInfo[]; // 获取兄弟节点
89
+ previousSiblings(): NodeInfo[]; // 获取前面的兄弟节点
90
+ nextSiblings(): NodeInfo[]; // 获取后面的兄弟节点
91
+ }
92
+ ```
93
+
94
+ ### 选择器方法
95
+
96
+ #### 获取节点
97
+
98
+ ```typescript
99
+ // releaseNode - 释放内存
100
+ releaseNode(): void;
101
+
102
+ // xml - 获取当前页面的 XML 字符串
103
+ xml(timeout?: number): string | null;
104
+
105
+ // 获取多个节点
106
+ getNodeInfo(timeout?: number): NodeInfo[]
107
+
108
+ // 获取单个节点
109
+ getOneNodeInfo(timeout?: number): NodeInfo | null
110
+
111
+ // 加载节点数据
112
+ loadNode(timeout?: number): NodeSelector;
113
+
114
+ // 清除所有选择条件
115
+ clearSelector(): NodeSelector;
116
+ ```
117
+
118
+ **示例:**
119
+
120
+ ```typescript
121
+ const selector = createNodeSelector();
122
+
123
+ // 获取所有匹配的节点
124
+ const allNodes = selector.getNodeInfo(5000);
125
+ logi(`找到 ${allNodes.length} 个节点`);
126
+
127
+ // 获取第一个匹配的节点
128
+ const firstNode = selector.getOneNodeInfo(3000);
129
+ if (firstNode) {
130
+ logi(`节点标签: ${firstNode.label}`);
131
+ }
132
+
133
+ selector.releaseNode();
134
+ ```
135
+
136
+ #### 条件筛选
137
+
138
+ ##### 文本相关
139
+
140
+ ```typescript
141
+ // 精确匹配标签
142
+ label(label: string): NodeSelector
143
+
144
+ // 标签模糊匹配
145
+ labelMatch(match: string): NodeSelector
146
+
147
+ // 精确匹配名称
148
+ title(title: string): NodeSelector
149
+
150
+ // 名称模糊匹配
151
+ titleMatch(match: string): NodeSelector
152
+
153
+ // 精确匹配标识符
154
+ identifier(identifier: string): NodeSelector
155
+
156
+ // 标识符模糊匹配
157
+ identifierMatch(match: string): NodeSelector
158
+
159
+ // 精确匹配值
160
+ value(value: string): NodeSelector
161
+
162
+ // 值模糊匹配
163
+ valueMatch(match: string): NodeSelector
164
+ ```
165
+
166
+ **示例:**
167
+
168
+ ```typescript
169
+ // 查找标签为"确定"的按钮
170
+ const confirmButton = selector.label("确定").getOneNodeInfo(3000);
171
+
172
+ // 查找包含"登录"的元素
173
+ const loginElements = selector.labelMatch(".*登录.*").getNodeInfo(3000);
174
+
175
+ // 查找名称包含"button"的元素
176
+ const buttons = selector.titleMatch("button").getNodeInfo(3000);
177
+
178
+ // 查找值为"submit"的元素
179
+ const submitElement = selector.value("submit").getOneNodeInfo(2000);
180
+
181
+ // 通过标识符查找
182
+ const elById = selector.identifier("login_btn").getOneNodeInfo(2000);
183
+ const fuzzy = selector.identifierMatch("^login_.*").getNodeInfo(3000);
184
+ ```
185
+
186
+ ##### 类型和属性
187
+
188
+ ```typescript
189
+ // 精确匹配类型
190
+ type(type: string): NodeSelector
191
+
192
+ // 类型模糊匹配
193
+ typeMatch(match: string): NodeSelector
194
+
195
+ // 启用状态
196
+ enabled(enabled: boolean): NodeSelector
197
+
198
+ // 可见性
199
+ visible(visible: boolean): NodeSelector
200
+ ```
201
+
202
+ **示例:**
203
+
204
+ ```typescript
205
+ const selector = createNodeSelector();
206
+ // 查找所有按钮
207
+ const allButtons = selector.type("XCUIElementTypeButton").getNodeInfo(3000);
208
+
209
+ // 查找所有文本框
210
+ const textFields = selector
211
+ .typeMatch("XCUIElementTypeTextField")
212
+ .getNodeInfo(3000);
213
+
214
+ // 查找启用的元素
215
+ const enabledElements = selector.enabled(true).getNodeInfo(3000);
216
+
217
+ selector.releaseNode();
218
+ ```
219
+
220
+ ##### 位置和结构
221
+
222
+ ```typescript
223
+ // 索引位置
224
+ index(index: number): NodeSelector
225
+
226
+ // 层级深度
227
+ depth(depth: number): NodeSelector
228
+
229
+ // 子节点数量
230
+ childCount(childCount: number | string): NodeSelector
231
+
232
+ // 边界范围
233
+ bounds(x: number, y: number, width: number, height: number): NodeSelector
234
+
235
+ // XPath 路径
236
+ xpath(path: string): NodeSelector
237
+ ```
238
+
239
+ **示例:**
240
+
241
+ ```typescript
242
+ const selector = createNodeSelector();
243
+
244
+ // 查找第一个元素
245
+ const firstElement = selector.index(0).getOneNodeInfo(2000);
246
+
247
+ // 查找特定深度的元素
248
+ const level3Elements = selector.depth(3).getNodeInfo(3000);
249
+
250
+ // 查找有子节点的元素
251
+ const parentElements = selector.childCount(">0").getNodeInfo(3000);
252
+
253
+ // 查找特定区域的元素
254
+ const regionElements = selector.bounds(100, 100, 200, 50).getNodeInfo(3000);
255
+
256
+ // 使用 XPath 查找
257
+ const xpathElements = selector.xpath("//*[@title='快点JS']").getNodeInfo(3000);
258
+
259
+ selector.releaseNode();
260
+ ```
261
+
262
+ ### 节点操作
263
+
264
+ #### 点击操作
265
+
266
+ ```typescript
267
+ // 点击节点中心
268
+ node.clickCenter(): boolean;
269
+
270
+ // 随机点击节点区域
271
+ node.clickRandom(): boolean;
272
+
273
+ // 节点是否可接收事件(用于判断是否显示在屏幕上)
274
+ node.hittable(): boolean;
275
+ ```
276
+
277
+ **示例:**
278
+
279
+ ```typescript
280
+ const selector = createNodeSelector();
281
+
282
+ // 查找并点击确定按钮
283
+ const confirmBtn = selector
284
+ .label("确定")
285
+ .type("XCUIElementTypeButton")
286
+ .getOneNodeInfo(3000);
287
+
288
+ if (confirmBtn) {
289
+ const isHittable = confirmBtn.hittable();
290
+ logi(`是否可接收事件: ${isHittable}`);
291
+
292
+ const clicked = confirmBtn.clickCenter();
293
+ if (clicked) {
294
+ logi("成功点击确定按钮");
295
+ }
296
+ }
297
+
298
+ // 随机点击避免检测
299
+ const randomClick = confirmBtn?.clickRandom();
300
+
301
+ selector.releaseNode();
302
+ ```
303
+
304
+ #### 节点导航
305
+
306
+ ```typescript
307
+ // 获取父节点
308
+ node.parent(): NodeInfo | null
309
+
310
+ // 获取指定索引的子节点
311
+ node.child(index: number): NodeInfo | null
312
+
313
+ // 获取所有子节点
314
+ node.allChildren(): NodeInfo[]
315
+
316
+ // 获取兄弟节点
317
+ node.siblings(): NodeInfo[]
318
+
319
+ // 获取前面的兄弟节点
320
+ node.previousSiblings(): NodeInfo[]
321
+
322
+ // 获取后面的兄弟节点
323
+ node.nextSiblings(): NodeInfo[]
324
+ ```
325
+
326
+ **示例:**
327
+
328
+ ```typescript
329
+ const selector = createNodeSelector();
330
+
331
+ // 查找输入框并获取其父容器
332
+ const textField = selector
333
+ .type("XCUIElementTypeTextField")
334
+ .getOneNodeInfo(3000);
335
+
336
+ if (textField) {
337
+ const container = textField.parent();
338
+ if (container) {
339
+ logi(`容器类型: ${container.type}`);
340
+
341
+ // 获取容器的所有子元素
342
+ const siblings = container.allChildren();
343
+ logi(`容器包含 ${siblings.length} 个子元素`);
344
+
345
+ // 查找同级的按钮
346
+ const siblingButtons = siblings.filter(
347
+ (node) => node.type === "XCUIElementTypeButton"
348
+ );
349
+ }
350
+ }
351
+
352
+ selector.releaseNode();
353
+ ```