Skip to content

feat(plugins): 迁移 MaaFW、M9A 与 HSR 集成 - #344

Merged
qiyinxi merged 2 commits into
AUTO-MAS-Project:dev-plugin-v2from
qiyinxi:work/pv2-plugins
Aug 9, 2026
Merged

feat(plugins): 迁移 MaaFW、M9A 与 HSR 集成#344
qiyinxi merged 2 commits into
AUTO-MAS-Project:dev-plugin-v2from
qiyinxi:work/pv2-plugins

Conversation

@qiyinxi

@qiyinxi qiyinxi commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

摘要

  • 将宿主插件声明对齐到当前 MaaFW 普通栈、M9A pack 与 HSR 三个实际 entry point distribution。
  • 将 MaaFW/M9A 接入共享 MaaFW 编辑、更新、Agent 环境和配置复用页面,并断开旧 builtin M9A 的可达登记。
  • 保持 HSR 现有专属编辑链;不修改 Config V2、模拟器、其他脚本或通用 task/plugin manager。

原因

dev-plugin-v2 仍使用旧 MaaFW/M9A bootstrap 版本和宿主内置 M9A 表面,无法直接承载当前三个插件仓的动态 provider 契约。本 PR 仅迁移三插件相关宿主表面,通用能力留给对应维护者处理。

验证

  • Electron build:main 通过。
  • Vite production build 通过(5,442 modules)。
  • 迁移文件定向 Prettier / ESLint 通过。
  • 12 个本地 distribution 构建、普通非 editable target 安装、版本和 auto_mas.plugins entry point 校验通过。
  • MaaFW 插件仓 unittest:345 passed,2 skipped。
  • HSR 插件仓 unittest:268/268 passed。
  • M9A 离线测试:29 passed;live host contract 被目标分支既有语法冲突阻断。

已知基线问题

  • dev-plugin-v2 当前 HEAD 的 app/core/config.pyapp/models/schema.py 自带未解决的 Git 冲突标记,后端无法完整导入;本 PR 未越权处理。
  • Electron bootstrap 仍使用既有 uv.md.exe 路径;本 PR 未修改通用安装框架。
  • 前端全量测试仍有 3 个既有 update/WS subscription 失败;全量 typecheck 仍有既有 markdown-it、main.ts 和测试类型错误。
  • automas-script-hsr==0.1.9automas-script-maafw==0.1.13automas-script-maafw-pack-m9a==0.1.6 需由对应插件仓发布后再做在线 bootstrap 验收。

Summary by Sourcery

将基于 MaaFramework 的插件集成到宿主中,同时弃用旧的 M9A 处理方式,并通过插件支持的 API 和更丰富的前端体验增强 MaaFW 项目更新与环境准备流程。

New Features:

  • 新增 MaaFW 配置复用工作流和面板,在创建 MaaFW 项目和用户时可导入外部 MaaFW 配置或复制已有用户的配置。
  • 引入基于 WebSocket 和插件路由的 MaaFW 项目实时更新及代理环境准备进度跟踪,在编辑器和安装向导中提供更详细的 UI 反馈。
  • 支持自动选择 MaaFW 更新源,包括 MirrorChyan 和 GitHub,并改进进度摘要与提供方错误报告。

Bug Fixes:

  • 通过更严格的 UI 禁用和状态检查,防止 MaaFW 环境准备与项目更新同时进行时发生冲突。
  • 在 MAS 任务选项编辑器中避免暴露不受支持的 MaaFW 热键任务选项,以减少用户困惑。

Enhancements:

  • 更新 MaaFW、M9A 包和 HSR 插件依赖,并使宿主的卫星图标与脚本类型注册与当前基于插件的分发方式保持一致。
  • 通过移除旧的、针对 M9A 的配置和路由路径,简化脚本与用户类型处理,改用基于 MaaFW 的插件脚本。
  • 在 MaaFW 脚本配置中,通过缓存、就绪标志以及更健壮的错误处理机制,改进模拟器选项和设备加载行为。

Build:

  • 刷新 pyproject 插件包版本至最新的 MaaFW、M9A 包以及 HSR 脚本和运行时组件,并文档化说明聚合包仅作为依赖使用。
Original summary in English

Summary by Sourcery

Integrate MaaFramework-based plugins into the host while deprecating legacy M9A handling, and enhance MaaFW project update and environment preparation flows with plugin-backed APIs and richer frontend UX.

