From 888c9952ccb93886c3ab3a449c16fa2619acf108 Mon Sep 17 00:00:00 2001 From: huashen <2494946808@qq.com> Date: Mon, 24 Aug 2026 23:06:57 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=B3=A8=E5=86=8C=E5=B7=B2=E9=AA=8C?= =?UTF-8?q?=E8=AF=81=E5=B7=A5=E5=85=B7=E5=A4=84=E7=90=86=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- akashic.plugin.toml | 2 +- plugin.py | 4 ++-- tests/test_plugin.py | 21 +++++++++++++++------ 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/akashic.plugin.toml b/akashic.plugin.toml index 82265e4..56d0962 100644 --- a/akashic.plugin.toml +++ b/akashic.plugin.toml @@ -1,5 +1,5 @@ schema_version = 1 name = "emotion" -version = "3.0.1" +version = "3.0.2" api_version = 3 entrypoint = "plugin.py" diff --git a/plugin.py b/plugin.py index 4dacc0f..2ba01ee 100644 --- a/plugin.py +++ b/plugin.py @@ -32,7 +32,7 @@ api_version = 3 name = "emotion" -version = "3.0.1" +version = "3.0.2" desc = "Timer-refreshed Emotion context and ordinary Drift preference projection." DRIFT_PROPOSALS = ServiceKey[DriftProposalServices]("drift.proposals.v1") DRIFT_WAKE = ServiceKey[DriftWakeServices]("drift.wake.v1") @@ -77,7 +77,7 @@ async def apply(ctx: Context, config: object) -> None: risk="read-write", search_hint="emotion drift preference feedback", ), - handler=runtime.commit_preference_context, + handler=emotion_commit_preference_context, ) # 3. Timer/lifecycle/Turn observer 都属于同一个 generation Fiber。 diff --git a/tests/test_plugin.py b/tests/test_plugin.py index 156fa8d..e5e31d5 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -31,7 +31,11 @@ RuntimeStarted, RuntimeStopping, ) -from agent.plugin_composition.tool_catalog import PluginTools, _freeze_plugin_tools +from agent.plugin_composition.tool_catalog import ( + PluginToolCatalog, + PluginTools, + _freeze_plugin_tools, +) from agent.plugin_composition.ui_slots import PluginUiSlots from bus.events_lifecycle import TurnCommitted from plugins.drift.store import DriftStore @@ -104,7 +108,9 @@ def selection(self, accepted_turn: object) -> None: return None -async def _mount_candidate(tmp_path: Path) -> tuple[CompositionRoot, Path]: +async def _mount_candidate( + tmp_path: Path, +) -> tuple[CompositionRoot, Path, PluginToolCatalog]: """Mount the real plugin with candidate Timer and ordinary service atoms.""" root = CompositionRoot("emotion-candidate") @@ -131,12 +137,12 @@ async def _mount_candidate(tmp_path: Path) -> tuple[CompositionRoot, Path]: data_access="read_only", ), ) - _ = _freeze_plugin_tools( + catalog = _freeze_plugin_tools( tools, root.instance_token, {"emotion": root.generation_id}, ) - return root, emotion_root + return root, emotion_root, catalog def _feedback_turn(turn_id: str = "turn-feedback-1") -> TurnCommitted: @@ -206,7 +212,10 @@ def test_module_uses_only_ordinary_v3_atoms() -> None: @pytest.mark.asyncio async def test_candidate_mount_has_zero_timer_and_zero_workspace_write(tmp_path: Path) -> None: - root, emotion_root = await _mount_candidate(tmp_path) + root, emotion_root, catalog = await _mount_candidate(tmp_path) + binding = catalog.get("emotion_commit_preference_context") + assert binding is not None + assert binding.handler is module.emotion_commit_preference_context assert not emotion_root.exists() assert not list(tmp_path.rglob("*.db")) await root.dispose() @@ -1212,7 +1221,7 @@ async def test_feedback_history_composes_in_both_mount_orders_and_uses_timer( async def test_feedback_history_candidate_handshake_has_zero_timer_and_db( tmp_path: Path, ) -> None: - root, emotion_root = await _mount_candidate(tmp_path) + root, emotion_root, _ = await _mount_candidate(tmp_path) history = RecordingHistory([_history_record(1)]) try: async def provider(ctx: Any) -> None: