feat: Python parity for Wave 6-8 — memory admin / cooking / leftoff / trivia / routines
New module `wave68_handlers.py` (~270 lines) covering the Rust packs that
were Rust-only after Waves 6-8:
- memory_admin: do_memory_count/list/wipe (with full RU plural decl.)
- cooking: do_cooking + reusable match_recipe(phrase) for the 15-dish
preset table. Schedules a "ready!" reminder via scheduler_store.
- leftoff: do_leftoff stitches memory + scheduled tasks + last reply
into a one-paragraph recap. Offline.
- trivia: do_trivia random one-liner from RU/EN MCU pools.
- routines: do_good_night (sleep profile + cancel one-shots),
do_good_morning (default profile + agenda hint),
do_coffee_break (5-min check-in via scheduler).
memory_store: new clear_all() returning removed count, atomic via _save.
extensions.py: imports + set_speak wiring + 9 proxy do_* fns.
main.py: 9 new dispatch elifs.
commands.yaml: 9 new entries (now 196 total).
tests/test_wave68_handlers.py: 15 unit tests covering each handler.
Test helper `_rewire()` re-imports state modules via the existing
isolated_state fixture then re-binds the wave68_handlers module-level
refs — fixes the gotcha where module-level imports cache the OLD
memory_store / scheduler_store instances from process startup.
Tests: 81 → 96 (+15).
This commit is contained in:
parent
5265cb0fbe
commit
94edb73f26
7 changed files with 644 additions and 0 deletions
|
|
@ -96,6 +96,17 @@ def forget(key: str) -> bool:
|
|||
return False
|
||||
|
||||
|
||||
def clear_all() -> int:
|
||||
"""Wipe every fact. Returns count of removed entries. Atomic via _save."""
|
||||
_load()
|
||||
n = len(_store)
|
||||
if n == 0:
|
||||
return 0
|
||||
_store.clear()
|
||||
_save()
|
||||
return n
|
||||
|
||||
|
||||
def search(query: str, limit: int = 5) -> list[dict]:
|
||||
_load()
|
||||
nq = _normalize_key(query)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue