Repository navigation
Harden suggestChanges and add an experimental suggest_changes MCP tool - #70
Merged
Merged
Conversation
suggestChanges no longer loops on an edit with empty before, inserted and after (reported as invalid, and nearestIndex returns -1 for an empty needle), skips edits that are already tracked (already-tracked) instead of tracking them twice, reads the doc again after writing and reports not-tracked when no tracked change shows up, reports unchanged when inserted equals deleted, and throws SuggestionPermissionError naming the missing edit access when the untracked undo is refused. The meta.tc seed now follows the format of Overleaf's generateIdSeed (timestamp plus random digits). planSuggestions reports the outcome per edit without writing, and an expectedVersion option refuses to write when the doc changed since. SuggestionResult only gains values; hint is optional. The new MCP tool suggest_changes calls suggestChanges behind the same confirmation as the other write tools: the dialog lists each edit with its location and the suggested deletion and insertion, it asks nothing when no edit can become a suggestion, and it refuses to write when the doc changed after the preview. Marked experimental in the tool description, the JSDoc and docs/LIBRARY.md: sharejs-text-ot docs only, history-ot docs are refused, and collaborators see the old text for about 0.2 seconds.
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.
Follow-up to #66. Thanks to @fredericosantos for the original suggestChanges idea and implementation; this PR fixes issues found after merging it and exposes it through MCP.
Fixes in suggestChanges:
API changes, all additive:
New MCP tool suggest_changes (experimental):
Tests: unit tests for each fix with a stubbed socket and no network, plus MCP tests for confirm, decline, already-tracked, version conflict, no elicitation, env opt-out and the tool schema. npm test 263/263, lint at the existing warning count.