telecoder 0.0.0-stage → 1.3.0

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.
Files changed (235) hide show
  1. package/.env.example +375 -0
  2. package/CHANGELOG.md +1867 -0
  3. package/LICENSE +22 -0
  4. package/README.md +130 -2
  5. package/dist/audio/transcribe.js +41 -0
  6. package/dist/bin/mcp-server.js +363 -0
  7. package/dist/bin/tool-result.js +22 -0
  8. package/dist/bot/access/group-access.js +147 -0
  9. package/dist/bot/bot.js +573 -0
  10. package/dist/bot/command-catalog.js +263 -0
  11. package/dist/bot/deleted-threads.js +103 -0
  12. package/dist/bot/file-access.js +150 -0
  13. package/dist/bot/handlers/album.handler.js +128 -0
  14. package/dist/bot/handlers/branch.handler.js +1096 -0
  15. package/dist/bot/handlers/command/access.js +407 -0
  16. package/dist/bot/handlers/command/admin.js +803 -0
  17. package/dist/bot/handlers/command/all-view.js +33 -0
  18. package/dist/bot/handlers/command/auto-approve.js +138 -0
  19. package/dist/bot/handlers/command/background.js +37 -0
  20. package/dist/bot/handlers/command/botname.js +76 -0
  21. package/dist/bot/handlers/command/btw.js +175 -0
  22. package/dist/bot/handlers/command/cleanup.js +329 -0
  23. package/dist/bot/handlers/command/model.js +226 -0
  24. package/dist/bot/handlers/command/prefs-scope.js +362 -0
  25. package/dist/bot/handlers/command/project.js +458 -0
  26. package/dist/bot/handlers/command/resume.js +325 -0
  27. package/dist/bot/handlers/command/session.js +299 -0
  28. package/dist/bot/handlers/command/settings.js +657 -0
  29. package/dist/bot/handlers/command/shared.js +207 -0
  30. package/dist/bot/handlers/command/tasks.js +681 -0
  31. package/dist/bot/handlers/command/thread.js +128 -0
  32. package/dist/bot/handlers/command/topic-store.js +74 -0
  33. package/dist/bot/handlers/command/topic.js +27 -0
  34. package/dist/bot/handlers/command/usage.js +382 -0
  35. package/dist/bot/handlers/command-fallback.js +179 -0
  36. package/dist/bot/handlers/command.handler.js +446 -0
  37. package/dist/bot/handlers/loop.handler.js +389 -0
  38. package/dist/bot/handlers/media-fallback.js +126 -0
  39. package/dist/bot/handlers/message/replies.js +56 -0
  40. package/dist/bot/handlers/message/shared.js +95 -0
  41. package/dist/bot/handlers/message/turn-notify.js +135 -0
  42. package/dist/bot/handlers/message/turn-runner.js +56 -0
  43. package/dist/bot/handlers/message.handler.js +114 -0
  44. package/dist/bot/handlers/newbot.handler.js +230 -0
  45. package/dist/bot/handlers/photo.handler.js +286 -0
  46. package/dist/bot/handlers/prompts.handler.js +343 -0
  47. package/dist/bot/handlers/running-note.js +44 -0
  48. package/dist/bot/handlers/session-guard.js +78 -0
  49. package/dist/bot/handlers/suggestion.handler.js +84 -0
  50. package/dist/bot/handlers/tree.handler.js +480 -0
  51. package/dist/bot/handlers/view.js +41 -0
  52. package/dist/bot/handlers/voice.handler.js +147 -0
  53. package/dist/bot/kept-threads.js +51 -0
  54. package/dist/bot/middleware/admin-only.js +49 -0
  55. package/dist/bot/middleware/album-collector.js +69 -0
  56. package/dist/bot/middleware/auth.middleware.js +122 -0
  57. package/dist/bot/middleware/group-mention.middleware.js +145 -0
  58. package/dist/bot/middleware/group-role.middleware.js +75 -0
  59. package/dist/bot/middleware/message-batcher.js +87 -0
  60. package/dist/bot/middleware/queued-messages.js +1082 -0
  61. package/dist/bot/middleware/stale-filter.js +9 -0
  62. package/dist/build-info.json +8 -0
  63. package/dist/claude/ask-user-form.js +517 -0
  64. package/dist/claude/ask-user.js +363 -0
  65. package/dist/claude/auto-approve.js +225 -0
  66. package/dist/claude/auto-topic-haiku.js +143 -0
  67. package/dist/claude/available-commands.js +156 -0
  68. package/dist/claude/background-hint.js +91 -0
  69. package/dist/claude/branch-tree.js +393 -0
  70. package/dist/claude/carry-over.js +25 -0
  71. package/dist/claude/ccr-shim.js +48 -0
  72. package/dist/claude/charter-judge.js +214 -0
  73. package/dist/claude/claude-auth.js +117 -0
  74. package/dist/claude/command-parser.js +206 -0
  75. package/dist/claude/cost-overlay-scraper.js +134 -0
  76. package/dist/claude/effort-level.js +5 -0
  77. package/dist/claude/enabled-plugins.js +52 -0
  78. package/dist/claude/in-flight-tracker.js +82 -0
  79. package/dist/claude/ipc-server.js +192 -0
  80. package/dist/claude/mcp-bridge.js +481 -0
  81. package/dist/claude/memory-guard.js +400 -0
  82. package/dist/claude/message-offsets.js +88 -0
  83. package/dist/claude/modal-relay.js +817 -0
  84. package/dist/claude/model-catalog.js +102 -0
  85. package/dist/claude/monitor-relay.js +712 -0
  86. package/dist/claude/native-commands.js +40 -0
  87. package/dist/claude/pending-branches.js +93 -0
  88. package/dist/claude/pending-suggestions.js +50 -0
  89. package/dist/claude/permission-gate.js +338 -0
  90. package/dist/claude/permission-mode.js +152 -0
  91. package/dist/claude/poll-user.js +51 -0
  92. package/dist/claude/prewarm.js +70 -0
  93. package/dist/claude/project-commands.js +69 -0
  94. package/dist/claude/prompt-hold.js +124 -0
  95. package/dist/claude/prompt-suggestion-scraper.js +89 -0
  96. package/dist/claude/pty-idle-reaper.js +96 -0
  97. package/dist/claude/pty-provider.js +2499 -0
  98. package/dist/claude/pty-spawn-config.js +343 -0
  99. package/dist/claude/pty-stream.js +363 -0
  100. package/dist/claude/pty-watch.js +201 -0
  101. package/dist/claude/request-queue.js +107 -0
  102. package/dist/claude/rewind.js +111 -0
  103. package/dist/claude/scheduled-runner.js +89 -0
  104. package/dist/claude/scheduler.js +241 -0
  105. package/dist/claude/scope-guard.js +279 -0
  106. package/dist/claude/screen-marks.js +83 -0
  107. package/dist/claude/screen-render.js +96 -0
  108. package/dist/claude/secret-request.js +576 -0
  109. package/dist/claude/session-history.js +288 -0
  110. package/dist/claude/session-jsonl.js +1067 -0
  111. package/dist/claude/session-manager.js +216 -0
  112. package/dist/claude/session-move.js +70 -0
  113. package/dist/claude/session-scan.js +270 -0
  114. package/dist/claude/setup-token.js +285 -0
  115. package/dist/claude/shell-mode-gate.js +60 -0
  116. package/dist/claude/side-call-options.js +45 -0
  117. package/dist/claude/side-question.js +252 -0
  118. package/dist/claude/stage-images.js +62 -0
  119. package/dist/claude/subagent-tools.js +12 -0
  120. package/dist/claude/synthetic-ctx.js +51 -0
  121. package/dist/claude/tasks-overlay-scraper.js +217 -0
  122. package/dist/claude/thread-judge-haiku.js +88 -0
  123. package/dist/claude/tip-scraper.js +77 -0
  124. package/dist/claude/tui-modal.js +746 -0
  125. package/dist/claude/tui-state.js +456 -0
  126. package/dist/claude/turn-end.js +105 -0
  127. package/dist/claude/turn-prose.js +64 -0
  128. package/dist/claude/typed-answer.js +104 -0
  129. package/dist/claude/update-banner-relay.js +70 -0
  130. package/dist/cli/commands/doctor.js +338 -0
  131. package/dist/cli/commands/help.js +34 -0
  132. package/dist/cli/commands/init.js +126 -0
  133. package/dist/cli/commands/service.js +710 -0
  134. package/dist/cli/commands/start.js +63 -0
  135. package/dist/cli/commands/version.js +11 -0
  136. package/dist/cli/commands/watch.js +322 -0
  137. package/dist/cli/dispatch.js +84 -0
  138. package/dist/cli/init/env-file.js +99 -0
  139. package/dist/cli/init/flow.js +705 -0
  140. package/dist/cli/init/prompter.js +124 -0
  141. package/dist/cli/init/telegram.js +120 -0
  142. package/dist/cli/service/render.js +212 -0
  143. package/dist/cli.js +18 -0
  144. package/dist/config-report.js +107 -0
  145. package/dist/config.js +525 -0
  146. package/dist/index.js +443 -0
  147. package/dist/launcher.js +960 -0
  148. package/dist/node-version-check.js +27 -0
  149. package/dist/providers/ccr-health.js +119 -0
  150. package/dist/providers/ccr-introspect.js +142 -0
  151. package/dist/providers/ccr-provider.js +59 -0
  152. package/dist/providers/claude-provider.js +10 -0
  153. package/dist/providers/prefs-sync.js +121 -0
  154. package/dist/providers/project-favorites.js +74 -0
  155. package/dist/providers/provider-router.js +128 -0
  156. package/dist/providers/provider-switch.js +91 -0
  157. package/dist/providers/spawn-settings.js +45 -0
  158. package/dist/providers/types.js +8 -0
  159. package/dist/providers/user-preferences.js +322 -0
  160. package/dist/restart-when-idle.js +173 -0
  161. package/dist/startup/auto-continue.js +67 -0
  162. package/dist/startup/auto-resume.js +161 -0
  163. package/dist/startup/notices.js +120 -0
  164. package/dist/startup/shared.js +44 -0
  165. package/dist/startup/verify-token.js +31 -0
  166. package/dist/telegram/access-request.js +153 -0
  167. package/dist/telegram/action-logger.js +522 -0
  168. package/dist/telegram/admin-mention.js +107 -0
  169. package/dist/telegram/background-activity-card.js +502 -0
  170. package/dist/telegram/botname-settings.js +282 -0
  171. package/dist/telegram/button-text.js +26 -0
  172. package/dist/telegram/client-options.js +26 -0
  173. package/dist/telegram/deduplication.js +33 -0
  174. package/dist/telegram/entities.js +295 -0
  175. package/dist/telegram/force-reply-tracker.js +96 -0
  176. package/dist/telegram/lettered-options.js +87 -0
  177. package/dist/telegram/markdown.js +362 -0
  178. package/dist/telegram/message-sender.js +1019 -0
  179. package/dist/telegram/prompt-label.js +148 -0
  180. package/dist/telegram/prompt-suggestion.js +54 -0
  181. package/dist/telegram/send.js +123 -0
  182. package/dist/telegram/streaming-turn.js +103 -0
  183. package/dist/telegram/suggestions-settings.js +30 -0
  184. package/dist/telegram/table-lists.js +56 -0
  185. package/dist/telegram/task-list.js +367 -0
  186. package/dist/telegram/task-tracker.js +128 -0
  187. package/dist/telegram/terminal-renderer.js +667 -0
  188. package/dist/telegram/thread-titles.js +262 -0
  189. package/dist/telegram/threads-setup.js +117 -0
  190. package/dist/utils/admins.js +143 -0
  191. package/dist/utils/agent-timer.js +55 -0
  192. package/dist/utils/atomic-write.js +24 -0
  193. package/dist/utils/bot-icon.js +248 -0
  194. package/dist/utils/bot-token.js +77 -0
  195. package/dist/utils/bounded-map.js +55 -0
  196. package/dist/utils/build-info.js +57 -0
  197. package/dist/utils/caffeinate.js +53 -0
  198. package/dist/utils/claude-env.js +53 -0
  199. package/dist/utils/claude-version.js +48 -0
  200. package/dist/utils/config-home.js +62 -0
  201. package/dist/utils/download.js +137 -0
  202. package/dist/utils/exit-codes.js +59 -0
  203. package/dist/utils/file-type.js +149 -0
  204. package/dist/utils/format.js +78 -0
  205. package/dist/utils/home-project.js +30 -0
  206. package/dist/utils/host-stall.js +51 -0
  207. package/dist/utils/id-list.js +44 -0
  208. package/dist/utils/idle-restart.js +92 -0
  209. package/dist/utils/install-mode.js +63 -0
  210. package/dist/utils/instance-config.js +148 -0
  211. package/dist/utils/instances.js +95 -0
  212. package/dist/utils/json-store.js +140 -0
  213. package/dist/utils/keyed-settings.js +62 -0
  214. package/dist/utils/legacy-env.js +35 -0
  215. package/dist/utils/memory-pressure.js +60 -0
  216. package/dist/utils/npm-version.js +134 -0
  217. package/dist/utils/prefs-relay.js +107 -0
  218. package/dist/utils/proc-children.js +102 -0
  219. package/dist/utils/resolve-bin.js +86 -0
  220. package/dist/utils/resolve-claude-bin.js +52 -0
  221. package/dist/utils/respawn-backoff.js +28 -0
  222. package/dist/utils/sanitize.js +91 -0
  223. package/dist/utils/session-key.js +37 -0
  224. package/dist/utils/stale-launcher.js +109 -0
  225. package/dist/utils/state-dir-migration.js +92 -0
  226. package/dist/utils/systemd.js +126 -0
  227. package/dist/utils/telegram-proxy.js +72 -0
  228. package/dist/utils/uploads-dir.js +27 -0
  229. package/dist/utils/user-roster.js +275 -0
  230. package/dist/utils/verbosity.js +118 -0
  231. package/dist/utils/version-check.js +166 -0
  232. package/dist/utils/workspace-guard.js +44 -0
  233. package/dist/worker-restart.js +141 -0
  234. package/instances.json.example +41 -0
  235. package/package.json +75 -4
