Feature request: let plugins detect if they are in an interactive session #2121

Open
opened 2026-02-16 17:34:14 -05:00 by yindo · 0 comments
Owner

Originally created by @ariane-emory on GitHub (Oct 15, 2025).

Originally assigned to: @thdxr on GitHub.

Please provide some function by which a plugin can detect on whether it is running in an interactive session (as opposed to an API call or opencode run invocation).

Motivation:

I have a plugin to ring a bell when session.idle, to alert me when work has been completed.

I also have custom slash commands that invoke opencode run to do prompt enhancement.

Presently, using one of these commands results in the bell ringing twice: once when the nested opencode run command completes, and then a second time when the work in response to the prompt I had input in the interactive session where I ran the command has finished. The earlier beep is not desired: the intent of the bell plugin was to alert me when the work is finished, not when the prompt enhancement that the nested opencode run invocation performs has complete (after which the enhanced prompt is handed back to the interactive opencode session and the 'work' proper begins

Some function like AmIRunningInAnInteractiveSession() that I could use in the plugin would suffice to accomplish my goal.

Originally created by @ariane-emory on GitHub (Oct 15, 2025). Originally assigned to: @thdxr on GitHub. Please provide some function by which a plugin can detect on whether it is running in an interactive session (as opposed to an API call or `opencode run` invocation). ### Motivation: I have a plugin to ring a bell when session.idle, to alert me when work has been completed. I also have custom slash commands that invoke `opencode run` to do prompt enhancement. Presently, using one of these commands results in the bell ringing twice: once when the nested `opencode run` command completes, and then a second time when the work in response to the prompt I had input in the interactive session where I ran the command has finished. The earlier beep is not desired: the intent of the bell plugin was to alert me when the work is finished, not when the prompt enhancement that the nested `opencode run` invocation performs has complete (after which the enhanced prompt is handed back to the interactive opencode session and the 'work' proper begins Some function like `AmIRunningInAnInteractiveSession()` that I could use in the plugin would suffice to accomplish my goal.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#2121