ms-vite-plugin 1.4.30 → 1.4.31

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/dist/build.js CHANGED
@@ -220,6 +220,12 @@ const buildAll = async (isDev = true, workspacePath) => {
220
220
  disableConsoleOutput: false,
221
221
  domainLock: [],
222
222
  selfDefending: false,
223
+ // 注入到引擎的全局对象与方法(如 paddleOcr.recognizeAbs、ms、ui、http…)
224
+ // 由原生侧按“名称字符串”绑定,一旦被改名原生就找不到对应实现。
225
+ // 这里强制关闭全局名 / 属性名改写,避免任何 obfuscator.json 误开导致注入 API 被混淆。
226
+ // 如确需对自有属性做重命名,请改用 renamePropertiesMode + reservedNames 白名单。
227
+ renameGlobals: false,
228
+ renameProperties: false,
223
229
  },
224
230
  }),
225
231
  ]),
package/docs/api/cloud.md CHANGED
@@ -30,6 +30,7 @@
30
30
  ```
31
31
 
32
32
  `event` 是脚本和服务器约定的自定义事件名。`data` 在 JS 中是普通 Object,必须能被 JSON 序列化。
33
+ 设备总览自定义字段读取最新一次 `cloud:status` 上报数据;上报时事件名固定为 `cloud:status`,`data` 是 key-value 对象。
33
34
 
34
35
  ## API 参考
35
36
 
@@ -128,6 +129,20 @@ const ok = cloud.report("taskFinished", {
128
129
  logi("上报结果:", ok);
129
130
  ```
130
131
 
132
+ **上报云控状态**
133
+
134
+ 设备总览自定义字段读取设备最新 `cloud:status` 上报数据。服务端按设备只保存最新一份状态;同一设备再次上报会覆盖前一次状态。
135
+
136
+ `data` 的 key 必须使用云控端已经配置好的设备总览自定义字段名。上报了云控端未配置的多余字段时,协议仍可发送,但云控端设备总览不会显示这些字段。
137
+
138
+ ```javascript
139
+ cloud.report("cloud:status", {
140
+ taskName: "巡检任务",
141
+ progress: 80,
142
+ online: true,
143
+ });
144
+ ```
145
+
131
146
  ### onEvent - 监听服务器事件
132
147
 
133
148
  ```typescript
@@ -30,6 +30,7 @@
30
30
  ```
31
31
 
32
32
  `event` 是脚本和服务器约定的自定义事件名。`data` 在 JS 中是普通 Object,必须能被 JSON 序列化。
33
+ 设备总览自定义字段读取最新一次 `cloud:status` 上报数据;上报时事件名固定为 `cloud:status`,`data` 是 key-value 对象。
33
34
 
34
35
  ## API 参考
35
36
 
