ms-vite-plugin 1.4.49 → 1.4.51

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 (42) hide show
  1. package/dist/build.js +1 -1
  2. package/dist/cli.js +1 -1
  3. package/dist/mcp/doc-tools.js +1 -1
  4. package/dist/mcp/docs-service.js +1 -1
  5. package/dist/mcp/types.d.ts +1 -1
  6. package/dist/mcp/types.js +1 -1
  7. package/dist/project.js +1 -1
  8. package/docs/AGENTS.md +3 -2
  9. package/docs/SKILL.md +2 -1
  10. package/docs/apilua/action.md +1013 -0
  11. package/docs/apilua/appleocr.md +281 -0
  12. package/docs/apilua/cloud.md +183 -0
  13. package/docs/apilua/config.md +181 -0
  14. package/docs/apilua/cryptoUtils.md +253 -0
  15. package/docs/apilua/device.md +485 -0
  16. package/docs/apilua/dotocr.md +230 -0
  17. package/docs/apilua/file.md +554 -0
  18. package/docs/apilua/global.md +654 -0
  19. package/docs/apilua/hid.md +1126 -0
  20. package/docs/apilua/hotUpdate.md +167 -0
  21. package/docs/apilua/http.md +427 -0
  22. package/docs/apilua/image.md +1177 -0
  23. package/docs/apilua/ime.md +283 -0
  24. package/docs/apilua/logger.md +294 -0
  25. package/docs/apilua/media.md +283 -0
  26. package/docs/apilua/mysql.md +445 -0
  27. package/docs/apilua/netCard.md +224 -0
  28. package/docs/apilua/node.md +264 -0
  29. package/docs/apilua/opencv.md +870 -0
  30. package/docs/apilua/paddleocr.md +324 -0
  31. package/docs/apilua/pip.md +359 -0
  32. package/docs/apilua/system.md +686 -0
  33. package/docs/apilua/tomatoocr.md +461 -0
  34. package/docs/apilua/tts.md +330 -0
  35. package/docs/apilua/ui.md +1033 -0
  36. package/docs/apilua/utils.md +222 -0
  37. package/docs/apilua/yolo.md +324 -0
  38. package/docs/apilua/yolocls.md +276 -0
  39. package/docs/mcp-agent-description.md +5 -4
  40. package/docs/quick/vscode/createProject.md +84 -0
  41. package/docs/quick/vscode/packProject.md +17 -0
  42. package/package.json +2 -1
@@ -0,0 +1,224 @@
1
+ # 卡密模块 (NetCard)
2
+
3
+ 卡密模块提供了卡密验证、备注设置以及键值对存储功能,用于管理网络卡密相关的操作。
4
+
5
+ ## 功能概览
6
+
7
+ - **卡密验证**: 验证卡密的有效性
8
+ - **备注管理**: 设置和管理卡密备注信息
9
+ - **云变量存储**: 提供键值对形式的数据存储和读取功能
10
+
11
+ ## 注意事项
12
+
13
+ 1. **卡密安全**: 卡密信息应当妥善保管,避免在日志中明文输出
14
+ 2. **普通卡密模式**: 需要先调用 `netCard.verify(cardNo)` 验证卡密,验证通过后才能调用获取卡密信息、备注和云变量等接口
15
+ 3. **授权卡密模式**: App 打开加密 UI 或运行脚本前会完成授权和卡密验证,脚本中不需要重复让用户输入卡密,也不需要重复调用 `netCard.verify`
16
+ 4. **兼容旧脚本**: 授权卡密模式下调用 `netCard.verify` 会直接返回 `true`,用于兼容原来已经写了 `verify` 的脚本
17
+
18
+ ## API 参考
19
+
20
+ ### 卡密验证
21
+
22
+ #### isAuthCardMode - 判断是否为授权卡密模式
23
+
24
+ ```lua
25
+ ---@return boolean
26
+ function isAuthCardMode() end
27
+ ```
28
+
29
+ **示例:**
30
+
31
+ ```lua
32
+ local netcard = require("netcard")
33
+ if netcard.isAuthCardMode() then
34
+ print("当前为授权卡密模式,不需要重复调用 verify")
35
+ end
36
+ ```
37
+
38
+ #### verify - 验证卡密
39
+
40
+ ```lua
41
+ ---@param cardNo string
42
+ ---@return boolean
43
+ function verify(cardNo) end
44
+ ```
45
+
46
+ **参数说明:**
47
+
48
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
49
+ | -------- | ------ | -------- | ------ | -------------------- |
50
+ | `cardNo` | string | 是 | | 需要验证的卡密字符串 |
51
+
52
+ **返回值:**
53
+
54
+ | 类型 | 描述 |
55
+ | --------- | ----------------------------------------------- |
56
+ | `boolean` | 验证结果,true 表示验证成功,false 表示验证失败 |
57
+
58
+ **说明:**
59
+
60
+ 普通卡密模式下,该方法会请求普通卡密验证接口,验证成功后才能继续使用卡密信息、备注和云变量相关能力。
61
+
62
+ 授权卡密模式下,App 层已经完成授权和卡密验证,脚本侧不需要重复调用该方法;如果旧脚本仍然调用,方法会直接返回 `true`。
63
+
64
+ **示例 1:普通卡密模式**
65
+
66
+ ```lua
67
+ local netcard = require("netcard")
68
+ -- 验证卡密
69
+ local cardNo = "ABC123456789"
70
+ local isValid = netcard.verify(cardNo)
71
+
72
+ if isValid then
73
+ print("卡密验证成功")
74
+ else
75
+ logger.error("卡密验证失败")
76
+ -- 注意卡密验证失败退出程序
77
+ return
78
+ end
79
+ ```
80
+
81
+
82
+ ### 获取卡密信息
83
+
84
+ #### getCardInfo - 获取卡密信息
85
+
86
+ ```lua
87
+ ---@return CardInfo | nil
88
+ function getCardInfo() end
89
+ ```
90
+
91
+ **返回值:**
92
+
93
+ | 类型 | 描述 |
94
+ | ---------- | ------------------------------------ |
95
+ | `CardInfo` | 卡密信息对象,包含卡密及备注和时间等 |
96
+
97
+ `CardInfo` 字段:
98
+
99
+ - `cardNo`: 卡密号码
100
+ - `batchCard`: 批量码
101
+ - `remark`: 备注
102
+ - `activeTime`: 激活时间
103
+ - `expireTime`: 过期时间
104
+
105
+ **示例:**
106
+
107
+ ```lua
108
+ local netcard = require("netcard")
109
+ -- 获取卡密信息
110
+ local cardInfo = netcard.getCardInfo()
111
+ print(ToJsonString(cardInfo))
112
+ ```
113
+
114
+ ### 备注管理
115
+
116
+ #### setCardRemark - 设置卡密备注
117
+
118
+ ```lua
119
+ ---@param remark string
120
+ ---@return boolean
121
+ function setCardRemark(remark) end
122
+ ```
123
+
124
+ **参数说明:**
125
+
126
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
127
+ | -------- | ------ | -------- | ------ | -------------- |
128
+ | `remark` | string | 是 | | 备注信息字符串 |
129
+
130
+ **返回值:**
131
+
132
+ | 类型 | 描述 |
133
+ | --------- | ----------------------------------------------- |
134
+ | `boolean` | 设置结果,true 表示设置成功,false 表示设置失败 |
135
+
136
+ **示例:**
137
+
138
+ ```lua
139
+ local netcard = require("netcard")
140
+ -- 设置卡密备注
141
+ local remark = "测试用户卡密"
142
+ local success = netcard.setCardRemark(remark)
143
+
144
+ if success then
145
+ print("备注设置成功")
146
+ else
147
+ logger.error("备注设置失败")
148
+ end
149
+ ```
150
+
151
+ ### 云变量
152
+
153
+ #### setValue - 设置键值对
154
+
155
+ ```lua
156
+ ---@param key string
157
+ ---@param value string
158
+ ---@return string
159
+ function setValue(key, value) end
160
+ ```
161
+
162
+ **参数说明:**
163
+
164
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
165
+ | ------- | ------ | -------- | ------ | ---------- |
166
+ | `key` | string | 是 | | 存储的键名 |
167
+ | `value` | string | 是 | | 存储的值 |
168
+
169
+ **返回值:**
170
+
171
+ | 类型 | 描述 |
172
+ | -------- | --------------------------------------------- |
173
+ | `string` | 成功时返回设置的 value 值,失败时返回空字符串 |
174
+
175
+ **示例:**
176
+
177
+ ```lua
178
+ local netcard = require("netcard")
179
+ -- 设置键值对
180
+ local key = "userConfig"
181
+ local value = "enableNotification"
182
+ local result = netcard.setValue(key, value)
183
+
184
+ if result == value then
185
+ print("成功设置 [" .. tostring(key) .. "] = " .. tostring(value))
186
+ else
187
+ logger.error("设置失败")
188
+ end
189
+ ```
190
+
191
+ #### getValue - 获取键值对
192
+
193
+ ```lua
194
+ ---@param key string
195
+ ---@return string
196
+ function getValue(key) end
197
+ ```
198
+
199
+ **参数说明:**
200
+
201
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
202
+ | ------ | ------ | -------- | ------ | ------------ |
203
+ | `key` | string | 是 | | 要获取的键名 |
204
+
205
+ **返回值:**
206
+
207
+ | 类型 | 描述 |
208
+ | -------- | ------------------------------------------------ |
209
+ | `string` | 成功时返回对应的值,失败或键不存在时返回空字符串 |
210
+
211
+ **示例:**
212
+
213
+ ```lua
214
+ local netcard = require("netcard")
215
+ -- 获取键值对
216
+ local key = "userConfig"
217
+ local value = netcard.getValue(key)
218
+
219
+ if value then
220
+ print("获取到配置: " .. tostring(key) .. " = " .. tostring(value))
221
+ else
222
+ print("配置 " .. tostring(key) .. " 不存在或获取失败")
223
+ end
224
+ ```
@@ -0,0 +1,264 @@
1
+ # 节点模块 (Node)
2
+
3
+ 用于查找和操作当前界面上的控件节点。
4
+
5
+ **注意**
6
+
7
+ - 仅支持快点 Agent 模式
8
+ - 用完调用 `releaseNode()` 释放;找完节点即可释放,不必等点击结束
9
+
10
+ **基本流程**
11
+
12
+ ```text
13
+ createNodeSelector → 设置筛选条件 → getOneNodeInfo / getNodeInfo
14
+ → 点击 / 输入 / 设值等 → releaseNode
15
+ ```
16
+
17
+ ---
18
+
19
+ ## 创建选择器
20
+
21
+ ```lua
22
+ ---@param params table?
23
+ ---@return NodeSelector
24
+ function node.createNodeSelector(params) end
25
+ ```
26
+
27
+ | 参数 | 默认 | 说明 |
28
+ | --- | --- | --- |
29
+ | `maxDepth` | `50` | 抓取深度,深层控件抓不到时可调大 |
30
+ | `mode` | `1` | 抓取模式,可选 `1` / `2` / `3`,默认 `1` |
31
+
32
+ ```lua
33
+ local selector = node.createNodeSelector()
34
+ local shallow = node.createNodeSelector({ maxDepth = 15 })
35
+ local listPage = node.createNodeSelector({ mode = 2 })
36
+ ```
37
+
38
+ ---
39
+
40
+ ## 节点信息
41
+
42
+ ### 位置 `NodeBoundsInfo`
43
+
44
+ | 字段 | 说明 |
45
+ | --- | --- |
46
+ | `x` / `y` | 左上角 |
47
+ | `width` / `height` | 宽高 |
48
+ | `centerX` / `centerY` | 中心点 |
49
+
50
+ ### 节点 `NodeInfo`
51
+
52
+ **属性**
53
+
54
+ | 字段 | 说明 |
55
+ | --- | --- |
56
+ | `id` | 节点 ID(内部定位用,不要改) |
57
+ | `identifier` | 控件标识符 |
58
+ | `label` | 标签文案 |
59
+ | `type` | 类型,如 `XCUIElementTypeButton` |
60
+ | `value` | 当前值 |
61
+ | `title` | 标题 |
62
+ | `enabled` | 是否启用 |
63
+ | `visible` | 是否可见 |
64
+ | `bounds` | 位置大小 |
65
+ | `depth` | 层级 |
66
+ | `index` | 在父节点下的序号 |
67
+ | `parentId` | 父节点 ID |
68
+ | `childCount` | 子节点数量 |
69
+
70
+ **方法**
71
+
72
+ | 方法 | 说明 |
73
+ | --- | --- |
74
+ | `clickCenter()` | 点击中心坐标(坐标点击,不会自动滚动) |
75
+ | `clickRandom()` | 在节点范围内随机点击(坐标点击,不会自动滚动) |
76
+ | `parent()` | 父节点 |
77
+ | `child(index)` | 第 `index` 个子节点 |
78
+ | `allChildren()` | 全部子节点 |
79
+ | `siblings()` | 全部兄弟节点 |
80
+ | `previousSiblings()` | 前面的兄弟 |
81
+ | `nextSiblings()` | 后面的兄弟 |
82
+
83
+ ---
84
+
85
+ ## 选择器方法
86
+
87
+ ### 加载与结果
88
+
89
+ | 方法 | 说明 |
90
+ | --- | --- |
91
+ | `releaseNode()` | 释放内存 |
92
+ | `loadNode(timeout?)` | 重新加载界面节点,默认超时 5000ms |
93
+ | `clearSelector()` | 清除已设置的筛选条件 |
94
+ | `xml(timeout?)` | 获取界面 XML,失败返回 `nil` |
95
+ | `getNodeInfo(timeout?)` | 获取所有匹配节点 |
96
+ | `getOneNodeInfo(timeout?)` | 获取第一个匹配节点,没有则 `nil` |
97
+
98
+ `timeout` 单位均为毫秒,默认 `5000`。
99
+
100
+ ```lua
101
+ local selector = node.createNodeSelector()
102
+ local nodes = selector:label("确定"):getNodeInfo(5000)
103
+ local one = selector:getOneNodeInfo(3000)
104
+ local xml = selector:xml()
105
+ selector:releaseNode()
106
+ ```
107
+
108
+ ### 筛选条件
109
+
110
+ 可链式调用,多个条件同时满足(并且关系)。
111
+ 带 `Match` 的为模糊/正则匹配。
112
+
113
+ **文本**
114
+
115
+ | 方法 | 说明 |
116
+ | --- | --- |
117
+ | `label` / `labelMatch` | 标签 |
118
+ | `title` / `titleMatch` | 标题 |
119
+ | `identifier` / `identifierMatch` | 标识符 |
120
+ | `value` / `valueMatch` | 值 |
121
+
122
+ **类型与状态**
123
+
124
+ | 方法 | 说明 |
125
+ | --- | --- |
126
+ | `type` / `typeMatch` | 类型,如 `XCUIElementTypeButton` |
127
+ | `enabled` | 是否启用 |
128
+ | `visible` | 是否可见 |
129
+
130
+ **位置与结构**
131
+
132
+ | 方法 | 说明 |
133
+ | --- | --- |
134
+ | `index` | 序号 |
135
+ | `depth` | 层级 |
136
+ | `childCount` | 子节点数,支持数字或如 `">0"` |
137
+ | `bounds(x, y, width, height)` | 区域 |
138
+ | `xpath` | XPath |
139
+ | `id` | 按节点 ID |
140
+
141
+ ```lua
142
+ -- 精确
143
+ selector:label("确定"):type("XCUIElementTypeButton"):getOneNodeInfo(3000)
144
+ -- 模糊
145
+ selector:labelMatch(".*登录.*"):getNodeInfo(3000)
146
+ selector:identifierMatch("^login_"):getNodeInfo(3000)
147
+ -- 组合
148
+ selector
149
+ :type("XCUIElementTypeTextField")
150
+ :enabled(true)
151
+ :getOneNodeInfo(3000)
152
+ ```
153
+
154
+ 常见类型:`XCUIElementTypeButton`、`StaticText`、`TextField`、`SecureTextField`、`TextView`、`SearchField`、`Cell`、`Table`、`CollectionView`、`PickerWheel`、`Switch`、`Slider` 等。
155
+
156
+ ---
157
+
158
+ ## 节点操作说明
159
+
160
+ ### 点击
161
+
162
+ | 方法 | 说明 |
163
+ | --- | --- |
164
+ | `clickCenter()` | 点中心坐标,不自动滚动 |
165
+ | `clickRandom()` | 范围内随机点,不自动滚动 |
166
+
167
+ 输入请配合 `ime` 或 `action.input`。
168
+
169
+ ```lua
170
+ local node = require("node")
171
+ local selector = node.createNodeSelector()
172
+ local btn = selector:label("确定"):type("XCUIElementTypeButton"):getOneNodeInfo(3000)
173
+
174
+ if btn then
175
+ btn:clickCenter()
176
+ end
177
+ ```
178
+
179
+
180
+ ### 树导航
181
+
182
+ ```lua
183
+ local field = selector:type("XCUIElementTypeTextField"):getOneNodeInfo(3000)
184
+ if field then
185
+ local parent = field:parent()
186
+ local children = parent:allChildren() or []
187
+ local prev = field:previousSiblings()
188
+ local next = field:nextSiblings()
189
+ local second = parent:child(1)
190
+ end
191
+ ```
192
+
193
+ ---
194
+
195
+ ## 示例
196
+
197
+ ### 登录
198
+
199
+ ```lua
200
+ local node = require("node")
201
+ local ime = require("ime")
202
+ local selector = node.createNodeSelector()
203
+
204
+ local user = selector:type("XCUIElementTypeTextField"):getOneNodeInfo(5000)
205
+ if user then
206
+ user:clickCenter()
207
+ ime.clearText()
208
+ ime.input("demo_user")
209
+ end
210
+
211
+ local pass = selector
212
+ :clearSelector()
213
+ :type("XCUIElementTypeSecureTextField")
214
+ :getOneNodeInfo(3000)
215
+ if pass then
216
+ pass:clickCenter()
217
+ ime.clearText()
218
+ ime.input("password")
219
+ end
220
+
221
+ local login = selector
222
+ :clearSelector()
223
+ :labelMatch(".*登录.*")
224
+ :type("XCUIElementTypeButton")
225
+ :getOneNodeInfo(3000)
226
+ if login then
227
+ login:clickCenter()
228
+ end
229
+ ```
230
+
231
+ ### 列表里靠后的项
232
+
233
+ ```lua
234
+ local node = require("node")
235
+ local selector = node.createNodeSelector({ mode = 2 })
236
+ local item = selector:label("第 30 项"):getOneNodeInfo(5000)
237
+ if item then
238
+ item:clickCenter()
239
+ end
240
+ ```
241
+
242
+ ### 查看界面结构
243
+
244
+ ```lua
245
+ local selector = node.createNodeSelector()
246
+ local xml = selector:xml(8000)
247
+ if xml then
248
+ print(xml)
249
+ end
250
+ selector:releaseNode()
251
+ ```
252
+
253
+ ---
254
+
255
+ ## 常见问题
256
+
257
+ **找不到节点**
258
+ 加大超时;减少条件或改用 `*Match`;换 `mode`;用 `xml()` 看实际文案和类型。
259
+
260
+ **点了没反应**
261
+ 确认点到的是目标控件;用 `clickCenter()` / `clickRandom()` 按坐标点击。
262
+
263
+ **输入叠在旧文字后面**
264
+ 节点没有输入方法,请先 `ime.clearText()` 再 `ime.input()`。