add editor subsystem — daemon state + editor.* IPC

EditorBuffer + Selection + EditorRegistry hold the daemon-side
active-file model (D-006 subsystem 'editor'). Active buffer
tracking means `clide insert "…"` and `clide replace-selection
"…"` target the UI's focused file without the caller supplying an
id. Mutations mark buffers dirty; editor.save writes back to disk
through the workspace root; events fire on every state change so
subscribers can mirror.

IPC surface matches CLAUDE.md's tier-2 list + the natural extras
(list, read, activate, set-selection, set-content, close). Tests
cover open-idempotence, insert at caret, replace-selection range
swap, dirty→save→clean round-trip, close picks a new active
buffer, out-of-range selection clamping.

69 core tests pass.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-04-22 10:10:42 +02:00
co-authored by Claude
parent 37108230f2
commit d32e8fdc17
8 changed files with 705 additions and 0 deletions
+12
View File
@@ -18,6 +18,18 @@ heading, and (b) bumping `project.yaml` `version:` in the same commit.
### Added
- Editor subsystem in the daemon (`lib/src/editor/`). `EditorBuffer`
holds path + content + cursor/selection + dirty flag;
`EditorRegistry` owns the open-buffer set, active-buffer tracking,
and file I/O. IPC verbs land alongside (`editor.open | active |
activate | list | read | insert | replace-selection | set-selection
| set-content | save | close`) with matching events (`editor.opened
| active-changed | selection-changed | edited | saved | closed`).
Omitting `id` on mutating verbs targets the active buffer so the
tier-2 CLI shortcuts (`clide insert "…"`, `clide replace-selection
"…"`) read naturally. 16 new core tests cover the lifecycle +
dispatcher round-trips.
- `builtin.claude` — Tier-1 stub upgraded to the real Claude pane per
D-041. Contributes a primary `Claude` tab in the workspace slot that
spawns `tmux new-session -A -s clide-claude-<hash> -- claude` via