-
Notifications
You must be signed in to change notification settings - Fork 6.4k
feat: use agent description as prompt placeholder #8788
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
feat: use agent description as prompt placeholder #8788
Conversation
- Show agent description in placeholder when available - Fall back to randomized hints for build agent or no description - Implement in both CLI (TUI) and app (web) components - Add .padEnd(70) workaround for text rendering ghosting bug Fixes issue where switching agents caused visual corruption with ghost characters from previous placeholder remaining visible. TODO: Find proper fix for text layout cache invalidation instead of padding workaround.
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
The following comment was made by an LLM, it may be inaccurate: No duplicate PRs found |
| // placeholder remain visible when switching to shorter text. Browser doesn't properly | ||
| // clear cached text layout with truncate/ellipsis CSS. Proper fix would be to force | ||
| // element recreation or use a different rendering approach. | ||
| return `Ask anything... "${PLACEHOLDERS[store.placeholder]}"`.padEnd(70, " ") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please advise. I'm not sure how to get around this ghosting of the previous cycle without the padEnd hack:
WindowsTerminal_genyHK2HUT.mp4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prompted opencode for it and it had no idea after 10 attempts.
| if (params.id) return | ||
| if (params.id || !shouldRotatePlaceholder()) return | ||
| const interval = setInterval(() => { | ||
| setStore("placeholder", (prev) => (prev + 1) % PLACEHOLDERS.length) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/oc Ah, I suppose we should only increment the placeholder index when we actually saw a placeholder
Summary
Implements dynamic placeholder hints that display the current agent's description instead of static randomized hints, except in build mode.
Closes #8804
WindowsTerminal_NgMLh7dY26.mp4
Changes
Implementation Details
CLI/TUI (
packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx)placeholderTextmemo that reactively returns agent description or randomized hintWeb App (
packages/app/src/components/prompt-input.tsx)placeholderTextmemo with same logic as CLIshouldRotatePlaceholdermemo to control hint rotationKnown Issues & Workarounds
Text Rendering Ghosting Bug
When switching between agents, ghost characters from the previous placeholder could remain visible due to browser/terminal text layout caching.
Workaround: Added
.padEnd(70, " ")to force full-width text rendering which overwrites stale cached text.TODO: This is a temporary fix. Investigate why OpenTUI textarea / browser doesn't invalidate text rendering cache, it should properly flush the input.
Testing
Files Changed
packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx(+14, -1)packages/app/src/components/prompt-input.tsx(+23, -4)