refactor(desktop-tools): consolidate preview + project, diet the desktop_ui suite (3,861 → 2,293 tok/call, −41%) (#97659)

* refactor(desktop-tools): consolidate preview(open/close/read) + project(create/switch/list), diet the desktop_ui suite — 3,861 -> 2,293 tok/call on desktop sessions (-41%)

* rename: preview -> desktop_preview, project -> desktop_project — namespace desktop-app tools against MCP/plugin name collisions

* test: sync remaining old-name pins — per-file registration import, GUI_TOOLS set, post-hook case read_preview -> desktop_preview action=read
This commit is contained in:
Teknium
2026-08-28 23:10:01 -07:00
committed by GitHub
parent 70c6d78cae
commit 217ab2f8df
23 changed files with 383 additions and 274 deletions

View File

@@ -112,37 +112,33 @@ _STEP_SCHEMA = {
"properties": {
"selector": {
"type": "string",
"description": "CSS selector of the element this step highlights. Omit for a centered narration-only step.",
"description": "Element to highlight; omit = centered narration.",
},
"title": {"type": "string", "description": "Popover title."},
"text": {"type": "string", "description": "Popover body text."},
"text": {"type": "string", "description": "Popover body."},
"side": {
"type": "string",
"enum": list(SIDES),
"description": "Preferred popover side. Omit to auto-place.",
"description": "Popover side; omit to auto-place.",
},
},
}
TOUR_SCHEMA = {
"name": "tour",
# Dieted (#95681): targets-first flow + stable-selector preference kept
# (pre-effect: skipping them means guessed selectors on re-rendering UI).
"description": (
"Give a live guided tour in the Hermes desktop GUI: dim the screen, "
"highlight an element, and attach a popover with your own title/text. "
"Works on two surfaces — 'app' (the Hermes app itself) and 'preview' "
"(whatever page is open in the in-app browser, so any web app can be "
"toured). ALWAYS call action='targets' first to discover what is on "
"screen instead of guessing selectors; each target reports "
"`stable: true` when its selector keys off identity (data-tour, id, "
"data-testid, aria-label) and survives a re-render — prefer those, and "
"re-scan if a selector stops matching. Then either narrate at your own "
"pace with action='show' (one highlight per call — replaces the "
"previous one; pair each with a chat message describing it), or hand "
"control to the user with action='start' + a steps array (driver.js "
"renders Next/Prev buttons; 'next'/'prev' also page it "
"programmatically). action='stop' clears the tour. Use when the user "
"asks how something works, where something is, or for a walkthrough of "
"an app or workflow."
"Guided tour in the desktop GUI: dim the screen, highlight an "
"element, attach a titled popover. Surfaces: 'app' (Hermes itself) "
"or 'preview' (the page in the preview pane). ALWAYS call "
"action='targets' first — prefer targets marked stable:true (their "
"selectors survive re-renders); re-scan if one stops matching. Then "
"narrate with action='show' (one highlight per call, replaces the "
"last — pair each with a chat message) or hand over with "
"action='start' + steps (user gets Next/Prev; 'next'/'prev' also "
"page it). 'stop' clears. Use for how-does-X-work / where-is-Y "
"walkthroughs."
),
"parameters": {
"type": "object",
@@ -150,32 +146,32 @@ TOUR_SCHEMA = {
"action": {
"type": "string",
"enum": list(ACTIONS),
"description": "targets: list tourable elements. show: highlight one element. start: begin a multi-step user-paced tour. next/prev: page a started tour. stop: end the tour.",
"description": "targets first; show narrates; start hands over.",
},
"surface": {
"type": "string",
"enum": list(SURFACES),
"description": "Where the tour runs: 'app' (Hermes desktop UI, default) or 'preview' (the page in the in-app browser pane).",
"description": "'app' (default) or 'preview'.",
},
"selector": {
"type": "string",
"description": "For show: CSS selector of the element to highlight (from action='targets', preferring a stable one). Omit for a centered narration popover.",
"description": "show: selector from targets (prefer stable). Omit = centered narration.",
},
"title": {"type": "string", "description": "For show: popover title."},
"text": {"type": "string", "description": "For show: popover body text."},
"title": {"type": "string", "description": "show: popover title."},
"text": {"type": "string", "description": "show: popover body."},
"side": {
"type": "string",
"enum": list(SIDES),
"description": "For show: preferred popover side. Omit to auto-place.",
"description": "show: popover side; omit to auto-place.",
},
"steps": {
"type": "array",
"items": _STEP_SCHEMA,
"description": "For start: the ordered tour steps.",
"description": "start: ordered steps.",
},
"step_index": {
"type": "integer",
"description": "For start: 0-indexed step to begin at (default 0).",
"description": "start: 0-indexed first step.",
},
},
"required": ["action"],