Skip to content

[R1-05] Add PDF selection actions: Add to chat and Explain #33

Description

@dkritarth

Outcome

Turn selected paper text into immediate research context. User can add selection to Ask composer or start an explanation grounded in paper.

Dependencies

Blocked by #32. Build on verified reader selection/highlight seam; do not mix into PR #22 retroactively.

Scope

  • Contextual selection menu with Add to chat and Explain.
  • Capture exact quote, paper slug/title, page, and stable location when available.
  • Add to chat inserts editable quoted context without sending.
  • Explain opens Ask and sends a clear paper-grounded question.
  • Preserve existing highlight action and normal copy/selection.
  • Define IPC/chat contract test-first before UI wiring.

Acceptance criteria

  • Menu appears only for non-empty selection and dismisses predictably.
  • Add to chat preserves quote and source/page context, remains editable, does not auto-send.
  • Explain sends one turn through selected backend and streams response.
  • Prompt instructs agent to interpret selection in paper context and cite relevant section.
  • Selection from paper A cannot be sent as paper B context.
  • Multi-line/unicode/long selection has defined safe behavior.
  • Keyboard and screen-reader path exists.
  • Highlight, copy, zoom, search, and citations still work.

Live verification

On real PDF, test short sentence, equation-adjacent text, multi-line passage, repeated text, page switch, Add to chat edit/send, Explain, backend error, and response grounding against source.

Required PR evidence

PR must use Closes #33, stay focused, and include:

  • regression/failing test or reproducible baseline;
  • focused tests plus npm test, npm run typecheck, npm run build, git diff --check;
  • exact Electron clicks/typing and observed result;
  • screenshots for UI changes when tooling permits;
  • console output, restart/persistence result, and unresolved limitations;
  • real-paper evidence for reader behavior.

Existing PR code and mocked tests are not sufficient. Reviewer must independently exercise live flow before merge.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:acpACP adapter, agent session, or grounding workarea:readerPDF reader, text layer, navigation, or citationsarea:uxUser-facing workflow or interfacephase:1-readingPhase 1: paper reading, selection, and evidence workflowstatus:in-progressImplementation PR exists or work is actively claimed

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions