Skip to content

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

Merged
MakinoharaShoko merged 9 commits into
OpenWebGAL:devfrom
A-kirami:feat/editor-preview-sync-v1-core-path
May 18, 2026
Merged

feat: 接入编辑器预览同步协议 V1 核心链路#585
MakinoharaShoko merged 9 commits into
OpenWebGAL:devfrom
A-kirami:feat/editor-preview-sync-v1-core-path

Conversation

@A-kirami

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

Copy link
Copy Markdown
Contributor

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 未回归

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

Copy link
Copy Markdown
Contributor

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.

Comment thread packages/terre2/src/Modules/websocket/websocketGateway.ts
@MakinoharaShoko

Copy link
Copy Markdown
Member

请检查 bad4745 支持的新协议是否影响此 PR

@MakinoharaShoko MakinoharaShoko merged commit 783b0ba into OpenWebGAL:dev May 18, 2026
7 checks passed
@A-kirami A-kirami deleted the feat/editor-preview-sync-v1-core-path branch May 18, 2026 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants