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,281 @@
1
+ # AppleOCR 模块
2
+
3
+ AppleOCR 模块基于 Apple Vision 框架,提供原生的光学字符识别(OCR)功能。该模块利用 iOS 系统内置的机器学习能力,无需额外模型文件,具有高效、准确的特点。
4
+
5
+ <span style="color: red;">此模块仅支持 iOS 系统。</span>
6
+
7
+ ## 核心特性
8
+
9
+ ### 🚀 性能优势
10
+
11
+ - **原生支持**: 基于 Apple Vision 框架,无需额外模型文件
12
+ - **高性能**: 利用 iOS 系统优化,识别速度快
13
+ - **低资源占用**: 无需加载大型模型文件
14
+
15
+ ### 🌍 多语言支持
16
+
17
+ - **默认语言**: 中文和英文(["zh-Hans", "en-US"])
18
+ - **支持语言**: ["en-US", "fr-FR", "it-IT", "de-DE", "es-ES", "pt-BR", "zh-Hans", "zh-Hant"]
19
+
20
+ ### 📱 多种输入源
21
+
22
+ - **屏幕截图**: 直接识别当前屏幕内容
23
+ - **图片文件**: 支持本地图片文件路径
24
+ - **图片 ID**: 通过 image 模块获取的图片 ID
25
+ - **区域识别**: 支持指定区域的精确文字识别
26
+
27
+ ## 数据类型
28
+
29
+ ### OCRResult
30
+
31
+ 识别结果对象,包含以下属性:
32
+
33
+ ```lua
34
+ ---@class OCRResult
35
+ ---@field text string 识别的文本内容
36
+ ---@field confidence number 识别置信度 (0-1)
37
+ ---@field x number 文本区域左上角 x 坐标
38
+ ---@field y number 文本区域左上角 y 坐标
39
+ ---@field width number 文本区域宽度
40
+ ---@field height number 文本区域高度
41
+ ---@field ex number 文本区域右下角 x 坐标
42
+ ---@field ey number 文本区域右下角 y 坐标
43
+ ---@field centerX number 文本区域中心点 x 坐标
44
+ ---@field centerY number 文本区域中心点 y 坐标
45
+ ```
46
+
47
+ **字段说明:**
48
+
49
+ | 参数名 | 类型 | 描述 |
50
+ | ------------------- | ------ | -------------------------------------- |
51
+ | `text` | string | 识别的文本内容 |
52
+ | `confidence` | number | 识别置信度 (0-1),值越高表示识别越准确 |
53
+ | `x`, `y` | number | 文本区域左上角坐标 |
54
+ | `width`, `height` | number | 文本区域宽度和高度 |
55
+ | `ex`, `ey` | number | 文本区域右下角坐标 |
56
+ | `centerX`, `centerY` | number | 文本区域中心点坐标 |
57
+
58
+ ## API 参考
59
+
60
+ ### 文字识别
61
+
62
+ #### recognize - 执行 OCR 识别。
63
+
64
+ 执行 OCR 识别。传入裁剪区域时,返回坐标相对于裁剪区域。全屏识别时 `x/y/ex/ey` 传 `0`。
65
+
66
+ ```lua
67
+ ---@param input string
68
+ ---@param x number?
69
+ ---@param y number?
70
+ ---@param ex number?
71
+ ---@param ey number?
72
+ ---@param languages string[]?
73
+ ---@return OCRResult[]
74
+ function recognize(input, x, y, ex, ey, languages) end
75
+ ```
76
+
77
+ **参数:**
78
+
79
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
80
+ | ----------- | -------- | -------- | ----------------------- | ------------------------------------------------------------------------------------------------------- |
81
+ | `input` | string | 是 | | 输入源,支持 `"screen"`、图片文件路径、URL 字符串或 imageId |
82
+ | `x` | number | 否 | 0 | 裁剪区域左上角 x 坐标;全屏识别传 0 |
83
+ | `y` | number | 否 | 0 | 裁剪区域左上角 y 坐标;全屏识别传 0 |
84
+ | `ex` | number | 否 | 0 | 裁剪区域右下角 x 坐标;全屏识别传 0 |
85
+ | `ey` | number | 否 | 0 | 裁剪区域右下角 y 坐标;全屏识别传 0 |
86
+ | `languages` | string[] | 否 | `{"zh-Hans", "en-US"}` | 识别语言数组,支持 `{"en-US", "fr-FR", "it-IT", "de-DE", "es-ES", "pt-BR", "zh-Hans", "zh-Hant"}` |
87
+
88
+ **返回值:**
89
+
90
+ | 类型 | 描述 |
91
+ | ------------- | ---------------------------------------------- |
92
+ | `OCRResult[]` | 识别结果数组,坐标相对于裁剪区域 |
93
+
94
+ **示例:**
95
+
96
+ ```lua
97
+ local appleocr = require("appleocr")
98
+ local action = require("action")
99
+
100
+ local results = appleocr.recognize("screen", 100, 100, 500, 300)
101
+ if #results > 0 then
102
+ action.click(results[1].centerX, results[1].centerY)
103
+ end
104
+ ```
105
+
106
+ #### recognizeAbs - 执行 OCR 识别,并将结果坐标映射为原图/全屏绝对坐标。
107
+
108
+ 传入裁剪区域时,返回坐标会映射回原图或全屏坐标,可直接用于点击。
109
+
110
+ ```lua
111
+ ---@param input string
112
+ ---@param x number?
113
+ ---@param y number?
114
+ ---@param ex number?
115
+ ---@param ey number?
116
+ ---@param languages string[]?
117
+ ---@return OCRResult[]
118
+ function recognizeAbs(input, x, y, ex, ey, languages) end
119
+ ```
120
+
121
+ **参数:** 与 `recognize` 相同;返回坐标为原图或全屏绝对坐标。
122
+
123
+ **示例:**
124
+
125
+ ```lua
126
+ local appleocr = require("appleocr")
127
+ local action = require("action")
128
+ local absResults = appleocr.recognizeAbs("screen", 100, 100, 500, 300)
129
+ if #absResults > 0 then
130
+ action.click(absResults[1].centerX, absResults[1].centerY)
131
+ end
132
+ ```
133
+
134
+ ### 数字识别
135
+
136
+ #### recognizeNumbers - 执行数字 OCR 识别。
137
+
138
+ 执行数字 OCR 识别。传入裁剪区域时,返回坐标相对于裁剪区域。
139
+
140
+ **支持字符**: 0-9 数字、逗号(,)、小数点(.)、加号(+)、减号(-)
141
+
142
+ ```lua
143
+ ---@param input string
144
+ ---@param x number?
145
+ ---@param y number?
146
+ ---@param ex number?
147
+ ---@param ey number?
148
+ ---@return OCRResult[]
149
+ function recognizeNumbers(input, x, y, ex, ey) end
150
+ ```
151
+
152
+ **参数:**
153
+
154
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
155
+ | ------- | ------ | -------- | ------ | --------------------------------------------------- |
156
+ | `input` | string | 是 | | 输入源,支持 `"screen"`、图片文件路径、URL 字符串或 imageId |
157
+ | `x` | number | 否 | 0 | 裁剪区域左上角 x 坐标;全屏识别传 0 |
158
+ | `y` | number | 否 | 0 | 裁剪区域左上角 y 坐标;全屏识别传 0 |
159
+ | `ex` | number | 否 | 0 | 裁剪区域右下角 x 坐标;全屏识别传 0 |
160
+ | `ey` | number | 否 | 0 | 裁剪区域右下角 y 坐标;全屏识别传 0 |
161
+
162
+ **返回值:**
163
+
164
+ | 类型 | 描述 |
165
+ | ------------- | ---------------------------------------------- |
166
+ | `OCRResult[]` | 数字识别结果数组,坐标相对于裁剪区域 |
167
+
168
+ **示例:**
169
+
170
+ ```lua
171
+ local appleocr = require("appleocr")
172
+ local action = require("action")
173
+
174
+ local numberResults = appleocr.recognizeNumbers("screen", 100, 100, 500, 300)
175
+ if #numberResults > 0 then
176
+ action.click(numberResults[1].centerX, numberResults[1].centerY)
177
+ end
178
+ ```
179
+
180
+ #### recognizeNumbersAbs - 执行数字 OCR 识别,并将结果坐标映射为原图/全屏绝对坐标。
181
+
182
+ **支持字符**: 0-9 数字、逗号(,)、小数点(.)、加号(+)、减号(-)
183
+
184
+ ```lua
185
+ ---@param input string
186
+ ---@param x number?
187
+ ---@param y number?
188
+ ---@param ex number?
189
+ ---@param ey number?
190
+ ---@return OCRResult[]
191
+ function recognizeNumbersAbs(input, x, y, ex, ey) end
192
+ ```
193
+
194
+ **参数:** 与 `recognizeNumbers` 相同;返回坐标为原图或全屏绝对坐标。
195
+
196
+ **示例:**
197
+
198
+ ```lua
199
+ local appleocr = require("appleocr")
200
+ local absNumberResults = appleocr.recognizeNumbersAbs("screen", 100, 100, 500, 300)
201
+ ```
202
+
203
+ ### 文本查找
204
+
205
+ #### findText - 查找目标子串。
206
+
207
+ 在整段识别文本中查找指定子串。传入裁剪区域时,返回坐标相对于裁剪区域。
208
+
209
+ ```lua
210
+ ---@param input string
211
+ ---@param texts string[]
212
+ ---@param x number?
213
+ ---@param y number?
214
+ ---@param ex number?
215
+ ---@param ey number?
216
+ ---@param languages string[]?
217
+ ---@param exactMatch boolean?
218
+ ---@return OCRResult[]
219
+ function findText(input, texts, x, y, ex, ey, languages, exactMatch) end
220
+ ```
221
+
222
+ **参数:**
223
+
224
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
225
+ | ------------ | -------- | -------- | ----------------------- | ----------------------------------------------------------------------------------------------------- |
226
+ | `input` | string | 是 | | 输入源,支持 `"screen"`、图片文件路径、URL 字符串或 imageId |
227
+ | `texts` | string[] | 是 | | 要查找的目标文本数组,可匹配识别结果中的子串 |
228
+ | `x` | number | 否 | 0 | 裁剪区域左上角 x 坐标;全屏识别传 0 |
229
+ | `y` | number | 否 | 0 | 裁剪区域左上角 y 坐标;全屏识别传 0 |
230
+ | `ex` | number | 否 | 0 | 裁剪区域右下角 x 坐标;全屏识别传 0 |
231
+ | `ey` | number | 否 | 0 | 裁剪区域右下角 y 坐标;全屏识别传 0 |
232
+ | `languages` | string[] | 否 | `{"zh-Hans", "en-US"}` | 识别语言数组 |
233
+ | `exactMatch` | boolean | 否 | false | 是否完整匹配;`false` 表示包含匹配,`true` 要求整条 OCR 识别结果文本等于目标文本 |
234
+
235
+ **返回值:**
236
+
237
+ | 类型 | 描述 |
238
+ | ------------- | ---------------------------------------------- |
239
+ | `OCRResult[]` | 命中子串的识别结果数组,坐标相对于裁剪区域 |
240
+
241
+ **示例:**
242
+
243
+ ```lua
244
+ local appleocr = require("appleocr")
245
+ local action = require("action")
246
+
247
+ local hits = appleocr.findText("screen", { "开始" }, 100, 100, 500, 400)
248
+ if #hits > 0 then
249
+ action.click(hits[1].centerX, hits[1].centerY)
250
+ end
251
+ ```
252
+
253
+ #### findTextAbs - 查找目标子串,并将子串结果坐标映射为原图/全屏绝对坐标。
254
+
255
+ 传入裁剪区域时,返回坐标会映射回原图或全屏坐标,可直接用于点击。`texts` 也可以是逗号分隔字符串。
256
+
257
+ ```lua
258
+ ---@param input string
259
+ ---@param texts string[]|string
260
+ ---@param x number?
261
+ ---@param y number?
262
+ ---@param ex number?
263
+ ---@param ey number?
264
+ ---@param languages string[]?
265
+ ---@param exactMatch boolean?
266
+ ---@return OCRResult[]
267
+ function findTextAbs(input, texts, x, y, ex, ey, languages, exactMatch) end
268
+ ```
269
+
270
+ **参数:** 与 `findText` 相同;返回坐标为原图或全屏绝对坐标。
271
+
272
+ **示例:**
273
+
274
+ ```lua
275
+ local appleocr = require("appleocr")
276
+ local action = require("action")
277
+ local absHits = appleocr.findTextAbs("screen", { "开始" }, 100, 100, 500, 400)
278
+ if #absHits > 0 then
279
+ action.click(absHits[1].centerX, absHits[1].centerY)
280
+ end
281
+ ```
@@ -0,0 +1,183 @@
1
+ # 云控模块 (Cloud)
2
+
3
+ 云控模块用于在主脚本中使用内置云控 WebSocket 连接。脚本可以主动连接云控服务器、判断连接状态、断开连接、上报事件数据,并监听服务器事件数据。
4
+
5
+ ## 注意事项
6
+
7
+ - `cloud` 只在主脚本上下文注册,不支持在线程脚本里调用。
8
+ - 服务器事件只有一个主脚本监听槽位,多次调用 `onEvent` 会覆盖旧监听。
9
+
10
+ ## 协议
11
+
12
+ 脚本上报数据时发送 JSON 文本帧:
13
+
14
+ ```json
15
+ {
16
+ "type": "scriptReport",
17
+ "event": "eventName",
18
+ "data": {}
19
+ }
20
+ ```
21
+
22
+ 服务器下发脚本事件时发送 JSON 文本帧:
23
+
24
+ ```json
25
+ {
26
+ "type": "scriptEvent",
27
+ "event": "eventName",
28
+ "data": {}
29
+ }
30
+ ```
31
+
32
+ `event` 是脚本和服务器约定的自定义事件名。`data` 在 JS 中是普通 Object,必须能被 JSON 序列化。
33
+ 设备总览自定义字段读取最新一次 `cloud:status` 上报数据;上报时事件名固定为 `cloud:status`,`data` 是 key-value 对象。
34
+
35
+ ## API 参考
36
+
37
+ ### connect - 连接云控服务器
38
+
39
+ ```lua
40
+ ---@param url string
41
+ ---@param deviceNo string?
42
+ ---@return boolean
43
+ function connect(url, deviceNo) end
44
+ ```
45
+
46
+ **参数**
47
+
48
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
49
+ | ---------- | ------ | -------- | -------------- | ---- |
50
+ | `url` | string | 是 | - | 完整 `ws://` 或 `wss://` 云控地址 |
51
+ | `deviceNo` | string | 否 | 已保存设备编号 | 连接时追加到 query 的设备编号 |
52
+
53
+ **返回值**
54
+
55
+ | 类型 | 描述 |
56
+ | ------- | ---- |
57
+ | boolean | URL 校验通过且连接请求已提交时返回 true |
58
+
59
+ **说明**
60
+
61
+ - `connect` 只能在主脚本上下文调用。
62
+ - `connect` 只影响当前运行期云控连接,不会写入设置页的持久化云控配置。
63
+
64
+ **示例**
65
+
66
+ ```lua
67
+ local cloud = require("cloud")
68
+ local accepted = cloud.connect("wss = //example.com/control", "device-001")
69
+ print("云控连接请求:", accepted)
70
+ ```
71
+
72
+ ### isConnected - 判断是否已连接
73
+
74
+ ```lua
75
+ ---@return boolean
76
+ function isConnected() end
77
+ ```
78
+
79
+ **返回值**
80
+
81
+ | 类型 | 描述 |
82
+ | ------- | ---- |
83
+ | boolean | WebSocket 已连接时返回 true |
84
+
85
+ **示例**
86
+
87
+ ```lua
88
+ local cloud = require("cloud")
89
+ if cloud.isConnected() then
90
+ cloud.report("status", { value = "ready" })
91
+ end
92
+ ```
93
+
94
+ ### disconnect - 断开连接
95
+
96
+ ```lua
97
+ function disconnect() end
98
+ ```
99
+
100
+ 断开云控 WebSocket 并停止自动重连。
101
+
102
+ **示例**
103
+
104
+ ```lua
105
+ local cloud = require("cloud")
106
+ cloud.disconnect()
107
+ ```
108
+
109
+ ### report - 上报数据
110
+
111
+ ```lua
112
+ ---@param event string
113
+ ---@param data table
114
+ ---@return boolean
115
+ function report(event, data) end
116
+ ```
117
+
118
+ **参数**
119
+
120
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
121
+ | ------- | --------- | -------- | ------ | ---- |
122
+ | `event` | string | 是 | - | 自定义事件名 |
123
+ | `data` | table | 是 | - | 要上报的普通 Object 参数 |
124
+
125
+ **返回值**
126
+
127
+ | 类型 | 描述 |
128
+ | ------- | ---- |
129
+ | boolean | 已连接且 JSON 文本帧已提交写出时返回 true |
130
+
131
+ **示例**
132
+
133
+ ```lua
134
+ local cloud = require("cloud")
135
+ local ok = cloud.report("taskFinished", {
136
+ taskId = "A-1001",
137
+ success = true,
138
+ costMs = 1280,
139
+ })
140
+ print("上报结果:", ok)
141
+ ```
142
+
143
+ **上报云控状态**
144
+
145
+ 设备总览自定义字段读取设备最新 `cloud:status` 上报数据。服务端按设备只保存最新一份状态;同一设备再次上报会覆盖前一次状态。
146
+
147
+ `data` 的 key 必须使用云控端已经配置好的设备总览自定义字段名。上报了云控端未配置的多余字段时,协议仍可发送,但云控端设备总览不会显示这些字段。
148
+
149
+ ```lua
150
+ local cloud = require("cloud")
151
+ cloud.report("cloud = status", {
152
+ taskName = "巡检任务",
153
+ progress = 80,
154
+ online = true,
155
+ })
156
+ ```
157
+
158
+ ### onEvent - 监听服务器事件
159
+
160
+ ```lua
161
+ ---@param callback function?
162
+ function onEvent(callback) end
163
+ ```
164
+
165
+ 监听服务器发送的 `scriptEvent` 协议帧。传入 `nil` 会取消主脚本监听。
166
+ 此回调注册接口只能在主线程调用,不能在线程脚本中调用。
167
+
168
+ **参数**
169
+
170
+ | 参数名 | 类型 | 是否必填 | 描述 |
171
+ | ---------- | ----------------------------- | -------- | ---- |
172
+ | `callback` | `(event, data) => void` 或 `nil` | 是 | 事件处理函数,或传 `nil` 取消监听 |
173
+
174
+ **示例**
175
+
176
+ ```lua
177
+ local cloud = require("cloud")
178
+ cloud.onEvent(function(event, data)
179
+ if event == "startTask" then
180
+ print("任务参数:", data)
181
+ end
182
+ end)
183
+ ```
@@ -0,0 +1,181 @@
1
+ # 配置模块 (Config)
2
+
3
+ 配置模块提供了读取、更新和删除应用配置的功能。
4
+
5
+ 网页的 ms.setConfig 对应 config.set
6
+
7
+ 网页的 ms.getConfig 对应 config.get
8
+
9
+ 网页的 ms.getAllConfig 对应 config.all
10
+
11
+ 网页的 ms.removeConfig 对应 config.remove
12
+
13
+ ## API 参考
14
+
15
+ ### all - 获取所有配置的 JSON 格式数据。
16
+
17
+ ```lua
18
+ ---@return table
19
+ function all() end
20
+ ```
21
+
22
+ **返回值:**
23
+
24
+ | 类型 | 描述 |
25
+ | --------------------- | ------------------ |
26
+ | `table` | 包含所有配置的对象 |
27
+
28
+ **示例:**
29
+
30
+ ```lua
31
+ local config = require("config")
32
+ local allConfigs = config.all()
33
+ print("所有配置: " .. tostring(ToJsonString(allConfigs, nil, 2)))
34
+ ```
35
+
36
+ ### setAll - 设置所有配置项。
37
+
38
+ ```lua
39
+ ---@param config table
40
+ ---@return boolean
41
+ function setAll(config) end
42
+ ```
43
+
44
+ **参数:**
45
+
46
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
47
+ | -------- | --------------------- | -------- | ------ | ---------------- |
48
+ | `config` | `table` | 是 | - | 完整配置对象 |
49
+
50
+ **返回值:**
51
+
52
+ | 类型 | 描述 |
53
+ | --------- | ------------ |
54
+ | `boolean` | 设置是否成功 |
55
+
56
+ **示例:**
57
+
58
+ ```lua
59
+ local config = require("config")
60
+ local success = config.setAll({ maxRetries = 5, debugEnabled = true })
61
+ if success then
62
+ print("所有配置已更新")
63
+ end
64
+ ```
65
+
66
+ ### set - 更新或设置配置项的值。
67
+
68
+ ```lua
69
+ ---@param key string
70
+ ---@param value any
71
+ ---@return boolean
72
+ function set(key, value) end
73
+ ```
74
+
75
+ **参数:**
76
+
77
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
78
+ | ------- | ------ | -------- | ------ | ---------- |
79
+ | `key` | string | 是 | - | 配置键名 |
80
+ | `value` | any | 是 | - | 新的配置值 |
81
+
82
+ **返回值:**
83
+
84
+ | 类型 | 描述 |
85
+ | --------- | ------------ |
86
+ | `boolean` | 更新是否成功 |
87
+
88
+ **示例:**
89
+
90
+ ```lua
91
+ local config = require("config")
92
+ -- 更新不同类型的配置
93
+ local success1 = config.set("maxRetries", 5)
94
+ local success2 = config.set("apiBaseUrl", "https://api.example.com")
95
+ local success3 = config.set("debugEnabled", true)
96
+
97
+ if success1 and success2 and success3 then
98
+ print("配置更新成功")
99
+ end
100
+ ```
101
+
102
+ ### get - 读取配置项的值。
103
+
104
+ ```lua
105
+ ---@param key string
106
+ ---@return any | nil
107
+ function get(key) end
108
+ ```
109
+
110
+ **参数:**
111
+
112
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
113
+ | ------ | ------ | -------- | ------ | -------- |
114
+ | `key` | string | 是 | - | 配置键名 |
115
+
116
+ **返回值:**
117
+
118
+ | 类型 | 描述 |
119
+ | ------------- | ------ |
120
+ | `any \| nil` | 配置值 |
121
+
122
+ **示例:**
123
+
124
+ ```lua
125
+ local config = require("config")
126
+ local maxRetries = config.get("maxRetries")
127
+ if maxRetries ~= nil then
128
+ print("最大重试次数: " .. tostring(maxRetries))
129
+ end
130
+ ```
131
+
132
+ ### getKuiConfig - 获取 KUI 的配置。
133
+
134
+ ```lua
135
+ ---@return table
136
+ function getKuiConfig() end
137
+ ```
138
+
139
+ **返回值:**
140
+
141
+ | 类型 | 描述 |
142
+ | --------------------- | -------------------------------------------------------- |
143
+ | `table` | `KUI_CONFIG` 对应的对象,配置不存在或无法转换时返回空对象 |
144
+
145
+ **示例:**
146
+
147
+ ```lua
148
+ local config = require("config")
149
+ local kuiConfig = config.getKuiConfig()
150
+ print("KUI 配置: " .. tostring(ToJsonString(kuiConfig, nil, 2)))
151
+ ```
152
+
153
+ ### remove - 删除指定的配置项。
154
+
155
+ ```lua
156
+ ---@param key string
157
+ ---@return boolean
158
+ function remove(key) end
159
+ ```
160
+
161
+ **参数:**
162
+
163
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
164
+ | ------ | ------ | -------- | ------ | ---------------- |
165
+ | `key` | string | 是 | - | 要删除的配置键名 |
166
+
167
+ **返回值:**
168
+
169
+ | 类型 | 描述 |
170
+ | --------- | ------------ |
171
+ | `boolean` | 删除是否成功 |
172
+
173
+ **示例:**
174
+
175
+ ```lua
176
+ local config = require("config")
177
+ local deleted = config.remove("temporaryConfig")
178
+ if deleted then
179
+ print("临时配置已删除")
180
+ end
181
+ ```