ms-vite-plugin 1.4.41 → 1.4.45
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/docs/api/global.md +70 -15
- package/docs/api/node.md +239 -348
- package/docs/apicn/global.md +65 -10
- package/docs/apicn/node.md +242 -365
- package/docs/apipython/g.md +74 -23
- package/docs/apipython/node.md +186 -287
- package/docs/httpapi/api.md +190 -189
- package/package.json +1 -1
package/docs/apipython/g.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
- 应用信息常量:版本号/构建号/名称/包名
|
|
8
8
|
- 前台切换:将宿主应用切到前台
|
|
9
|
-
- Agent 设置:读取和设置 Agent
|
|
9
|
+
- Agent 设置:读取和设置 Agent 触控模式
|
|
10
10
|
- 脚本生命周期:设置停止回调和异常停止回调
|
|
11
11
|
|
|
12
12
|
## 常量
|
|
@@ -55,9 +55,9 @@ from kuaijs import g
|
|
|
55
55
|
g.takeMeToFront()
|
|
56
56
|
```
|
|
57
57
|
|
|
58
|
-
#### `setAgentFastMode` - 设置 Agent
|
|
58
|
+
#### `setAgentFastMode` - 设置 Agent 快速模式(兼容)
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
兼容旧接口:开启对应模式 `1`,关闭对应模式 `0`。推荐改用 `setAgentTouchMode`。设置会持久化。
|
|
61
61
|
|
|
62
62
|
```python
|
|
63
63
|
def setAgentFastMode(enabled: bool) -> bool
|
|
@@ -81,9 +81,9 @@ enabled = g.setAgentFastMode(True)
|
|
|
81
81
|
print(f"Agent 快速模式: {enabled}")
|
|
82
82
|
```
|
|
83
83
|
|
|
84
|
-
#### `getAgentFastMode` - 获取 Agent
|
|
84
|
+
#### `getAgentFastMode` - 获取 Agent 快速模式(兼容)
|
|
85
85
|
|
|
86
|
-
|
|
86
|
+
获取 Agent 快速模式当前状态。
|
|
87
87
|
|
|
88
88
|
```python
|
|
89
89
|
def getAgentFastMode() -> bool
|
|
@@ -102,6 +102,57 @@ if g.getAgentFastMode():
|
|
|
102
102
|
print("Agent 快速模式已开启")
|
|
103
103
|
```
|
|
104
104
|
|
|
105
|
+
#### `setAgentTouchMode` - 设置 Agent 触控模式
|
|
106
|
+
|
|
107
|
+
默认 `1`,设置会持久化。
|
|
108
|
+
|
|
109
|
+
- `0` 标准:等待完整执行完成
|
|
110
|
+
- `1` 快速:更快的执行速度
|
|
111
|
+
- `2` 真实点击:更接近真实手指触控
|
|
112
|
+
|
|
113
|
+
```python
|
|
114
|
+
def setAgentTouchMode(mode: int) -> int
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
**参数:**
|
|
118
|
+
| 参数 | 类型 | 必需 | 默认值 | 描述 |
|
|
119
|
+
| ---- | ---- | ---- | ------ | ---- |
|
|
120
|
+
| `mode` | int | 是 | - | 0 标准 / 1 快速 / 2 真实点击 |
|
|
121
|
+
|
|
122
|
+
**返回值:**
|
|
123
|
+
|
|
124
|
+
- `int` 实际生效的模式
|
|
125
|
+
|
|
126
|
+
**示例:**
|
|
127
|
+
|
|
128
|
+
```python
|
|
129
|
+
from kuaijs import g
|
|
130
|
+
|
|
131
|
+
mode = g.setAgentTouchMode(1)
|
|
132
|
+
print(f"Agent 触控模式: {mode}")
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
#### `getAgentTouchMode` - 获取 Agent 触控模式
|
|
136
|
+
|
|
137
|
+
默认 `1`,设置会持久化。
|
|
138
|
+
|
|
139
|
+
```python
|
|
140
|
+
def getAgentTouchMode() -> int
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
**返回值:**
|
|
144
|
+
|
|
145
|
+
- `int` 当前模式(0/1/2)
|
|
146
|
+
|
|
147
|
+
**示例:**
|
|
148
|
+
|
|
149
|
+
```python
|
|
150
|
+
from kuaijs import g
|
|
151
|
+
|
|
152
|
+
mode = g.getAgentTouchMode()
|
|
153
|
+
print(f"当前触控模式: {mode}")
|
|
154
|
+
```
|
|
155
|
+
|
|
105
156
|
#### `setCpuAutoThrottle` - 设置脚本 CPU 自动限流
|
|
106
157
|
|
|
107
158
|
默认开启。开启后,脚本 API 在 CPU 占用接近系统杀进程阈值时会轻微让步,降低被系统终止的风险。
|
|
@@ -164,17 +215,17 @@ def setCpuThrottleDelay(min_ms: int, max_ms: int) -> CpuThrottleDelay
|
|
|
164
215
|
|
|
165
216
|
**参数:**
|
|
166
217
|
|
|
167
|
-
| 参数名
|
|
168
|
-
|
|
|
169
|
-
| `min_ms`
|
|
170
|
-
| `max_ms`
|
|
218
|
+
| 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
|
|
219
|
+
| -------- | ----- | -------- | ------ | ---------------------------------------- |
|
|
220
|
+
| `min_ms` | `int` | 是 | - | 最低延迟(毫秒) |
|
|
221
|
+
| `max_ms` | `int` | 是 | - | 最高延迟(毫秒);小于 min_ms 时自动对齐 |
|
|
171
222
|
|
|
172
223
|
**返回值:**
|
|
173
224
|
|
|
174
|
-
| 字段名 | 类型 | 描述
|
|
175
|
-
| ------- | ----- |
|
|
176
|
-
| `minMs` | `int` | 实际最低延迟
|
|
177
|
-
| `maxMs` | `int` | 实际最高延迟
|
|
225
|
+
| 字段名 | 类型 | 描述 |
|
|
226
|
+
| ------- | ----- | ------------ |
|
|
227
|
+
| `minMs` | `int` | 实际最低延迟 |
|
|
228
|
+
| `maxMs` | `int` | 实际最高延迟 |
|
|
178
229
|
|
|
179
230
|
**示例:**
|
|
180
231
|
|
|
@@ -237,16 +288,16 @@ def setStopCallback(callback: Callable[[Literal["success", "error", "stopped"]],
|
|
|
237
288
|
|
|
238
289
|
**参数:**
|
|
239
290
|
|
|
240
|
-
| 参数名 | 类型
|
|
241
|
-
| ---------- |
|
|
242
|
-
| `callback` | `Callable[[Literal["success", "error", "stopped"]], None]` 或 `None` | 是
|
|
291
|
+
| 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
|
|
292
|
+
| ---------- | -------------------------------------------------------------------- | -------- | ------ | -------------------------------- |
|
|
293
|
+
| `callback` | `Callable[[Literal["success", "error", "stopped"]], None]` 或 `None` | 是 | - | 停止回调函数,传 `None` 取消回调 |
|
|
243
294
|
|
|
244
295
|
**状态值:**
|
|
245
296
|
|
|
246
|
-
| 状态
|
|
247
|
-
|
|
|
248
|
-
| `success` | 脚本正常执行完成
|
|
249
|
-
| `error`
|
|
297
|
+
| 状态 | 描述 |
|
|
298
|
+
| --------- | ------------------------ |
|
|
299
|
+
| `success` | 脚本正常执行完成 |
|
|
300
|
+
| `error` | 脚本发生未捕获异常 |
|
|
250
301
|
| `stopped` | 脚本被手动停止或主动退出 |
|
|
251
302
|
|
|
252
303
|
**示例:**
|
|
@@ -275,9 +326,9 @@ def setExceptionCallback(callback: Callable[[], None] | None) -> None
|
|
|
275
326
|
|
|
276
327
|
**参数:**
|
|
277
328
|
|
|
278
|
-
| 参数名 | 类型
|
|
279
|
-
| ---------- |
|
|
280
|
-
| `callback` | `Callable[[], None]` 或 `None` | 是
|
|
329
|
+
| 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
|
|
330
|
+
| ---------- | ------------------------------ | -------- | ------ | ------------------------------------ |
|
|
331
|
+
| `callback` | `Callable[[], None]` 或 `None` | 是 | - | 异常停止回调函数,传 `None` 取消回调 |
|
|
281
332
|
|
|
282
333
|
**示例:**
|
|
283
334
|
|