HEL-916: auditable dialogue input, natural two-world boundary, live-activity wiring, bounded judgment retry, chat-driven mood

Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
施工员2号
2026-11-03 11:07:38 +08:00
co-authored by multica-agent
parent e74531cf98
commit adf4d5c4f7
11 changed files with 461 additions and 33 deletions
+31
View File
@@ -2,6 +2,9 @@
from __future__ import annotations
import asyncio
import contextlib
import sys
from pathlib import Path
import pytest
@@ -9,6 +12,34 @@ import pytest
from cybergril.config import CharacterConfig, ModelsConfig, Settings
from cybergril.memory import Store
# Test-env compatibility only (product targets Python 3.11, deploy/hel874 uses
# uv --python 3.11): this workspace runs 3.10, where asyncio.timeout does not
# exist. The shim mirrors the only shape the product uses —
# ``async with asyncio.timeout(delay)`` raising TimeoutError on expiry.
if sys.version_info < (3, 11) and not hasattr(asyncio, "timeout"):
@contextlib.asynccontextmanager
async def _timeout_compat(delay: float):
loop = asyncio.get_running_loop()
deadline = loop.time() + max(0.0, delay)
current = asyncio.current_task()
def _expire():
if current is not None:
current.cancel()
handle = loop.call_at(deadline, _expire)
try:
yield
except asyncio.CancelledError:
if loop.time() < deadline:
raise
raise TimeoutError from None
finally:
handle.cancel()
asyncio.timeout = _timeout_compat # type: ignore[attr-defined]
try:
from cybergril.think.budget import CATEGORIES, BudgetConfig
except ImportError: # r3 baseline probe runs these tests against older src trees