Skip to content

Conversation

@msmps
Copy link
Owner

@msmps msmps commented Jan 28, 2026

Add element detection for identifying interactive UI elements in terminal screens. The system uses visual style segmentation and pattern classification to identify buttons, inputs, and toggles.

Key components (crates/pilotty-core/src/elements/):

  • grid: maps vt100 screen to typed cells with style info
  • segment: clusters adjacent cells by visual style
  • classify: pattern-matches clusters to element types
  • Element: output type with ref_id, kind, position, confidence

Detection patterns:

  • Buttons: [OK], <Cancel>, inverse-video text, underlined text
  • Inputs: underscore runs (____), cursor-containing regions
  • Toggles: [x], [ ], (o), ( ) checkbox/radio patterns

Classification priority ensures pattern recognition takes precedence over cursor position (cursor on button = focused button, not input).

Elements include confidence scores and optional focused/checked state.

Known limitation: ncurses apps that style brackets differently from interior text (e.g., dialog) may not detect buttons correctly.

@msmps msmps force-pushed the feat/element-detection branch from f6e08c2 to 088036b Compare January 28, 2026 21:47
Add element detection for identifying interactive UI elements in terminal
screens. The system uses visual style segmentation and pattern
classification to identify buttons, inputs, and toggles.

Key components (crates/pilotty-core/src/elements/):
- grid: maps vt100 screen to typed cells with style info
- segment: clusters adjacent cells by visual style
- classify: pattern-matches clusters to element types
- Element: output type with kind, position, text, confidence

Detection patterns:
- Buttons: [OK], <Cancel>, inverse-video text, underlined text
- Inputs: underscore runs (____), cursor-containing regions
- Toggles: [x], [ ], (o), ( ) checkbox/radio patterns

Classification priority ensures pattern recognition takes precedence
over cursor position (cursor on button = focused button, not input).

Elements include row/col for direct use with click command.
Confidence scores indicate detection certainty (1.0 = high, 0.6 = low).

Known limitation: ncurses apps that style brackets differently from
interior text (e.g., dialog) may not detect buttons correctly.
@msmps msmps force-pushed the feat/element-detection branch from 088036b to 85106b5 Compare January 28, 2026 21:49
@msmps msmps marked this pull request as ready for review January 28, 2026 22:03
@msmps msmps merged commit 71d194a into main Jan 28, 2026
6 checks passed
@msmps msmps deleted the feat/element-detection branch January 28, 2026 22:04
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.

2 participants