Files
CatoandClaude Opus 5.5 0dc521df93 feat(terminal): Loki tells you what to type, and typing it is one click (#1164)
* feat(terminal): Loki tells you what to type, and typing it is one click

A person looking at the terminal did not know what to do: the agent said
"Please run /login", or they wanted Opus instead of the current model, and
nothing on the page said the answer is a command. The summary offered prose
tasks, and a command sent through Inject was wrapped in project context, so
"/model opus" reached the agent as a sentence about a model.

- config/agent-commands.ts is the one list of each CLI's own commands
  (sign in, choose a model, free up memory, start fresh), in plain words.
- lib/terminal-commands.ts reads the screen: signed out, out of quota,
  memory nearly full, or a menu waiting on a choice. TerminalActions shows
  the sentence and a button that types the command or key into the session.
- The Loki panel knows the commands too. "What's going on?" and every Ask
  carry them with the screen, and a step that is a command ("→ /model opus")
  becomes a button that types it instead of an Inject draft.
- A draft that is exactly a known command is typed, never injected. "/" in
  the Prompt box lists the agent's commands above the prompt library, and
  the panel has the full list one click away.
- Clicking or tapping the read-only terminal switches to Type and puts the
  cursor where keys go, so the screen can be worked in directly.
- Copy no longer says "tap" to people on a computer: gesture-neutral wording
  where possible, usePressVerb() (and widget/press.ts) where the gesture is
  the instruction, "pressed" when narrating what someone did.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZqZujmXpupVDC1Hi5Jbsx

* test(widget): the watch remark names the control as pressed, not tapped

The widget's narration now says "pressed", which is true on a phone and a
computer alike; this browser assertion still expected the old word.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZqZujmXpupVDC1Hi5Jbsx

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-12 06:09:16 -07:00

17 lines
790 B
TypeScript

/**
* "Tap" on a touch screen, "click" with a mouse — for instructions that name
* the gesture. This widget runs on other people's sites and is used from
* phones and computers alike; "Tap ◎" read on a laptop is a small, constant
* wrongness. Mirrors src/lib/pointer-verb (the widget cannot import from src/).
*
* Narration of what someone DID ("You pressed Save") uses "pressed", which is
* true of both — that line is also read later, on whatever device.
*/
export function pressVerb(): { verb: "tap" | "click"; Verb: "Tap" | "Click" } {
const touch =
typeof window !== "undefined" &&
typeof window.matchMedia === "function" &&
window.matchMedia("(pointer: coarse)").matches;
return touch ? { verb: "tap", Verb: "Tap" } : { verb: "click", Verb: "Click" };
}