From 1a2a36f0b8e4161252c15d1ca835788485ad0908 Mon Sep 17 00:00:00 2001 From: cliffhall Date: Thu, 27 Aug 2026 02:24:22 -0400 Subject: [PATCH 01/14] feat(web): use the Ace JSON editor everywhere, and restore the raw-JSON toggle MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Extracts the Ace integration #2094 carried inline into a shared `elements/JsonEditor`, and renders it on every surface where the web client types or displays JSON. The element is deliberately text in, text out. The two editing contracts above it disagree about what an unparseable draft means — JsonObjectInput keeps the last valid object and says nothing to its parent, SchemaJsonField reports `undefined` and blocks submission (#2020) — so parsing, and the draft/value split that goes with it, stays with each caller. Surfaces: SchemaJsonField (inherited by all four SchemaForm consumers), a new "Edit as JSON" switch for the whole arguments object, the server.json File Contents box, the raw JSON-RPC request box, ContentViewer's JSON branch (read-only, inherited by its eleven consumers), and a new "Edit and replay" modal on a Protocol entry. Ace read-only replaces the CodeHighlight JSON path and the Prism `json` grammar loader is dropped: folding, not colorization, is what it adds, and two highlighters for one language drift. `wrap={false}` callers and untyped text that only looks like JSON keep the plain renderer. Closes #2151 Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01UL9retfvAXRgvi6EWk4SY4 Signed-off-by: cliffhall --- clients/web/README.md | 31 +- clients/web/src/App.css | 7 + .../CodeHighlight/CodeHighlight.stories.tsx | 11 +- .../CodeHighlight/CodeHighlight.test.tsx | 23 +- .../elements/CodeHighlight/CodeHighlight.tsx | 6 +- .../ContentViewer/ContentViewer.test.tsx | 42 +- .../elements/ContentViewer/ContentViewer.tsx | 64 ++- .../ContentViewer/contentViewerUtils.test.ts | 24 ++ .../ContentViewer/contentViewerUtils.ts | 21 + .../EditReplayButton.stories.tsx | 24 ++ .../EditReplayButton.test.tsx | 21 + .../EditReplayButton/EditReplayButton.tsx | 31 ++ .../JsonEditor/JsonEditor.stories.tsx | 117 ++++++ .../elements/JsonEditor/JsonEditor.test.tsx | 190 +++++++++ .../elements/JsonEditor/JsonEditor.tsx | 263 +++++++++++++ .../JsonObjectInput/JsonObjectInput.tsx | 195 ++------- .../AppDetailPanel/AppDetailPanel.test.tsx | 7 +- .../EditReplayModal.stories.tsx | 51 +++ .../EditReplayModal/EditReplayModal.test.tsx | 121 ++++++ .../EditReplayModal/EditReplayModal.tsx | 133 +++++++ .../ExperimentalFeaturesPanel.test.tsx | 7 +- .../ExperimentalFeaturesPanel.tsx | 33 +- .../ImportServerJsonPanel.test.tsx | 9 +- .../ImportServerJsonPanel.tsx | 54 +-- .../MrtrConversation/MrtrConversation.tsx | 7 +- .../groups/NetworkEntry/NetworkEntry.test.tsx | 22 +- .../ProtocolEntry/ProtocolEntry.test.tsx | 79 ++++ .../groups/ProtocolEntry/ProtocolEntry.tsx | 50 ++- .../ProtocolListPanel.test.tsx | 5 +- .../ProtocolListPanel/ProtocolListPanel.tsx | 5 +- .../ResourceLink/ResourceLink.stories.tsx | 13 +- .../groups/ResourceLink/ResourceLink.test.tsx | 27 +- .../ResourcePreviewPanel.test.tsx | 8 +- .../groups/SchemaForm/SchemaForm.stories.tsx | 43 +- .../groups/SchemaForm/SchemaForm.test.tsx | 369 +++++++++++++----- .../groups/SchemaForm/SchemaForm.tsx | 182 ++++++++- .../ServerImportJsonModal.test.tsx | 37 +- .../StructuredOutputPanel.test.tsx | 15 +- .../ToolDetailPanel/ToolDetailPanel.test.tsx | 7 +- .../ToolResultPanel/ToolResultPanel.test.tsx | 7 +- .../screens/ProtocolScreen/ProtocolScreen.tsx | 3 +- .../views/InspectorView/InspectorView.tsx | 3 +- .../web/src/hooks/useExportActions.test.tsx | 32 ++ clients/web/src/hooks/useExportActions.ts | 24 +- clients/web/src/lib/protocolReplay.ts | 12 + clients/web/src/test/aceEditor.ts | 39 +- 46 files changed, 2026 insertions(+), 448 deletions(-) create mode 100644 clients/web/src/components/elements/EditReplayButton/EditReplayButton.stories.tsx create mode 100644 clients/web/src/components/elements/EditReplayButton/EditReplayButton.test.tsx create mode 100644 clients/web/src/components/elements/EditReplayButton/EditReplayButton.tsx create mode 100644 clients/web/src/components/elements/JsonEditor/JsonEditor.stories.tsx create mode 100644 clients/web/src/components/elements/JsonEditor/JsonEditor.test.tsx create mode 100644 clients/web/src/components/elements/JsonEditor/JsonEditor.tsx create mode 100644 clients/web/src/components/groups/EditReplayModal/EditReplayModal.stories.tsx create mode 100644 clients/web/src/components/groups/EditReplayModal/EditReplayModal.test.tsx create mode 100644 clients/web/src/components/groups/EditReplayModal/EditReplayModal.tsx diff --git a/clients/web/README.md b/clients/web/README.md index 934b799c54..02fe4d893c 100644 --- a/clients/web/README.md +++ b/clients/web/README.md @@ -49,8 +49,8 @@ Components live under `src/components/` in four layers, smallest to largest: | Layer | Count | What it is | | ----------- | ----- | ------------------------------------------------------------------------------ | -| `elements/` | ~31 | Leaf presentational pieces (badges, buttons, toggles) over Mantine primitives. | -| `groups/` | ~63 | Composite pieces (cards, panels, modals, control bars). | +| `elements/` | ~48 | Leaf presentational pieces (badges, buttons, toggles) over Mantine primitives. | +| `groups/` | ~64 | Composite pieces (cards, panels, modals, control bars). | | `screens/` | ~11 | Full tab screens (Tools, Resources, Servers, monitoring screens…). | | `views/` | 1 | `InspectorView` — the top-level layout that composes the screens. | @@ -283,17 +283,32 @@ Each customized Mantine component has a `Theme.ts` file (`Button.ts`, `Tex **`cssVariables.ts` is the third piece, beside the component files and `App.css`.** It holds overrides for the CSS variables `MantineProvider` injects at runtime, which `App.css` cannot reach: the provider appends its generated `