diff --git a/beaver_agent/memory/recall.py b/beaver_agent/memory/recall.py index 015fee2..4f27487 100644 --- a/beaver_agent/memory/recall.py +++ b/beaver_agent/memory/recall.py @@ -400,7 +400,8 @@ class ReplyLog: if said.agent in self.mute: return text = said.text - if text.startswith("[сид:"): + seeded = text.startswith("[сид:") + if seeded: # спавн ветки с текстом: строка сида едет над самим сообщением text = text.split("\n\n", 1)[1] if "\n\n" in text else "" flat = " ⏎ ".join(ln.strip() for ln in text.strip().splitlines() if ln.strip()) @@ -412,6 +413,9 @@ class ReplyLog: where = KINDS.get(said.kind, said.kind) if said.kind != "master" and said.title: where = f"{where} «{said.title}»" + if seeded: + # не человек сказал, а механизм спавна: видно по источнику, не по тексту + where = f"{where} (бриф)" path = self.dir / f"{local:%Y-%m}.md" self.dir.mkdir(parents=True, exist_ok=True) if not path.exists(): diff --git a/tests/test_recall.py b/tests/test_recall.py index 29d05d8..f2d1dee 100644 --- a/tests/test_recall.py +++ b/tests/test_recall.py @@ -5,6 +5,7 @@ from beaver_gateway.conversations.texts import UserSaid from beaver_gateway.conversations.envelope import RecallContext from beaver_agent.hands.calendars import Calendars, Event, Feed +from beaver_agent.memory.curator import new_replies from beaver_agent.memory.recall import ( LABEL, Recall, @@ -171,8 +172,14 @@ def test_reply_log_appends_one_line_per_message_and_strips_seed(tmp_path: Path) assert text.startswith("# реплики Бобра, 2026-09\n") assert text.endswith( "- 2026-09-01 14:04 · мастер · привет ⏎ ты меня любишь\n" - "- 2026-09-01 14:04 · ветка «крипто-карта» · сравни Trustee и RedotPay\n" + "- 2026-09-01 14:04 · ветка «крипто-карта» (бриф) · " + "сравни Trustee и RedotPay\n" ) + since = datetime(2026, 9, 1, 0, 0, tzinfo=UTC) + # пометка брифа не мешает куратору разбирать строку + assert new_replies(tmp_path / "реплики", since, "Europe/Warsaw") == [ + line for line in text.splitlines() if line.startswith("- ") + ] assert date.fromisoformat("2026-09-01") # tz shift stays inside the month here