forked niri forked from okami.mom/niri

fix: expose only hashline edits when hashline mode is enabled #73

targeting main from deleted fork:fix/hashline-only-edit-schema
Merged opened by and assigned to callie.on-her.computer
targeting main from deleted fork:fix/hashline-only-edit-schema

With hashline enabled, edit_file currently advertises both top-level old_text/new_text and structured edits. This lets the model choose the wrong format despite the configured mode.

This PR makes the advertised format match the setting:

  • hashline enabled: require edits; omit top-level old_text/new_text
  • hashline disabled or no attached workspace: require old_text/new_text; omit edits
  • memory reads, frontend tool descriptions, and bootstrap instructions follow the same mode
  • handlers reject the unadvertised format before touching memory or forwarding a client request
  • existing saved-session catalog reconciliation picks up the new definitions

Keeps the memory-edit implementation already on main, including empty-file initialization, Markdown validation, stale-hash checks, access controls, index synchronization, and virtual frontend soul edits. Does not add a duplicate implementation from closed/superseded #28.

Verification against main 75345d7:

  • npm install
  • npm run typecheck
  • npm test: 323 passed, 0 failed
  • actual isolated memory-handler test: read then anchored edit with hashline enabled, exact edit and empty-file initialization with it disabled, rejected wrong/mixed formats leave the file unchanged
  • schema tests for main/frontend, unattached workspaces, and restored mixed tool catalogs
  • git diff --check

Not deployed; this is a reviewable fix for the advertised edit format.

Uploaded patch fetched back and applied to clean main; resulting tree matches commit 94a79b6. The source branch is based directly on current main, with one fix commit.

Commits 0