OpenCode V2 TUI: List and stop AFT background shell tasks
I often see ◈Background bash status in the OpenCode V2 TUI, but AFT background commands don’t show up in OpenCode’s Shell list. I can’t check which tasks are still running or stop one directly from the TUI. To stop one, I have to find its task ID and ask the agent to run bash_kill.
Could we add /aft-tasks to AFT’s OpenCode V2 plugin? It would list running background tasks with each task’s command, working directory, and elapsed time. The list would load when opened and support manual refresh. Users could select a task to stop and see the result directly in the TUI.
The PR would reuse AFT’s existing task list and stop logic. If you approve this approach, I’ll open a PR to implement it right away.
Thanks for the request and for offering a PR, @KomeijiReimu. This fits: AFT's OpenCode 2 TUI already registers its own commands (the AFT status command), so /aft-tasks belongs next to it.
Please go ahead. A few things that will help it land quickly:
- Reuse what's there. List tasks and stop them through the same calls the
bash_statusandbash_killtools use, so the TUI and the agent always see the same tasks. Please don't add a new task registry or a new server operation. - Same project only. Show only the tasks of the session's own project, the way the tools do today.
- Honest results. When a stop fails or the task already finished, show that plainly rather than reporting success.
- Tests. Cover listing, refresh, stopping a running task, and stopping a task that already finished.
Any new text the TUI shows (titles, empty states, error lines) goes through review before merge, so please list it in the PR description.
Thanks! I’ll add /aft-tasks using the existing AFT calls, keep it scoped to the current session’s project, and list the new TUI text in the PR.
@alfonso-aft One implementation detail to confirm: bash_status takes a task ID, so I’d use the existing bash_owned_tasks call to list the current session’s tasks in its project, then use bash_status and bash_kill. The OpenCode TUI can’t call those directly. Is a thin OpenCode plugin RPC that forwards to these existing calls within scope? It would add no AFT engine operation or task registry.
Yes, that's in scope. A thin plugin RPC is the right way to do it: the OpenCode 2 TUI already reaches AFT through the plugin's RPC client (AftRpcClient in packages/opencode-plugin/src/shared/rpc-client.ts, which the AFT status command uses). Add methods there that forward to bash_owned_tasks, bash_status and bash_kill, and keep the session and project scoping those calls already apply. No new engine operation or task registry needed.