Skip to content

Commit bb58133

Browse files
committed
Document the actual OpenTUI send-path ingest
Architecture and implementation still claimed mention resolution and image paste were unwired. Submit already ingests both; the map was wrong.
1 parent 058fd43 commit bb58133

3 files changed

Lines changed: 31 additions & 4 deletions

File tree

docs/ARCHITECTURE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ OpenTUI (`@opentui/core`) is the shipping shell; the Ink/React tree has been del
403403
- **Runner host** (`runner-host.ts`) — Runner-facing mount: catalog assembly from live config, chrome pushes on session change, subagent observe resolution, and session teardown (quitting is Ctrl+C twice, owned by the shell).
404404
- **Overlays and pickers** — Resume picker (`src/tui/pick-session.ts`) uses `runListModal` (`src/tui/list-modal.ts`). Slash-command surfaces (`/model`, `/settings`, `/permissions`, `/plugins`, etc.) route through `openCommandSurface` (`src/tui/command-surfaces.ts`).
405405
- **Auto mode** — Toggled by CLI flags only (`--auto` / `--no-auto`); there is currently no in-session key bound to it.
406-
- `@file` mention resolution and image paste are not wired on the OpenTUI send path.
406+
- **Send-path ingest** — Submit, leftover send, and live steer run `ingestOperatorPrompt` (`src/tui/prompt-attachments.ts`): inline image-path mentions become attachments (`findImagePathMentions` / `imageAttachmentFromPath`); `@file` contents are inlined and `@dir` mentions become a directory summary (`resolveAtMentions` in `mention-resolution.ts`). The mention popup splices paths into the prompt (`spliceMentionCompletion`); it does not send. Ctrl+V / Ctrl+P (and `/paste-image`) attach a macOS clipboard PNG (`attachClipboardImage` in `shell.ts``readClipboardImage`); Cmd+V stays text (bracketed paste). Linux/Windows bitmap clipboard paste is not supported.
407407

408408
Known keybindings: `Ctrl+C` interrupts the in-flight run, and quits on a second press inside a two-second window.
409409

docs/IMPLEMENTATION.md

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,29 @@ Idle-with-fleet is shipped: after a non-blocking `spawn_agent` dispatch the pare
195195

196196
`src/tui/stream-event-map.ts` maps reactor events onto the bridge's inbound events, and `src/tui/turn-state.ts` tracks the turn's status. `src/tui/turns-to-blocks.ts` hydrates a resumed session's stored turns into the same content blocks.
197197

198-
### @file Mention Resolution
199-
200-
`@-mention` resolution and image paste are not wired on the OpenTUI send path.
198+
### Send-path ingest
199+
200+
Submit, leftover send, and live steer all run `ingestOperatorPrompt`
201+
(`src/tui/prompt-attachments.ts`) before the inbound user message is sent.
202+
That ingest:
203+
204+
1. Turns inline image-path mentions (`/path/to/shot.png`, `file://…`) into
205+
attachments via `ingestPathMentions``findImagePathMentions` /
206+
`imageAttachmentFromPath` (`src/tui/image-attachments.ts`).
207+
2. Expands `@file` mentions to file contents and `@dir` mentions to a
208+
directory summary via `resolveAtMentions` (`src/tui/mention-resolution.ts`),
209+
gated by sensitive-path and size caps.
210+
3. Merges any pending clipboard attachments already sitting on the prompt.
211+
212+
The `@` mention popup (`openAtMentionSuggestions` in `shell.ts`) only splices
213+
a path into the prompt (`spliceMentionCompletion`). Attachments land at send
214+
time, not at accept time.
215+
216+
Ctrl+V / Ctrl+P and `/paste-image` call `attachClipboardImage` (`shell.ts`) →
217+
`readClipboardImage` (`image-attachments.ts`), which reads a macOS clipboard
218+
PNG via osascript `«class PNGf»`. Cmd+V is terminal bracketed paste and stays
219+
text. Linux and Windows bitmap clipboard paste is a separate product gap; do
220+
not treat bracketed-paste path text as a paste-time image gesture.
201221

202222
## Configuration
203223

docs/TUI.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -587,6 +587,13 @@ sent messages. Once a real `paste` event has fired even once, the fallback
587587
heuristic is permanently skipped for the rest of the session
588588
(`shell.ts`, the `sawBracketedPaste` guard).
589589

590+
Ctrl+V and Ctrl+P attach a PNG from the macOS clipboard
591+
(`attachClipboardImage` in `shell.ts``readClipboardImage` in
592+
`image-attachments.ts`).
593+
Cmd+V stays text (bracketed paste above). Clipboard image attach is
594+
macOS-only; Linux/Windows bitmap clipboard paste is not supported.
595+
`/paste-image` is the same attach path.
596+
590597
@-mention path completion opens a popup keyed off the `@token` under the
591598
cursor (`openAtMentionSuggestions`, `src/tui/shell.ts`); every keystroke re-queries,
592599
and a generation counter discards a slower, stale query's results if a newer

0 commit comments

Comments
 (0)