Skip to content

feat(mobile): image picker button (reuses sendPasteImage)#91

Merged
attson merged 1 commit into
mainfrom
feat/mobile-image-input
Jun 1, 2026
Merged

feat(mobile): image picker button (reuses sendPasteImage)#91
attson merged 1 commit into
mainfrom
feat/mobile-image-input

Conversation

@attson
Copy link
Copy Markdown
Owner

@attson attson commented Jun 1, 2026

Summary

Adds an Image button to the mobile control panel so users can hand pictures to AI CLIs (claude, codex, etc.) the same way they do from desktop. No new transport — the chosen file goes through the existing `SessionConnection.sendPasteImage` → `TypePasteImage (0x33)` → desktop PTY host's "save tempfile + put on native clipboard + send Ctrl-V" path that's been in production since the desktop paste-image work.

  • New 图片/Image button in the kbbar next to 粘贴/Paste (`data-testid="mobile-image"`).
  • Hidden `` triggered on button tap; iOS WKWebView shows its native sheet with "Photo Library / Take Photo / Choose Files".
  • Gated identically to paste-text: requires driver + control mode, disabled / not rendered for view-only.
  • Input `value` reset to `''` after each change so re-picking the same file fires again.
  • i18n: `mobile.pasteImage` added in en + zh-CN.

Test plan

  • vitest: new cases for happy path (file → sendPasteImage call), control-mode gate (disabled when off), view-only gate
  • `npm test` — 77 files / 644 tests green
  • `npx vue-tsc --noEmit` — clean
  • `npm run build:capacitor` — clean
  • manual: on iOS Capacitor build, attach to a session as driver, toggle control mode, tap the Image button — native picker opens; select a screenshot; the image lands in claude's input area (Ctrl-V via desktop clipboard)

Out of scope

  • Camera-only or library-only buttons (`@capacitor/camera`). The native HTML5 picker already exposes both; can add the plugin later if separating sources matters.
  • In-app crop/preview before send.

Adds a 图片/Image button next to 粘贴/Paste in the mobile control panel.
Tapping it opens an iOS/Android-native picker via a hidden
<input type="file" accept="image/*">; the chosen file is forwarded to
the existing SessionConnection.sendPasteImage flow that the desktop
already routes through TypePasteImage → desktop host → temp file +
native clipboard + Ctrl-V to the PTY. No new dependency, no new wire
protocol — only the renderer entrypoint.

The button respects the same gate as paste-text (canSend = driver +
controlMode + non-view-only). The hidden input is reset to '' after
each change so picking the same file twice still fires.
@attson attson merged commit 073025e into main Jun 1, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant