feat(web): slash command autocomplete + /status /list + fix chat input locking#404
feat(web): slash command autocomplete + /status /list + fix chat input locking#404henrypark133 merged 3 commits intomainfrom
Conversation
…ut locking Backend: - Add JobStatus, JobList, JobCancel Submission variants to submission.rs - Parse /status [id], /progress [id], /list, /cancel <id> as control commands - Dispatch to existing handle_check_status/handle_list_jobs/handle_cancel_job handlers via new process_job_status/process_job_list/process_job_cancel methods - Add 4 parser tests (34 total, all passing) Web UI: - Add slash command autocomplete: type / in chat input to see all 18 commands with descriptions; arrow-key navigation, Tab/Enter to select, Escape to close - Remove chat input locking: drop textarea.disabled + sendBtn.disabled so users can always type and send (including /interrupt while agent is processing) - Remove quick-action toolbar buttons (↩↪⏸⊖🗑📋) added in previous session - Remove dead #chat-status bar (min-height 28px black bar always visible when empty) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the user experience of the web interface by introducing robust slash command functionality and improving chat input responsiveness. It enables users to interact with the agent more efficiently through new job-related commands and an intuitive autocomplete system, while also streamlining the UI by removing unnecessary elements. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces excellent new features, including slash command autocomplete and handlers for /status and /list. The implementation is solid, particularly the frontend work for the autocomplete UI and the fix for chat input locking. I have a couple of suggestions to improve code clarity and efficiency. One is to simplify the backend parsing for the new /list command by treating it as a direct alias for /status, which would reduce some code redundancy. The other is a small refactoring in the JavaScript to cache autocomplete results and avoid re-filtering, which would make the UI slightly more performant.
| if lower == "/list" { | ||
| return Submission::JobList; | ||
| } |
There was a problem hiding this comment.
The /list command is an alias for /status without arguments. Instead of introducing a new Submission::JobList variant, you could parse /list directly into Submission::JobStatus { job_id: None }.
This would simplify the code by allowing you to remove the Submission::JobList enum variant and the Agent::process_job_list handler function, reducing code duplication.
You can achieve this by modifying the condition on line 111 to include /list:
if lower == "/status" || lower == "/progress" || lower == "/list" {
return Submission::JobStatus { job_id: None };
}And then you can remove this /list block.
There was a problem hiding this comment.
Fixed in f5fc18a — /list now parses directly to Submission::JobStatus { job_id: None }. Removed the JobList variant, the is_control arm, the match arm in agent_loop, and the process_job_list wrapper function.
| if (e.key === 'Tab' || (e.key === 'Enter' && _slashSelected >= 0)) { | ||
| e.preventDefault(); | ||
| const matched = SLASH_COMMANDS.filter((c) => c.cmd.startsWith(chatInput.value.toLowerCase())); | ||
| const pick = _slashSelected >= 0 ? matched[_slashSelected] : matched[0]; | ||
| if (pick) selectSlashItem(pick.cmd); | ||
| return; |
There was a problem hiding this comment.
The list of matching slash commands is being re-filtered inside the keydown event handler. This is slightly inefficient as the filtering already happens in the input event handler via filterSlashCommands.
You can avoid this re-computation by caching the list of matches when showSlashAutocomplete is called and reusing it here. To do this:
- Add
let _slashMatches = [];at the top level (e.g., near_slashSelected). - In
showSlashAutocomplete(matches), store the matches:_slashMatches = matches;. - In
hideSlashAutocomplete(), clear it:_slashMatches = [];.
Then you can use _slashMatches here directly as suggested below.
if (e.key === 'Tab' || (e.key === 'Enter' && _slashSelected >= 0)) {
e.preventDefault();
const pick = _slashSelected >= 0 ? _slashMatches[_slashSelected] : _slashMatches[0];
if (pick) selectSlashItem(pick.cmd);
return;
}There was a problem hiding this comment.
Fixed in f5fc18a — added let _slashMatches = []; module-level cache. showSlashAutocomplete sets it, hideSlashAutocomplete resets it, and the keydown handler now uses _slashMatches directly instead of re-filtering SLASH_COMMANDS.
- Remove Submission::JobList variant; parse /list directly as
JobStatus { job_id: None } (simpler, eliminates redundant enum
variant, match arm, is_control branch, and wrapper function)
- Cache autocomplete matches in _slashMatches to avoid re-filtering
SLASH_COMMANDS on every keydown while autocomplete is open
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…t locking (nearai#404) * feat(web): slash command autocomplete, /status /list /cancel, fix input locking Backend: - Add JobStatus, JobList, JobCancel Submission variants to submission.rs - Parse /status [id], /progress [id], /list, /cancel <id> as control commands - Dispatch to existing handle_check_status/handle_list_jobs/handle_cancel_job handlers via new process_job_status/process_job_list/process_job_cancel methods - Add 4 parser tests (34 total, all passing) Web UI: - Add slash command autocomplete: type / in chat input to see all 18 commands with descriptions; arrow-key navigation, Tab/Enter to select, Escape to close - Remove chat input locking: drop textarea.disabled + sendBtn.disabled so users can always type and send (including /interrupt while agent is processing) - Remove quick-action toolbar buttons (↩↪⏸⊖🗑📋) added in previous session - Remove dead #chat-status bar (min-height 28px black bar always visible when empty) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * refactor: address PR review comments - Remove Submission::JobList variant; parse /list directly as JobStatus { job_id: None } (simpler, eliminates redundant enum variant, match arm, is_control branch, and wrapper function) - Cache autocomplete matches in _slashMatches to avoid re-filtering SLASH_COMMANDS on every keydown while autocomplete is open Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: Pierre LE GUEN <26087574+PierreLeGuen@users.noreply.github.com>
Summary
/status [id],/progress [id], and/listas true slash commands (were in/helpoutput but never parsed or dispatched)/in chat input to see all 18 available commands with descriptions; arrow-key navigation, Tab/Enter to select, Escape to closetextarea.disabled+sendBtn.disabledso users can always type and send, including/interruptwhile the agent is processing#chat-statusbar (black box visible due tomin-height: 28pxeven when empty)Test plan
/in chat → autocomplete dropdown appears with all 18 commands/status→ agent responds with job summary (no LLM turn)/status <uuid-prefix>→ agent shows specific job details/list→ lists all jobs/interrupt+ Enter → interrupt is sent🤖 Generated with Claude Code