New Features:

  • Add a MaaFW configuration reuse workflow and panel to import external MaaFW configs or copy existing users when creating MaaFW projects and users.
  • Introduce real-time MaaFW project update and agent environment preparation progress tracking via WebSocket and plugin routes, with detailed UI feedback in the editor and setup wizard.
  • Support automatic selection of MaaFW update sources, including MirrorChyan and GitHub, with improved progress summaries and provider error reporting.

Bug Fixes:

  • Prevent simultaneous MaaFW environment preparation and project updates from conflicting by tightening UI disabling and state checks.
  • Avoid exposing unsupported MaaFW hotkey task options in the MAS task option editor to reduce user confusion.

Enhancements:

  • Update MaaFW, M9A pack, and HSR plugin dependencies and align host satellite icons and script type registrations with the current plugin-based distribution.
  • Simplify script and user type handling by removing legacy M9A-specific config and routing paths in favor of MaaFW-based plugin scripts.
  • Improve emulator option and device loading behavior with caching, readiness flags, and more robust error handling in MaaFW script configuration.

Build:

  • Refresh pyproject plugin package versions to the latest MaaFW, M9A pack, and HSR script and runtime components, and document that aggregate packages are dependency-only.

@sourcery-ai

sourcery-ai Bot commented Aug 9, 2026

Copy link
Copy Markdown

