opencode-wait-plugin
v0.1.1
Published
OpenCode plugin that holds /wait prompts until the session is idle.
Readme
opencode-wait-plugin
OpenCode plugin that adds a server-side /wait <message> command.
/wait holds a prompt outside the transcript while the current session is busy, then releases it only after the current assistant turn reaches idle. This is intentionally different from OpenCode's built-in QUEUED display, where queued messages are already saved and can be picked up by the next backend loop step.
Install
Use OpenCode's plugin installer:
opencode plugin opencode-wait-plugin --globalThe package contains both server and TUI plugin targets. OpenCode loads server plugins from opencode.json[c] and TUI plugins from tui.json[c], so both entries are required:
- the server plugin implements the reliable
/waitqueue - the TUI plugin adds slash autocomplete, a dialog, and local
WAITINGdisplay for prompts submitted through the helper
If you need to pin a version:
opencode plugin [email protected] --global --forceManual opencode.jsonc entry:
{
"plugin": [["opencode-wait-plugin", { "enabled": true, "releaseTimeout": 15000 }]]
}Manual tui.jsonc entry:
{
"plugin": [["opencode-wait-plugin", { "enabled": true }]],
"plugin_enabled": {
"wait.plugin.tui": true
}
}Restart OpenCode after installing or updating the plugin.
Usage
In a session prompt:
/wait summarize the result after this turn finishesBehavior:
/wait <message>while idle sends<message>immediately./wait <message>while busy stores the prompt in an in-memory FIFO for that session.- Only one waiting prompt is released per full assistant turn.
- The server refreshes current session status when a
/waitprompt is submitted, so it still waits correctly if it missed an earlier busy event. - Waiting messages are not persisted. Restarting OpenCode drops in-memory waiting state.
The TUI helper can be selected from slash autocomplete. If the prompt is empty, it opens a small dialog. If the prompt already contains text, it prefixes that text with /wait and submits it. Prompts submitted this way are shown in the sidebar under Waiting and as WAITING N beside the prompt until the saved text part appears in the transcript.
Local Development
bun install
bun run typecheck
bun run test
bun run build
npm pack --dry-runFor local OpenCode testing, build first and point both config files at the package root:
opencode.jsonc:
{
"plugin": [["file:///home/tim/projects/wait_plugin", { "enabled": true, "releaseTimeout": 15000 }]]
}tui.jsonc:
{
"plugin": [["file:///home/tim/projects/wait_plugin", { "enabled": true }]],
"plugin_enabled": {
"wait.plugin.tui": true
}
}This repo includes .opencode/opencode.jsonc and .opencode/tui.json with those local package-root entries.
Manual Acceptance
This repo also includes .opencode/commands/wait-loop.md, which adds a /wait-loop command for manual acceptance testing. The command keeps the assistant turn busy across six separate tool-call checkpoints so normal queued messages would have chances to enter the loop.
- Start
/wait-loopin OpenCode. - Submit
/wait first waiting message. - Submit
/wait second waiting message. - Confirm neither message appears in the transcript while the current turn is busy.
- Confirm the first appears only after the current turn becomes idle.
- Confirm the second appears only after the first waiting prompt's assistant turn finishes.
Release
CI runs tests, typecheck, build, and npm pack --dry-run from the repo root.
opencode-wait-plugin must exist on npm before trusted publishing can be configured. Bootstrap the package once with an interactive npm login:
npm login --registry https://registry.npmjs.org
bun run typecheck
bun test
bun run build
npm publish --access public --tag latest --registry https://registry.npmjs.orgThen configure the trusted publisher:
npm trust github opencode-wait-plugin --repo timrichardson/wait_plugin --file release.yml --registry https://registry.npmjs.orgEquivalent npm website settings:
- Publisher: GitHub Actions
- Organization or user:
timrichardson - Repository:
wait_plugin - Workflow filename:
release.yml - Environment name: leave blank
After trusted publishing is configured, releases publish to https://registry.npmjs.org when a stable v* tag matches package.json version:
git tag v0.1.2
git push origin v0.1.2The release workflow uses npm trusted publishing with GitHub Actions OIDC and creates a GitHub release after npm publish succeeds.
Limits
- The queue is process-local and in-memory.
- The TUI
Waitingdisplay is local to prompts submitted through the plugin helper. Directly typing/wait <message>and pressing Enter still uses the reliable server queue, but OpenCode does not expose a plugin pre-submit hook for the TUI to mark that raw submission before it leaves the prompt. - The TUI helper cannot preserve every prompt detail in dialog/fallback submissions; direct prompt submissions through the normal prompt preserve the current prompt context.