@@ -128,6 +129,20 @@ const 成功 = $云控.上报数据("taskFinished", {
128
129
  $打印信息日志("上报结果:", 成功);
129
130
  ```
130
131
 
132
+ **上报云控状态**
133
+
134
+ 设备总览自定义字段读取设备最新 `cloud:status` 上报数据。服务端按设备只保存最新一份状态;同一设备再次上报会覆盖前一次状态。
135
+
136
+ `数据` 的 key 必须使用云控端已经配置好的设备总览自定义字段名。上报了云控端未配置的多余字段时,协议仍可发送,但云控端设备总览不会显示这些字段。
137
+
138
+ ```javascript
139
+ $云控.上报数据("cloud:status", {
140
+ taskName: "巡检任务",
141
+ progress: 80,
142
+ online: true,
143
+ });
144
+ ```
145
+
131
146
  ### 监听事件回调
132
147
 
133
148
  ```typescript
@@ -31,6 +31,7 @@
31
31
  ```
32
32
 
33
33
  `event` 是脚本和服务器约定的自定义事件名。`data` 在 Python 中是普通 `dict`,必须能被 JSON 序列化。
34
+ 设备总览自定义字段读取最新一次 `cloud:status` 上报数据;上报时事件名固定为 `cloud:status`,`data` 是 key-value 字典。
34
35
 
35
36
  ## API 参考
36
37
 
@@ -138,6 +139,20 @@ ok = cloud.report("taskFinished", {
138
139
  logger.info(f"上报结果: {ok}")
139
140
  ```
140
141
 
142
+ **上报云控状态**
143
+
144
+ 设备总览自定义字段读取设备最新 `cloud:status` 上报数据。服务端按设备只保存最新一份状态;同一设备再次上报会覆盖前一次状态。
145
+
146
+ `data` 的 key 必须使用云控端已经配置好的设备总览自定义字段名。上报了云控端未配置的多余字段时,协议仍可发送,但云控端设备总览不会显示这些字段。
147
+
148
+ ```python
149
+ cloud.report("cloud:status", {
150
+ "taskName": "巡检任务",
151
+ "progress": 80,
152
+ "online": True,
153
+ })
154
+ ```
155
+
141
156
  ### onEvent - 监听服务器事件
142
157
 
143
158
  ```python
@@ -541,6 +541,7 @@ GET /api/status
541
541
  "appName": "string",
542
542
  "appBuildNumber": 0,
543
543
  "appBundleId": "string",
544
+ "appNo": "string",
544
545
  "deviceModel": "string",
545
546
  "agentConnected": true,
546
547
  "isRun": true,
@@ -550,6 +551,14 @@ GET /api/status
550
551
  "udid": "string",
551
552
  "serverDeviceId": "string",
552
553
  "orientation": "PORTRAIT",
554
+ "memory": {
555
+ "used": 0,
556
+ "available": 0,
557
+ "total": 0,
558
+ "systemUsed": 0,
559
+ "usagePercentage": 0
560
+ },
561
+ "cpuUsage": 0,
553
562
  "osVersion": "string",
554
563
  "ecid": "string",
555
564
  "isVolumeControlEnabled": true,
@@ -592,6 +601,7 @@ GET /api/status
592
601
  | »» appName | string | true | none | app名称 | none |
593
602
  | »» appBuildNumber | integer | true | none | app构建号 | none |
594
603
  | »» appBundleId | string | true | none | app 包名 | none |
604
+ | »» appNo | string | true | none | 当前软件编号 | 未加载软件时为空字符串 |
595
605
  | »» deviceModel | string | true | none | 设备型号 | none |
596
606
  | »» agentConnected | boolean | true | none | agent是否连接 | none |
597
607
  | »» isRun | boolean | true | none | 脚本是否启动 | none |
@@ -601,6 +611,13 @@ GET /api/status
601
611
  | »» udid | string | true | none | 设备唯一 UDID | none |
602
612
  | »» serverDeviceId | string | true | none | 服务器设备ID | none |
603
613
  | »» orientation | string | true | none | 屏幕方向 | none |
614
+ | »» memory | object | true | none | 内存状态 | 单位为 MB,字段与系统模块内存信息一致 |
615
+ | »»» used | number | true | none | 应用已用内存 | 当前应用内存占用,单位 MB |
616
+ | »»» available | number | true | none | 系统可用内存 | 系统可用内存,单位 MB |
617
+ | »»» total | number | true | none | 系统总内存 | 物理内存总量,单位 MB |
618
+ | »»» systemUsed | number | true | none | 系统已用内存 | 系统已用内存,单位 MB |
619
+ | »»» usagePercentage | integer | true | none | 系统内存使用率 | 系统已用内存占总内存百分比 |
620
+ | »» cpuUsage | number | true | none | CPU 使用率 | 当前应用 CPU 使用率百分比 |
604
621
  | »» osVersion | string | true | none | 系统版本 | none |
605
622
  | »» ecid | string | true | none | 设备唯一 ECID | none |
606
623
  | »» isVolumeControlEnabled | boolean | true | none | 是否开启了音量键启停 | none |
@@ -764,9 +781,9 @@ POST /api/setConfig
764
781
  | --------- | ------- | ---- | ---- | -------- | ---- |
765
782
  | » success | boolean | true | none | 是否成功 | none |
766
783
 
767
- ## GET 实时屏幕画面流MJPEG
784
+ ## WebSocket 实时屏幕画面流
768
785
 
769
- GET /mirror/image
786
+ WebSocket Upgrade /mirror/ws
770
787
 
771
788
  ### 请求参数
772
789
 
@@ -774,18 +791,11 @@ GET /mirror/image
774
791
  | ------------- | ----- | ------- | ---- | ------ | ---------------------------- |
775
792
  | fps | query | integer | 否 | | 帧率,默认 10,范围 1-30 |
776
793
  | quality | query | number | 否 | | 质量,默认 0.25,范围 0.1-1.0 |
794
+ | scalingFactor | query | number | 否 | | 缩放比例,默认 1.0,范围 0.1-1.0 |
777
795
 
778
- > 返回示例
779
-
780
- > 200 Response
781
-
782
- ### 返回结果
783
-
784
- | 状态码 | 状态码含义 | 说明 | 数据模型 |
785
- | ------ | ------------------------------------------------------- | ---- | -------- |
786
- | 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | none | Inline |
796
+ ### 返回数据
787
797
 
788
- ### 返回数据结构
798
+ 连接成功后服务端持续发送 JPEG 二进制 WebSocket frame;客户端不需要发送业务消息。
789
799
 
790
800
  ## POST 执行脚本(仅支持JS脚本)
791
801
 
@@ -2954,6 +2964,7 @@ GET /api/file/download
2954
2964
  "appName": "string",
2955
2965
  "appBuildNumber": 0,
2956
2966
  "appBundleId": "string",
2967
+ "appNo": "string",
2957
2968
  "deviceModel": "string",
2958
2969
  "agentConnected": true,
2959
2970
  "isRun": true,
@@ -2963,6 +2974,14 @@ GET /api/file/download
2963
2974
  "udid": "string",
2964
2975
  "serverDeviceId": "string",
2965
2976
  "orientation": "PORTRAIT",
2977
+ "memory": {
2978
+ "used": 0,
2979
+ "available": 0,
2980
+ "total": 0,
2981
+ "systemUsed": 0,
2982
+ "usagePercentage": 0
2983
+ },
2984
+ "cpuUsage": 0,
2966
2985
  "osVersion": "string",
2967
2986
  "ecid": "string",
2968
2987
  "isVolumeControlEnabled": true,
@@ -2994,6 +3013,7 @@ GET /api/file/download
2994
3013
  | appName | string | true | none | app名称 | none |
2995
3014
  | appBuildNumber | integer | true | none | app构建号 | none |
2996
3015
  | appBundleId | string | true | none | app 包名 | none |
3016
+ | appNo | string | true | none | 当前软件编号 | 未加载软件时为空字符串 |
2997
3017
  | deviceModel | string | true | none | 设备型号 | none |
2998
3018
  | agentConnected | boolean | true | none | agent是否连接 | none |
2999
3019
  | isRun | boolean | true | none | 脚本是否启动 | none |
@@ -3003,6 +3023,13 @@ GET /api/file/download
3003
3023
  | udid | string | true | none | 设备唯一 UDID | none |
3004
3024
  | serverDeviceId | string | true | none | 服务器设备ID | none |
3005
3025
  | orientation | string | true | none | 屏幕方向 | none |
3026
+ | memory | object | true | none | 内存状态 | 单位为 MB,字段与系统模块内存信息一致 |
3027
+ | » used | number | true | none | 应用已用内存 | 当前应用内存占用,单位 MB |
3028
+ | » available | number | true | none | 系统可用内存 | 系统可用内存,单位 MB |
3029
+ | » total | number | true | none | 系统总内存 | 物理内存总量,单位 MB |
3030
+ | » systemUsed | number | true | none | 系统已用内存 | 系统已用内存,单位 MB |
3031
+ | » usagePercentage | integer | true | none | 系统内存使用率 | 系统已用内存占总内存百分比 |
3032
+ | cpuUsage | number | true | none | CPU 使用率 | 当前应用 CPU 使用率百分比 |
3006
3033
  | osVersion | string | true | none | 系统版本 | none |
3007
3034
  | ecid | string | true | none | 设备唯一 ECID | none |
3008
3035
  | isVolumeControlEnabled | boolean | true | none | 是否开启了音量键启停 | none |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ms-vite-plugin",
3
- "version": "1.4.30",
3
+ "version": "1.4.31",
4
4
  "type": "commonjs",
5
5
  "license": "MIT",
6
6
  "publishConfig": {