feat(history): bind scoped MCP sessions to timestamped history - #720
Merged
Conversation
JSv4
pushed a commit
that referenced
this pull request
Sep 6, 2026
The second batch of the stack rippled History outward: sequence replay and timestamp lookup in the core, a HistoryClientOps facade, then the bridges and clients — wasm/DocxodusWasm/HistoryBridge.cs, npm/src/history.ts, the python-host bindings, docx_scalpel/history.py, and a new history tool in the MCP server. Rebuild-yes, re-measure-no, and a clean auto-merge with no CHANGELOG in the range. The risk worth naming: tools/mcp-server/ToolCatalog.cs gained 58 lines. This demo's redline-theater.test.mjs parses that file and fails if any (tool, action) pair, search mode, set_mode value or argument the script puts on the wire is missing from the real catalog — so a catalog edit is the one upstream change that can break the demo's central claim without touching a line of demo code. Ran that check first, before the rebuild, because it needs no build to answer: 45/45. The new history tool is purely additive; nothing the script calls was renamed or removed. Rebuilt because npm/src/embed.ts, index.ts and types.ts all changed and a new history.ts joined them, all bundled into the embed bundle this demo loads. Not re-measured. The edits to files outside History are wiring — one line in the MCP dispatcher, three in its Program, five in SessionStore — and nothing in the range touches DocxDiff, the session save path or the HTML converter behaviourally. Verified: 61 node checks, 3 pin checks, 14 browser assertions.
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.
Stack layer 16 for #671/#672, based on #719. Adds opt-in
docxodus_historyon the existing MCP session/dispatch path; no new transport, timer, service, or subscription. Hosts configure an absoluteDOCXODUS_HISTORY_ROOT; tool callers cannot override storage or document identity. Identity is the session's canonical scoped opening location, including across save-as.Supports read/updates/create/list/get/export/materialize/replay/time lookup/restore through the shared facade, plus sequence- or timestamp-selected HTML rendering through the existing converter. Create captures clean session bytes without writing the source. Restore appends history only, preserving open local work and the source file. Exact-head CAS, strict bounded metadata, lossless Int64 strings, foreign-version checks, and immutable file storage remain core-owned.
Validation: 206 focused .NET history/replay/MCP tests pass, including five new MCP history tests for full action parity, timestamp rendering, ordered tails, reopen, stale publication, restore non-mutation, capability/root/identity refusals, malformed inputs, and a binary checkpoint above the metadata request limit. Existing MCP acceptance smoke passes all 79 calls and 235 assertions with zero unexpected failures. Tool inventory/docs and git diff --check pass.
Self-review: GPT-5.6-sol reviewed the entire layer read-only; no actionable findings.
Client/log-rendering stack (merge bottom-up)
This completes the requested host-driven checkpoint-rendering/client-binding scope. Sequence orders accepted changes; timestamps select historical positions. Fine-grained keystroke recording, automatic concurrent-edit rebase, durable outbox and selective undo remain explicitly outside this implementation; this does not claim to close the broader #671/#672 roadmap.