package/.env.example ADDED
@@ -0,0 +1,375 @@
1
+ # ═══════════════════════════════════════════════════════════════
2
+ # TeleCoder Configuration
3
+ # ═══════════════════════════════════════════════════════════════
4
+
5
+ # Note: a variable already exported in the environment the bot was started from
6
+ # wins over the value here — dotenv never overwrites what is already set, and a
7
+ # restart inherits the environment it was started from, so an old exported value
8
+ # can outlive every restart. The bot logs an [env] warning at startup naming any
9
+ # setting in this file that is being shadowed that way; the fix is to restart it
10
+ # from a shell that doesn't export them.
11
+
12
+ # ── Core ──────────────────────────────────────────────────────
13
+ # Telegram bot token from @BotFather
14
+ TELEGRAM_BOT_TOKEN=your_telegram_bot_token
15
+
16
+ # Comma-separated numeric Telegram user IDs allowed to use the bot — numbers,
17
+ # not @usernames. Get yours by messaging @userinfobot on Telegram, or message
18
+ # the bot once it runs: it tells anyone not on this list their ID.
19
+ # 123456789 below is a placeholder: the bot refuses to start until you replace it.
20
+ ALLOWED_USER_IDS=123456789
21
+
22
+ # ── Sharing the bot ───────────────────────────────────────────
23
+ # Everything below is for a bot you share with other people. A solo bot needs
24
+ # none of it and behaves exactly the same whether or not you read this section.
25
+ #
26
+ # ADMIN_USER_IDS is the subset of ALLOWED_USER_IDS that may approve permission
27
+ # prompts and run bot-lifecycle commands (/botupdate, /botrestart, /botrebuild)
28
+ # and the backend one (/ccr). Everyone else is a "guest":
29
+ # they can use the agent normally, but guarded commands wait on an admin.
30
+ # Unset = every allowed user is an admin. Admins must also be in
31
+ # ALLOWED_USER_IDS — the auth check runs first and would turn them away, so the
32
+ # bot refuses to start rather than leave an admin who can never act.
33
+ # ADMIN_USER_IDS=111111111
34
+
35
+ # APPROVER_USER_IDS is the subset of ALLOWED_USER_IDS that may answer a
36
+ # permission prompt without owning the bot. An approver is a guest everywhere
37
+ # else — the charter judge still reads their messages, the gate still stops
38
+ # their tool calls, /botrestart and /ccr still refuse them. They just stop
39
+ # you being the only person who can unblock a prompt. Nobody approves their own
40
+ # request: the buttons go to the admins plus every approver except whoever
41
+ # asked. Needs ADMIN_USER_IDS set — without it everyone is already an admin.
42
+ # An approver has to be able to reach the bot first, so their id must be in
43
+ # ALLOWED_USER_IDS or have been /allow'd from chat; the bot says so at startup
44
+ # if it is in neither.
45
+ # APPROVER_USER_IDS=222222222,333333333
46
+
47
+ # Comma-separated group/supergroup chat IDs the bot is used in.
48
+ # ALLOWED_GROUP_IDS=-1001234567890
49
+
50
+ # What being in an allow-listed group grants:
51
+ # spectator — membership grants presence only. People read along and talk to
52
+ # each other; only someone an admin has /allow'd can prompt the
53
+ # agent. Right for a group with an audience in it, and the
54
+ # default: it matches what the roster gate already enforced.
55
+ # contributor — membership is the whole gate: anyone in the group can prompt
56
+ # the agent, which is shell access on this machine. Right for a
57
+ # group of peers who all own the box.
58
+ # Admins always have full access. Grant and revoke from the chat with /allow and
59
+ # /deny — replying to someone's message is the surest way to name them — and
60
+ # check the current state with /members. Those take effect immediately; no
61
+ # restart. /allow in the group grants it *there*; /allow in a DM admits someone
62
+ # to the bot everywhere, which /users reads back.
63
+ #
64
+ # Note: posts from anonymous group admins all arrive as the same Telegram user
65
+ # id (1087968824), so under 'spectator' they are gated as one. /allow 1087968824
66
+ # admits every anonymous admin at once, or ask them to post normally.
67
+ # GROUP_MEMBERS_DEFAULT=spectator
68
+
69
+ # In a group, only react to messages that address the bot: an @mention, a reply
70
+ # to one of the bot's own messages, or a slash command. Set to false to treat
71
+ # every message in the group as a prompt (only sensible in a group dedicated to
72
+ # the bot — otherwise people can't talk to each other).
73
+ # Requires Telegram's privacy mode to be OFF for the bot (@BotFather ->
74
+ # /setprivacy -> Disable, then re-add the bot to the group), or Telegram won't
75
+ # deliver mentions at all.
76
+ # GROUP_REQUIRE_MENTION=true
77
+
78
+ # Treat any reply to one of the bot's messages as addressing it, as it worked
79
+ # before mentions were required. Off by default: replying is also how you quote
80
+ # a message, so it is a poor signal of intent. Answers to the bot's own
81
+ # ForceReply prompts (/dir, /file) always get through, since
82
+ # Telegram leaves nowhere to put a mention in those.
83
+ # GROUP_REPLY_IS_MENTION=false
84
+
85
+ # Confine guests to those groups, so they can't take the bot into a private
86
+ # chat where you can't see what they're asking it. Admins can still DM it.
87
+ # RESTRICT_TO_GROUPS=false
88
+
89
+ # The permission gate: matching a dangerous Bash pattern (rm -rf, sudo,
90
+ # git push --force, DROP TABLE, terraform destroy, ...) pauses the tool call
91
+ # and posts an approval prompt that only an admin can answer. With guests
92
+ # present it turns itself on; set it explicitly to override in either
93
+ # direction.
94
+ # TELECODER_PERMISSION_PROMPTS=1
95
+
96
+ # How long a prompt (or a held message) waits for an admin before it is refused.
97
+ # PERMISSION_PROMPT_TIMEOUT_MINUTES=10
98
+
99
+ # Scope guard: also prompt when a tool call names a path outside the shared
100
+ # projects, or a credential path anywhere (~/.ssh, ~/.aws, a .env outside the
101
+ # roots, the bot's own state). System paths and language toolchains stay
102
+ # readable without prompting, so ordinary work is unaffected.
103
+ # 'auto' follows the permission gate. 'on' / 'off' force it.
104
+ # SCOPE_GUARD=auto
105
+
106
+ # Extra directories the scope guard counts as in-bounds, on top of
107
+ # WORKSPACE_DIR and the temp dir. Comma-separated absolute paths.
108
+ # SCOPE_ALLOWED_PATHS=/srv/data,/opt/shared
109
+
110
+ # Charter judge: before a guest's message reaches Claude, a Haiku side-call
111
+ # reads it against a plain-language charter and holds anything out of bounds
112
+ # for an admin. Catches what the scope guard cannot — "open a tunnel to this
113
+ # box", "email me the projects folder" — because neither names a path.
114
+ # Adds ~5s to a guest's turn; conversational filler is skipped. Fails open.
115
+ # 'auto' turns it on once the bot has guests.
116
+ # CHARTER_JUDGE=auto
117
+
118
+ # The charter the judge reads. Defaults to CHARTER.md in WORKSPACE_DIR when
119
+ # that file exists, and to a generated one naming the allowed roots otherwise.
120
+ # CHARTER_FILE=/srv/shared/CHARTER.md
121
+
122
+ # ── Claude ────────────────────────────────────────────────────
123
+ # Anthropic API key (optional — leave empty to use Claude Max subscription)
124
+ # ANTHROPIC_API_KEY=sk-ant-...
125
+
126
+ # A long-lived Claude token from `claude setup-token`, for a machine you won't
127
+ # sign in on. Used in place of the `claude` login.
128
+ # CLAUDE_CODE_OAUTH_TOKEN=sk-ant-oat01-...
129
+
130
+ # Optional: explicit .env path (useful if you start the bot from another directory)
131
+ # TELECODER_ENV_PATH=/absolute/path/to/telecoder/.env
132
+
133
+ # Upgrading from Claudegram? Every TELECODER_* var below was CLAUDEGRAM_* before
134
+ # the July 2026 rename. The old names still work and log a one-time deprecation
135
+ # warning at startup, so you can rename them whenever it suits you:
136
+ # TELECODER_ENV_PATH, TELECODER_INSTANCES_CONFIG, TELECODER_IPC_PORT,
137
+ # TELECODER_PERMISSION_PROMPTS, TELECODER_ALLOW_NATIVE_SCHEDULING
138
+
139
+ # The `claude` your chats run: CLAUDE_BIN, else the one on PATH (~/.local/bin
140
+ # is searched first). Set it when the CLI lives where the service can't see it.
141
+ # CLAUDE_BIN=/home/username/.local/bin/claude
142
+
143
+ # The `claude` the quick Haiku side calls (topic names, the charter judge) run
144
+ # through: the copy bundled with the agent SDK, or CLAUDE_EXECUTABLE_PATH when
145
+ # the flag is false.
146
+ # CLAUDE_USE_BUNDLED_EXECUTABLE=true
147
+ # CLAUDE_EXECUTABLE_PATH=/home/username/.local/bin/claude
148
+
149
+ # Whether Claude starts with your own Claude Code setup, as it does in your
150
+ # terminal: ~/.claude (CLAUDE.md, skills, commands, agents, settings.json), your
151
+ # MCP servers, your plugins and your claude.ai connectors.
152
+ # auto yes, unless the bot has guests: they would otherwise work with your
153
+ # instructions, and with connectors signed in as you (default)
154
+ # on always
155
+ # off never: Claude knows the project and what the two settings below name
156
+ # CLAUDE_USER_SETUP=auto
157
+
158
+ # Extra MCP servers for the bot's agent, as a path to a JSON file holding
159
+ # {"mcpServers": {...}} in the same shape as ~/.claude.json. Merged into the
160
+ # spawn config; the bot's own telecoder-tools always wins a name clash.
161
+ #
162
+ # Your own servers come with your setup (CLAUDE_USER_SETUP). This is for a
163
+ # server only the bot should have, and it is the only way to add one while your
164
+ # setup stays out: a `claude mcp add` entry is then stored and ignored. Keep
165
+ # the file outside the repo if it carries a token.
166
+ # EXTRA_MCP_CONFIG=/home/you/.config/telecoder-mcp.json
167
+
168
+ # Marketplace plugins to enable inside the bot's agent, comma-separated, as the
169
+ # plugin@marketplace ids `claude plugin list` prints. A plugin you enabled in
170
+ # the terminal sits in ~/.claude/settings.json and comes with your setup
171
+ # (CLAUDE_USER_SETUP). This is for a plugin only the bot should have, or for
172
+ # bringing one across while your setup stays out.
173
+ # CLAUDE_PLUGINS=frontend-design@claude-plugins-official
174
+
175
+ # Claude Code's own scheduling tools (CronCreate, ScheduleWakeup, RemoteTrigger)
176
+ # are blocked: what they schedule fires outside the chat and never reaches
177
+ # Telegram. /loop and the bot's own tools take their place. 1 leaves the
178
+ # built-ins enabled.
179
+ # TELECODER_ALLOW_NATIVE_SCHEDULING=1
180
+
181
+ # The port on 127.0.0.1 where the bot listens for Claude Code's hooks and its
182
+ # own MCP tools. Unset, a free port is picked; leave it that way unless
183
+ # something has to know the port. Several bots in one launcher can't share one.
184
+ # TELECODER_IPC_PORT=47821
185
+
186
+ # The bot's name: what it calls itself in the system prompt and its messages,
187
+ # and the display name it sets in Telegram at startup when this is given.
188
+ # Unset, the name chosen in BotFather is kept. /botname in the chat wins over this.
189
+ # BOT_NAME=TeleCoder
190
+
191
+ # ── Workspace ─────────────────────────────────────────────────
192
+ # Root directory shown in /dir picker
193
+ # Default: $HOME
194
+ # WORKSPACE_DIR=/home/username/projects
195
+
196
+ # The project this bot is for: conversations with nothing to restore start
197
+ # there, and threads in it are named without it. Usually set per bot in
198
+ # instances.json, which /newbot does. Absolute, or relative to WORKSPACE_DIR.
199
+ # HOME_PROJECT=my-project
200
+
201
+ # ── Network ───────────────────────────────────────────────────
202
+ # An HTTP or HTTPS proxy for the bot's requests to Telegram, for a network
203
+ # where Telegram is blocked. SOCKS proxies aren't supported. Unset, HTTPS_PROXY
204
+ # or HTTP_PROXY is used when the environment has one. Files you send the bot
205
+ # are fetched through it too, and `telecoder init` and `telecoder doctor --live`
206
+ # reach Telegram through it.
207
+ # TELEGRAM_PROXY_URL=http://127.0.0.1:8080
208
+
209
+ # ── Response Behavior ─────────────────────────────────────────
210
+ # The longest one message of a reply may be, in characters; a longer reply is
211
+ # split into several (default: 4000, Telegram's own limit is 4096)
212
+ MAX_MESSAGE_LENGTH=4000
213
+
214
+ # Auto-restore session on /botrestart and /botrebuild (true/false)
215
+ # Default: false (shows manual Continue/Resume buttons instead)
216
+ AUTO_RESTORE_SESSION=false
217
+
218
+ # ── PTY turn timeout ──────────────────────────────────────────
219
+ # Absolute per-turn wall-clock cap. The turn is killed with a
220
+ # "turn exceeded" error if it runs longer. Default 7200000 = 2 h.
221
+ # Raise it if intensive turns legitimately hit the cap.
222
+ # CLAUDE_PTY_HARD_TIMEOUT_MS=7200000
223
+
224
+ # ── PTY idle timeout ──────────────────────────────────────────
225
+ # A PTY session keeps its claude process (a few hundred MB) between turns.
226
+ # One idle this long is ended; the next message resumes the conversation in
227
+ # a new one. Never while a turn, background task or background shell runs.
228
+ # Also cleans up after threads deleted by hand. Default 3600000 = 1 h; 0 keeps
229
+ # them until a restart.
230
+ # CLAUDE_PTY_IDLE_TIMEOUT_MS=3600000
231
+
232
+ # ── telecoder watch ───────────────────────────────────────────
233
+ # Serve each chat's live Claude Code screen, read-only, for the
234
+ # "telecoder watch" command. The socket is in ~/.telecoder/watch and only this
235
+ # user can open it. false turns it off.
236
+ # PTY_WATCH=true
237
+
238
+ # ── Early start ───────────────────────────────────────────────
239
+ # Start a chat's claude as soon as its conversation is chosen (/dir,
240
+ # /clear, /resume), so the first message doesn't wait for Claude Code to
241
+ # start. Skipped silently when memory is under the guard's floor below; one
242
+ # nobody uses is ended by the idle timeout. false starts it on the first
243
+ # message instead.
244
+ # PREWARM_CLAUDE=true
245
+
246
+ # ── Memory guard ──────────────────────────────────────────────
247
+ # Before a message starts a new claude for a chat (a new chat or thread,
248
+ # or one whose claude was ended), the machine's available memory is checked.
249
+ # Under MEMORY_GUARD_MIN_AVAILABLE_MB, claudes idle longer than
250
+ # MEMORY_GUARD_REAP_IDLE_MS are ended first; if that still leaves too little,
251
+ # the chat is asked: start anyway, end the longest-idle claude first, or drop
252
+ # the message. A message to a running claude never asks. A claude let through
253
+ # in the last half minute counts as a few hundred MB spent, so two threads
254
+ # started together can't both slip past. "auto" is a quarter of RAM, at least
255
+ # 1024 MB. 0 turns it off.
256
+ # MEMORY_GUARD_MIN_AVAILABLE_MB=auto
257
+ # MEMORY_GUARD_REAP_IDLE_MS=300000
258
+ # Swap in use above this many MB also counts as tight. Off (0) by default:
259
+ # swap stays occupied long after the pressure passes, so this nags on a box
260
+ # that swaps at all.
261
+ # MEMORY_GUARD_MAX_SWAP_USED_MB=0
262
+
263
+ # ── Question timeout ──────────────────────────────────────────
264
+ # How long a question the agent asks in the chat waits for an answer: the
265
+ # buttons of telecoder_ask_user, a telecoder_poll_user poll, a Claude Code
266
+ # dialog relayed to the chat. After that the turn carries on without one, and
267
+ # the question is closed — buttons taken down, poll stopped — so it doesn't
268
+ # look answerable any more. The turn is paused for the whole wait and new
269
+ # messages queue behind it, so a long timeout is a long stall whenever a
270
+ # question goes unanswered. Permission prompts have their own timeout,
271
+ # PERMISSION_PROMPT_TIMEOUT_MINUTES. Default: 10.
272
+ # QUESTION_TIMEOUT_MINUTES=10
273
+
274
+ # ── Voice Transcription (Groq Whisper) ────────────────────────
275
+ # Requires: a Groq API key
276
+ # Leave empty to disable voice message support
277
+
278
+ # Enable voice notes (set false to disable)
279
+ TRANSCRIBE_ENABLED=true
280
+
281
+ # Groq API key for Whisper transcription
282
+ # GROQ_API_KEY=gsk_...
283
+
284
+
285
+ # Show transcript text before agent response
286
+ VOICE_SHOW_TRANSCRIPT=true
287
+
288
+ # Max voice file size in MB (Telegram limit ~20MB)
289
+ VOICE_MAX_FILE_SIZE_MB=19
290
+
291
+ # Transcription language (ISO 639-1 code)
292
+ VOICE_LANGUAGE=en
293
+
294
+ # Transcription timeout (ms)
295
+ VOICE_TIMEOUT_MS=60000
296
+
297
+ # ── Replies and notifications ─────────────────────────────────
298
+ # The /verbosity tier for chats that haven't picked one: quiet, normal,
299
+ # verbose or debug.
300
+ # VERBOSITY_DEFAULT=normal
301
+
302
+ # The footer that closes every reply (project, effort, model, context and
303
+ # the topic), for chats that haven't used /footer. Sent silently. The
304
+ # last-prompts and claude --resume lines stay opt-in through /footer.
305
+ STATUS_LINE_DEFAULT=true
306
+
307
+ # Show a tool's full input in the live status message — the whole Bash command,
308
+ # the full file path or URL — instead of a shortened one, whatever the
309
+ # /verbosity tier (which turns it on from verbose up). Was TERMINAL_UI_VERBOSE.
310
+ # FULL_TOOL_INPUTS=true
311
+
312
+ # Show the context-use line after each turn (a bar, the percentage, tokens used
313
+ # and turns), whatever the /verbosity tier. Unset, the tier decides, and shows
314
+ # it from verbose up. It closes the footer when that's on.
315
+ # CONTEXT_SHOW_USAGE=true
316
+
317
+ # Say so in the chat when Claude Code compacts the conversation by itself.
318
+ # Unset, the tier decides, and every tier says so; false turns the notice off.
319
+ # CONTEXT_NOTIFY_COMPACTION=false
320
+
321
+ # Predicted next-prompt buttons under each reply, for chats that haven't used
322
+ # /suggestions. Off by default: each suggestion is an extra, speculative call,
323
+ # and Claude Code doesn't offer them on every account. Takes effect when a
324
+ # chat's claude next starts.
325
+ # PROMPT_SUGGESTIONS_DEFAULT=false
326
+
327
+ # After a turn that took at least NOTIFICATION_THRESHOLD_SECONDS, send a short
328
+ # "Done (1m 12s)" message, so that Telegram notifies you. The quiet /verbosity
329
+ # tier leaves it out. A background task that ran at least that long also
330
+ # notifies when it ends; a shorter one is noted silently, unless it failed.
331
+ # NOTIFICATION_ENABLED=true
332
+ # NOTIFICATION_THRESHOLD_SECONDS=60
333
+
334
+ # ── Message Batching ──────────────────────────────────────────
335
+ # Telegram splits a long paste into several messages; combine them back into a
336
+ # single prompt. Only a message of 2000+ characters waits for more parts, so
337
+ # ordinary messages aren't delayed. How long to wait for the next part, in ms;
338
+ # 0 = disabled.
339
+ # MESSAGE_BATCH_TIMEOUT_MS=1500
340
+
341
+ # Fire a parallel Haiku side-call on every user message to derive a 1-4 word
342
+ # topic label for the footer and the thread name, independent of the main
343
+ # agent. Deferral-immune (bypasses settingSources and tools entirely). Off, the
344
+ # agent is asked to keep the topic itself with telecoder_set_topic. Auth
345
+ # piggybacks on the same Claude executable, so no extra API key is needed under Max.
346
+ AUTO_TOPIC_HAIKU=true
347
+
348
+ # Image Uploads
349
+ # Max image file size in MB (Telegram limit ~20MB for downloads)
350
+ IMAGE_MAX_FILE_SIZE_MB=20
351
+
352
+ # Max size in MB for any other file sent to the bot. Telegram won't let a bot
353
+ # download a file over 20 MB, so raising either limit past that doesn't help.
354
+ # DOCUMENT_MAX_FILE_SIZE_MB=19
355
+
356
+ # ── Claude Code Router (CCR) Provider ────────────────────────
357
+ # Enable /ccr, the switch between Claude (Max) and CCR (true/false).
358
+ # Redirects the spawned `claude` binary through a local CCR proxy so it can
359
+ # be backed by non-Anthropic models — useful as a fallback when Max runs out.
360
+ # Requires CCR installed and running: https://github.com/musistudio/claude-code-router
361
+ # CCR_ENABLED=false
362
+
363
+ # CCR proxy base URL (where ccr's local HTTP proxy listens).
364
+ # CCR_BASE_URL=http://localhost:3456
365
+
366
+ # CCR's local auth token (see ccr config — usually any non-empty string).
367
+ # CCR_AUTH_TOKEN=
368
+
369
+ # When the CCR proxy isn't reachable, automatically run `ccr start` in the
370
+ # background instead of letting the request hang on ConnectionRefused.
371
+ # CCR_AUTOSTART=false
372
+
373
+ # Path or name of the `ccr` binary used for autostart. Defaults to `ccr`
374
+ # (resolved via PATH). Override if `ccr` lives where systemd can't see it.
375
+ # CCR_BINARY=ccr