@@ -18,7 +18,7 @@ The server loads the plugin at startup. The plugin starts a grammY long-polling
1818src/
1919 main.ts -- plugin entry: env validation, bot start, event hook
2020 telegram.ts -- grammY bot: auth middleware, commands, prompt dispatch, streaming edits
21- opencode.ts -- SDK client wrapper: session CRUD, prompt, abort, permissions, auto-approve
21+ opencode.ts -- SDK client wrapper: session CRUD, prompt, abort, permissions
2222 format.ts -- MarkdownV2 escaping, code block preservation, tool summaries, message chunking
2323 events.ts -- event router: message.part.updated, permission.asked, streaming dispatch
2424 memory.ts -- exchange logging: saves every Telegram exchange as markdown to exchanges/
@@ -35,7 +35,7 @@ skills/
3535- Session-to-chat mapping persisted to ` sessions.json ` (resolved relative to ` directory ` from plugin context)
3636- Streaming uses edit-in-place with 2s throttle to stay under Telegram rate limits
3737- Prompt is fired non-blocking (` .then/.catch ` ) so grammY can process permission callbacks while waiting
38- - Permission requests surface as inline keyboards (Allow/Session/Deny); auto-approve is per-session toggle
38+ - Permission requests surface as inline keyboards (Allow/Session/Deny)
3939- Permission callback data uses short counter keys (Telegram 64-byte limit on callback data)
4040- Message chunking respects code block boundaries at 4096 char Telegram limit
4141- Server sends ` permission.asked ` with a shape that diverges from the SDK's v1 ` Permission ` type.
@@ -51,6 +51,7 @@ skills/
5151## Config
5252
5353Environment variables (set in server's environment or systemd ` EnvironmentFile= ` ):
54+
5455- ` TELEGRAM_BOT_TOKEN ` -- required
5556- ` TELEGRAM_ALLOWED_USERS ` -- required, comma-separated Telegram user IDs
5657- ` OPENCODE_WORKSPACE ` -- optional, server working directory (used by Makefile at install time)
@@ -78,7 +79,7 @@ Install the plugin into the OpenCode workspace's plugin directory (symlink or co
7879| Telegram lib | grammY | Lightweight, TypeScript-native |
7980| Runtime | bun | No build step, runs TS directly |
8081| Bot mode | Long polling | Simpler than webhooks for single-user |
81- | Session mapping | File-persisted Map | Survives restarts; auto-approve is in-memory only |
82+ | Session mapping | File-persisted Map | Survives restarts |
8283| Deployment | systemd user service | Reliable, auto-restart, journald logging |
8384| Streaming | Edit-in-place messages | ChatGPT-style UX with 2s throttle |
8485| Prompt execution | Non-blocking ` .then/.catch ` | Avoids deadlock: grammY must process permission callbacks while prompt blocks |
0 commit comments