opencode-tbot 0.1.26 → 0.1.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -98,7 +98,7 @@ Legacy `openrouter` voice-transcription settings are ignored at runtime. When th
98
98
  | `telegram.allowedChatIds` | No | `[]` | Allowed Telegram chat IDs. If empty, the bot accepts messages from any chat. |
99
99
  | `telegram.apiRoot` | No | `https://api.telegram.org` | Telegram Bot API base URL. Useful for tests or self-hosted gateways. |
100
100
  | `state.path` | No | `./data/opencode-tbot.state.json` | JSON state file path, resolved relative to the current OpenCode worktree. |
101
- | `prompt.waitTimeoutMs` | No | `1800000` | Maximum total wait for a synchronous prompt before the plugin stops waiting. |
101
+ | `prompt.waitTimeoutMs` | No | `1800000` | Maximum total wait for one async prompt lifecycle before the plugin stops waiting for OpenCode recovery. |
102
102
  | `prompt.pollRequestTimeoutMs` | No | `15000` | Timeout for each individual recovery poll request to OpenCode. |
103
103
  | `prompt.recoveryInactivityTimeoutMs` | No | `120000` | Recovery timeout that only applies when prompt progress stops advancing. |
104
104
  | `logLevel` | No | `info` | Plugin log level. Logs are emitted through `client.app.log()`. |
@@ -106,6 +106,7 @@ Legacy `openrouter` voice-transcription settings are ignored at runtime. When th
106
106
  ### Notes
107
107
 
108
108
  - `state.path` is resolved relative to the current OpenCode worktree.
109
+ - Telegram prompt handling is async-first: the plugin submits `session.promptAsync()` and then recovers the reply from session messages and session status.
109
110
  - `prompt.waitTimeoutMs` is the total safety cap; `prompt.recoveryInactivityTimeoutMs` only applies when OpenCode stops making progress.
110
111
  - If `telegram.allowedChatIds` is left empty, the bot accepts messages from any chat. Restrict it in production.
111
112
  - Permission approvals and session notifications are handled through plugin hooks.
@@ -126,7 +127,7 @@ Legacy `openrouter` voice-transcription settings are ignored at runtime. When th
126
127
  - `/new [title]` create a new OpenCode session
127
128
  - `/agents` or `/agent` list available agents and switch the active one
128
129
  - `/sessions` list available sessions and switch the active one
129
- - `/cancel` cancel session rename or abort the running request for the current session
130
+ - `/cancel` cancel session rename or abort the running request for the current session, including the local Telegram wait state
130
131
  - `/model` or `/models` list available models and switch the active one
131
132
  - `/language` switch the bot display language
132
133
 
@@ -135,6 +136,7 @@ Message handling:
135
136
  - Non-command text is treated as a prompt and sent to OpenCode.
136
137
  - Telegram photos and image documents are forwarded as OpenCode file parts.
137
138
  - Image attachments are processed in a temporary fork of the active session so later text-only prompts stay clean.
139
+ - `/cancel` aborts both the OpenCode session and the local Telegram wait, so the next prompt can start immediately.
138
140
  - Telegram voice messages are not supported and receive a localized rejection reply.
139
141
 
140
142
  ## Development
package/README.zh-CN.md CHANGED
@@ -97,11 +97,16 @@ npm exec --package opencode-tbot@latest opencode-tbot -- update
97
97
  | `telegram.allowedChatIds` | 否 | `[]` | 允许访问的 Telegram chat ID 数组。为空时表示接受任意 chat。 |
98
98
  | `telegram.apiRoot` | 否 | `https://api.telegram.org` | Telegram Bot API 根地址,适合测试或自托管网关。 |
99
99
  | `state.path` | 否 | `./data/opencode-tbot.state.json` | JSON 状态文件路径,相对当前 OpenCode worktree 解析。 |
100
+ | `prompt.waitTimeoutMs` | 否 | `1800000` | 单次异步 prompt 生命周期的最大等待时间;超过后插件会停止等待 OpenCode 恢复结果。 |
101
+ | `prompt.pollRequestTimeoutMs` | 否 | `15000` | 每次向 OpenCode 拉取恢复状态时的单次请求超时。 |
102
+ | `prompt.recoveryInactivityTimeoutMs` | 否 | `120000` | 仅在 prompt 长时间没有任何新进展时生效的恢复超时。 |
100
103
  | `logLevel` | 否 | `info` | 插件日志级别。日志统一通过 `client.app.log()` 上报。 |
101
104
 
102
105
  ### 说明
103
106
 
104
107
  - `state.path` 会相对当前 OpenCode worktree 解析。
108
+ - Telegram prompt 处理现在采用 async-first:插件先调用 `session.promptAsync()`,再通过会话消息和会话状态恢复最终回复。
109
+ - `prompt.waitTimeoutMs` 是整体安全上限;`prompt.recoveryInactivityTimeoutMs` 只在 OpenCode 长时间没有新进展时生效。
105
110
  - 如果 `telegram.allowedChatIds` 为空,bot 会接受任意 chat 的消息;生产环境建议显式限制。
106
111
  - 权限审批和会话通知通过插件 hook 处理。
107
112
  - `/language` 当前支持 English、简体中文、日本語。
@@ -121,7 +126,7 @@ npm exec --package opencode-tbot@latest opencode-tbot -- update
121
126
  - `/new [title]` 创建新的 OpenCode 会话
122
127
  - `/agents` 或 `/agent` 列出可用 agent 并切换当前 agent
123
128
  - `/sessions` 列出会话并切换当前会话
124
- - `/cancel` 取消会话重命名,或中止当前会话正在运行的请求
129
+ - `/cancel` 取消会话重命名,或中止当前会话正在运行的请求,并同步结束本地 Telegram 等待状态
125
130
  - `/model` 或 `/models` 列出可用模型并切换当前模型
126
131
  - `/language` 切换 bot 显示语言
127
132
 
@@ -129,6 +134,7 @@ npm exec --package opencode-tbot@latest opencode-tbot -- update
129
134
 
130
135
  - 任意非命令文本都会被当作 prompt 发送给 OpenCode。
131
136
  - Telegram 照片和图片文档会作为 OpenCode 文件片段上传。
137
+ - `/cancel` 会同时中止 OpenCode 侧会话和本地 Telegram 等待,因此下一条消息可以立即开始处理。
132
138
  - Telegram 语音消息当前不受支持,bot 会直接返回本地化拒绝提示。
133
139
 
134
140
  ## 开发