From 5b5659cb830a6bf107dd0c9a0bb0f34045d6a8ce Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Tue, 10 Nov 2026 12:24:18 +0100 Subject: docs: the Assistant tab, and the spec follows the plan's decisions Co-Authored-By: Claude Opus 5.5 --- AGENTS.md | 13 ++++++++++- README.md | 7 +++++- .../specs/2026-11-10-assistant-design.md | 26 +++++++++++----------- 3 files changed, 31 insertions(+), 15 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 6817cdb..455eef6 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -52,6 +52,16 @@ Keep the server dependency-free apart from that one package. - `tablet` reads the tablet's battery (`dumpsys battery`) and Wi-Fi (`cmd wifi status`, Android 11+) over adb, from the device whose reverse carries the dashboard socket; reads are cached 10s. +- `assistant` is a client of desktop-assistant's socket + (`$XDG_RUNTIME_DIR/desktop-assistant.sock`, JSON lines; every client sees + every event); a reader thread folds events into the state the tab polls + every 0.5s. Presets, ops and paths come from quickshell's + `qs -p <[assistant] shell> ipc call assistant catalog`. Files are picked + on the PC with qarma, never named by the tablet. Voice is a WAV upload + (`Module.uploads`, a raw body with its own size limit) written to the run + dir and asked with `audio`. The tab's icons are the Nerd Font the server + serves at `/fonts/nerd.ttf`; Markdown goes through `static/md.js` + (vendored `marked`, HTML escaped, images never fetched). - The page holds a Screen Wake Lock while visible, so the tablet never sleeps over the dashboard; nothing on the tablet's settings is changed. - Launchers are `[launch] apps`, desktop ids run with `gtk-launch`; label and @@ -71,7 +81,8 @@ Keep the server dependency-free apart from that one package. python3 -m unittest discover -s tests -`node --check` any changed JS file. The real hardware paths (wayvnc, adb, OBS, +`node --check` any changed JS file. The `tests/test_*.mjs` node checks run +inside the suite through `tests/test_js.py`. The real hardware paths (wayvnc, adb, OBS, the tablet) are manual. ## Repo facts diff --git a/README.md b/README.md index 7e39898..a7b7a34 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ there is no cloud, account or app-store install. - `adb`, `wayvnc`, `openssl` - `playerctl`, `wpctl` (PipeWire), `wtype` - optional: `qrencode` for Wi-Fi pairing +- optional: desktop-assistant and `qarma` for the Assistant tab **Tablet** - Android with USB debugging or Wireless debugging @@ -50,7 +51,7 @@ launchers included, with a Restart button to apply a save. ## Usage - Tabs: **Dashboard** (draggable/resizable cards, each foldable to its title - bar), **Windows**, **OBS**, **K1C**. Swipe the content sideways to change + bar), **Windows**, **OBS**, **K1C**, **Assistant**. Swipe the content sideways to change tab; ⟳ at the top right reloads the page. - `deck-it install` prints the `exec-once` line for USB autostart. - `config.toml` holds the defaults: display, Wi-Fi address, workspaces, @@ -64,6 +65,10 @@ launchers included, with a Restart button to apply a save. - The K1C tab follows a Klipper printer through Moonraker (`[k1c] url`): state, progress with the slicer's model preview, temperatures, camera, and a red emergency stop that fires on a press and hold. +- The Assistant tab talks to desktop-assistant: type or tap the mic to ask, + pick the model, and use the canvas's Ask presets and Do ops on a file you + choose in a dialog on the PC (add a Translate preset on keystone's Ask + presets page to get one here). - The screen stays on while the dashboard is in front. ## License diff --git a/docs/superpowers/specs/2026-11-10-assistant-design.md b/docs/superpowers/specs/2026-11-10-assistant-design.md index 2c26188..1e22ef3 100644 --- a/docs/superpowers/specs/2026-11-10-assistant-design.md +++ b/docs/superpowers/specs/2026-11-10-assistant-design.md @@ -27,13 +27,12 @@ for a finger: icon buttons, no text buttons. - **`assistant catalog` IPC call** (an `IpcHandler` function returning a string). One JSON object: - `presets`: the list in use, `Presets.list(Prefs.presets)`; - - `ops`: Ops.js's list (label, icon, op, kinds, min, max, format) and the - compress formats; + - `ops`: Ops.js's list (label, icon, op, kinds, min, max, format), with + the Compress submenu's formats as ops of their own, of kind `any`; - `kinds`: kind → file extensions, from Files.js; - `fileops`: the absolute path of `assistant/fileops`; - `outDir`, `mdPrompt`: what the canvas uses for Do ops and To .md; - - `preferred`: `Prefs.assistantModel`, "" for none; - - `routerRoot`: the router's root URL (AssistantModule's `routerRoot`). + - `preferred`: `Prefs.assistantModel`, "" for none. - **Preset prompts are sent as written.** `Presets.prompt` today appends "Answer in the language of the document."; that sentence moves into the default prompts' own text and `prompt()` returns `p.prompt` unchanged, so @@ -49,8 +48,9 @@ for a finger: icon buttons, no text buttons. - reconnects every 5s while the daemon is down, as the OBS module does; - reads the catalog with `qs -p ipc call assistant catalog` at start and on each pick, so edits on keystone's presets page apply; - - reads `/models` (urllib) when the model list is refreshed, - for each local model's `architecture.input_modalities`. + - each local model's audio support comes with the daemon's `models` + event: desktop-assistant reports `inputs` (the router's + `architecture.input_modalities`) per local model. - **`static/modules/assistant.js`**: the tab (`tab: "Assistant"`, wrapper class `.assistant`), polling every 0.5s; the state is in memory, so a poll costs the PC nothing. @@ -71,7 +71,7 @@ The client sends text, ids and labels; never a path or a command. | --- | --- | --- | | `ask` | `text` | daemon `ask`, with `model` when one is wanted | | `stop`, `new` | — | the daemon commands | -| `models` | — | daemon `models` plus the router's inputs | +| `models` | — | daemon `models`, local items with `inputs` | | `model` | `id` | the chat's pick; must be in the last model list | | `voice` | raw WAV (upload) | writes `$XDG_RUNTIME_DIR/deck-it/voice.wav`, then `ask` with `text: ""`, `audio` and `model` | | `pick` | `preset` or `op` label | qarma on the PC, then the preset or op | @@ -87,9 +87,9 @@ that provider. ### Voice -The tablet records with `getUserMedia` and an AudioWorklet, downsamples to -16 kHz mono and encodes a 16-bit WAV in JS (stdlib only, ~40 lines), up to -59 s. A recording under 0.5 s is dropped. The mic is greyed out when the +The tablet records with `MediaRecorder`, decodes the clip with +`decodeAudioData`, resamples it to 16 kHz mono with an +`OfflineAudioContext` and encodes a 16-bit WAV in JS, up to 59 s. A recording under 0.5 s is dropped. The mic is greyed out when the model that will hear it takes no audio: the chat's pick if it is local, else the loaded local model (a cloud chat's voice is still transcribed locally). Unknown inputs count as yes; the daemon's error covers the rest. @@ -98,8 +98,8 @@ locally). Unknown inputs count as yes; the daemon's error covers the rest. 1. The label must be in the current catalog, else 400. 2. `qarma --file-selection` opens on the PC with a `--file-filter` built - from the action's kinds, and `--multiple` for an op with `min >= 2` or a - `many` preset. It runs on a thread; state is `picking` until it returns. + from the action's kinds, and `--multiple` unless the op has `max: 1`; an + op's `min` is checked after the pick. It runs on a thread; state is `picking` until it returns. One picker at a time; a second `pick` is refused. 3. Cancel or a closed dialog: back to idle. 4. A preset sends `ask` with `files` and the preset's prompt; the reply @@ -122,7 +122,7 @@ glyphs the canvas uses. replaced by "Choose the file on the PC" and a cancel icon. - **Transcript:** questions and replies, Markdown rendered by `marked`; a status line for thinking and running tools. A code block gets a copy - icon once its fence closes. + icon once its turn is finished. - **Input bar:** text field, then mic (toggle, with a running timer while recording), then send, which becomes stop while a reply streams. - **Model panel** slides over the transcript and close on a -- cgit v1.2.3