feat(maafw): 收口普通 MaaFW 并迁出内置 M9A - #340
Closed
qiyinxi wants to merge 5 commits into
Closed
Conversation
Reviewer's Guide重构 MaaFW 主机与前端,使其围绕基于 Runtime Pool 的新环境生命周期运作;新增脚本配置写入序列化事务与执行保留机制;通过 WebSocket 暴露更详细的 MaaFW 项目更新/环境进度;并完全移除内置 M9A schema/路由,改为由插件管理相关条目。 MaaFW 项目更新与环境预热的时序图sequenceDiagram
actor Editor
participant MaaFWScriptConfigComposable as useMaaFWScriptConfig
participant ScriptsApi as update_maafw_project
participant UpdateService as MaaFWProjectUpdateService
participant RunnerService as MaaFWRunnerService
participant RuntimePool as maafw.runtime_pool.v1
participant WS as Publisher
Editor->>MaaFWScriptConfigComposable: handleManualProjectUpdate
MaaFWScriptConfigComposable->>ScriptsApi: update_maafw_project(scriptId, apply)
ScriptsApi->>UpdateService: discover_update()/update_if_needed()
UpdateService-->>ScriptsApi: MaaFWProjectUpdateResult
Note over ScriptsApi,WS: publish_update_progress(..., stage=checking...)
alt update_result.updated
ScriptsApi->>RuntimePool: _maafw_runtime_pool_route()
RuntimePool-->>ScriptsApi: (runtime_pool_root, pool_id)
ScriptsApi->>RunnerService: prepare_project_environment(project_path, interface_model,...)
RunnerService-->>ScriptsApi: prepared_result (agents, projectFingerprint, runtime)
ScriptsApi->>ScriptsApi: _build_maafw_runtime_cache_fields()
ScriptsApi->>ScriptsApi: _save_maafw_agent_env_state_if_current(..., expected_fingerprint)
ScriptsApi->>WS: Publisher.send(MAAFW_PROJECT_UPDATE_PROGRESS, stage=completed)
else no update or check only
ScriptsApi->>WS: Publisher.send(MAAFW_PROJECT_UPDATE_PROGRESS, stage=completed, status=no_update|version_discovered)
end
ScriptsApi-->>MaaFWScriptConfigComposable: MaaFWProjectUpdateOut
MaaFWScriptConfigComposable-->>Editor: updateProjectResources result and logs
带缓存的 MaaFW Agent 环境准备时序图sequenceDiagram
actor Editor
participant MaaFWScriptConfigComposable as useMaaFWScriptConfig
participant MaaFWApi as prepare_maafw_agent_env
participant EnvState as maafw_agent_env_state
participant RuntimePool as maafw.runtime_pool.v1
participant RunnerService as MaaFWRunnerService
participant WS as Publisher
Editor->>MaaFWScriptConfigComposable: handlePrepareAgentEnv
MaaFWScriptConfigComposable->>MaaFWApi: prepareAgentEnv(path, scriptId)
MaaFWApi->>MaaFWApi: _load_maafw_agent_env_state_for_request(scriptId, path)
alt cached_data found and valid
MaaFWApi->>WS: Publisher.send(MAAFW_ENV_PREPARE_PROGRESS, stage=completed, status=ready)
MaaFWApi-->>MaaFWScriptConfigComposable: MaaFWAgentEnvPrepareOut(data=cached)
else cache miss
MaaFWApi->>RuntimePool: _maafw_runtime_pool_route()
RuntimePool-->>MaaFWApi: (runtime_pool_root, pool_id)
MaaFWApi->>RunnerService: prepare_project_environment(root_path, interface,...)
RunnerService-->>MaaFWApi: prepared_result (agents, projectFingerprint, runtime)
MaaFWApi->>EnvState: save_maafw_agent_env_state(scriptId, path, prepared_data, expected_fingerprint)
EnvState-->>MaaFWApi: saved/failed
MaaFWApi->>WS: Publisher.send(MAAFW_ENV_PREPARE_PROGRESS, stage=completed, status=completed)
MaaFWApi-->>MaaFWScriptConfigComposable: MaaFWAgentEnvPrepareOut(data=prepared)
end
MaaFWScriptConfigComposable-->>Editor: agentEnvResult and progress UI
文件级改动
可能关联的 Issue
Tips and commandsInteracting with Sourcery
Customizing Your Experience访问你的 dashboard 以:
Getting HelpOriginal review guide in EnglishReviewer's GuideRefactors MaaFW host and frontend around a new Runtime Pool-based environment lifecycle, adds serialized script config write transactions and execution reservations, exposes detailed MaaFW project update/environment progress over WebSocket, and fully removes built‑in M9A schema/routes in favor of plugin-managed entries. Sequence diagram for MaaFW project update and environment prewarmsequenceDiagram
actor Editor
participant MaaFWScriptConfigComposable as useMaaFWScriptConfig
participant ScriptsApi as update_maafw_project
participant UpdateService as MaaFWProjectUpdateService
participant RunnerService as MaaFWRunnerService
participant RuntimePool as maafw.runtime_pool.v1
participant WS as Publisher
Editor->>MaaFWScriptConfigComposable: handleManualProjectUpdate
MaaFWScriptConfigComposable->>ScriptsApi: update_maafw_project(scriptId, apply)
ScriptsApi->>UpdateService: discover_update()/update_if_needed()
UpdateService-->>ScriptsApi: MaaFWProjectUpdateResult
Note over ScriptsApi,WS: publish_update_progress(..., stage=checking...)
alt update_result.updated
ScriptsApi->>RuntimePool: _maafw_runtime_pool_route()
RuntimePool-->>ScriptsApi: (runtime_pool_root, pool_id)
ScriptsApi->>RunnerService: prepare_project_environment(project_path, interface_model,...)
RunnerService-->>ScriptsApi: prepared_result (agents, projectFingerprint, runtime)
ScriptsApi->>ScriptsApi: _build_maafw_runtime_cache_fields()
ScriptsApi->>ScriptsApi: _save_maafw_agent_env_state_if_current(..., expected_fingerprint)
ScriptsApi->>WS: Publisher.send(MAAFW_PROJECT_UPDATE_PROGRESS, stage=completed)
else no update or check only
ScriptsApi->>WS: Publisher.send(MAAFW_PROJECT_UPDATE_PROGRESS, stage=completed, status=no_update|version_discovered)
end
ScriptsApi-->>MaaFWScriptConfigComposable: MaaFWProjectUpdateOut
MaaFWScriptConfigComposable-->>Editor: updateProjectResources result and logs
Sequence diagram for MaaFW agent environment prepare with cachesequenceDiagram
actor Editor
participant MaaFWScriptConfigComposable as useMaaFWScriptConfig
participant MaaFWApi as prepare_maafw_agent_env
participant EnvState as maafw_agent_env_state
participant RuntimePool as maafw.runtime_pool.v1
participant RunnerService as MaaFWRunnerService
participant WS as Publisher
Editor->>MaaFWScriptConfigComposable: handlePrepareAgentEnv
MaaFWScriptConfigComposable->>MaaFWApi: prepareAgentEnv(path, scriptId)
MaaFWApi->>MaaFWApi: _load_maafw_agent_env_state_for_request(scriptId, path)
alt cached_data found and valid
MaaFWApi->>WS: Publisher.send(MAAFW_ENV_PREPARE_PROGRESS, stage=completed, status=ready)
MaaFWApi-->>MaaFWScriptConfigComposable: MaaFWAgentEnvPrepareOut(data=cached)
else cache miss
MaaFWApi->>RuntimePool: _maafw_runtime_pool_route()
RuntimePool-->>MaaFWApi: (runtime_pool_root, pool_id)
MaaFWApi->>RunnerService: prepare_project_environment(root_path, interface,...)
RunnerService-->>MaaFWApi: prepared_result (agents, projectFingerprint, runtime)
MaaFWApi->>EnvState: save_maafw_agent_env_state(scriptId, path, prepared_data, expected_fingerprint)
EnvState-->>MaaFWApi: saved/failed
MaaFWApi->>WS: Publisher.send(MAAFW_ENV_PREPARE_PROGRESS, stage=completed, status=completed)
MaaFWApi-->>MaaFWScriptConfigComposable: MaaFWAgentEnvPrepareOut(data=prepared)
end
MaaFWScriptConfigComposable-->>Editor: agentEnvResult and progress UI
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
…ugin-clean-20260805 # Conflicts: # app/models/schema.py # frontend/src/api/models/ScriptCreateIn.ts # frontend/src/api/models/ScriptCreateOut.ts # frontend/src/api/models/ScriptGetOut.ts # frontend/src/api/models/ScriptUpdateIn.ts # frontend/src/api/models/UserCreateOut.ts # frontend/src/api/models/UserGetOut.ts # frontend/src/api/models/UserUpdateIn.ts # frontend/src/types/script.ts # frontend/src/utils/scriptRegistry.ts # frontend/src/views/scripts/components/scriptCreateFlow.test.ts # frontend/src/views/scripts/components/scriptCreateFlow.ts # plugins/ok_script_adapter/src/ok_script_adapter/adapter/runtime.py
qiyinxi
commented
Aug 6, 2026
| async def unlock_script_config(self, script_id: str) -> None: | ||
| """在宿主写门内解锁一个运行结束的脚本配置。""" | ||
|
|
||
| await self.ScriptConfig[uuid.UUID(script_id)].unlock() |
qiyinxi
commented
Aug 6, 2026
| self.is_locked = False | ||
|
|
||
| def _write_locked(self) -> bool: | ||
| owner = self._maintenance_owner |
Contributor
Author
|
Closed it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
摘要
automas-script-maafw0.1.13。upstream/dev_v2@b6cc0fcb。验证
build:main、Vite 生产构建、完整 format 通过;lint 0 error、2 个既有v-htmlwarning。依赖与范围