openclaw/extensions
saram ali 985533efbc
fix: cover buffered Telegram apiRoot downloads (#59544) (thanks @SARAMALI15792)
* test(telegram): add URL construction tests for custom apiRoot

Add comprehensive test cases to verify that file download URLs are correctly
constructed when using a custom apiRoot configuration for local Bot API servers.

Tests validate:
- Document downloads use the custom apiRoot in the constructed URL
- Sticker downloads use the custom apiRoot in the constructed URL
- SSRF policy correctly includes the custom hostname

This ensures issue #59512 (Telegram file downloads with local Bot API) is
properly covered by regression tests.

* refactor(telegram): improve media resolution code quality

Apply KISS and YAGNI principles to reduce code duplication and improve maintainability:

1. Extract media metadata resolution
   - Consolidate resolveMediaFileRef(), resolveTelegramFileName(), and
     resolveTelegramMimeType() into single resolveMediaMetadata() function
   - Returns typed MediaMetadata object with fileRef, fileName, mimeType
   - Reduces duplication and improves readability

2. Add logging for apiRoot parsing failures
   - Log when custom apiRoot URL parsing fails in buildTelegramMediaSsrfPolicy()
   - Helps debug configuration issues with local Bot API servers

3. Fix missing apiRoot in buffered messages
   - Add telegramCfg.apiRoot parameter to resolveMedia() calls in
     bot-handlers.buffers.ts (lines 150-159, 189)
   - Ensures reply media in buffered contexts respects custom apiRoot config
   - Fixes inconsistency where runtime handler passed apiRoot but buffers didn't

These changes improve code quality while maintaining backward compatibility and
ensuring issue #59512 (Telegram file downloads with local Bot API) works correctly
in all contexts.

* fix(telegram): resolve bot review issues

Address critical issues identified by Greptile code review:

1. Define telegramCfg in bot-handlers.buffers.ts
   - Extract telegramCfg from cfg.channels?.telegram
   - Fixes ReferenceError when accessing telegramCfg.apiRoot
   - Ensures buffered message handlers can access apiRoot configuration

2. Restore type safety for MediaMetadata.fileRef
   - Change from 'unknown' to proper union type
   - Preserves type information for downstream file_id access
   - Prevents TypeScript strict mode compilation errors

These fixes ensure the PR compiles correctly and handles buffered
media downloads with custom apiRoot configuration.

* fix(telegram): use optional chaining for telegramCfg.apiRoot

TypeScript strict mode requires optional chaining when accessing
properties on potentially undefined objects. Changed telegramCfg.apiRoot
to telegramCfg?.apiRoot to handle cases where telegramCfg is undefined.

Fixes TypeScript errors:
- TS18048: 'telegramCfg' is possibly 'undefined' (line 160)
- TS18048: 'telegramCfg' is possibly 'undefined' (line 191)

* fix(telegram): add missing optional chaining on line 191

Complete the fix for telegramCfg optional chaining.
Previous commit only fixed line 160, but line 191 also needs
the same fix to prevent TS18048 error.

* fix: cover buffered Telegram apiRoot downloads (#59544) (thanks @SARAMALI15792)

---------

Co-authored-by: Ayaan Zaidi <hi@obviy.us>
2026-04-03 08:41:41 +05:30
..
acpx build: prepare 2026.4.1-beta.1 release 2026-04-01 15:09:19 +01:00
amazon-bedrock fix: mirror bedrock runtime dep in root package 2026-04-02 19:26:56 +01:00
anthropic refactor(providers): centralize request capabilities (#59636) 2026-04-02 20:26:22 +09:00
anthropic-vertex fix(providers): centralize Google endpoint classification (#59556) 2026-04-02 19:21:31 +09:00
bluebubbles refactor: apply context visibility across channels 2026-04-03 04:34:57 +09:00
brave build: prepare 2026.4.1-beta.1 release 2026-04-01 15:09:19 +01:00
browser fix(browser): block SSRF redirect bypass via real-time route interception (#58771) 2026-04-02 09:07:57 -07:00
byteplus build: prepare 2026.4.1-beta.1 release 2026-04-01 15:09:19 +01:00
chutes build: prepare 2026.4.1-beta.1 release 2026-04-01 15:09:19 +01:00
cloudflare-ai-gateway build: prepare 2026.4.1-beta.1 release 2026-04-01 15:09:19 +01:00
copilot-proxy build: prepare 2026.4.1-beta.1 release 2026-04-01 15:09:19 +01:00
deepgram refactor(providers): normalize transport policy wiring (#59682) 2026-04-02 22:54:34 +09:00
deepseek build: prepare 2026.4.1-beta.1 release 2026-04-01 15:09:19 +01:00
device-pair refactor(channels): route core through registered plugin capabilities 2026-03-30 01:03:42 +01:00
diagnostics-otel build: prepare 2026.4.1-beta.1 release 2026-04-01 15:09:19 +01:00
diffs Docs: refresh diffs plugin docs 2026-04-02 21:47:55 -04:00
discord refactor: apply context visibility across channels 2026-04-03 04:34:57 +09:00
duckduckgo build: prepare 2026.4.1-beta.1 release 2026-04-01 15:09:19 +01:00
elevenlabs build: prepare 2026.4.1-beta.1 release 2026-04-01 15:09:19 +01:00
exa build: prepare 2026.4.1-beta.1 release 2026-04-01 15:09:19 +01:00
fal fix(providers): route image generation through shared transport (#59729) 2026-04-03 00:32:37 +09:00
feishu refactor: apply context visibility across channels 2026-04-03 04:34:57 +09:00
firecrawl refactor(plugins): tighten web fetch provider boundary (#59646) 2026-04-02 20:53:57 +09:00
github-copilot build: prepare 2026.4.1-beta.1 release 2026-04-01 15:09:19 +01:00
google Separate Gemini OAuth state from PKCE verifier (#59116) 2026-04-02 09:51:11 -07:00
googlechat build: prepare 2026.4.1-beta.1 release 2026-04-01 15:09:19 +01:00
groq build: prepare 2026.4.1-beta.1 release 2026-04-01 15:09:19 +01:00
huggingface build: prepare 2026.4.1-beta.1 release 2026-04-01 15:09:19 +01:00
image-generation-core build: prepare 2026.4.1-beta.1 release 2026-04-01 15:09:19 +01:00
imessage refactor: apply context visibility across channels 2026-04-03 04:34:57 +09:00
irc build: prepare 2026.4.1-beta.1 release 2026-04-01 15:09:19 +01:00
kilocode build: prepare 2026.4.1-beta.1 release 2026-04-01 15:09:19 +01:00
kimi-coding fix: normalize kimi anthropic tool payloads (#59440) 2026-04-02 13:39:51 +05:30
line perf(test): narrow line reply context import 2026-04-02 00:16:03 +09:00
litellm build: prepare 2026.4.1-beta.1 release 2026-04-01 15:09:19 +01:00
llm-task build: prepare 2026.4.1-beta.1 release 2026-04-01 15:09:19 +01:00
lobster !feat(plugins): add web fetch provider boundary (#59465) 2026-04-02 20:25:19 +09:00
matrix fix(matrix): align IDB snapshot lock timing 2026-04-02 21:44:08 -04:00
mattermost fix(compare): reuse shared secret comparison helper (#58432) 2026-04-02 13:53:19 +01:00
media-understanding-core build: prepare 2026.4.1-beta.1 release 2026-04-01 15:09:19 +01:00
memory-core build: prepare 2026.4.1-beta.1 release 2026-04-01 15:09:19 +01:00
memory-lancedb build: prepare 2026.4.1-beta.1 release 2026-04-01 15:09:19 +01:00
microsoft build: prepare 2026.4.1-beta.1 release 2026-04-01 15:09:19 +01:00
microsoft-foundry build: prepare 2026.4.1-beta.1 release 2026-04-01 15:09:19 +01:00
minimax fix(providers): route image generation through shared transport (#59729) 2026-04-03 00:32:37 +09:00
mistral build: prepare 2026.4.1-beta.1 release 2026-04-01 15:09:19 +01:00
modelstudio refactor(providers): centralize request capabilities (#59636) 2026-04-02 20:26:22 +09:00
moonshot refactor(providers): normalize transport policy wiring (#59682) 2026-04-02 22:54:34 +09:00
msteams fix(msteams): preserve channel reply threading in proactive fallback (#55198) 2026-04-02 18:27:13 -05:00
nextcloud-talk build: prepare 2026.4.1-beta.1 release 2026-04-01 15:09:19 +01:00
nostr docs: fix Nostr inbound signature verification order in docs 2026-04-02 10:11:09 +09:00
nvidia build: prepare 2026.4.1-beta.1 release 2026-04-01 15:09:19 +01:00
ollama build: prepare 2026.4.1-beta.1 release 2026-04-01 15:09:19 +01:00
open-prose build: prepare 2026.4.1-beta.1 release 2026-04-01 15:09:19 +01:00
openai fix(openai): support reference-image edits 2026-04-03 02:26:33 +09:00
opencode build: prepare 2026.4.1-beta.1 release 2026-04-01 15:09:19 +01:00
opencode-go build: prepare 2026.4.1-beta.1 release 2026-04-01 15:09:19 +01:00
openrouter build: prepare 2026.4.1-beta.1 release 2026-04-01 15:09:19 +01:00
openshell OpenShell: constrain mirror sync roots (#58515) 2026-04-02 06:21:30 -07:00
perplexity build: prepare 2026.4.1-beta.1 release 2026-04-01 15:09:19 +01:00
phone-control tighten phone-control scope helper extraction 2026-03-30 16:17:17 +02:00
qianfan build: prepare 2026.4.1-beta.1 release 2026-04-01 15:09:19 +01:00
qqbot fix(qqbot): restrict structured payload local paths (#58453) 2026-04-02 10:20:52 +01:00
searxng build: prepare 2026.4.1-beta.1 release 2026-04-01 15:09:19 +01:00
sglang build: prepare 2026.4.1-beta.1 release 2026-04-01 15:09:19 +01:00
shared refactor: route plugin runtime through bundled seams 2026-03-27 16:40:27 +00:00
signal refactor: apply context visibility across channels 2026-04-03 04:34:57 +09:00
slack Matrix: add native exec approvals (#58635) 2026-04-02 21:08:54 -04:00
speech-core build: prepare 2026.4.1-beta.1 release 2026-04-01 15:09:19 +01:00
synology-chat build: prepare 2026.4.1-beta.1 release 2026-04-01 15:09:19 +01:00
synthetic build: prepare 2026.4.1-beta.1 release 2026-04-01 15:09:19 +01:00
talk-voice style: apply formatter cleanups 2026-03-30 16:20:27 +01:00
tavily build: prepare 2026.4.1-beta.1 release 2026-04-01 15:09:19 +01:00
telegram fix: cover buffered Telegram apiRoot downloads (#59544) (thanks @SARAMALI15792) 2026-04-03 08:41:41 +05:30
thread-ownership feat(gateway): make chat history max chars configurable (#58900) 2026-04-01 21:08:37 +11:00
tlon build: prepare 2026.4.1-beta.1 release 2026-04-01 15:09:19 +01:00
together build: prepare 2026.4.1-beta.1 release 2026-04-01 15:09:19 +01:00
twitch build: prepare 2026.4.1-beta.1 release 2026-04-01 15:09:19 +01:00
venice build: prepare 2026.4.1-beta.1 release 2026-04-01 15:09:19 +01:00
vercel-ai-gateway build: prepare 2026.4.1-beta.1 release 2026-04-01 15:09:19 +01:00
vllm build: prepare 2026.4.1-beta.1 release 2026-04-01 15:09:19 +01:00
voice-call fix(compare): reuse shared secret comparison helper (#58432) 2026-04-02 13:53:19 +01:00
volcengine build: prepare 2026.4.1-beta.1 release 2026-04-01 15:09:19 +01:00
whatsapp test: refresh generated baselines 2026-04-03 04:54:59 +09:00
xai fix(xai): make x_search auth plugin-owned (#59691) 2026-04-02 23:54:07 +09:00
xiaomi build: prepare 2026.4.1-beta.1 release 2026-04-01 15:09:19 +01:00
zai build: prepare 2026.4.1-beta.1 release 2026-04-01 15:09:19 +01:00
zalo fix(zalo): scope replay dedupe cache key to path and account [AI] (#59387) 2026-04-02 09:36:35 -07:00
zalouser build: prepare 2026.4.1-beta.1 release 2026-04-01 15:09:19 +01:00
.npmignore
AGENTS.md Docs: add boundary AGENTS guides (#56647) 2026-03-28 20:22:03 -04:00
CLAUDE.md Docs: add boundary AGENTS guides (#56647) 2026-03-28 20:22:03 -04:00