Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ OPENCODE_MODEL_ID=big-pickle
# Hide tool call service messages (default: false)
# HIDE_TOOL_CALL_MESSAGES=false

# Hide tool file edit documents sent as .txt attachments (default: false)
# HIDE_TOOL_FILE_MESSAGES=false

# Assistant message formatting mode (default: markdown)
# markdown = convert assistant replies to Telegram MarkdownV2
# raw = show assistant replies as plain text
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ When installed via npm, the configuration wizard handles the initial setup. The
| `SERVICE_MESSAGES_INTERVAL_SEC` | Service messages interval (thinking + tool calls); keep `>=2` to avoid Telegram rate limits, `0` = immediate | No | `5` |
| `HIDE_THINKING_MESSAGES` | Hide `💭 Thinking...` service messages | No | `false` |
| `HIDE_TOOL_CALL_MESSAGES` | Hide tool-call service messages (`💻 bash ...`, `📖 read ...`, etc.) | No | `false` |
| `HIDE_TOOL_FILE_MESSAGES` | Hide file edit documents sent as `.txt` attachments (`edit_*.txt`, `write_*.txt`) | No | `false` |
| `RESPONSE_STREAMING` | Stream assistant replies while they are generated across one or more Telegram messages | No | `true` |
| `MESSAGE_FORMAT_MODE` | Assistant reply formatting mode: `markdown` (Telegram MarkdownV2) or `raw` | No | `markdown` |
| `CODE_FILE_MAX_SIZE_KB` | Max file size (KB) to send as document | No | `100` |
Expand Down
4 changes: 4 additions & 0 deletions src/bot/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,10 @@ async function ensureEventSubscription(directory: string): Promise<void> {
return;
}

if (config.bot.hideToolFileMessages) {
return;
}

try {
await toolCallStreamer.breakSession(fileInfo.sessionId, "tool_file_boundary");

Expand Down
1 change: 1 addition & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ export const config = {
locale: getOptionalLocaleEnvVar("BOT_LOCALE", "en"),
hideThinkingMessages: getOptionalBooleanEnvVar("HIDE_THINKING_MESSAGES", false),
hideToolCallMessages: getOptionalBooleanEnvVar("HIDE_TOOL_CALL_MESSAGES", false),
hideToolFileMessages: getOptionalBooleanEnvVar("HIDE_TOOL_FILE_MESSAGES", false),
messageFormatMode: getOptionalMessageFormatModeEnvVar("MESSAGE_FORMAT_MODE", "markdown"),
},
files: {
Expand Down
8 changes: 8 additions & 0 deletions tests/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,41 +17,49 @@ describe("config boolean env parsing", () => {
it("uses false defaults for hide service message flags", async () => {
vi.stubEnv("HIDE_THINKING_MESSAGES", "");
vi.stubEnv("HIDE_TOOL_CALL_MESSAGES", "");
vi.stubEnv("HIDE_TOOL_FILE_MESSAGES", "");

const config = await loadConfig();

expect(config.bot.hideThinkingMessages).toBe(false);
expect(config.bot.hideToolCallMessages).toBe(false);
expect(config.bot.hideToolFileMessages).toBe(false);
});

it("parses truthy values for hide service message flags", async () => {
vi.stubEnv("HIDE_THINKING_MESSAGES", "YES");
vi.stubEnv("HIDE_TOOL_CALL_MESSAGES", "1");
vi.stubEnv("HIDE_TOOL_FILE_MESSAGES", "true");

const config = await loadConfig();

expect(config.bot.hideThinkingMessages).toBe(true);
expect(config.bot.hideToolCallMessages).toBe(true);
expect(config.bot.hideToolFileMessages).toBe(true);
});

it("parses falsy values for hide service message flags", async () => {
vi.stubEnv("HIDE_THINKING_MESSAGES", "off");
vi.stubEnv("HIDE_TOOL_CALL_MESSAGES", "0");
vi.stubEnv("HIDE_TOOL_FILE_MESSAGES", "false");

const config = await loadConfig();

expect(config.bot.hideThinkingMessages).toBe(false);
expect(config.bot.hideToolCallMessages).toBe(false);
expect(config.bot.hideToolFileMessages).toBe(false);
});

it("falls back to defaults on invalid values", async () => {
vi.stubEnv("HIDE_THINKING_MESSAGES", "banana");
vi.stubEnv("HIDE_TOOL_CALL_MESSAGES", "nope");
vi.stubEnv("HIDE_TOOL_FILE_MESSAGES", "invalid");

const config = await loadConfig();

expect(config.bot.hideThinkingMessages).toBe(false);
expect(config.bot.hideToolCallMessages).toBe(false);
expect(config.bot.hideToolFileMessages).toBe(false);
});

it("uses markdown as default message format mode", async () => {
Expand Down
Loading