Expose generic host integration primitives#514
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 8f1c834. Configure here.
| sfxEmitter.emit('sfx:item-place') | ||
| useViewer.getState().setSelection({ selectedIds: [committedId] }) | ||
| } | ||
| return |
There was a problem hiding this comment.
Fresh 2D commit breaks pause
High Severity
The new 2D fresh-placement commit path calls commitFreshPlacementSubtree while pauseSceneHistory is still active. That helper always calls temporal.resume() after deleting the draft, which turns Zundo tracking back on even though the overlay’s pause depth is still greater than zero. The follow-up createNodes can then land in local undo history as extra or misaligned steps instead of one clean placement.
Reviewed by Cursor Bugbot for commit 8f1c834. Configure here.


Summary
Why
Hosted consumers need stable integration points without coupling the open-source packages to any transport, backend, identity model, or product workflow.
Impact
Standalone behavior remains local by default. Hosts may subscribe to semantic scene commits, apply host-owned snapshots or patches outside local history, delegate history commands, and consume transient camera or drafting state.
Verification
bun check@pascal-app/core,@pascal-app/editor, and dependenciesNote
Medium Risk
Touches core scene history, host patch atomicity, and camera control paths; regressions could affect undo boundaries or collaborative sync, though behavior is heavily tested and standalone defaults stay local.
Overview
Introduces host integration primitives on top of the existing Zundo scene store:
subscribeSceneCommitsemits coalescedbefore/currentsnapshots (skipping semantic no-ops), whileapplyScenePatchandapplySceneSnapshotapply host-owned changes outside local undo history, with refcountedacquireSceneReadOnlyLeasereplacing ad hoc version-preview locking.runAsSingleSceneHistoryStepnow drops no-op compound transactions from both commit notifications and past states.Camera gains a shared
CameraPosemodel and bus events (apply-pose,pose,cancel-pose,interaction-start); the editor applies poses with bounded interpolation and publishes live poses when the user navigates.Editor hosting: optional
viewerSceneSlot/floorplanSceneSlot, exportableFloorplanNodePreview, andinstallHistoryCommandDelegateso hosts can own undo/redo while standalone still uses Zundo. Transient draft state is expanded (usePathDraftPreview, richer floorplan/fence/stair stores) and wired from MEP and structure tools so external 2D previews stay in sync.Schema / systems:
LevelNodeofficially allows MEP child IDs (schema v2). Elevator auto-opening updates run with history paused so derived slab holes share one undo step with the elevator edit. Minor 2D fixes include fresh-placement commit on the registry move overlay and stair rotate keys gated to 2D view.Reviewed by Cursor Bugbot for commit 8f1c834. Bugbot is set up for automated code reviews on this repo. Configure here.