审查者指南(Reviewer's Guide)

将 MaaFramework/M9A/HSR 集成迁移到基于插件的 MaaFW 栈,替换传统的 M9A host 类型,将 MaaFW 脚本接入新的插件 HTTP/WebSocket API,新增配置复用流程,并改进 MaaFW 项目更新 / agent-env 的用户体验和进度处理(覆盖向导和编辑器视图)。

通过插件 HTTP 和 WebSocket 进度进行 MaaFW 项目更新的时序图

sequenceDiagram
  actor User
  participant MaaFWScriptEdit
  participant useMaaFWScriptConfig
  participant useMaaFWApi
  participant MaaFWPluginHTTP as MaaFW_plugin_HTTP
  participant MaaFWProgressWS as MaaFW_progress_WebSocket

  User->>MaaFWScriptEdit: 点击“检查更新 / 开始更新资源”
  MaaFWScriptEdit->>useMaaFWScriptConfig: handleManualProjectUpdate()
  useMaaFWScriptConfig->>useMaaFWScriptConfig: ensureMaaFWProgressSocket()
  useMaaFWScriptConfig->>MaaFWProgressWS: WebSocket connect /plugin/maafw/progress
  useMaaFWScriptConfig->>useMaaFWApi: updateProjectResources(scriptId, apply)
  useMaaFWApi->>MaaFWPluginHTTP: POST /plugin/maafw/project/update
  MaaFWPluginHTTP-->>useMaaFWApi: PluginRouteEnvelope<MaaFWPluginProjectUpdateData>
  useMaaFWApi-->>useMaaFWScriptConfig: response
  useMaaFWScriptConfig->>useMaaFWScriptConfig: handleProjectUpdateProgress()
  useMaaFWScriptConfig->>useMaaFWScriptConfig: refreshPreviewIfPossible()

  MaaFWProgressWS-->>useMaaFWScriptConfig: progress message
  useMaaFWScriptConfig->>useMaaFWScriptConfig: handleMaaFWProgressMessage()
  useMaaFWScriptConfig->>useMaaFWScriptConfig: handleProjectUpdateProgress()
  useMaaFWScriptConfig-->>MaaFWScriptEdit: 更新 projectUpdateStage / projectUpdateProgress
  MaaFWScriptEdit-->>User: 展示更新进度、日志与结果
Loading

从外部来源复用 MaaFW 配置的时序图

sequenceDiagram
  actor User
  participant MaaFWSetupWizard
  participant MaaFWConfigurationReusePanel
  participant useMaaFWConfigurationReuse
  participant MaaFWConfigReuseHTTP as MaaFW_config_reuse_HTTP

  User->>MaaFWSetupWizard: 打开 MaaFW 项目引导 / 新用户页
  MaaFWSetupWizard->>MaaFWConfigurationReusePanel: 渲染复用面板

  User->>MaaFWConfigurationReusePanel: 选择“外部 MaaFW 配置”并选择路径
  MaaFWConfigurationReusePanel->>useMaaFWConfigurationReuse: discoverSources(scriptId, sourcePath)
  useMaaFWConfigurationReuse->>MaaFWConfigReuseHTTP: POST /plugin/maafw/config-reuse/sources
  MaaFWConfigReuseHTTP-->>useMaaFWConfigurationReuse: { sources }
  useMaaFWConfigurationReuse-->>MaaFWConfigurationReusePanel: sources
  MaaFWConfigurationReusePanel-->>User: 展示候选配置

  User->>MaaFWConfigurationReusePanel: 选择一个来源并点击“预览导入内容”
  MaaFWConfigurationReusePanel->>useMaaFWConfigurationReuse: planExternal(scriptId, source, target)
  useMaaFWConfigurationReuse->>MaaFWConfigReuseHTTP: POST /plugin/maafw/config-reuse/plan/external
  MaaFWConfigReuseHTTP-->>useMaaFWConfigurationReuse: MaaFWConfigurationPlan
  useMaaFWConfigurationReuse-->>MaaFWConfigurationReusePanel: plan
  MaaFWConfigurationReusePanel-->>User: 展示预览与提示

  User->>MaaFWConfigurationReusePanel: 点击“确认导入并创建用户”
  MaaFWConfigurationReusePanel->>useMaaFWConfigurationReuse: applyPlan(scriptId, planId)
  useMaaFWConfigurationReuse->>MaaFWConfigReuseHTTP: POST /plugin/maafw/config-reuse/apply
  MaaFWConfigReuseHTTP-->>useMaaFWConfigurationReuse: MaaFWConfigurationApplyResult
  useMaaFWConfigurationReuse-->>MaaFWConfigurationReusePanel: result
  MaaFWConfigurationReusePanel-->>MaaFWSetupWizard: applied(result)
  MaaFWSetupWizard-->>User: 跳转到新建 / 导入用户编辑页
Loading

文件级变更(File-Level Changes)

Change Details Files
为项目更新与 agent env 准备引入 MaaFW 插件 HTTP/WebSocket 进度处理,并将其接入 MaaFW 脚本编辑器、设置向导和基础信息视图。
  • 新增 MaaFW WebSocket 进度封装类型、解析逻辑,以及通过 OpenAPI base 或 Electron API 端点解析 WebSocket URL。
  • 管理 MaaFW 进度 WebSocket 的生命周期(带超时的连接、generation 防护、在销毁时清理),并将消息路由到项目更新和 agent-env 的处理器。
  • 跟踪详细的项目更新和 agent-env 进度状态(阶段、百分比、字节数、日志、提供方错误码),并向 UI 暴露用于禁用操作和状态展示的计算标记。
  • 更新 BasicInfoSection 和 UpdateSettingsSection UI,以显示进度条、提示信息,并在更新 / 环境准备运行期间禁用冲突操作。
  • 在接口预览之后以及初次加载时(当 path+preview 存在)自动触发 agent env 准备。
frontend/src/composables/useMaaFWScriptConfig.ts
frontend/src/views/EditView/Script/MaaFWScriptEdit/BasicInfoSection.vue
frontend/src/views/EditView/Script/MaaFWScriptEdit/UpdateSettingsSection.vue
frontend/src/views/EditView/Script/MaaFWScriptEdit.vue
frontend/src/views/EditView/Script/MaaFWSetupWizard.vue
通过插件 HTTP 端点路由 MaaFW 项目更新与 agent-env API,并调整更新语义(检查 vs 应用)及更新来源行为。
  • 用基于 axios 的插件路由辅助方法替换直接使用 MaaFwService / core 请求的方式,目标为 /plugin/maafw 路径。
  • 使用新的封装类型(envelope types)对 MaaFW 插件 project-update 和 agent-env 响应建模,并将数据规范化为现有前端类型。
  • 修改 updateProjectResources,使其支持分离的检查 / 应用流程,提供更丰富的日志、版本 / 来源元数据,以及更好的错误处理。
  • 更新 MaaFW 更新来源默认值,使其允许自动选择来源(留空意味着 MirrorChyan+GitHub 回退),以及复用全局 MirrorChyan CDK。
  • 在更新设置 UI 中暴露 MirrorChyan CDK 的需求与阻塞状态,当缺少 CDK 时显示警示并禁用相关操作。
frontend/src/composables/useMaaFWApi.ts
frontend/src/composables/useMaaFWScriptConfig.ts
frontend/src/views/EditView/Script/MaaFWScriptEdit/UpdateSettingsSection.vue
提升 MaaFW 模拟器选择体验,加入延迟加载、缓存和就绪标记,以避免竞争条件和不必要的加载状态。
  • 引入 emulatorOptionsReady 标记、内部 loaded/promise 跟踪,以及模拟器设备选项和进行中请求的缓存映射。
  • 按模拟器 id 保护设备加载逻辑,在无效 id 时清空选项,并在可用时复用缓存选项。
  • 在模拟器选项就绪之前禁用模拟器选择框 / 输入框,并避免在向导 / 编辑器挂载流程中重复调用 loadEmulatorOptions。
frontend/src/composables/useMaaFWScriptConfig.ts
frontend/src/views/EditView/Script/MaaFWScriptEdit/ControlConfigSection.vue
frontend/src/views/EditView/Script/MaaFWSetupWizard.vue
frontend/src/views/EditView/Script/MaaFWScriptEdit.vue
为项目设置向导和 MaaFW 用户创建新增 MaaFW 配置复用流程(外部 MaaFW 配置或已有用户),通过新的 composable 和面板组件实现。
  • 创建 MaaFWConfigurationReusePanel 组件,提供 UI 以选择复用模式(空白、外部 MaaFW 配置、复制已有用户)并预览导入计划。
  • 新增 useMaaFWConfigurationReuse composable,与新的插件端点 /plugin/maafw/config-reuse(sources、plan/external、plan/copy、apply)交互,并具有类型化响应。
  • 将复用面板接入 MaaFW 设置向导(首个用户创建的新步骤)和 MaaFW 用户新增流程(表单前步骤),跟踪复用完成状态与导入用户 ID。
  • 更新向导步骤(标题、maxReachableStep、导航规则)以及项目显示名称,以反映 MaaFW/M9A/HSR 插件条目,而非传统 M9A。
  • 确保在应用复用计划后,脚本 / 用户加载与导航能反映新创建 / 导入的用户。
frontend/src/components/MaaFWConfigurationReusePanel.vue
frontend/src/composables/useMaaFWConfigurationReuse.ts
frontend/src/views/EditView/Script/MaaFWSetupWizard.vue
frontend/src/views/EditView/User/MaaFWUserEdit.vue
移除传统内置 M9A 脚本 / 用户类型,将 M9A 使用路由到 MaaFW 插件栈,并清理相关前后端引用。
  • 从 BuiltinScriptType、ScriptIndexItem 类型、AddScriptResponse、ScriptDetail 以及相关脚本 / 用户配置联合类型中移除 M9A。
  • 删除 M9A 特定的 script_type 注册条目、传统绑定,以及针对 M9AConfig/M9AUserConfig 的传统配置解析逻辑。
  • 删除 useScriptApi 中 M9A 特定分支及相关用户形状转换,以及与 M9A 相关的任务选项 / 队列类型。
  • 移除 Vue router 中的 M9A 路由和重定向,并停止从 app.task 中导出 M9AManager / task manager 接线。
  • 从导入中排除 M9A 传统卫星图标,并调整常量映射,使其不再引用 M9A 配置类型。
frontend/src/types/script.ts
frontend/src/composables/useScriptApi.ts
app/core/script_types.py
app/models/schema.py
frontend/src/router/index.ts
app/task/__init__.py
frontend/src/composables/satellite-config.ts
app/models/config.py
app/models/config_legacy.py
app/utils/constants.py
优化 MaaFW 脚本 UI(向导和编辑器),使其具备项目感知能力、避免热键选项编辑,并与基于插件的 MaaFW/HSR 入口保持一致。
  • 从接口预览 / 项目标签 / 名称中计算 projectDisplayName,并在 MaaFW 脚本向导 / 编辑器标题中使用它来替代静态的 MaaFramework/M9A 标签。
  • 在 MaaFWTaskOptionEditor 中过滤掉类型为 'hotkey' 的 MaaFW 任务选项,以避免暗示 MAS 持久化由 MaaFW 项目拥有的热键。
  • 调整向导步骤流程,插入配置复用步骤,并将进度控制在 agent env 就绪、复用完成以及无运行中更新的前提下。
  • 在编辑器中,当 path 和预览数据存在时,在预览之后自动准备 MaaFW agent env。
frontend/src/views/EditView/Script/MaaFWSetupWizard.vue
frontend/src/views/EditView/Script/MaaFWScriptEdit.vue
frontend/src/views/EditView/User/MaaFWTaskOptionEditor.vue
更新 MaaFW、M9A pack 和 HSR 插件版本以及引导插件包列表,使宿主与新的插件契约发行版保持一致。
  • 提升 MaaFW interface、agent-env、controllers、project-update、runtime-pool 和 runner 包版本,以支持基于插件的流程。
  • 更新 automas-script-maafw 和 automas-script-maafw-pack-m9a 版本,并将 automas-script-hsr 及 HSR 适配器包加入插件包列表。
  • 在注释中说明 automas-m9a 和 automas-hsr 聚合包仅作为依赖使用,而非直接的引导条目。
pyproject.toml
调整 MaaFW 脚本路由和插件编辑器映射,以匹配新的基于插件的 MaaFW/HSR 入口,并移除传统 M9A 编辑器映射。
  • 更改插件编辑器段映射,加入 plugin:automas_script_maafw -> 'maafw',并移除内置 m9a 编辑器段。
  • 确保 MaaFW 插件脚本通过脚本注册工具解析到 maafw 编辑器路由。
  • 保持 Okww 插件 / 编辑器映射继续使用独立的 okww 编辑路由。
frontend/src/utils/scriptRegistry.ts
使后端 MaaFW 辅助方法与基于插件的脚本保持一致,移除在 MaaFW 检测和 agent env 信息构建中对 M9AConfig 的引用。
  • 更新 _is_maafw_framework_script,仅将 MaaFWConfig 视为传统 MaaFW 框架脚本(不再包含 M9AConfig)。
  • 在文档中澄清插件形式 MaaFW 脚本与传统 MaaFWConfig 的存储与解码方式差异。
  • 移除 app/api/scripts 中用于 agent env 信息的脚本 / 用户类型映射字典里的 M9AConfig/M9AUserConfig 映射。
app/api/scripts.py

可能关联的问题(Possibly linked issues)

  • #共用MAA Framework:问题询问多脚本共用 MaaFW;本 PR 将 MaaFW/M9A/HSR 迁移到共享插件环境,并加入配置复用面板,直接实现共用并减少重复安装。

技巧与命令(Tips and commands)

与 Sourcery 交互(Interacting with Sourcery)

  • 触发新的审查: 在 pull request 上评论 @sourcery-ai review
  • 继续讨论: 直接回复 Sourcery 的审查评论。
  • 从审查评论生成 GitHub issue: 通过回复某条审查评论,要求 Sourcery 根据该评论创建一个 issue。你也可以在审查评论下回复 @sourcery-ai issue 来从该评论创建 issue。
  • 生成 pull request 标题: 在 pull request 标题中的任意位置写入 @sourcery-ai,即可随时生成标题。你也可以在 pull request 上评论 @sourcery-ai title 来(重新)生成标题。
  • 生成 pull request 摘要: 在 pull request 正文的任意位置写入 @sourcery-ai summary,即可在该位置生成 PR 摘要。你也可以在 pull request 上评论 @sourcery-ai summary 来在任意时间(重新)生成摘要。
  • 生成审查者指南: 在 pull request 上评论 @sourcery-ai guide,即可在任意时间(重新)生成审查者指南。
  • 解决所有 Sourcery 评论: 在 pull request 上评论 @sourcery-ai resolve,以解决所有 Sourcery 评论。当你已经处理完所有评论且不希望再看到它们时很有用。
  • 撤销所有 Sourcery 审查: 在 pull request 上评论 @sourcery-ai dismiss,以撤销所有已有的 Sourcery 审查。若你希望从头开始新的审查尤其有用——别忘了再评论 @sourcery-ai review 以触发新的审查!

自定义你的体验(Customizing Your Experience)

访问你的 仪表盘 以:

  • 启用或禁用审查功能,例如 Sourcery 生成的 pull request 摘要、审查者指南等。
  • 更改审查语言。
  • 添加、移除或编辑自定义审查指令。
  • 调整其他审查设置。

获取帮助(Getting Help)

Original review guide in English

Reviewer's Guide

Migrates MaaFramework/M9A/HSR integrations to plugin-based MaaFW stack, replacing legacy M9A host types, wiring MaaFW scripts to new plugin HTTP/WebSocket APIs, adding configuration reuse flows, and improving MaaFW project update/agent-env UX and progress handling across wizard and editor views.

Sequence diagram for MaaFW project update via plugin HTTP and WebSocket progress

sequenceDiagram
  actor User
  participant MaaFWScriptEdit
  participant useMaaFWScriptConfig
  participant useMaaFWApi
  participant MaaFWPluginHTTP as MaaFW_plugin_HTTP
  participant MaaFWProgressWS as MaaFW_progress_WebSocket

  User->>MaaFWScriptEdit: 点击“检查更新 / 开始更新资源”
  MaaFWScriptEdit->>useMaaFWScriptConfig: handleManualProjectUpdate()
  useMaaFWScriptConfig->>useMaaFWScriptConfig: ensureMaaFWProgressSocket()
  useMaaFWScriptConfig->>MaaFWProgressWS: WebSocket connect /plugin/maafw/progress
  useMaaFWScriptConfig->>useMaaFWApi: updateProjectResources(scriptId, apply)
  useMaaFWApi->>MaaFWPluginHTTP: POST /plugin/maafw/project/update
  MaaFWPluginHTTP-->>useMaaFWApi: PluginRouteEnvelope<MaaFWPluginProjectUpdateData>
  useMaaFWApi-->>useMaaFWScriptConfig: response
  useMaaFWScriptConfig->>useMaaFWScriptConfig: handleProjectUpdateProgress()
  useMaaFWScriptConfig->>useMaaFWScriptConfig: refreshPreviewIfPossible()

  MaaFWProgressWS-->>useMaaFWScriptConfig: progress message
  useMaaFWScriptConfig->>useMaaFWScriptConfig: handleMaaFWProgressMessage()
  useMaaFWScriptConfig->>useMaaFWScriptConfig: handleProjectUpdateProgress()
  useMaaFWScriptConfig-->>MaaFWScriptEdit: 更新 projectUpdateStage / projectUpdateProgress
  MaaFWScriptEdit-->>User: 展示更新进度、日志与结果
Loading

Sequence diagram for MaaFW configuration reuse from external sources

sequenceDiagram
  actor User
  participant MaaFWSetupWizard
  participant MaaFWConfigurationReusePanel
  participant useMaaFWConfigurationReuse
  participant MaaFWConfigReuseHTTP as MaaFW_config_reuse_HTTP

  User->>MaaFWSetupWizard: 打开 MaaFW 项目引导 / 新用户页
  MaaFWSetupWizard->>MaaFWConfigurationReusePanel: 渲染复用面板

  User->>MaaFWConfigurationReusePanel: 选择“外部 MaaFW 配置”并选择路径
  MaaFWConfigurationReusePanel->>useMaaFWConfigurationReuse: discoverSources(scriptId, sourcePath)
  useMaaFWConfigurationReuse->>MaaFWConfigReuseHTTP: POST /plugin/maafw/config-reuse/sources
  MaaFWConfigReuseHTTP-->>useMaaFWConfigurationReuse: { sources }
  useMaaFWConfigurationReuse-->>MaaFWConfigurationReusePanel: sources
  MaaFWConfigurationReusePanel-->>User: 展示候选配置

  User->>MaaFWConfigurationReusePanel: 选择一个来源并点击“预览导入内容”
  MaaFWConfigurationReusePanel->>useMaaFWConfigurationReuse: planExternal(scriptId, source, target)
  useMaaFWConfigurationReuse->>MaaFWConfigReuseHTTP: POST /plugin/maafw/config-reuse/plan/external
  MaaFWConfigReuseHTTP-->>useMaaFWConfigurationReuse: MaaFWConfigurationPlan
  useMaaFWConfigurationReuse-->>MaaFWConfigurationReusePanel: plan
  MaaFWConfigurationReusePanel-->>User: 展示预览与提示

  User->>MaaFWConfigurationReusePanel: 点击“确认导入并创建用户”
  MaaFWConfigurationReusePanel->>useMaaFWConfigurationReuse: applyPlan(scriptId, planId)
  useMaaFWConfigurationReuse->>MaaFWConfigReuseHTTP: POST /plugin/maafw/config-reuse/apply
  MaaFWConfigReuseHTTP-->>useMaaFWConfigurationReuse: MaaFWConfigurationApplyResult
  useMaaFWConfigurationReuse-->>MaaFWConfigurationReusePanel: result
  MaaFWConfigurationReusePanel-->>MaaFWSetupWizard: applied(result)
  MaaFWSetupWizard-->>User: 跳转到新建 / 导入用户编辑页
Loading

File-Level Changes

Change Details Files
Introduce MaaFW plugin HTTP/WebSocket progress handling for project updates and agent env preparation and wire it into MaaFW script editor, setup wizard, and basic info views.
  • Add MaaFW WebSocket progress envelope types, parsing, and URL resolution using OpenAPI base or Electron API endpoints.
  • Manage MaaFW progress WebSocket lifecycle (connect with timeout, generation guarding, cleanup on dispose) and route messages to project-update and agent-env handlers.
  • Track detailed project update and agent-env progress state (stages, percentages, bytes, logs, provider error codes) and expose computed flags for UI disablement and status.
  • Update BasicInfoSection and UpdateSettingsSection UIs to display progress bars, messages, and disable conflicting actions while updates/env preparation run.
  • Auto-trigger agent env preparation after interface preview and on initial load when path+preview exist.
frontend/src/composables/useMaaFWScriptConfig.ts
frontend/src/views/EditView/Script/MaaFWScriptEdit/BasicInfoSection.vue
frontend/src/views/EditView/Script/MaaFWScriptEdit/UpdateSettingsSection.vue
frontend/src/views/EditView/Script/MaaFWScriptEdit.vue
frontend/src/views/EditView/Script/MaaFWSetupWizard.vue
Route MaaFW project update and agent-env APIs through plugin HTTP endpoints and adjust update semantics (check vs apply) and update-source behavior.
  • Replace direct MaaFwService / core request usage with axios-based plugin route helper targeting /plugin/maafw paths.
  • Model MaaFW plugin project-update and agent-env responses with new envelope types, normalizing data to existing frontend types.
  • Change updateProjectResources to support separate check/apply flows with richer logs, version/source metadata, and better error handling.
  • Update MaaFW update-source defaults to allow auto source selection (blank meaning MirrorChyan+GitHub fallback) and global MirrorChyan CDK reuse.
  • Surface MirrorChyan CDK requirement and blocking state in update settings UI with alerts and disabled actions when CDK is missing.
frontend/src/composables/useMaaFWApi.ts
frontend/src/composables/useMaaFWScriptConfig.ts
frontend/src/views/EditView/Script/MaaFWScriptEdit/UpdateSettingsSection.vue
Enhance MaaFW emulator selection UX with lazy loading, caching, and readiness flags to avoid race conditions and unnecessary loading states.
  • Introduce emulatorOptionsReady flag, internal loaded/promise tracking, and caching maps for emulator device options and in-flight requests.
  • Guard emulator device loading by emulator id, clear options on invalid ids, and reuse cached options when available.
  • Disable emulator selects/inputs until emulator options are ready and avoid duplicate loadEmulatorOptions calls in wizard/editor mounting flows.
frontend/src/composables/useMaaFWScriptConfig.ts
frontend/src/views/EditView/Script/MaaFWScriptEdit/ControlConfigSection.vue
frontend/src/views/EditView/Script/MaaFWSetupWizard.vue
frontend/src/views/EditView/Script/MaaFWScriptEdit.vue
Add MaaFW configuration reuse workflow (external MaaFW configs or existing users) for project setup wizard and MaaFW user creation, via a new composable and panel component.
  • Create MaaFWConfigurationReusePanel component with UI to select reuse mode (blank, external MaaFW config, copy existing user) and preview import plans.
  • Add useMaaFWConfigurationReuse composable to talk to new plugin /plugin/maafw/config-reuse endpoints (sources, plan/external, plan/copy, apply) with typed responses.
  • Wire reuse panel into MaaFW setup wizard (new step for first-user creation) and MaaFW user add flow (pre-form step), tracking reuse completion and imported user id.
  • Update wizard steps (titles, maxReachableStep, navigation rules) and project display names to reflect MaaFW/M9A/HSR plugin entries instead of legacy M9A.
  • Ensure script/user loads and navigation reflect newly created/imported users after applying reuse plans.
frontend/src/components/MaaFWConfigurationReusePanel.vue
frontend/src/composables/useMaaFWConfigurationReuse.ts
frontend/src/views/EditView/Script/MaaFWSetupWizard.vue
frontend/src/views/EditView/User/MaaFWUserEdit.vue
Remove legacy built-in M9A script/user types, routing M9A usage through MaaFW plugin stack and cleaning up associated frontend/backend references.
  • Drop M9A from BuiltinScriptType, ScriptIndexItem types, AddScriptResponse, ScriptDetail, and related script/user config unions.
  • Remove M9A-specific script_type registry entries, legacy binding, and legacy config resolution for M9AConfig/M9AUserConfig.
  • Delete M9A-specific branches in useScriptApi and related user-shape transformations, as well as task option/queue types for M9A.
  • Remove M9A routes and redirects in Vue router and stop exporting M9AManager/task manager wiring from app.task.
  • Exclude M9A legacy satellite icon from imports and adjust constants mappings to no longer refer to M9A config types.
frontend/src/types/script.ts
frontend/src/composables/useScriptApi.ts
app/core/script_types.py
app/models/schema.py
frontend/src/router/index.ts
app/task/__init__.py
frontend/src/composables/satellite-config.ts
app/models/config.py
app/models/config_legacy.py
app/utils/constants.py
Refine MaaFW script UI (wizard and editor) to be project-aware, avoid hotkey option editing, and align with plugin-based MaaFW/HSR entry points.
  • Compute projectDisplayName from interface preview/project label/name and use it in MaaFW script wizard/editor titles instead of static MaaFramework/M9A labels.
  • Filter out MaaFW task options of type 'hotkey' in MaaFWTaskOptionEditor to avoid implying MAS persistence of hotkeys owned by the MaaFW project.
  • Adjust wizard step flow to insert configuration reuse step, gate progression on agent env readiness, reuse completion, and non-running updates.
  • Automatically prepare MaaFW agent env after preview in editor when path and preview data are present.
frontend/src/views/EditView/Script/MaaFWSetupWizard.vue
frontend/src/views/EditView/Script/MaaFWScriptEdit.vue
frontend/src/views/EditView/User/MaaFWTaskOptionEditor.vue
Update MaaFW, M9A pack, and HSR plugin versions and bootstrap plugin package list to align host with new plugin-contract distributions.
  • Bump MaaFW interface, agent-env, controllers, project-update, runtime-pool, and runner packages to newer versions supporting plugin-based flows.
  • Update automas-script-maafw and automas-script-maafw-pack-m9a versions and add automas-script-hsr plus HSR adapter packages to plugin package list.
  • Clarify in comments that automas-m9a and automas-hsr aggregates are dependency-only and not direct bootstrap entries.
pyproject.toml
Adjust MaaFW script routing and plugin editor mapping to match new plugin-based MaaFW/HSR entries and remove legacy M9A editor mapping.
  • Change plugin editor segment map to include plugin:automas_script_maafw -> 'maafw' and remove builtin m9a editor segments.
  • Ensure MaaFW plugin scripts resolve to maafw editor route via script registry utilities.
  • Keep Okww plugin/editor mapping using dedicated okww edit route as before.
frontend/src/utils/scriptRegistry.ts
Align backend MaaFW helpers with plugin-based scripts and remove references to M9AConfig in MaaFW detection and agent env info builders.
  • Update _is_maafw_framework_script to treat only MaaFWConfig as legacy MaaFW framework scripts (excluding M9AConfig).
  • Clarify documentation on how plugin-form MaaFW scripts are stored and decoded versus legacy MaaFWConfig.
  • Remove M9AConfig/M9AUserConfig mappings in app/api/scripts script/user type mapping dictionaries used for agent env info.
app/api/scripts.py

Possibly linked issues

  • #共用MAA Framework: 问题询问多脚本共用 MaaFW;PR迁移 MaaFW/M9A/HSR 到共享插件环境并加入配置复用面板,直接实现共用和减少重复安装。

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@qiyinxi
qiyinxi marked this pull request as ready for review August 9, 2026 04:55

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @qiyinxi, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@qiyinxi
qiyinxi merged commit 9eecfc0 into AUTO-MAS-Project:dev-plugin-v2 Aug 9, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant