fix(opencode): the 2.x home placeholder is not typed input, cut example included (Issue #60, Linux item 1)

An adapter can now name its placeholder as a pattern the box's first line
matches in full (input_placeholder_pattern); input_placeholder stays the
literal lib.sh greps for. opencode: `Ask anything… "<example>"`, the closing
quote optional because a box under ~65 columns cuts the example. Fixtures:
the 140-column herdr capture and a 60-column one with the cut example.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
GodopuandClaude Opus 5.5 committed 2026-10-18 12:29:54 +00:00
1 parent 4d49abb371
commit 14d7a46181
6 files changed
+170 -2

No files matched your search

+4 -2
View File
@@ -17,7 +17,8 @@ def extract_input_region(pane_text: str, agent_name: str) -> str:
prompt line is input: a multi-line draft is never cut to its first line.
Then `input_frame_chars` are stripped, and the prompt and the placeholder
(whole-line) are stripped from the box's first non-blank line only. There
(whole-line: `input_placeholder` exactly or `input_placeholder_pattern` in
full) are stripped from the box's first non-blank line only. There
is no whole-pane fallback: a pane with none of these shapes has no input
region and yields a non-empty "unknown" result rather than a guess.
Raises ValueError for agents without input area facts (like hermes' peers).
@@ -79,7 +80,8 @@ def extract_input_region(pane_text: str, agent_name: str) -> str:
if first is not None:
head = re.sub(r'^\s*' + re.escape(prompt) + r'\s*', '', region_lines[first], count=1)
placeholder = adapter.input_placeholder
if placeholder and head.strip() == placeholder:
pattern = adapter.input_placeholder_pattern
if (placeholder and head.strip() == placeholder) or (pattern and re.fullmatch(pattern, head.strip())):
head = ''
region_lines[first] = head