feat(config,curator,recall): memory curator job on opus high, notes head inline in the envelope, portrait in the morning seed
This commit is contained in:
+38
-6
@@ -4,7 +4,7 @@ from pathlib import Path
|
||||
from beaver_gateway.core.conversations import UserSaid
|
||||
from beaver_gateway.core.envelope import RecallContext
|
||||
|
||||
from recall import LABEL, Recall, ReplyLog, frontmatter_aliases, mentions
|
||||
from recall import LABEL, Recall, ReplyLog, frontmatter_aliases, mentions, notes_head
|
||||
|
||||
|
||||
def _card(path: Path, aliases: list[str] | None = None) -> None:
|
||||
@@ -38,10 +38,17 @@ def _vault(tmp_path: Path) -> Recall:
|
||||
notes = tmp_path / "мета" / "бобер" / "наблюдения"
|
||||
notes.mkdir(parents=True)
|
||||
(notes / "Зина - наблюдения.md").write_text(
|
||||
"# Зина\n\n- 2026-08-26 · перенесла встречу на час · [[2026-08-26]]\n"
|
||||
"# Зина - наблюдения\n\n## сейчас\n- просила перезвонить вечером 26.08\n"
|
||||
"- ждёт ответа про поездку до четверга\n\n## паттерны\n"
|
||||
"- переносит встречи: [[2026-08-10]], [[2026-08-26]]\n\n## факты\n\n## открытое\n\n"
|
||||
"## лента\n- 2026-08-26 · перенесла встречу на час · [[2026-08-26]]\n"
|
||||
"- 2026-08-31 · прислала список покупок · транскрипт\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
(notes / "Прохор - наблюдения.md").write_text(
|
||||
"# Прохор - наблюдения\n\n## сейчас\n\n## лента\n- 2026-08-07 · вернулся · [[2026-08-07]]\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
boards = tmp_path / "📆 доски"
|
||||
boards.mkdir()
|
||||
(boards / "организация.md").write_text(
|
||||
@@ -91,14 +98,24 @@ def test_block_points_to_card_notes_diary_and_deadlines_once(tmp_path: Path) ->
|
||||
assert block is not None
|
||||
lines = block.splitlines()
|
||||
assert lines[0] == LABEL
|
||||
assert lines[1].startswith(
|
||||
"👤 Зина - карточка `👤 люди/личное/Зина.md`; записки `мета/бобер/наблюдения/Зина - наблюдения.md`: 2 стр., последняя: 2026-08-31 · четыре смягчения"
|
||||
assert lines[1] == (
|
||||
"👤 Зина - карточка `👤 люди/личное/Зина.md`; записки "
|
||||
"`мета/бобер/наблюдения/Зина - наблюдения.md`: лента 2 стр., паттернов 1; "
|
||||
"дневник: [[2026-08-31]], [[2026-08-26]], [[2026-08-13]]; сейчас:"
|
||||
)
|
||||
assert lines[1].endswith("дневник: [[2026-08-31]], [[2026-08-26]], [[2026-08-13]]")
|
||||
assert lines[2:] == [
|
||||
assert lines[2:4] == [
|
||||
" - просила перезвонить вечером 26.08",
|
||||
" - ждёт ответа про поездку до четверга",
|
||||
]
|
||||
assert lines[4:] == [
|
||||
"📆 09-01 организация: заполнить файрфлай",
|
||||
"📆 09-02 организация: витамины",
|
||||
]
|
||||
artem = recall.person_line(
|
||||
next(p for p in recall.people.all() if p.name == "Прохор")
|
||||
)
|
||||
assert "лента 1 стр., последняя: 2026-08-07 · вернулся" in artem
|
||||
assert "сейчас:" not in artem
|
||||
again = recall.block(RecallContext(text="и ещё про Зину", kind="master", now=now))
|
||||
assert again is not None and "📆" not in again
|
||||
branch = recall.block(RecallContext(text="Фёдор звонил", kind="branch", now=now))
|
||||
@@ -150,3 +167,18 @@ def test_reply_log_appends_one_line_per_message_and_strips_seed(tmp_path: Path)
|
||||
"- 2026-09-01 14:04 · ветка «крипто-карта» · сравни Trustee и RedotPay\n"
|
||||
)
|
||||
assert date.fromisoformat("2026-09-01") # tz shift stays inside the month here
|
||||
|
||||
|
||||
def test_notes_head_picks_sections_for_the_seed(tmp_path: Path) -> None:
|
||||
recall = _vault(tmp_path)
|
||||
path = recall.notes_dir / "Зина - наблюдения.md"
|
||||
head = notes_head(path, ("сейчас", "паттерны"))
|
||||
assert head == (
|
||||
"## сейчас\n- просила перезвонить вечером 26.08\n"
|
||||
"- ждёт ответа про поездку до четверга\n"
|
||||
"## паттерны\n- переносит встречи: [[2026-08-10]], [[2026-08-26]]"
|
||||
)
|
||||
assert notes_head(path, ("факты",)) is None
|
||||
assert notes_head(recall.notes_dir / "нет.md", ("сейчас",)) is None
|
||||
short = notes_head(path, ("сейчас", "паттерны"), cap=2)
|
||||
assert short is not None and short.endswith("… ещё 3 строк в файле")
|
||||
|
||||
Reference in New Issue
Block a user