Prompt editor affordances: version-in-use hint, dirty-gated Save, auto-on

Owner-confirmed semantics (verified in composeInstructions first: switch
ON = the user's override text is what the agent reads; OFF = the default
composes, the saved file stays on disk unused). Four refinements:

1. The small text under a file name states WHICH VERSION IS IN USE:
   'Your version is in use' (PROMPT_IN_USE_HINT, pinned) when the
   switch is on; NOTHING when the default composes — even with a saved
   override sitting on disk. The old presence-based 'Your version is
   saved' (shown whenever a file existed, regardless of the switch)
   dies; the switch's meaning becomes legible through the line it
   visibly controls.

2. Save is clickable only when there's something to save: grayed and
   inert while the draft equals what's on disk (including the
   untouched editor just opened), full-contrast the moment the text
   differs. The always-active same-color button was the 'doesn't feel
   like it does anything' half of the report.

3. Saving auto-turns the switch ON — writing an override and putting
   it to work collapse into one action (a save with the switch off was
   the did-something-changed-nothing trap). Fires whenever the record
   genuinely has the path off, so a re-save after toggling off re-on's
   too. Order is the safe one (file first, then the switch the
   validation requires it).

4. A quiet inline 'Saved' / 'Deleted' confirmation rides next to the
   buttons (the old status line echoed the file path at the section's
   bottom — production-copy violation and easy to miss).

Plus the mirror-symmetry the auto-on needs: deleting an override while
its switch is on now composes the switch OFF in the same action — not
just redundant with Platform's 643a693 server-side clear: the dialog's
record mirror is what composes the next section write, so a stale ON
would silently defeat the auto-on after a save-following-delete (the
mirror would think the switch is already on and skip the write the
server record needs).

Live-verified on :3001: untouched editor grays Save; typing activates
it; reverting re-grays it; save-with-switch-off lands toggle ON + hint
+ 'Saved' + Save re-grayed in one click; toggle-off drops the hint
with the file retained on disk; re-save while off re-on's; delete
while on clears switch + file + hint with record left clean and a
subsequent agent-section write landing 200.
This commit is contained in:
amosblomqvist
2026-09-25 19:18:57 +03:00
parent c25ee44bfd
commit 3dfc331d7b
2 changed files with 63 additions and 18 deletions
+3 -3
View File
@@ -9,7 +9,7 @@ import assert from "node:assert/strict";
import { describe, it } from "node:test";
import { appearanceVars, derivedPalette, resolveAppearance, staleVarNames } from "../components/settings/appearance.tsx";
import {
PROMPT_SAVED_HINT,
PROMPT_IN_USE_HINT,
composePromptSwitch,
composeSearchEngine,
composeSlotModel,
@@ -384,7 +384,7 @@ describe("sectionedSegments — the prompts overhaul (2026-09-26)", () => {
assert.equal(teacher.hint, undefined);
});
it("the indicator copy is pinned (override present = the row earns its line)", () => {
assert.equal(PROMPT_SAVED_HINT, "Your version is saved");
it("the indicator copy is pinned — it states WHICH VERSION IS IN USE (refined 2026-09-26)", () => {
assert.equal(PROMPT_IN_USE_HINT, "Your version is in use");
});
});