opencode-plugin-teleprompt
v0.1.12
Published
OpenCode TUI plugin — control your AI coding session remotely via Telegram. Queue prompts, approve permissions, and get results as Telegram messages.
Maintainers
Readme
opencode-plugin-teleprompt
TUI-scoped OpenCode plugin that binds a Telegram channel to one active OpenCode session.
What It Does
- Polls a strict Telegram channel for
/tpcommands - Injects
/tp <prompt>into the currently bound OpenCode session - Sends summary-only response messages back to the same channel
- Relays OpenCode permission prompts and accepts Telegram
approve,approve-always,deny - Keeps single-owner bridge semantics across multiple OpenCode consoles
V1 Limits
- Single strict channel
- Single active bound session
- Summary-only output (no full transcript)
- No auto-bind on startup
Requirements
- Telegram bot token
- Bot must be an admin in the target channel
- Telegram credentials can be provided either:
- via env vars (
OPENCODE_TELEGRAM_BOT_TOKEN,OPENCODE_TELEGRAM_CHANNEL_ID) - or at runtime with
/tp:start <bot_token> <channel_id>or/tp:credentials <bot_token> <channel_id>
- via env vars (
Optional:
OPENCODE_TELEGRAM_POLL_TIMEOUT_SEC(default:30)OPENCODE_TELEGRAM_HEARTBEAT_MS(default:10000)OPENCODE_TELEGRAM_LEASE_TTL_MS(default:30000)OPENCODE_TELEGRAM_SUMMARY_MAX_CHARS(default:1200)OPENCODE_TELEGRAM_ONLINE_NOTICE(true/false, default:true)OPENCODE_TELEGRAM_OFFLINE_NOTICE(true/false, default:true)
Install And Build
npm install
npm run buildInstall In OpenCode (npm package)
Add this plugin package name into your OpenCode config:
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-plugin-teleprompt"]
}OpenCode installs npm plugins automatically at startup.
Activation And Use
- Publish this package to npm.
- Add package name to
opencode.jsonas shown above. - Open a session in OpenCode TUI.
- Run
/tp:startin OpenCode to activate teleprompt for the current session.- If env vars are missing, run
/tp:start <bot_token> <channel_id>once (or/tp:credentials <bot_token> <channel_id>then/tp:start). - Runtime credentials are session-only and are cleared on plugin/session shutdown.
- If env vars are missing, run
- While teleprompt is active, local prompt input is locked for that session.
- Disconnect options:
- Press
Esctwice in a row in OpenCode - Send
/tp:dcin Telegram channel - Run
/tp:stopin OpenCode
- Press
- Use Telegram channel commands:
/tp <prompt>/tp:interrupt/tp:queue/tp:cancel <job_id|last>/tp:retry/tp:context/tp:compact/tp:newsession/tp:reset-context/tp:who/tp:health/tp:reclaim/tp:history/tp:last-error/tp:model/tp:model fast/tp:model smart/tp:model max/tp:model <provider>/<model>/tp approve <request_id>/tp approve-always <request_id>/tp deny <request_id>/tp status/tp:dc
During remote runs, teleprompt posts lifecycle updates (accepted, queued, running, waiting-permission, completed, failed) and result summaries are sent as replies to the originating Telegram message for clear correlation.
Publish And Install Verification
npm Publish Preparation
- Run release validation locally:
npm run verify:release
- Validate npm auth/account:
npm whoami
- Publish:
npm publish
prepublishOnly is enabled and will run release verification automatically before publishing.
Clean-Machine Install Checklist
- On a clean machine, create
opencode.jsonwith:"plugin": ["opencode-plugin-teleprompt"]
- Set required env vars:
OPENCODE_TELEGRAM_BOT_TOKENOPENCODE_TELEGRAM_CHANNEL_ID
- Start OpenCode and ensure plugin loads without startup errors.
- Open one session, run
/tp:start, verify bridge binds. - Send
/tp statusfrom Telegram and confirm status response. - Send
/tp test pingand confirm lifecycle + summary reply. - Send
/tp:dcand confirm local input is unlocked in OpenCode.
Telegram Live E2E Quick Checklist
- Start OpenCode session and run
/tp:start. - From Telegram channel, run
/tp statusand verify owner/session info. - Run
/tp:modeland switch once with/tp:model fast(or explicit provider/model). - Send
/tp write a 1-line summary of this sessionand verify:accepted->running->completed- summary arrives as reply to the same Telegram message
- Trigger a permissioned action prompt and verify:
- plugin posts permission request with
request_id /tp approve <request_id>(or/tp deny <request_id>) is applied immediately
- plugin posts permission request with
- Send
/tp:interruptduring a long run and confirm graceful stop. - Send
/tp:dcand confirm disconnect/unlock behavior.
Command Reference
OpenCode Local Commands
/tp:start: Bind teleprompt to the current OpenCode session and start Telegram polling./tp:start <bot_token> <channel_id>: Bind with session-only credentials when env vars are not set./tp:credentials <bot_token> <channel_id>: Store session-only credentials for the current runtime./tp:stop: Unbind teleprompt, stop polling, and unlock local session input./tp:status: Show current bridge status in OpenCode (session, owner, model, queue, permissions).
Telegram Commands
/tp <prompt>: Queue a new prompt for the currently bound session./tp:interrupt: Abort the currently running remote prompt without disconnecting the bridge./tp:queue: Show active prompt and queued prompts./tp:cancel <job_id|last>: Remove a queued prompt by job ID, or remove the newest queued prompt withlast./tp:retry: Re-queue the most recent prompt from prompt history./tp:context: Show compact session context (recent prompts, summaries, and changed files)./tp:compact: Trigger session summarization/compaction for long-running sessions./tp:newsession: Create a new OpenCode session and switch teleprompt binding to it./tp:reset-context: Alias behavior for creating/switching to a fresh session context./tp:who: Show lease ownership details (current instance, lease owner, ownership state)./tp:health: Show bridge health (lease age/staleness, poller/event stream status, queue stats)./tp:reclaim: Try to reclaim bridge ownership for the current instance./tp:history: Show recent run history with status and short summaries./tp:last-error: Show the latest failed or interrupted run summary./tp:model: List available models by provider and show current model selection./tp:model fast: Select a model using thefastpreset resolver./tp:model smart: Select a model using thesmartpreset resolver./tp:model max: Select a model using themaxpreset resolver./tp:model <provider>/<model>: Select an explicit provider/model for the bound session./tp approve <request_id>: Approve a pending permission request once./tp approve-always <request_id>: Approve a pending permission request and persist approval behavior when supported./tp deny <request_id>: Reject a pending permission request./tp status: Show bridge status from Telegram./tp:dc: Disconnect teleprompt from Telegram and unbind the current session.
Shutdown Behavior
- On normal TUI disposal (
Ctrl+C, clean exit), poller and heartbeat stop and lease is released. - On unclean termination, lease expires by TTL and next owner instance can reclaim.
