Skip to content

Commit b273a7a

Browse files
authored
docs: add resource.hash field to PI V2 (v2.6.0) (#1284)
1 parent 5b189f6 commit b273a7a

3 files changed

Lines changed: 24 additions & 2 deletions

File tree

docs/en_us/3.3-ProjectInterfaceV2.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ We have designated the version number for the independent release (January 30, 2
2626
| 2026-03-05 | v2.3.1 | Clarified option applicability filtering |
2727
| 2026-03-09 | v2.4.0 | Added top-level `group` declarations and `task.group` task grouping |
2828
| 2026-03-23 | v2.5.0 | Convention for `PI_*` environment variables when the Client starts Agent subprocesses (UI / Client metadata and the selected controller and resource with i18n resolved) |
29+
| 2026-04-18 | v2.6.0 | Added `resource.hash` resource integrity check field |
2930

3031
## `interface.json`
3132

@@ -227,6 +228,12 @@ We have designated the version number for the independent release (January 30, 2
227228
_Optional._ Resource-level option configuration, an array of strings. Array elements should correspond to the key names in the outer `option` configuration. The parameters generated by this option will participate in the pipeline override of all tasks, serving as resource-level parameter passing.
228229
If a referenced option does not satisfy the current controller/resource constraints, that option's `pipeline_override` (including nested `option.option`) must not be merged. **💡 v2.3.1**
229230

231+
- **hash** `string` **💡 v2.6.0**
232+
_Optional._ Resource integrity check value. This should be the hash string obtained via `MaaResourceGetHash` after loading only `path`.
233+
Verification should occur after loading `path` but before loading `controller.attach_resource_path`.
234+
If the actual hash does not match, a warning should be shown to the user (e.g. suggest re-downloading the resource package) without preventing continued use.
235+
Debug builds (e.g. pre-release versions) may skip this check. If this field is not set, no verification is needed.
236+
230237
```jsonc
231238
"resource": [
232239
{
@@ -238,7 +245,8 @@ We have designated the version number for the independent release (January 30, 2
238245
{
239246
"name": "GeneralResource",
240247
"label": "$GeneralResource",
241-
"path": ["resource"]
248+
"path": ["resource"],
249+
"hash": "1a2b3c4d"
242250
}
243251
]
244252
```

docs/zh_cn/3.3-ProjectInterfaceV2协议.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
| 2026-3-5 | v2.3.1 | 明确 option 适用性过滤规则 |
2727
| 2026-3-9 | v2.4.0 | 新增顶层 `group` 分组声明与 `task.group` 任务分组字段 |
2828
| 2026-3-23 | v2.5.0 | 约定 Client 启动 Agent 子进程时注入 `PI_*` 环境变量,传递 UI / Client 属性及当前选中的控制器与资源(i18n 已解析) |
29+
| 2026-4-18 | v2.6.0 | 新增 `resource.hash` 资源完整性校验字段 |
2930

3031
## `interface.json`
3132

@@ -227,6 +228,12 @@
227228
可选。资源包级的选项配置,为一个字符串数组,数组元素应与外层 option 配置中的键名对应。
228229
该选项生成的参数会参与到所有任务的 pipeline override 中,起到资源包级参数传递的作用。
229230
若被引用的 option 不支持当前 controller/resource 条件,则该 option 的 `pipeline_override`(含其嵌套 `option.option`)不参与合并。 **💡 v2.3.1**
231+
232+
- hash `string` **💡 v2.6.0**
233+
可选。资源完整性校验值。该值应为仅加载 `path` 后通过 `MaaResourceGetHash` 获取的 hash 字符串。
234+
校验时机为加载完 `path` 后、加载 `controller.attach_resource_path` 之前。
235+
若实际 hash 与该值不匹配,应向用户发出警告(例如建议重新下载资源包),但不应阻止继续使用。
236+
调试版本(如预发布版本)可跳过此校验。若未设置此字段,无需校验。
230237

231238
```jsonc
232239
"resource": [
@@ -239,7 +246,8 @@
239246
{
240247
"name": "通用资源",
241248
"label": "$通用资源",
242-
"path": ["resource"]
249+
"path": ["resource"],
250+
"hash": "1a2b3c4d"
243251
}
244252
]
245253
```

tools/interface.schema.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -677,6 +677,12 @@
677677
"items": {
678678
"type": "string"
679679
}
680+
},
681+
"hash": {
682+
"type": "string",
683+
"minLength": 1,
684+
"title": "资源 hash",
685+
"description": "资源校验值,通过 MaaResourceGetHash 获取。校验时机为加载 resource.path 后、加载 controller.attach_resource_path 之前"
680686
}
681687
},
682688
"required": [

0 commit comments

Comments
 (0)