feat: track element deletions in the agent context - #127
Merged
Conversation
Deleting an element previously removed its session edit entirely and recorded the removal only in the local undo stack, so agents never learned the element should be removed from source. Now mark the edit as deleted (capturing its locator before DOM removal) instead of dropping it, keep deleted edits through the disconnected-edit filter, and emit a delete action + instruction in the export text and the agent payload. Undo cleanly restores the prior state.
Expand the eight vetted backlog items in plans/README.md into self-contained handoff plans: utils god-module slice extraction, overlay/canvas-store tests, replaceSelectionColor scan perf (gated), eslint+prettier baseline, test:fast script, preload hook version field, rotated-element drag scale (gated), and provider footer wiring. Numbered 010-017 to avoid colliding with the 008/009 commit references in the execution record.
…ument deletion send Code review of the deletion-tracking feature found one real defect: a deleted element that also had a pending move emitted a contradictory "move this element" plan alongside the "delete this element" action across every export/send surface. Skip deleted edits in buildMoveEntries so no move intent/plan/profile-flag is generated for them. Keep a deleted-and-moved edit visible in the edits popover. Add tests for the delete+move suppression, the deleted:true agent payload, and multi-element deletion tracking. Document the deleted payload field in the mcp-server, runner-workflow, and mac-app-integration contracts.
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
Deleting an element in the overlay was invisible to coding agents.
deleteSelectionremoved the element's session edit entirely and recorded the removal only in the local undo stack, so nothing in the exported/sent context told the agent to remove the element from source. If you styled an element and then deleted it, even the styling edit was wiped.This PR makes deletions first-class session edits that flow to agents through every send/copy surface.
What changed (feature —
80fe237)types.ts— optionaldeleted?: booleanonSessionEdit.use-session-manager.ts—deleteSelectionmarks the editdeleted: true(capturing the locator before DOM removal) instead of dropping it; undo restores the prior state.getSessionEditskeeps deleted edits and only prunes genuinely-stale disconnected ones (!isConnected && !deleted).utils.ts—hasSessionEditChangescounts deletions;buildSessionExportemits anaction: delete this elementblock;getExportContentProfile/buildExportInstructiongain a delete directive.use-agent-comms.ts— the per-item send addsdeleted: trueto the agent payload; apply-all/copy-all pick it up viagetSessionItems.edits-popover.tsx— deleted items render asdeleted: <element>.Code review fixes (
7559cc6)Ran a structured multi-agent review (8 reviewers). One real defect surfaced and is fixed here:
buildMoveEntries(a deleted edit produces no move intent/plan/profile-flag). Kept deleted-and-moved edits visible in the popover.deletedfield in themcp-server,runner-workflow, andmac-app-integrationcontracts.deleted:truepayload reaching the agent, and multi-element deletion tracking.Also included (docs —
a8e1aaf)Backlog implementation plans
010–017underplans/(utils god-module slice, overlay/canvas tests, color-scan perf, eslint+prettier,test:fast, preload version field, rotated-drag scale, provider footer wiring). Pure planning docs — no code impact. Split into its own commit if you'd prefer a separate PR.Verification
bunx tsc --noEmitclean;bun run testgreen (515 tests, +7 from baseline).deleted: ….Notes / follow-ups
deletedfield rides to the out-of-repo Mac app broker; even if stripped,exportMarkdowncarries the delete instruction. Confirm passthrough (same open question asmoveIntent/movePlan).deletededits and extend thegetSessionEditsguard.