aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/assistant/README.md
blob: 0f80993802ca964cc556adecdad130da81bf5b6c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# assistant

The assistant canvas: a centred card on DP-1, on SUPER+Home, for typed
conversations with the local text assistant. It is only a view.
desktop-assistant (the repo next to this one) is the daemon that owns the
model, the tools and the history; this connects to its socket,
`$XDG_RUNTIME_DIR/desktop-assistant.sock`, draws what it is told and sends
what is typed. The protocol is specified in that repo,
`docs/superpowers/specs/2026-10-16-text-daemon-design.md`.

    qs -p ./desktop ipc call assistant toggle

| File | Does |
| --- | --- |
| `Assistant.qml` | the socket, the turn model, the window |
| `Card.qml` | header, transcript, input, the history panel's place |
| `Message.qml` | one turn: question, thinking line, tool chips, reply |
| `Segments.qml` | markdown with a copy button per code block |
| `History.qml` | conversation list and full-text search |
| `Md.js` | splits a message into prose and fenced code |

Keys: Enter sends, Shift+Enter is a newline, Escape closes the history
panel and then the card. Stop replaces Send while a reply streams.

Notes:

- **The state outlives the card.** The socket and the turn model live in
  `Assistant.qml`, outside the window's loader, so closing the card loses
  nothing, and a reply keeps streaming into it while it is closed.
- **Tokens are batched.** They collect in a buffer and reach the model on a
  50 ms tick, so markdown is re-rendered twenty times a second at most
  rather than per token.
- **Prose goes through `Notify.sanitize`**, which blocks remote images.
  Model output can quote a search result, and an image URL in it would be
  fetched the moment it rendered.
- **A code block's copy button appears once the fence closes.** A
  half-streamed block is not the command the model meant.
- **The daemon may be down.** The card says so and disables the input; the
  socket retries every 2 s with a fresh `Socket` (see AGENTS.md), logging a
  `ServerNotFoundError` warning each time.
- **`tools` is a comma-joined string role.** A ListModel role holding an
  array becomes a nested model, which `setProperty` cannot append to.
- **Search snippets** mark matches with `**`, rendered as bold; backticks
  are stripped first, since a match inside a code span would show the
  markers literally.

Test the splitter: `node desktop/assistant/test_md.js`.