A2: engine half of files changed on disk and Local History v1

- Disk conflicts per buffer (changed / removed), reported in buffer.get
  as diskConflict; diskConflictResolved when settled.
- Every watcher event only means "look again": delete + create (git
  checkout, atomic saves) reloads instead of losing the buffer; a file that
  disappears keeps its buffer as unsaved.
- file.save checks mtime + hash and fails with disk_changed instead of
  overwriting a newer file (overwrite: true after asking); saveAll lists
  such buffers under diskChanged. New file.reload and file.readDisk.
- Local History store in the data dir (content-addressed SHA-256 blobs,
  index.jsonl, 14 days / 200 MB, pruned on open); snapshots on save,
  before reloads, on deletion, before lsp.rename and file-changing git
  commands. Commands history.list / history.read / history.revert.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
danny 2026-11-08 12:09:16 +01:00
parent 7f309dbc4e
commit dfe2f19ca5
17 changed files with 1953 additions and 116 deletions

View file

@ -34,6 +34,9 @@ pub struct State {
/// The crash-recovery journal of the open project; `None` without a
/// project or without persistence.
pub journal: Option<Journal>,
/// The Local History of the open project ([`crate::history`]); `None`
/// without a project, without persistence, or when it failed to open.
pub history: Option<crate::history::History>,
/// Ids of the engine's own commands, which UI commands may not take.
pub engine_commands: BTreeSet<&'static str>,
/// UI commands the frontend registered (`ui.registerCommands`), by id.