Open
Conversation
Contributor
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@webgal/editor-preview-protocolworkspace 包,集中承载 editor preview sync V1 canonical contractterre2引入EditorPreviewHost和独立LegacyEditorPreviewAdapter,按 WebSocket subprotocol 分流 V1 / legacy,并桥接核心preview.command.*、session.register-preview、stage.snapshot.updatedorigine2移除wsUtil/debugProtocol主路径,新增editorPreviewClient、editorPreviewTransport、editorPreviewBootstrap,改为消费共享 V1 contractEditorSidebar、EditorDebugger、文本/图形编辑相关入口切到新的 V1 client,并保留旧引擎兼容路径Notes
preview.ready.updated在 editor 侧目前只用于 ready 后的字体优化同步,不作为初始化控制链Test Plan
cd packages/terre2 && yarn test editorPreviewHost.spec.ts --runInBandcd packages/origine2 && yarn build