fix(scene): route PinK MCP operations through hierarchy - #890
Closed
bofeng-song wants to merge 1 commit into
Closed
Conversation
Contributor
Author
|
#873 |
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.
Related issue: https://zentao.sud.center/index.php?m=bug&f=view&bugID=974
Summary
Problem
The cocos-code utility process and the Hierarchy Scene WebView run in different processes. The CLI worker creates its own
cc.Scene, so opening the same.scenefile in both processes does not share unsaved changes, Undo state, or selection state. As a result, MCP could query or modify a stale scene copy while Hierarchy showed a different scene.Why this approach
MCP requests now use a single authority entry point. In PinK, that entry point forwards Editor, Node, Component, and Prefab operations to the SceneInstance behind Hierarchy. This makes MCP edits visible in Hierarchy immediately and preserves the IDE Undo flow without attempting to synchronize two in-memory scenes.
The worker is intentionally still started. Scene WebView initialization depends on its RPC services; making it a no-op breaks i18n and engine bootstrap. The worker is no longer allowed to be a fallback authority for MCP operations in the IDE.
scene-savereturns no data after a successful command instead of fabricating partial asset metadata, which keeps the MCP result contract valid.PinK follow-up
This change includes a temporary project-scoped named-pipe adapter to validate the routing end to end. PinK should replace it with an internal project-scoped authority channel:
bindIdeSceneAuthorityRpc()during scene initialization.The worker must remain available for Scene WebView infrastructure after this native channel replaces the temporary bridge.
Validation
npx tsc -bnpm test -- --runInBand src/core/scene/test/scene-authority-request.test.ts src/core/scene/test/lib-scene-authority.test.ts --detectOpenHandlesgit diff --check