mirror of
https://github.com/Yuyi-Oak/BlueArchiveToolkit.git
synced 2026-09-18 07:24:55 +08:00
feat(bat): 完善工作流调度与 dashboard RPC
补全资源拉取、解析、翻译、重打包和本地化发布命令,支持单次、限定次数与周期调度。移除 TUI 计划并通过 schedule.* RPC 暴露给 bat-api dashboard。 Closes #43
This commit is contained in:
@@ -159,6 +159,40 @@ SQLite `ResourceRepository`,索引不存在时返回 `ok=true` 且
|
||||
|
||||
删除资源只进入 `official-resource-changes.json`,不进入 Crowdin handoff。
|
||||
|
||||
### schedule
|
||||
|
||||
调度计划由 Rust `bat` 持有,状态文件为 daemon `state_dir` 下的
|
||||
`bat-schedules.json`。CLI、RPC 和 `bat-api` dashboard 都调用同一组原子
|
||||
读改写逻辑,不在 Go 侧复制计划状态。
|
||||
|
||||
| 方法 | 状态 | params | data |
|
||||
|---|---|---|---|
|
||||
| `schedule.list` | 已实现 | `null` | `{ "command": "schedule-list", "schedules": [...] }`。 |
|
||||
| `schedule.add` | 已实现 | 调度 mutation | 新建 schedule report。 |
|
||||
| `schedule.update` | 已实现 | 调度 mutation,必须有 `id` | 更新后的 schedule report。 |
|
||||
| `schedule.remove` | 已实现 | `{ "id": "daily-pull" }` | 删除报告。 |
|
||||
| `schedule.run` | 已实现 | `{ "id": "daily-pull", "force": true }`,字段可省略 | 到期或强制执行报告;省略 `id` 执行所有到期计划。 |
|
||||
|
||||
调度 mutation 字段如下:
|
||||
|
||||
| 字段 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| `id` | string | 计划 ID;add 必填,update/remove 用于定位。 |
|
||||
| `group` | string | `res`、`parse` 或 `i18n`;对应一级工作流。 |
|
||||
| `action` | string | `res` 的 `pull/refresh/verify/repair`、`parse` 的 `run/repack`、`i18n` 的 `run/export/publish`。 |
|
||||
| `args` | string[] | 目标工作流的 CLI 参数。 |
|
||||
| `next_run_unix_seconds` | uint64 | 指定下一次执行时间;不能和 `delay_seconds` 同时使用。 |
|
||||
| `delay_seconds` | uint64 | 从当前时间计算下一次执行时间。 |
|
||||
| `every_seconds` | uint64 | 周期秒数;必须大于 0。 |
|
||||
| `count` | uint64 | 最大执行次数;省略周期无限执行,非周期计划默认执行一次。 |
|
||||
| `clear_args` | bool | update 时清空工作流参数。 |
|
||||
| `clear_every` | bool | update 时清除周期并转为单次计划。 |
|
||||
| `enabled` | bool | 启用或停用计划。 |
|
||||
|
||||
`count > 1` 必须和周期同时存在;`schedule.run` 的 `force=true` 只忽略
|
||||
到期时间,不会绕过 `enabled=false`。每次执行前先持久化下一次状态,执行后
|
||||
再持久化成功/失败和错误信息,避免进程中断后重复领取同一计划。
|
||||
|
||||
### parse
|
||||
|
||||
| 方法 | 状态 | params | data |
|
||||
@@ -376,7 +410,8 @@ CLI 对应关系:
|
||||
- `Call` 可发送本文档中的任意已记录方法,并负责 JSON-RPC transport、
|
||||
envelope 和 `ApiError` 解码;它不是 bat-api 的 HTTP 任意 RPC proxy。
|
||||
- typed helper 已覆盖 daemon 已实现方法(`status/logs/stop/restart/reload/refresh/doctor`)、
|
||||
`resource.state/sync/verify/repair/manifest/list`、`catalog.*`、`parse.*`、
|
||||
`resource.state/sync/verify/repair/manifest/list`、`schedule.list/add/update/remove/run`、
|
||||
`catalog.*`、`parse.*`、
|
||||
`localized.status`、`task.*` 和三个
|
||||
`unityfs.patch_*` 方法。
|
||||
- `resource.index`、`translation.tasks`、`translation.handoff`、
|
||||
@@ -389,6 +424,7 @@ CLI 对应关系:
|
||||
|---|---|---|
|
||||
| `Backend` | `daemon.status`、`daemon.doctor`、`resource.state`、`catalog.status`、`resource.manifest` | 启动发现、周期刷新和资源分发 |
|
||||
| `ControlBackend` | `daemon.restart`、`daemon.reload`、`daemon.refresh`、`resource.sync`、`resource.verify`、`resource.repair`、`catalog.refresh` | 鉴权后的管理控制白名单 |
|
||||
| `ScheduleBackend` | `schedule.list`、`schedule.add`、`schedule.update`、`schedule.remove`、`schedule.run` | 鉴权后的 dashboard 调度计划控制 |
|
||||
|
||||
`daemon.stop`、`daemon.clean-stable` 和任意通用 RPC 不属于 bat-api 管理控制面。
|
||||
Rust dispatch、Go transport 和 bat-api 接口的权威实现位置分别是
|
||||
|
||||
Reference in New Issue
Block a user