update: 编辑整理文档 architecture

MemRelay-Operation: curated-update:44fc1143-7dee-4e0a-8086-42b65f39e0de:4
MemRelay-Resource: 44fc1143-7dee-4e0a-8086-42b65f39e0de
This commit is contained in:
2026-10-08 16:07:50 +08:00
parent 80178c93ad
commit 898eb1a5b7
2 changed files with 15 additions and 84 deletions
@@ -1,7 +1,7 @@
--- ---
title: Metrix 经核实的实现决策 title: Metrix 主体实现决策与开发范围
type: curated type: curated
permalink: main/projects/d5a7f581-c442-4554-87b9-ee723b8b0258/curated/metrix-经核实的实现决策 permalink: main/projects/d5a7f581-c442-4554-87b9-ee723b8b0258/curated/metrix-主体实现决策与开发范围
stable_id: 783ddcc0-2e2e-4731-906a-e67cabc552a5 stable_id: 783ddcc0-2e2e-4731-906a-e67cabc552a5
scope: project scope: project
project_id: d5a7f581-c442-4554-87b9-ee723b8b0258 project_id: d5a7f581-c442-4554-87b9-ee723b8b0258
@@ -9,7 +9,7 @@ workspace_type: development
usage_profile_id: null usage_profile_id: null
preference_context: development preference_context: development
document_type: decisions document_type: decisions
revision: 2 revision: 3
source_memory_ids: [] source_memory_ids: []
source_checkpoint_ids: [] source_checkpoint_ids: []
source_file_ids: [] source_file_ids: []
@@ -58,24 +58,24 @@ prompt_version: 2026-08-12.3
schema_version: '3' schema_version: '3'
curation_job_id: null curation_job_id: null
created_at: '2026-09-23T15:09:14.248903+00:00' created_at: '2026-09-23T15:09:14.248903+00:00'
updated_at: '2026-10-08T07:04:48.034674+00:00' updated_at: '2026-10-08T08:07:46.790221+00:00'
tags: tags:
- curated - curated
- manual - manual
restored_from_commit: 6a6a895eafcca6052e81a14fca103a42635dd1c2 restored_from_commit: 6a6a895eafcca6052e81a14fca103a42635dd1c2
--- ---
# Metrix 决策与实现约定 # Metrix 实现决策
根据实际代码和现行项目规则核对: 首要范围决定:用户488dc961-50c7-41c4-a946-ba291a8bc411要求后续仅开发Metrix主体,暂停plugins读取/修改/测试/启动/安装/构建。目录保留,不主动删除;以后是否重写/清除按明确需求。该决定替代旧四服务联动,不将插件历史方案当作主体约束。
- 模块在server/app/modules和web/src/modules自动发现;CapacityReport与InterferenceETL是plugins/独立Git子模块,不能混为同一扩展机制。 - 主体模块由server/app/modules和web/src/modules各自自动发现;新增业务优先脚手架和demo_crud,不手动分散注册核心。
- 权限统一action:<resource>:<action>,read作为页面入口,manage_others约束跨用户操作;管理接口按需require_web_session,API Token复用角色权限。 - 权限action:<resource>:<action>,read页面入口,manage_others跨用户,Token复用角色权限;管理接口按需Web-only,写操作审计。
- 脚本通过Docker容器执行,不自动pull,镜像缺失提示导入;none/bridge网络,工作区.venv自动使用。原decision 34271d12-a706-491b-a06b-f561e81f7346实际描述此决策,与保留策略无关。 - 用户脚本在Docker容器执行,镜像不自动pull,none/bridge网络,项目工作区.venv自动使用;这是主体scripts模块能力,与暂停插件开发不同。
- 运行记录保留实际参数为script_run_retention_hours和script_run_retention_count;按年龄和每项目数量分别清理,0关闭对应限制,不是max_days/max_count。 - 运行记录保留script_run_retention_hours与script_run_retention_count共同生效,各自0关闭对应限制,不是max_days/max_count。
- Monaco+Shiki提供本地高亮,两编辑器已有明暗主题监听;不存在“待实现主题同步”的当前决策。 - Monaco+Shiki本地高亮和主题监听已存在,不重复开发。
- MemRelay为唯一当前记忆存储。历史检查点保留时间范围,源码变化时修正稳定文档及对应事实,不能仅追加互相矛盾的总结。 - dev.py仅根环境及web,两个主体进程,--check不启动安装;保留进程清理/严格端口/代理同步,无插件相关选项。
- Windows/WSL2/Docker环境;临时产物限定项目Temp或PI scratch;保护业务数据、配置和凭据。 - MemRelay为唯一当前记忆,原位更新事实/稳定文档,历史保留时间范围;Windows兼容,临时产物项目Temp或PI scratch。
- 每个功能验证后提交type: 中文描述,有远端则fetch后安全推送;保护分支按PR流程,不强推、不自动部署。 - 完成验证后规范提交、有远端fetch后安全推送,遵循保护分支/PR,不强推、不擅自部署。
Docker socket挂载、离线应用包、内网PyPI已有实现;是否实际部署以及部署版本必须另外验证。历史Windows目录移动操作不是日常开发步骤。 主体Docker socket、离线构建和PyPI已有实现,实际部署状态须另行验证。
@@ -1,69 +0,0 @@
---
title: Metrix 实际架构与模块边界
type: curated
permalink: main/projects/d5a7f581-c442-4554-87b9-ee723b8b0258/curated/development/metrix-实际架构与模块边界
stable_id: 44fc1143-7dee-4e0a-8086-42b65f39e0de
scope: project
project_id: d5a7f581-c442-4554-87b9-ee723b8b0258
workspace_type: development
usage_profile_id: null
preference_context: development
document_type: architecture
revision: 3
source_memory_ids: []
source_checkpoint_ids: []
source_file_ids: []
source_git_commit: e660bc7bb4fc5ccda47decb4d514874a148ed9b2
source_git_commits:
- e660bc7bb4fc5ccda47decb4d514874a148ed9b2
source_agent_sync_ids: []
model_connection: Sub2API
model_name: manual
source_count: 29
source_revisions: {}
source_dispositions:
processed: 29
unchanged: 0
unsupported: 0
skipped: 0
cited_source_ids:
- git:server/app/main.py
- git:server/app/modules/registry.py
- git:server/app/core/permissions.py
- git:server/app/core/security.py
- git:server/app/db/init.py
- git:server/app/migrations/registry.py
job_cited_source_ids: []
conflicts: []
supersedes: []
preferences: []
source_cursor: 162
source_hash: e2fcea7c8a9e0df7a91925fb2a9beabd922058868310effc908f95df2d78b218
prompt_version: 2026-08-12.3
schema_version: '3'
curation_job_id: null
created_at: '2026-09-23T15:09:30.147437+00:00'
updated_at: '2026-10-08T07:53:55.197089+00:00'
tags:
- curated
- manual
restored_from_commit: 6a6a895eafcca6052e81a14fca103a42635dd1c2
---
# Metrix 架构
源码基线main@e77a28a;两个独立Git子模块CapacityReport488c540、InterferenceETLba2d3b2。版本变化后同步README/指南/MemRelay。
server/app/main.py为FastAPI工厂、CORS、模块router、本地Swagger及web/dist托管,不是独立网关服务。后端modules/registry.py扫描APP_MODULE并校验key/版本/依赖,加载router/model/权限/迁移/生命周期;前端modules/registry.ts发现*/index.ts声明页面菜单。plugins/不在扫描范围。
core/deps.py区分Web/API Token并执行RBAC;权限action:<resource>:<action>,read页面入口,manage_others跨用户;Token复用角色权限,require_web_session限制管理接口。security使用PBKDF2-SHA256、Token哈希、Fernet。api_enabled是数据库系统设置,不在core/config.py。
db/session.py首次连接sync_database完成建表、模块迁移/字段/权限种子同步;migrations/registry.py是自有机制,不依赖Alembic。主平台FastAPI固定0.136.3,0.142.4改变include_router包装,旧操作名迁移需兼容后才升级。
database/jobs.py导入导出使用线程池;scripts/scheduler.py使用APScheduler,scripts/runs.py线程池或独立线程+Docker执行,镜像不自动pull。保留参数script_run_retention_hours默认168、script_run_retention_count默认每项目100,各自0关闭该限制,二者共同生效。
web为Vue3/TS/Naive UI/i18n/Monaco+Shiki+xterm;脚本及SQL编辑器均监听appStore.dark并切换主题。storage是FTP/SFTP,containers是当前宿主Docker,pypi是内网包源管理。
CapacityReport独立Web/Tauri应用,源/仓库双模式,CellData仍直连;InterferenceETL独立15分钟组批处理,通过平台API协作,无专属cron编辑器。
dev.py只管理已准备的环境,默认四进程,预检及跳过选项见README;pytest/Playwright产物与浏览器缓存统一Temp。现有本地测试不意味着远端已有CI流水线,HTTP服务可用不意味着外部数据库健康。