From d1ce3586463d72923749a2ac788ef8ca0f90358b Mon Sep 17 00:00:00 2001 From: Siddharth Balyan <52913345+alt-glitch@users.noreply.github.com> Date: Thu, 23 Apr 2026 12:50:22 +0530 Subject: [PATCH] feat(agent): add PLATFORM_HINTS for matrix, mattermost, and feishu (#14428) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat(agent): add PLATFORM_HINTS for matrix, mattermost, and feishu These platform adapters fully support media delivery (send_image, send_document, send_voice, send_video) but were missing from PLATFORM_HINTS, leaving agents unaware of their platform context, markdown rendering, and MEDIA: tag support. Salvaged from PR #7370 by Rutimka — wecom excluded since main already has a more detailed version. Co-Authored-By: Marco Rutsch * test: add missing Markdown assertion for feishu platform hint --------- Co-authored-by: Marco Rutsch --- agent/prompt_builder.py | 26 ++++++++++++++++++++++++++ tests/agent/test_prompt_builder.py | 18 ++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/agent/prompt_builder.py b/agent/prompt_builder.py index 8e061f831..3a6ec2441 100644 --- a/agent/prompt_builder.py +++ b/agent/prompt_builder.py @@ -370,6 +370,32 @@ PLATFORM_HINTS = { "MEDIA:/absolute/path/to/file in your response. Images (.jpg, .png, " ".heic) appear as photos and other files arrive as attachments." ), + "mattermost": ( + "You are in a Mattermost workspace communicating with your user. " + "Mattermost renders standard Markdown — headings, bold, italic, code " + "blocks, and tables all work. " + "You can send media files natively: include MEDIA:/absolute/path/to/file " + "in your response. Images (.jpg, .png, .webp) are uploaded as photo " + "attachments, audio and video as file attachments. " + "Image URLs in markdown format ![alt](url) are rendered as inline previews automatically." + ), + "matrix": ( + "You are in a Matrix room communicating with your user. " + "Matrix renders Markdown — bold, italic, code blocks, and links work; " + "the adapter converts your Markdown to HTML for rich display. " + "You can send media files natively: include MEDIA:/absolute/path/to/file " + "in your response. Images (.jpg, .png, .webp) are sent as inline photos, " + "audio (.ogg, .mp3) as voice/audio messages, video (.mp4) inline, " + "and other files as downloadable attachments." + ), + "feishu": ( + "You are in a Feishu (Lark) workspace communicating with your user. " + "Feishu renders Markdown in messages — bold, italic, code blocks, and " + "links are supported. " + "You can send media files natively: include MEDIA:/absolute/path/to/file " + "in your response. Images (.jpg, .png, .webp) are uploaded and displayed " + "inline, audio files as voice messages, and other files as attachments." + ), "weixin": ( "You are on Weixin/WeChat. Markdown formatting is supported, so you may use it when " "it improves readability, but keep the message compact and chat-friendly. You can send media files natively: " diff --git a/tests/agent/test_prompt_builder.py b/tests/agent/test_prompt_builder.py index 11712b951..88de5186b 100644 --- a/tests/agent/test_prompt_builder.py +++ b/tests/agent/test_prompt_builder.py @@ -807,6 +807,24 @@ class TestPromptBuilderConstants: # check that this test is calibrated correctly). assert "include MEDIA:" in PLATFORM_HINTS["telegram"] + def test_platform_hints_mattermost(self): + hint = PLATFORM_HINTS["mattermost"] + assert "Mattermost" in hint + assert "MEDIA:" in hint + assert "Markdown" in hint + + def test_platform_hints_matrix(self): + hint = PLATFORM_HINTS["matrix"] + assert "Matrix" in hint + assert "MEDIA:" in hint + assert "Markdown" in hint + + def test_platform_hints_feishu(self): + hint = PLATFORM_HINTS["feishu"] + assert "Feishu" in hint + assert "MEDIA:" in hint + assert "Markdown" in hint + # ========================================================================= # Environment hints