Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.
Python agentagent-osaiai-agentsai-partnerchatopsclaudeclaude-codecodexdevtoolsdiscord-botlark-botllmlocal-firstlong-term-memoryopencodeslack-botvibe-codingvibeywechat
fix(reply): render placeholder-link quick replies as buttons (#2232)
Call White0d39db9235ee
diff --git a/core/reply_enhancer.py b/core/reply_enhancer.pyindex 047bddccd..f206d36b4 100644--- a/core/reply_enhancer.py+++ b/core/reply_enhancer.py@@ -454,14 +454,21 @@ class _FileLinkMatch:# quick-reply label in a link — the label stays the payload, the URL is dropped.# Tolerated link forms: plain Markdown ``[label](https://…)``, Slack-escaped# ``[label](<https://…>)``, and Slack autolink ``<https://…|label>``. Only-# ``http(s)`` targets count (a bare ``[label](foo)`` is left alone).+# ``http(s)`` targets count as real links (a bare ``[label](foo)`` is left alone).+# Placeholder targets — ``[label](#)``, ``[label](#anchor)``, ``[label]()`` —+# point nowhere in a chat message, so they are read exactly like a bare+# ``[label]`` token; the link-only guards below apply to real links only.## ``_PLAIN_URL`` allows one level of balanced parentheses (e.g. Wikipedia# ``…/A_(B)``) like ``_FILE_LINK_RE`` does, so such a URL doesn't truncate at the# first ``)`` and drop the rest of the button group._PLAIN_URL = r"https?://(?:[^()\s]|\([^()]*\))+"-# Optional link wrapper after a ``[label]`` token: ``(<https://…>)`` or ``(https://…)``.-_LINK_SUFFIX = r"(?:\((?:<https?://[^>\n]+>|" + _PLAIN_URL + r")\))?"+_PLACEHOLDER_TARGET = r"(?:#[^()\s]*)?"+# Optional link wrapper after a ``[label]`` token: ``(<https://…>)``,+# ``(https://…)``, or a placeholder ``(#…)`` / ``()``.+_LINK_SUFFIX = (+ r"(?:\((?:<https?://[^>\n]+>|" + _PLAIN_URL + r"|" + _PLACEHOLDER_TARGET + r")\))?"+)_BUTTON_BLOCK_RE = re.compile(r"\n-{3,}\s*\n" # --- separator linediff --git a/tests/test_reply_enhancer_platform.py b/tests/test_reply_enhancer_platform.pyindex 355eac9f8..9835f9da8 100644--- a/tests/test_reply_enhancer_platform.py+++ b/tests/test_reply_enhancer_platform.py@@ -1481,6 +1481,45 @@ class ReplyEnhancerPlatformTests(unittest.IsolatedAsyncioTestCase):self.assertEqual(reply.text, "Done.")self.assertEqual([button.text for button in reply.buttons], ["Wiki", "Done"])+ def test_process_reply_accepts_placeholder_link_buttons(self):+ # Agents sometimes write every button as a ``[label](#)`` link. A+ # placeholder target points nowhere in a chat message, so the row must+ # render as buttons instead of a line of dead links.+ reply = process_reply(+ "你定一下先做哪个。\n\n---\n"+ "[✅ 三个都做](#) | [📝 先改提示词](#) | [🔁 先做重启续跑](#) | [⏳ 等2230合并再说](#)"+ )++ self.assertEqual(reply.text, "你定一下先做哪个。")+ self.assertEqual(+ [button.text for button in reply.buttons],+ ["✅ 三个都做", "📝 先改提示词", "🔁 先做重启续跑", "⏳ 等2230合并再说"],+ )++ def test_process_reply_reads_placeholder_link_like_bare_button(self):+ cases = {+ "Done.\n\n---\n[A](#)": ["A"],+ "Done.\n\n---\n[A]() | [B](#next) | [C]": ["A", "B", "C"],+ "Done.\n[A](#) | [B](#b)": ["A", "B"],+ }+ for text, labels in cases.items():+ with self.subTest(text=text):+ reply = process_reply(text)++ self.assertEqual(reply.text, "Done.")+ self.assertEqual([button.text for button in reply.buttons], labels)++ def test_process_reply_preserves_relative_link_row(self):+ for text in (+ "Done.\n\n---\n[Guide](docs/guide.md) | [Notes](notes.md)",+ "Done.\n[Guide](docs/guide.md) | [Notes](notes.md)",+ ):+ with self.subTest(text=text):+ reply = process_reply(text)++ self.assertEqual(reply.text, text)+ self.assertEqual(reply.buttons, [])+def test_prompt_keeps_harness_routing_and_moves_operational_detail_to_skill(self):context = MessageContext(user_id="U1",