This addendum documents the current Bridge-first runtime flow after migration progress:
- Tauri launches the Rust host process.
- Rust spawns the Node sidecar and Godot executable.
- Godot connects to PathBridge (
ws://127.0.0.1:9876). - Backend receives configuration/path actions through bridge messages.
- Graph data is restored from cache or rebuilt and then synchronized to frontend/Godot consumers.
- Sidecar startup and graph build pipeline execute successfully in Tauri mini GPU runs.
- Worker-thread graph stages (keyword/statistical/layout workers) resolve from runtime paths correctly in sidecar execution.
- Path Mode control migration is operational with Godot-driven settings and actions.
- Existing-data prompt behavior must consistently ask users to reuse cache or rebuild before load.
- Startup should avoid duplicate load execution after a single load action.
- WebSocket startup sequencing should avoid redundant early disconnect/reconnect cycles.
- History recording should capture center-node switching triggered by double-click navigation in Godot.
- Run
npm run tauri:dev:mini:gpu. - Select a source that already has cached data.
- Confirm exactly one prompt appears and exactly one load path executes.
- Confirm no duplicate build/restore in sidecar logs.
- Confirm History list updates when switching central nodes in Godot.
本补充说明记录了迁移后 Bridge-first 的当前运行流程:
- Tauri 启动 Rust 宿主进程。
- Rust 拉起 Node Sidecar 与 Godot 可执行文件。
- Godot 连接 PathBridge(
ws://127.0.0.1:9876)。 - 后端通过桥接消息接收配置与路径动作。
- 图数据从缓存恢复或重新构建后,同步给前端/Godot 使用方。
- 在 Tauri mini GPU 运行下,Sidecar 启动与图构建流水线可正常执行。
- 图构建的 worker 阶段(关键词/统计/布局)在 Sidecar 运行时路径解析正确。
- Path Mode 控制迁移已可用,由 Godot 侧设置与动作驱动。
- 缓存已存在时,应稳定提示用户选择复用缓存或重建。
- 单次加载动作不应触发重复执行。
- WebSocket 启动时序应避免早期重复断开/重连。
- Godot 双击切换中心节点时,History 记录应同步更新。
- 运行
npm run tauri:dev:mini:gpu。 - 选择一个已有缓存数据的源。
- 确认只出现一次提示,且只执行一次加载路径。
- 确认 Sidecar 日志中无重复 build/restore。
- 确认 Godot 切换中心节点后 History 列表有记录。
Issue: When double-clicking a node or switching the center, the Tree View would crash and revert to a linear list because the treeLayout data was missing from the update payload.
Fix: Updated path_app.js's switchCentral function to explicitly call triggerUpdate(). This forces the Web Worker to re-calculate the full treeLayout (including correct levels and connections) for the new central node before sending it to Godot.
- In-Degree Display Setting: Added option to toggle between "Visible" (default) and "Total" In-Degree counts in Node Popup.
- Godot Lazy Loading: Implemented "Expand (+)" and "Collapse (-)" buttons in Godot Tree View to manage prerequisite visibility.
- i18n Fixes: Added missing keys
focus_inbound/focus_outboundto English and Chinese locales.
- Visuals ("Zen Mode"): Simplified view removing all extra buttons. Only nodes and connections are visible.
- Interactions:
- Double Click / Right Click: Toggle Context (Expand/Collapse prerequisites).
- Long Press (Left): Navigate to Node (Switch Central). Visualized by a progress ring overlay.
- Middle Click: Collapse All nodes (Reset view).
- Focus Mode:
- Toggle via Settings ("Focus on this node").
- Highlights the Central Node and its direct incoming prerequisites.
- Dims all other nodes to reduce clutter and focus on immediate dependencies.
- This creates a cleaner, less cluttered tree where lines only connect direct neighbors (Level 1 → Level 2), as requested.
Last Node Cleanup:
- The "Expand" button logic relies on data validation. With the
treeLayoutnow correctly re-computing, the "Target" node (which corresponds to the end of the chain) correctly reports0children in the layout, so the expand button will automatically be hidden.
- Navigation: Double-clicking nodes in Tree View now correctly keeps the Tree View active and re-centers the graph.
- Aesthetics: Long, confusing Bezier curves skipping levels are gone.
- Data: In-degree numbers are visible.
- Missing Edges: Fixed
treeLayouthaving 0 edges by sanitizing data in path_app.js (converting Object references back to ID strings for the worker). - Right-Click Toggle: Fixed "Cannot Collapse" bug by:
- Patching path_core.js to correctly pass
isExpandedstate. - Updating PathBridge.ts to relay collapsePrereqs messages (which were previously dropped).
- Patching path_core.js to correctly pass
- Collapse All:
- Added a visible
[-]button to the Godot UI. - Updated PathBridge.ts to relay the collapseAll message.
- Added a visible
问题 (Issue): 双击节点或切换中心时,由于更新负载中缺少 treeLayout 数据,树状视图会崩溃并恢复为线性列表。
修复 (Fix): 更新了 path_app.js 的 switchCentral 函数,显式调用 triggerUpdate()。这强制 Web Worker 在将新的中心节点发送到 Godot 之前重新计算完整的 treeLayout(包括正确的层级和连接)。
- 入度显示设置: 在节点弹窗中添加了选项,用于在“可见” (默认) 和“总计”入度计数之间切换。
- Godot 懒加载: 在 Godot 树状视图中实现了“展开 (+)”和“折叠 (-)”按钮,以管理前置节点的可见性。
- 国际化修复: 为英语和中文语言环境添加了缺失的键
focus_inbound/focus_outbound。
- 视觉效果 ("禅模式"): 简化视图,移除所有额外按钮。仅节点和连接可见。
- 交互:
- 双击 / 右键单击: 切换上下文(展开/折叠前置节点)。
- 长按 (左键): 导航到节点(切换中心)。通过进度环叠加层可视化。
- 中键单击: 折叠所有节点(重置视图)。
- 专注模式:
- 通过设置切换(“聚焦于此节点”)。
- 高亮显示中心节点及其直接传入的前置节点。
- 调暗所有其他节点以减少混乱并专注于直接依赖关系。
- 这创造了一个更清晰、更少混乱的树,其中线条仅连接直接邻居(Level 1 → Level 2),按要求。
末端节点清理:
- “展开”按钮逻辑依赖于数据验证。由于
treeLayout现在可以正确重新计算,对应于链末端的“目标”节点正确报告布局中的0个子节点,因此展开按钮将自动隐藏。
- 导航: 树状视图中的双击节点现在可以正确保持树状视图处于活动状态并重新居中图表。
- 美学: 移除了跳层级的长而混乱的贝塞尔曲线。
- 数据: 入度数字可见。
- 缺失边: 通过在 path_app.js 中清理数据(将对象引用转回 Workers 的 ID 字符串),修复了
treeLayout只有 0 条边的问题。 - 右键切换: 修复了“无法折叠”的 Bug:
- 修补 path_core.js 以正确传递
isExpanded状态。 - 更新 PathBridge.ts 以转发 collapsePrereqs 消息(以前被丢弃)。
- 修补 path_core.js 以正确传递
- 全部折叠:
- 在 Godot UI 中添加了一个可见的
[-]按钮。 - 更新 PathBridge.ts 以转发 collapseAll 消息。
- 在 Godot UI 中添加了一个可见的
Performed comprehensive gap analysis between tree_path_mockup.html (702 lines, 9 rules) and production code.
| File | Lines | Purpose |
|---|---|---|
tree_path_mockup.html |
702 | Reference implementation with all 9 rules |
path_core.js |
1375 | Production core algorithm (getTreeLayout() L742-1133) |
tree_renderer.gd |
531 | Godot tree visualization |
tree_view_panel.gd |
159 | Godot panel controller |
path_app.js |
1166 | Frontend bridge and interaction handler |
- 8 of 9 rules are completely missing from production
- 5 core concepts absent: ownership, expansion order, effective index, visibility chain, hull collision avoidance
- 7 existing features preserved: spine ID, contour collision, tributary placement, hull drawing, collapse state, WebSocket bridge, tree renderer
- Production code is geometrically correct but lacks the semantic claiming/ownership layer
- implementation_plan.md — Phase 3 with 13 steps
- brainstorming.md — Session 6: Ownership Engine design
- task.md — v1.4.3 checklist (EN + ZH)
- TODO.md — v1.4.3 implementation checklist
Implementation of 13 steps across 4 components (Core Algorithm, Frontend Bridge, Godot Renderer, Worker Communication).
对 tree_path_mockup.html(702 行,9 条规则)和生产代码进行了全面的差距分析。
| 文件 | 行数 | 用途 |
|---|---|---|
tree_path_mockup.html |
702 | 包含所有 9 条规则的参考实现 |
path_core.js |
1375 | 生产核心算法 |
tree_renderer.gd |
531 | Godot 树可视化 |
tree_view_panel.gd |
159 | Godot 面板控制器 |
path_app.js |
1166 | 前端桥接和交互处理 |
- 9 条规则中有 8 条在生产代码中完全缺失
- 5 个核心概念缺失:所有权、展开顺序、有效索引、可见性链、hull 碰撞避让
- 7 个现有特性保留:脊柱识别、轮廓碰撞、支流放置、hull 绘制、折叠状态、WebSocket 桥、树渲染器
- 生产代码几何上正确但缺乏语义认领/所有权层
implementation_plan.md— 第三阶段,13 个步骤brainstorming.md— 会话 6:所有权引擎设计task.md— v1.4.3 清单(中英双语)TODO.md— v1.4.3 实施清单
跨 4 个组件(核心算法、前端桥接、Godot 渲染器、Worker 通信)实施 13 个步骤。