diff --git a/docs/superpowers/plans/2026-08-06-em-observation-web-staged-execution.md b/docs/superpowers/plans/2026-08-06-em-observation-web-staged-execution.md new file mode 100644 index 0000000..bedca56 --- /dev/null +++ b/docs/superpowers/plans/2026-08-06-em-observation-web-staged-execution.md @@ -0,0 +1,619 @@ +# EM Observation Web Visualization Staged Execution Implementation Plan + +> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. + +**Goal:** Execute the approved EM observe-only web visualization work across eight fresh Codex windows with bounded context, reproducible verification, exact Git ownership, and durable handoffs. + +**Architecture:** The code-level work remains defined by the approved library and EM integration plans. This plan is the orchestration layer: each task is one isolated window, consumes the preceding handoff, executes a dependency-aligned slice of the original plans, records evidence, and emits the next task's complete prompt. + +**Tech Stack:** Codex staged sessions, PowerShell, Git, C# 10, `netstandard2.0`, `net10.0-windows` verification hosts, Markdown handoff records. + +## Global Constraints + +- Repository root is `D:\Users\Desktop\项目\prakrobot\ParkingRobot`. +- The approved design commit `b0b79e5` must remain an ancestor of every stage baseline. +- Execute stages strictly in order; do not advance after a blocked or unverified stage. +- Use one primary agent per window and do not spawn subagents. +- Preserve all unrelated dirty-worktree and index changes; never reset, clean, restore, or include them in a stage commit. +- Read only the current stage's named plan sections and source files; locate additional symbols with targeted `rg` before opening files. +- Follow TDD order from the original plan and use systematic debugging for unexpected failures. +- Keep `OBSERVE_ONLY`; never add or call actuator write APIs. +- A success claim requires fresh evidence collected under `verification-before-completion`. +- Each completed stage creates and commits exactly one handoff file under `docs/superpowers/handoffs/em-observation-web/`. +- A blocked stage emits a same-stage recovery prompt, not the next-stage prompt. +- The final response ends with the next prompt copied verbatim from this plan, except after fully completed Stage 8. + +--- +## Shared Session Protocol + +Every stage prompt below already contains the shared protocol. The agent must keep the original task-level commits specified by the code-level plans. After those commits and fresh verification, it creates its handoff file with actual facts under these headings: + +```markdown +# EM 观察网页可视化阶段 NN 交接 + +状态:完成 +阶段目标:本阶段实际完成的目标 +基线提交:启动阶段时记录的提交哈希 +实现提交:本阶段代码和文档提交哈希列表 +修改文件:本阶段实际修改和创建的文件列表 +新增或确认的接口:可供下一阶段依赖的接口和行为 +验证命令与结果:逐条记录命令、退出码和关键 PASS 输出 +未运行的验证及原因:没有未运行项时明确写“无” +已知警告或遗留问题:没有时明确写“无” +与原计划的偏差:没有时明确写“无” +下一阶段注意事项:下一阶段必须核查的事实 +``` + +Handoff commits use `docs: record EM visualization phase NN handoff`. The handoff records implementation commits; it does not need to contain its own commit hash. + +If a required command fails, the stage agent writes the same handoff fields with `状态:阻塞`, does not mark unchecked plan work complete, and returns a newly written recovery prompt that tells a fresh agent to resume the same stage from the recorded failure. It must include the exact failed command, exit code, first actionable error, current commits, relevant files, and remaining verification. + +--- + +### Task 1: Stage 1 — Visualization library foundations + +**Files:** + +- Read: `docs/superpowers/specs/2026-08-06-em-observation-web-staged-execution-design.md` +- Read: `docs/superpowers/specs/2026-08-05-em-observation-web-visualization-design.md` +- Read: `docs/superpowers/plans/2026-08-05-trajectory-planning-visualization-library.md` Task 1–2 +- Create/modify: every exact file listed by library Task 1–2 +- Create: `docs/superpowers/handoffs/em-observation-web/phase-01.md` + +**Interfaces:** + +- Consumes: approved design commit `b0b79e5`, existing `ClumsyPilot.csproj`, Newtonsoft.Json 13.0.4. +- Produces: standalone visualization project, immutable contracts, `PlanningVisualizationOptions`, capacity-one latest frame, bounded cycle history, and stable JSON required by Stage 2. + +- [ ] **Step 1: Open a fresh window and paste this prompt exactly** + +```text +你正在执行 EM 观察网页可视化的阶段 1/8:可视化类库基础。只完成本阶段,不要提前实现 HTTP/SSE、网页、EM Adapter 或 MovementTest 集成,也不要派生子智能体。 + +仓库根目录:D:\Users\Desktop\项目\prakrobot\ParkingRobot + +设计已经批准,不要重新进行 brainstorming。开始前完整阅读并遵守: +1. C:\Users\admin\.codex\skills\executing-plans\SKILL.md +2. C:\Users\admin\.codex\skills\test-driven-development\SKILL.md +3. C:\Users\admin\.codex\skills\verification-before-completion\SKILL.md +遇到任何非预期测试或构建失败时,再完整阅读 C:\Users\admin\.codex\skills\systematic-debugging\SKILL.md,然后先定位根因再修改。 + +必读资料: +- docs/superpowers/specs/2026-08-06-em-observation-web-staged-execution-design.md +- docs/superpowers/specs/2026-08-05-em-observation-web-visualization-design.md 的第 1–6、10–12 节 +- docs/superpowers/plans/2026-08-05-trajectory-planning-visualization-library.md 的标题、Global Constraints、File Structure、Task 1、Task 2 +- ClumsyPilot/ClumsyPilot.csproj + +启动检查: +- 执行 git branch --show-current、git rev-parse HEAD、git log -5 --oneline。 +- 执行 git merge-base --is-ancestor b0b79e5 HEAD;若退出码非 0,停止并报告基线不包含已批准设计。 +- 用 (git status --porcelain=v1 | Measure-Object).Count 统计全部脏项,但只展开本阶段文件路径的 git status --short 和 git diff。 +- 执行 git diff --cached --name-status。不得重置、取消暂存、覆盖或提交任何既有无关改动。 +- 运行 dotnet build ClumsyPilot/ClumsyPilot.csproj -p:ExcludeLegacyAutoAvoidance=true,记录基线退出码;若失败,先判断是否为本阶段开始前已存在的问题并在交接中保留证据。 + +实施范围是原类库计划 Task 1–2 的所有复选步骤,保持原顺序和 TDD: +- 建立 ClumsyPilot/TrajectoryPlanningVisualization 独立 netstandard2.0 项目; +- 建立独立 net10.0-windows 验证宿主; +- 实现不可变契约、防御性复制、有限数值验证和紧凑占用 bitset; +- 主项目排除嵌套源码并通过 ProjectReference 引用类库; +- 实现 PlanningVisualizationOptions、LatestVisualizationFrameStore、BoundedCycleHistory、VisualizationJson; +- 严格执行原计划中的 RED、GREEN 和两个任务的独立提交。 + +只能修改原计划 Task 1–2 的 Files 清单。若当前阶段文件已有用户修改,先阅读 diff 并兼容;无法安全兼容时停止,不要覆盖。提交必须使用精确路径。若暂存区存在无关内容,使用仅包含当前阶段精确路径的提交方式,并在提交后用 git diff-tree --no-commit-id --name-status -r 实际提交哈希核对文件。 + +退出验证必须重新运行: +1. dotnet run --project ClumsyPilot/tests/TrajectoryPlanningVisualizationVerificationHost/TrajectoryPlanningVisualizationVerificationHost.csproj +2. dotnet build ClumsyPilot/TrajectoryPlanningVisualization/TrajectoryPlanningVisualization.csproj +3. dotnet build ClumsyPilot/ClumsyPilot.csproj -p:ExcludeLegacyAutoAvoidance=true +4. 对本阶段实际修改文件运行 git diff --check,并核对每个实现提交的文件树。 + +全部退出验证通过后,创建 docs/superpowers/handoffs/em-observation-web/phase-01.md。按照阶段执行设计第 8 节填写真实基线、实现提交、文件、接口、逐条命令/退出码、警告、偏差和下一阶段注意事项,不得把未运行写成通过。单独提交该文件,提交信息为 docs: record EM visualization phase 01 handoff,并核对该提交只含这一文件。 + +最终回答先用中文报告完成内容、实现/交接提交和新鲜验证证据。然后打开 docs/superpowers/plans/2026-08-06-em-observation-web-staged-execution.md,找到 Task 2 的提示词,并在最终回答最后一个 Markdown 代码块中逐字完整输出,供用户复制到新窗口。若本阶段阻塞,不得输出 Task 2;改为输出信息完整的阶段 1 恢复提示词。 +``` + +- [ ] **Step 2: Accept only a verified Stage 1 handoff** + +Expected: `phase-01.md` says `状态:完成`, names the contract/runtime commits, and records successful visualization-host and main-project builds. + +--- + +### Task 2: Stage 2 — Restricted Loopback HTTP/SSE + +**Files:** + +- Read: Stage 1 handoff and library Task 3 +- Create/modify: every exact file listed by library Task 3 +- Create: `docs/superpowers/handoffs/em-observation-web/phase-02.md` + +**Interfaces:** + +- Consumes: Stage 1 immutable snapshots, options, frame store, history and JSON. +- Produces: authenticated loopback server, SSE connections and `PlanningVisualizationSession` facade required by Stage 3. + +- [ ] **Step 1: Open a fresh window and paste this prompt exactly** + +```text +你正在执行 EM 观察网页可视化的阶段 2/8:受限 Loopback HTTP/SSE。只完成本阶段,不要实现网页资源或任何 EM/MovementTest 适配,也不要派生子智能体。 + +仓库根目录:D:\Users\Desktop\项目\prakrobot\ParkingRobot + +设计已经批准,不要重新进行 brainstorming。完整阅读并使用 executing-plans、test-driven-development、verification-before-completion;路径分别是: +- C:\Users\admin\.codex\skills\executing-plans\SKILL.md +- C:\Users\admin\.codex\skills\test-driven-development\SKILL.md +- C:\Users\admin\.codex\skills\verification-before-completion\SKILL.md +出现非预期失败时完整阅读并使用 C:\Users\admin\.codex\skills\systematic-debugging\SKILL.md。 + +必读资料: +- docs/superpowers/specs/2026-08-06-em-observation-web-staged-execution-design.md +- docs/superpowers/specs/2026-08-05-em-observation-web-visualization-design.md 的第 3–6、10–12 节 +- docs/superpowers/plans/2026-08-05-trajectory-planning-visualization-library.md 的 Global Constraints、File Structure、Task 3 +- docs/superpowers/handoffs/em-observation-web/phase-01.md +- 阶段 1 新增的 Contracts、Runtime 和 PlanningVisualizationOptions 相关文件;只读取 Task 3 直接依赖的类型 + +启动检查: +- 记录当前分支、HEAD、最近 8 条提交。 +- git merge-base --is-ancestor b0b79e5 HEAD 必须成功。 +- phase-01.md 必须存在且状态为完成;逐一用 git show --stat 核对其中实现提交,并运行独立可视化验证宿主建立入口基线。 +- 统计整个工作区脏项数量,只展开 Task 3 文件范围的状态/diff;检查暂存区并保护无关内容。 + +严格执行原类库计划 Task 3 的全部复选步骤和两个阶段:真实 socket RED 检查先行,再实现。必须落实: +- TcpListener 只绑定 IPAddress.Loopback; +- 只接受受限 HTTP/1.1 GET,16 KiB header 与 2 s 读取上限; +- 所有现有路由要求 256-bit 随机 token; +- 最多两个 SSE 客户端,第三个返回 503; +- Publish 只做验证和 Interlocked.Exchange,不序列化、不等待 socket; +- 单 dispatcher 在无浏览器时仍收集有界周期摘要; +- 每客户端容量一发送槽与 1 s 写超时; +- Stop 最多等待 100 ms 发送 event:end 并可靠释放端口; +- Start/Publish/Stop/Dispose 幂等且服务故障不逃逸到规划发布调用。 + +只能修改 Task 3 的 Files 清单。不得绑定 0.0.0.0、IPAddress.Any 或局域网地址,不得改用 HttpListener、ASP.NET Core、Kestrel 或外部包。按原计划完成 transport 实现提交,提交后核对文件树。 + +退出验证必须重新运行: +1. dotnet run --project ClumsyPilot/tests/TrajectoryPlanningVisualizationVerificationHost/TrajectoryPlanningVisualizationVerificationHost.csproj +2. dotnet build ClumsyPilot/TrajectoryPlanningVisualization/TrajectoryPlanningVisualization.csproj +3. 确认真实 socket 检查覆盖 403/404/405/400/503、慢客户端非阻塞、无客户端历史、正常停止和端口重绑。 +4. 对本阶段修改文件运行 git diff --check,并核对提交内容。 + +全部通过后创建 docs/superpowers/handoffs/em-observation-web/phase-02.md,按阶段设计第 8 节填写真实证据,单独提交为 docs: record EM visualization phase 02 handoff。最终回答先报告结果与提交,再从阶段执行手册 Task 3 复制完整提示词作为最后一个代码块。若阻塞,只输出阶段 2 恢复提示词,不得推进阶段 3。 +``` + +- [ ] **Step 2: Accept only a verified Stage 2 handoff** + +Expected: the handoff proves loopback-only binding, bounded request parsing, non-blocking publication and released ports with real-socket tests. + +--- + +### Task 3: Stage 3 — Chinese scientific dashboard and library closure + +**Files:** + +- Read: Stage 2 handoff and library Task 4–5 +- Create/modify: every exact file listed by library Task 4–5 +- Create: `docs/superpowers/handoffs/em-observation-web/phase-03.md` + +**Interfaces:** + +- Consumes: Stage 2 session, bootstrap and SSE endpoints. +- Produces: embedded Chinese Canvas/SVG dashboard and documented, independently verified reusable library required by EM integration. + +- [ ] **Step 1: Open a fresh window and paste this prompt exactly** + +```text +你正在执行 EM 观察网页可视化的阶段 3/8:中文科研风网页与独立类库收口。只完成本阶段,不要开始 EM Adapter 或 MovementTest 集成,也不要派生子智能体。 + +仓库根目录:D:\Users\Desktop\项目\prakrobot\ParkingRobot + +设计已经批准。完整阅读并使用 executing-plans、test-driven-development、verification-before-completion;发生非预期失败时再使用 systematic-debugging。对应 SKILL.md 均位于 C:\Users\admin\.codex\skills\ 下的同名目录。 + +必读资料: +- docs/superpowers/specs/2026-08-06-em-observation-web-staged-execution-design.md +- docs/superpowers/specs/2026-08-05-em-observation-web-visualization-design.md 的第 3–6、8、10–12 节 +- docs/superpowers/plans/2026-08-05-trajectory-planning-visualization-library.md 的 Global Constraints、File Structure、Task 4、Task 5 +- docs/superpowers/handoffs/em-observation-web/phase-02.md +- Stage 2 的 PlanningVisualizationSession、LoopbackVisualizationServer 与契约类型;不要阅读无关 EM 源码 + +启动时记录分支、HEAD、最近提交;验证 b0b79e5 为祖先;核对 phase-02.md 状态与提交;运行独立可视化验证宿主作为入口基线。统计全部脏项但只展开本阶段文件范围,保护无关工作区和暂存区内容。 + +严格执行原类库计划 Task 4–5 的全部复选步骤: +- 先写嵌入资源和中文内容 RED 检查; +- 实现程序集内 index.html/app.css/app.js,不使用 CDN、Node.js 或运行时文件查找; +- 鸟瞰图使用单个 Canvas 解码行优先 LSB-first bitset,SVG 只覆盖路径/车辆/标记; +- X/Y 等比例,科研白底和 1.1 px 数据线,中文说明、英文/数学轴与 SI 单位; +- 四个页签和八个固定 chart ID 完整; +- EventSource 普通断线显示重连/过期,只有 event:end 显示会话已结束;前端异常只停止当前页面重绘; +- 快照文本一律 textContent,不执行 HTML;每条路由保留 token; +- 从非仓库工作目录验证嵌入资源; +- 实现 --smoke-seconds N 的确定性合成冒烟模式; +- 写独立类库 README 和文档检查; +- 保留原计划 Task 4 与 Task 5 的独立提交。 + +只能修改 Task 4–5 的 Files 清单。不得把 EM、MDCS、Painter 或 MovementTest 类型引入独立类库或验证宿主。 + +退出验证必须重新运行: +1. dotnet run --project ClumsyPilot/tests/TrajectoryPlanningVisualizationVerificationHost/TrajectoryPlanningVisualizationVerificationHost.csproj +2. dotnet build ClumsyPilot/TrajectoryPlanningVisualization/TrajectoryPlanningVisualization.csproj +3. dotnet build ClumsyPilot/ClumsyPilot.csproj -p:ExcludeLegacyAutoAvoidance=true +4. 先 Resolve-Path 得到验证宿主项目绝对路径,再 Push-Location $env:TEMP,从非仓库目录运行该宿主并返回。 +5. dotnet run --project ClumsyPilot/tests/TrajectoryPlanningVisualizationVerificationHost/TrajectoryPlanningVisualizationVerificationHost.csproj -- --smoke-seconds 1 +6. 对本阶段文件运行 git diff --check 并核对提交文件树。 + +全部通过后创建并单独提交 docs/superpowers/handoffs/em-observation-web/phase-03.md,提交信息为 docs: record EM visualization phase 03 handoff。最终回答报告证据后,从本手册 Task 4 逐字复制下一阶段完整提示词作为最后一个代码块。阻塞时只输出阶段 3 恢复提示词。 +``` + +- [ ] **Step 2: Accept only a verified Stage 3 handoff** + +Expected: the reusable library passes from repository and temporary working directories, has embedded assets, and contains no EM/MDCS/Painter dependency. + +--- + +### Task 4: Stage 4 — Observation settings and pure segment tracker + +**Files:** + +- Read: Stage 3 handoff and integration Task 1–2 +- Create/modify: every exact file listed by integration Task 1–2 +- Create: `docs/superpowers/handoffs/em-observation-web/phase-04.md` + +**Interfaces:** + +- Consumes: completed reusable library, current MovementTest observer and EM direction segments. +- Produces: frozen settings and pure sequential segment tracker required by Stage 5. + +- [ ] **Step 1: Open a fresh window and paste this prompt exactly** + +```text +你正在执行 EM 观察网页可视化的阶段 4/8:观察参数同步与纯换向段状态机。只完成集成计划 Task 1–2,不要修改活动段控制器、图表适配、网页托管或插件发布,也不要派生子智能体。 + +仓库根目录:D:\Users\Desktop\项目\prakrobot\ParkingRobot + +设计已经批准。完整阅读并使用 executing-plans、test-driven-development、verification-before-completion;非预期失败时使用 systematic-debugging。技能文件位于 C:\Users\admin\.codex\skills\对应目录。 + +必读资料: +- docs/superpowers/specs/2026-08-06-em-observation-web-staged-execution-design.md +- docs/superpowers/specs/2026-08-05-em-observation-web-visualization-design.md 的第 1–3、6–7、10–12 节 +- docs/superpowers/plans/2026-08-05-em-observation-web-integration.md 的 Prerequisite、Global Constraints、File Structure、Task 1、Task 2 +- docs/superpowers/handoffs/em-observation-web/phase-03.md +- ClumsyPilot/ParkrobTrajplanner/tarjplanner_movementtest/TrajectoryObservationContracts.cs +- ClumsyPilot/ParkrobTrajplanner/tarjplanner_movementtest/MovementTest.TrajectoryObservationTest.cs +- ClumsyPilot/ParkrobTrajplanner/tarjplanner_movementtest/TrajectoryObservationPipeline.cs 中与 settings/bootstrap/segment 直接相关部分 +- DirectionSegmentView、VehicleMotionState、FrenetProjector、轨迹 metadata/terminal 契约 + +启动检查:记录分支/HEAD/最近提交,验证 b0b79e5 为祖先,核对 phase-03.md 完成及其提交。运行独立可视化验证宿主和 trajectory-observation 入口检查。统计全局脏项但只展开 Task 1–2 路径;特别保护 MovementTest 文件中用户已经设置的 5.0 s、100000、2.0 s,不得回退。 + +严格执行集成计划 Task 1–2 的所有 TDD 步骤和两个独立提交: +- 将 TrajectoryObservationSettings 默认值同步为 SolverTimeoutSeconds=5.0、MaximumOsqpIterations=100000、TimeHorizonSeconds=2.0; +- 新增并冻结网页/Painter 开关、端口、10 Hz、60 轮历史和换向确认参数; +- 网页与 Painter 默认都关闭,网页自动打开默认开启,端口 0 或 1024..65535; +- MovementTest 公共字段一对一映射到冻结 settings; +- 实现纯 TrajectoryObservationSegmentTracker,严格 N 到 N+1; +- 只有匹配段/方向的 GearSwitch 轨迹已到绝对末点、测量位姿同时接近两段连接点、真实速度连续停车保持、随后 3 个严格递增序列的目标符号速度样本才切段; +- 错误方向、零速样本、重复序列、超投影距离、非 GearSwitch、时间不连续必须重置确认; +- 单段结束进入 Completed,不越界;状态机不得写 coordinator、UI、网页或硬件。 + +只能修改 Task 1–2 的 Files 清单。保持 OBSERVE_ONLY,不调用或新增任何底盘/运动写接口。 + +退出验证必须重新运行: +1. dotnet run --project ClumsyPilot/tests/EMPlannerVerificationHost/EMPlannerVerificationHost.csproj -- trajectory-observation +2. dotnet run --project ClumsyPilot/tests/TrajectoryPlanningVisualizationVerificationHost/TrajectoryPlanningVisualizationVerificationHost.csproj +3. rg -n "SendXYThSpeed|SendMotion|DriveStop|PredefinedDriveStop|AccumulateSpeed" ClumsyPilot/ParkrobTrajplanner/tarjplanner_movementtest,并确认运行观察源码没有调用这些接口;测试中的字符串审计本身需单独解释。 +4. 对阶段文件运行 git diff --check,核对实现提交文件树。 + +全部通过后创建并单独提交 docs/superpowers/handoffs/em-observation-web/phase-04.md,提交信息为 docs: record EM visualization phase 04 handoff。最终回答报告提交和证据,再从本手册 Task 5 逐字复制下一阶段提示词作为最后一个代码块。阻塞时输出阶段 4 恢复提示词而不是推进。 +``` + +- [ ] **Step 2: Accept only a verified Stage 4 handoff** + +Expected: settings retain the approved defaults, the tracker passes deterministic transition checks, and source audit confirms observe-only behavior. + +--- +### Task 5: Stage 5 — Active-segment rolling controller + +**Files:** + +- Read: Stage 4 handoff and integration Task 3 +- Modify: every exact file listed by integration Task 3 +- Create: `docs/superpowers/handoffs/em-observation-web/phase-05.md` + +**Interfaces:** + +- Consumes: Stage 4 frozen settings and pure `TrajectoryObservationSegmentTracker`. +- Produces: active-segment controller/loop, per-segment coordinator replacement and visualization-only previous trajectory required by Stage 6. + +- [ ] **Step 1: Open a fresh window and paste this prompt exactly** + +```text +你正在执行 EM 观察网页可视化的阶段 5/8:活动方向段滚动规划控制器。只完成集成计划 Task 3,不要实现静态/动态图表 Adapter、网页生命周期或插件发布,也不要派生子智能体。 + +仓库根目录:D:\Users\Desktop\项目\prakrobot\ParkingRobot + +设计已批准。完整阅读并使用 executing-plans、test-driven-development、verification-before-completion;发生非预期失败时完整阅读并使用 systematic-debugging。SKILL.md 位于 C:\Users\admin\.codex\skills\对应目录。 + +必读资料: +- docs/superpowers/specs/2026-08-06-em-observation-web-staged-execution-design.md +- docs/superpowers/specs/2026-08-05-em-observation-web-visualization-design.md 的第 3、7、9–12 节 +- docs/superpowers/plans/2026-08-05-em-observation-web-integration.md 的 Global Constraints、File Structure、Task 3 +- docs/superpowers/handoffs/em-observation-web/phase-04.md +- TrajectoryObservationPipeline.cs 全文 +- TrajectoryObservationSegmentTracker.cs 及其检查 +- EmPlanningCoordinator、TrajectoryExecutor、EmPlanningRequest、PlanningCycleResult 和 TrajectoryObservationLoop 直接相关契约 + +启动检查:记录分支、HEAD 和最近提交;验证 b0b79e5 为祖先;核对 phase-04.md 状态和实现提交。运行 trajectory-observation、coordinator、executor 三个入口基线。统计全局脏项但只展开 Task 3 路径,保护所有无关修改与暂存内容。 + +严格执行集成计划 Task 3 的 RED/GREEN 与提交: +- 移除硬编码 segmentIndex = 0,以 tracker 的 ActiveSegment 为唯一活动段来源; +- 保存 planningService,使 coordinator/executor 可在确认换向后按新段替换; +- 同段滚动周期继续使用 coordinator.PublishedTrajectory 作为 previous seed; +- 跨方向段只把旧轨迹保留为 PreviousTrajectoryForVisualization,新 coordinator 的第一次请求 PreviousTrajectory 必须为 null; +- 会话 cycle ID 在 coordinator 替换后继续单调增长; +- CreateEffectiveConfigurationSnapshot 返回 configuration.Copy,不泄露可变配置; +- 规划任务在飞行时不得切段或仅为切段取消; +- Tick 只在完成任务已消费且无任务在飞行时调用 TryAdvanceSegment; +- 等待换向时区分当前方向、期望方向和 directionConfirmed,不能伪造档位读数; +- TrajectoryObservationLoopTick 暴露 SegmentAdvanced 与不可变段状态; +- 全程 OBSERVE_ONLY,不新增执行器写调用。 + +只能修改 Task 3 的 Files 清单。若为测试需要访问内部状态,沿用现有验证宿主/内部可见模式,不扩大公开 EM API。 + +退出验证必须重新运行: +1. dotnet run --project ClumsyPilot/tests/EMPlannerVerificationHost/EMPlannerVerificationHost.csproj -- trajectory-observation +2. dotnet run --project ClumsyPilot/tests/EMPlannerVerificationHost/EMPlannerVerificationHost.csproj -- coordinator +3. dotnet run --project ClumsyPilot/tests/EMPlannerVerificationHost/EMPlannerVerificationHost.csproj -- executor +4. rg -n "segmentIndex = 0|SendXYThSpeed|SendMotion|DriveStop|PredefinedDriveStop|AccumulateSpeed" ClumsyPilot/ParkrobTrajplanner/tarjplanner_movementtest,并解释任何命中,确认运行源码无硬编码活动段和执行器调用。 +5. 对阶段文件运行 git diff --check 并核对实现提交文件树。 + +全部通过后创建并单独提交 docs/superpowers/handoffs/em-observation-web/phase-05.md,提交信息为 docs: record EM visualization phase 05 handoff。最终回答报告新鲜证据,然后从本手册 Task 6 逐字复制完整提示词作为最后一个代码块。阻塞时只输出阶段 5 恢复提示词。 +``` + +- [ ] **Step 2: Accept only a verified Stage 5 handoff** + +Expected: requests follow the tracker-confirmed active segment, same-segment seeding remains intact, cross-direction seeding is null, and coordinator/executor regressions pass. + +--- + +### Task 6: Stage 6 — EM visualization adapters and handoff evidence + +**Files:** + +- Read: Stage 5 handoff and integration Task 4–5 +- Create/modify: every exact file listed by integration Task 4–5 +- Create: `docs/superpowers/handoffs/em-observation-web/phase-06.md` + +**Interfaces:** + +- Consumes: Stage 3 generic visualization contracts and Stage 5 active-segment controller state. +- Produces: static/dynamic snapshot builders, all required charts and shared-segment handoff metrics required by Stage 7. + +- [ ] **Step 1: Open a fresh window and paste this prompt exactly** + +```text +你正在执行 EM 观察网页可视化的阶段 6/8:EM 静态/动态数据可视化适配。只完成集成计划 Task 4–5,不要启动网页会话、修改 Painter 生命周期或插件发布,也不要派生子智能体。 + +仓库根目录:D:\Users\Desktop\项目\prakrobot\ParkingRobot + +设计已批准。完整阅读并使用 executing-plans、test-driven-development、verification-before-completion;非预期失败时使用 systematic-debugging。技能文件位于 C:\Users\admin\.codex\skills\对应目录。 + +必读资料: +- docs/superpowers/specs/2026-08-06-em-observation-web-staged-execution-design.md +- docs/superpowers/specs/2026-08-05-em-observation-web-visualization-design.md 的第 4–6、8–12 节 +- docs/superpowers/plans/2026-08-05-em-observation-web-integration.md 的 Global Constraints、File Structure、Task 4、Task 5 +- docs/superpowers/handoffs/em-observation-web/phase-05.md +- Stage 3 的 Visualization contracts 与 SampleSnapshotFactory +- TrajectoryObservationPipeline、现有 TrajectoryObservationCharts/Diagnostics/Presentation +- PlanningGridMap、DirectionSegmentView、FrenetProjector、EmTrajectory、EmTrajectoryPoint、TrajectorySampler 和配置 Copy 契约 + +启动检查:记录分支/HEAD/最近提交;验证批准设计为祖先;核对 phase-05.md 完成与提交;运行 trajectory-observation 和 em-core-all 入口基线。统计全局脏项但只展开 Task 4–5 文件范围,保护无关修改和暂存内容。 + +严格执行集成计划 Task 4–5 的全部 TDD 步骤和两个独立提交: +- 静态快照仅会话构建一次,包含世界边界、行优先 LSB-first bitset 占用图、粗路径、Local G2、全部方向段、换向点和冻结的真实生效配置; +- bitset 字节长度严格为 (Rows*Cols+7)/8,不得为每格创建 DTO、SVG 或 Painter 对象; +- 配置按计划规定顺序分组,展示 raw C# 字段名、不变量格式值、中文名和单位; +- 动态快照包含实车位姿、当前/上一轨迹、活动段与当前 horizon 高亮、状态和摘要,历史摘要不得包含完整点数组; +- 生成 ls、st、curvature-s、curvature-t、velocity-t、acceleration-t、jerk-t、yaw-rate-t; +- LS 使用完整活动方向段的 SourceStartArcLength + ReferenceS,ST 保持周期局部 PathS; +- jerk 只发布 N-1 个真实区间样本,使用区间起点,不制造末点之后的值; +- 显示实际加速度/jerk/曲率/带符号速度限制,但没有独立 yaw-rate 配置时不得虚构限制线; +- RollingContinuation 与 ExactStopAtBoundary 的中文语义和真实终端 v/a 必须区分; +- 用绝对 EffectiveAtUtc 对齐当前点 0 与上一轨迹插值点;比较世界 DeltaPosition、共享完整方向段 DeltaReferenceS、DeltaV、DeltaA,绝不相减两轮局部 PathS;投影失败时只将 DeltaReferenceS 标为不可用。 + +只能修改 Task 4–5 的 Files 清单。EmTrajectoryPoint 的 internal a/j 可在同一 ClumsyPilot 程序集中读取,不要为了网页修改公共 EM API。 + +退出验证必须重新运行: +1. dotnet run --project ClumsyPilot/tests/EMPlannerVerificationHost/EMPlannerVerificationHost.csproj -- trajectory-observation +2. dotnet run --project ClumsyPilot/tests/EMPlannerVerificationHost/EMPlannerVerificationHost.csproj -- em-core-all +3. dotnet run --project ClumsyPilot/tests/TrajectoryPlanningVisualizationVerificationHost/TrajectoryPlanningVisualizationVerificationHost.csproj +4. 确认 rolling service 回归仍为 21 个 knot、滚动末速非零,jerk 图为 20 个区间样本。 +5. 对阶段文件运行 git diff --check 并核对两个实现提交的文件树。 + +全部通过后创建并单独提交 docs/superpowers/handoffs/em-observation-web/phase-06.md,提交信息为 docs: record EM visualization phase 06 handoff。最终回答报告证据,再从本手册 Task 7 逐字复制下一阶段提示词作为最后一个代码块。阻塞时只输出阶段 6 恢复提示词。 +``` + +- [ ] **Step 2: Accept only a verified Stage 6 handoff** + +Expected: all generic snapshots are built from frozen EM/map data, jerk has no terminal fiction, and handoff deltas use world/shared-segment coordinates. + +--- + +### Task 7: Stage 7 — MovementTest hosting, Painter isolation and packaging + +**Files:** + +- Read: Stage 6 handoff and integration Task 6–7 +- Create/modify: every exact file listed by integration Task 6–7 +- Create: `docs/superpowers/handoffs/em-observation-web/phase-07.md` + +**Interfaces:** + +- Consumes: Stage 3 reusable session and Stage 6 static/dynamic builders. +- Produces: optional web/Painter lifecycle, exception fuse, browser launch, published plugin DLL and operator documentation required by Stage 8. + +- [ ] **Step 1: Open a fresh window and paste this prompt exactly** + +```text +你正在执行 EM 观察网页可视化的阶段 7/8:MovementTest 网页托管、Painter 隔离、插件发布与操作文档。只完成集成计划 Task 6–7,不要进行最终实车验收,也不要派生子智能体。 + +仓库根目录:D:\Users\Desktop\项目\prakrobot\ParkingRobot + +设计已批准。完整阅读并使用 executing-plans、test-driven-development、verification-before-completion;出现非预期失败时使用 systematic-debugging。技能文件位于 C:\Users\admin\.codex\skills\对应目录。 + +必读资料: +- docs/superpowers/specs/2026-08-06-em-observation-web-staged-execution-design.md +- docs/superpowers/specs/2026-08-05-em-observation-web-visualization-design.md 的第 2–6、8、10–12 节 +- docs/superpowers/plans/2026-08-05-em-observation-web-integration.md 的 Global Constraints、File Structure、Task 6、Task 7 +- docs/superpowers/handoffs/em-observation-web/phase-06.md +- MovementTest.TrajectoryObservationTest.cs、TrajectoryObservationPresentation.cs、TrajectoryObservationPipeline.cs +- Stage 6 三个 snapshot/handoff/chart builder +- PlanningVisualizationSession 公开 API +- Publish-ClumsyPilotPlugin.ps1 与 PluginPackagingChecks.cs +- MovementTest README 与 EMPlanner README +启动检查:记录分支、HEAD、最近提交;验证批准设计为祖先;核对 phase-06.md 状态与提交。运行两个验证宿主的当前入口检查。统计全局脏项但只展开 Task 6–7 文件范围;这些文件可能有用户修改,必须逐项兼容且不得覆盖。检查暂存区并保护无关内容。 + +严格执行集成计划 Task 6–7 的所有 TDD 步骤和两个独立提交: +- 建立内部 ITrajectoryObservationVisualizationSink seam 与 TrajectoryObservationVisualizationPublisher; +- publisher 在 10 Hz 门控点才调用 snapshotFactory,异常只记录一次、停止网页 sink 并永久熔断网页输出,规划 loop 继续; +- EnableWebVisualization=false 时不启动服务、不构建网页快照/历史; +- bootstrap 成功后按开关启动网页,记录完整 token URI;AutoOpen 失败只记录,不停止服务; +- 原生 Painter 默认关闭,移除静态 eager Presentation,仅在 EnableNativePainterVisualization=true 时会话内懒创建; +- Stop/替换会话幂等回收网页、端口与已存在 Painter; +- 实际 tick 使用 controller.ActiveSegment 及当前/上一轨迹发布,不在观察循环序列化或等待; +- 保持 OBSERVE_ONLY,网页关闭/慢客户端不改变规划周期; +- 插件发布从 ManagedDll 的同目录精确解析 TrajectoryPlanningVisualization.dll,放入 staging 后再原子交换;保留现有根目录保护、OSQP hash 与恢复机制; +- PluginPackagingChecks 验证精确包树和程序集名; +- 更新两个 README,完整说明开关、Token、科研风图、ReferenceS/PathS、N-1 jerk、滚动/停车、段高亮、换向确认和清理行为。 + +只能修改 Task 6–7 的 Files 清单。不得新增硬件写接口、局域网监听、自动循环重启网页服务或把独立网页依赖恢复到 Painter。 + +退出验证必须重新运行: +1. dotnet run --project ClumsyPilot/tests/EMPlannerVerificationHost/EMPlannerVerificationHost.csproj -- trajectory-observation +2. dotnet run --project ClumsyPilot/tests/EMPlannerVerificationHost/EMPlannerVerificationHost.csproj -- plugin-package +3. 再运行一次 plugin-package,确认无遗留 staging/backup。 +4. dotnet run --project ClumsyPilot/tests/TrajectoryPlanningVisualizationVerificationHost/TrajectoryPlanningVisualizationVerificationHost.csproj +5. dotnet build ClumsyPilot/ClumsyPilot.csproj -p:ExcludeLegacyAutoAvoidance=true +6. rg -n "SendXYThSpeed|SendMotion|DriveStop|PredefinedDriveStop|AccumulateSpeed" ClumsyPilot/ParkrobTrajplanner/tarjplanner_movementtest,确认运行源码无执行器调用。 +7. 对阶段文件运行 git diff --check,核对两个实现提交和插件输出契约。 + +全部通过后创建并单独提交 docs/superpowers/handoffs/em-observation-web/phase-07.md,提交信息为 docs: record EM visualization phase 07 handoff。最终回答报告提交和证据,再从本手册 Task 8 逐字复制完整提示词作为最后一个代码块。阻塞时只输出阶段 7 恢复提示词。 +``` + +- [ ] **Step 2: Accept only a verified Stage 7 handoff** + +Expected: web and Painter are independently optional, visualization faults do not stop planning, and the plugin package contains the reusable visualization assembly. + +--- + +### Task 8: Stage 8 — Full automated, browser and vehicle acceptance + +**Files:** + +- Read: Stage 7 handoff and integration Task 8 +- Modify: no planned runtime source; acceptance-driven fixes return to the owning task's files and tests +- Create: `docs/superpowers/handoffs/em-observation-web/phase-08.md` +- Conditional create: `docs/superpowers/handoffs/em-observation-web/phase-08-vehicle.md` + +**Interfaces:** + +- Consumes: both verification hosts, main build, deterministic smoke mode, plugin output and deployed MovementTest. +- Produces: fresh end-to-end evidence and either full completion or an explicit vehicle-only continuation boundary. + +- [ ] **Step 1: Open a fresh window and paste this prompt exactly** + +```text +你正在执行 EM 观察网页可视化的阶段 8/8:全量自动化、网页冒烟与实车观察验收。本阶段以验证为主,不得顺手扩展功能,也不要派生子智能体。 + +仓库根目录:D:\Users\Desktop\项目\prakrobot\ParkingRobot + +设计已批准。完整阅读并使用 executing-plans 与 verification-before-completion。只有发现回归时才使用 test-driven-development;出现非预期失败时完整阅读并使用 systematic-debugging。技能文件位于 C:\Users\admin\.codex\skills\对应目录。 + +必读资料: +- docs/superpowers/specs/2026-08-06-em-observation-web-staged-execution-design.md +- docs/superpowers/specs/2026-08-05-em-observation-web-visualization-design.md 的第 10–12 节和所有完成标准 +- docs/superpowers/plans/2026-08-05-em-observation-web-integration.md 的 Global Constraints 与 Task 8 +- docs/superpowers/plans/2026-08-05-trajectory-planning-visualization-library.md 的 Global Constraints 与 Task 5 最终验证 +- docs/superpowers/handoffs/em-observation-web/phase-07.md +- phase-01.md 至 phase-06.md 只读取状态、提交、验证和遗留问题字段,不重新加载全部实现推理 +- 两个 README 中的操作与图表解释 + +启动检查:记录分支、HEAD、最近 20 条提交;验证 b0b79e5 为祖先;核对 phase-01 至 phase-07 全部存在且状态为完成,并抽查各阶段实现提交可达。统计全局脏项但不展开无关 diff;检查暂存区。阶段 8 没有预定源码修改,不能把无关脏项当成本功能失败。 + +先执行完整自动化: +1. dotnet run --project ClumsyPilot/tests/TrajectoryPlanningVisualizationVerificationHost/TrajectoryPlanningVisualizationVerificationHost.csproj +2. dotnet run --project ClumsyPilot/tests/EMPlannerVerificationHost/EMPlannerVerificationHost.csproj -- trajectory-observation +3. dotnet run --project ClumsyPilot/tests/EMPlannerVerificationHost/EMPlannerVerificationHost.csproj -- em-all +4. dotnet run --project ClumsyPilot/tests/EMPlannerVerificationHost/EMPlannerVerificationHost.csproj -- plugin-package +5. dotnet build ClumsyPilot/ClumsyPilot.csproj -p:ExcludeLegacyAutoAvoidance=true +6. 对本功能自 phase-01 起的提交范围运行 whitespace 检查,并记录任何与本功能无关的既有警告,不能声称由本功能引入。 + +然后执行网页冒烟: +- 运行 dotnet run --project ClumsyPilot/tests/TrajectoryPlanningVisualizationVerificationHost/TrajectoryPlanningVisualizationVerificationHost.csproj -- --smoke-seconds 30。 +- 在 30 秒内打开输出的 token URI;如当前工具具有浏览器控制能力,可用浏览器检查,否则明确要求用户协助打开,不能伪造肉眼结果。 +- 核对中文标题/状态、英文或数学坐标、科研细线白底、四页签、八图表、Canvas 栅格、SVG 路径覆盖、活动段/horizon 高亮、生效配置、过期状态和进程退出后端口释放。 + +最后执行实车观察清单,但只能在有人监督且环境安全时进行: +1. 开启网页、保持 Painter 关闭;确认 OBSERVE_ONLY。 +2. 观察 rolling、approach、exact-stop;滚动模式不能标为强制停车。 +3. 确认 jerk 为 N-1 区间且无终点下一点/JerkLimitExceeded 假象。 +4. 确认当前/上一轮显示 DeltaPosition、DeltaReferenceS、DeltaV、DeltaA。 +5. 真实换向点必须经过停车保持和 3 个带符号速度样本后才 N 到 N+1 高亮。 +6. 关闭浏览器后规划周期继续;停止 MovementTest 后网页端口和 Painter 正确回收;全程没有执行器输出。 + +如果自动化或网页冒烟失败:不要创建“完成”交接。先定位归属阶段,补充聚焦失败测试,做最小修复,运行归属阶段验证后重新从完整自动化第 1 项开始。只提交回归测试和修复的精确文件,并记录偏差。 + +如果自动化和网页冒烟通过但当前没有受监督实车条件:创建 docs/superpowers/handoffs/em-observation-web/phase-08.md,状态必须写“自动验收完成但实车待验”,逐条记录自动证据和未运行的实车项;单独提交为 docs: record EM visualization phase 08 handoff。最终回答不得声称整体完成,最后一个代码块必须逐字复制本手册“Stage 8 Vehicle Continuation Prompt”。 + +只有自动化、网页冒烟和实车清单全部真实完成,phase-08.md 才能写“状态:完成”并单独提交。最终回答报告所有证据和提交,不再输出下一阶段提示词。 +``` + +- [ ] **Step 2: Accept the correct Stage 8 terminal state** + +Expected: either full verified completion, or `自动验收完成但实车待验` with the exact continuation prompt below. Automated-only evidence must never be labeled as full completion. + +--- + +## Stage 8 Vehicle Continuation Prompt + +Use this only when `phase-08.md` records successful automated/browser acceptance and explicitly leaves supervised vehicle observation pending. + +```text +你正在续验 EM 观察网页可视化阶段 8 的实车观察部分。自动化与网页冒烟已经完成;本窗口只核查交接证据并在受监督安全环境中完成尚未执行的实车清单,不要重复开发、扩展功能或派生子智能体。 + +仓库根目录:D:\Users\Desktop\项目\prakrobot\ParkingRobot + +完整阅读并使用 C:\Users\admin\.codex\skills\verification-before-completion\SKILL.md。只有发现真实回归时才阅读和使用 test-driven-development 与 systematic-debugging;设计已批准,不要重新 brainstorming。 + +必读资料: +- docs/superpowers/specs/2026-08-06-em-observation-web-staged-execution-design.md 的第 8–10 节 +- docs/superpowers/specs/2026-08-05-em-observation-web-visualization-design.md 的第 10–12 节 +- docs/superpowers/plans/2026-08-05-em-observation-web-integration.md 的 Task 8 +- docs/superpowers/handoffs/em-observation-web/phase-08.md +- ClumsyPilot/ParkrobTrajplanner/tarjplanner_movementtest/README.md + +启动时记录当前分支、HEAD、最近提交,验证 b0b79e5 为祖先,并确认 phase-08.md 的状态正是“自动验收完成但实车待验”。核对其中自动化提交和命令证据可达;如果代码在 phase-08 后发生相关变化,必须先重新运行受影响自动验证,不能直接沿用旧证据。保护所有无关脏工作区和暂存内容。 + +只有在有人监督且环境安全时执行: +1. 开启 EnableWebVisualization,关闭 EnableNativePainterVisualization;确认 UI、控制台和网页显示 OBSERVE_ONLY。 +2. 观察 rolling、approach、exact-stop;确认滚动末端停车硬约束显示未启用,精确停车锚点只在真实边界出现。 +3. 确认 jerk 为轨迹 N-1 个时间区间,没有末点之后的加加速度点或虚假 JerkLimitExceeded。 +4. 确认周期交接展示世界 DeltaPosition、共享方向段 DeltaReferenceS、DeltaV、DeltaA,没有直接比较局部 PathS。 +5. 在真实换向点确认连续停车保持和 3 个正确带符号速度样本后才从 N 高亮到 N+1,等待期间页面明确显示未满足条件。 +6. 关闭浏览器,确认规划观察周期继续且不受慢客户端/关闭影响。 +7. 停止 MovementTest,确认 HTTP/SSE、端口和可能存在的 Painter 全部回收。 +8. 通过日志和源审计确认全过程没有底盘、转向、制动、电机或档位写输出。 + +不得通过操作真实底盘来“帮助”观察任务满足条件;MovementTest 本身必须保持只读观察。任何一项无法安全执行都应记录为未完成,不能声称整体完成。 + +全部实车项通过后创建 docs/superpowers/handoffs/em-observation-web/phase-08-vehicle.md,记录车辆/环境前提、执行时间、逐项结果、日志或截图位置、未运行项、警告和最终结论。单独提交该文件,提交信息为 docs: record EM visualization vehicle acceptance。最终回答列出新鲜实车证据和交接提交,明确整体完成,不再输出后续提示词。 + +若发现回归,创建 phase-08-vehicle.md 并写状态“阻塞”,记录首个有效失败、复现步骤和安全影响;不要现场扩大修改。最终回答输出一份新的阶段 8 实车恢复提示词,携带真实失败事实和允许继续的精确范围。 +``` + +--- + +## Plan Completion Check + +- [ ] All eight stage prompts are copied without truncation when handed to new windows. +- [ ] Every original library Task 1–5 is owned exactly once by Stages 1–3. +- [ ] Every original integration Task 1–8 is owned exactly once by Stages 4–8. +- [ ] Every stage has a distinct handoff path and terminal verification. +- [ ] Blocked stages resume themselves and never advance. +- [ ] Stage 8 distinguishes full vehicle completion from automated-only acceptance.