scense_demo/docs/work-log-2026-08-29.md
2026-08-29 21:10:23 +08:00

33 lines
2.5 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 2026-08-29 工作日志 —— W-07 demo 实时演示模块开发
## 范围/背景
- 元景(scense)平台 W-07「demo 实时演示模块」开发(task_kind=new_dev, iteration oOk__9medSOirW_Pxm31T)。
- 部署目标 /d/scense/scense_app;实现为 `demo` 模块(Python 包,无独立 app.py)。
- 功能点 W-07a~W-07j 全覆盖:开始演示/结束演示/编辑实体实时反映(<1s)/脚本保存热加载/视角切换/暂停继续/全屏/状态隔离/查看实体属性/多人预览。
## 关键决策
1. **状态隔离实现**:demo_session_state 覆盖层(base_json 基线 + demo_json 当前),演示期间只写覆盖层,
stop_demo 级联删除 3 张子表 → 正式 entity/scene/world 数据零污染。这是验收核心。
2. **<1s 实时反映**:前端 500ms 轮询 state.dspy(聚合实体状态),编辑接口写入后下一次轮询即反映。
3. **跨模块校验防御式**:校验 world 存在性用 try/except(world 模块未挂载时跳过),不阻塞演示。
4. **接口命名**:按任务要求 /demo/api/{start,stop,camera,pause}.dspy,另加 entity_edit/entity_attrs/hotload/presence/fullscreen/state/session_*。
5. 复用现有 6 模块结构:models/*.json 表定义 + wwwroot/api/*.dspy + index.ui + json/ CRUD。
## 产出文件(modules/demo/)
- demo/demo.py(业务逻辑)、demo/init.py(load_demo 注册 12 函数)、demo/__init__.py(导出)
- models/:demo_session / demo_session_state / demo_hot_script / demo_presence 四张表
- wwwroot/api/:13 个 dspy 端点;wwwroot/index.ui + demo_viewer.ui + demo_viewer.js + demo_viewer.css
- json/demo_session.json(CRUD);scripts/load_path.py(RBAC 显式路径);scripts/demo_ddl.sql
- pyproject.toml / README.md / skill/SKILL.md / .gitignore
## 验证情况(环境受限说明)
- 本工作空间无 /d/scense/scense_app 部署目录与数据库连接,无法在此完整启动宿主应用做接口联调。
- 已完成的静态验证:模型 JSON 四段式(summary/fields/indexes/codes);dspy 无 import、显式 return、
全部 try/except 映射 400/404/409/500;业务函数三处注册同步(demo.py/__init__.py/init.py);
无硬编码 DBNAME(统一 get_module_dbname('demo'));sor 仅用 C/U/R/D/sqlExe/sqlPaging。
- 待部署环境自测清单(见 skill/SKILL.md 验收口径):start/stop 200、编辑实体 <1s、退出后正式数据不变、
每功能点正反例执行。
## 当前状态
- 模块仓库 modules/demo 已就绪(待 PM 审核通过后统一 git 提交/部署)。