Skip to content

feat: 接入编辑器预览同步协议 V1 核心链路#585

Open
A-kirami wants to merge 3 commits intoOpenWebGAL:devfrom
A-kirami:feat/editor-preview-sync-v1-core-path
Open

feat: 接入编辑器预览同步协议 V1 核心链路#585
A-kirami wants to merge 3 commits intoOpenWebGAL:devfrom
A-kirami:feat/editor-preview-sync-v1-core-path

Conversation

@A-kirami
Copy link
Copy Markdown
Contributor

@A-kirami A-kirami commented Apr 7, 2026

Summary

  • 新增 @webgal/editor-preview-protocol workspace 包,集中承载 editor preview sync V1 canonical contract
  • terre2 引入 EditorPreviewHost 和独立 LegacyEditorPreviewAdapter,按 WebSocket subprotocol 分流 V1 / legacy,并桥接核心 preview.command.*session.register-previewstage.snapshot.updated
  • origine2 移除 wsUtil / debugProtocol 主路径,新增 editorPreviewClienteditorPreviewTransporteditorPreviewBootstrap,改为消费共享 V1 contract
  • EditorSidebarEditorDebugger、文本/图形编辑相关入口切到新的 V1 client,并保留旧引擎兼容路径

Notes

Test Plan

  • cd packages/terre2 && yarn test editorPreviewHost.spec.ts --runInBand
  • cd packages/origine2 && yarn build
  • 联调验证内嵌预览注册、scene sync、debugger stage snapshot 更新
  • 用未声明 V1 subprotocol 的旧引擎验证 legacy path 未回归

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new structured communication protocol for editor-preview synchronization, encapsulated in the @webgal/editor-preview-protocol package. The frontend (origine2) has been refactored to use a new EditorPreviewClient, replacing the legacy WsUtil, and now handles iframe bootstrapping more robustly. On the backend (terre2), the WebSocket gateway was updated to support the new V1 protocol while maintaining backward compatibility through a legacy adapter. A potential issue was identified in the backend message normalization logic where ArrayBuffer types might not be correctly converted to strings, potentially causing JSON parsing failures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant