Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion akashic.plugin.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
schema_version = 1
name = "emotion"
version = "3.0.0"
version = "3.0.1"
api_version = 3
entrypoint = "plugin.py"
10 changes: 6 additions & 4 deletions plugin.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import json
from pathlib import Path
from collections.abc import Mapping
from typing import Any
Expand Down Expand Up @@ -31,7 +32,7 @@

api_version = 3
name = "emotion"
version = "3.0.0"
version = "3.0.1"
desc = "Timer-refreshed Emotion context and ordinary Drift preference projection."
DRIFT_PROPOSALS = ServiceKey[DriftProposalServices]("drift.proposals.v1")
DRIFT_WAKE = ServiceKey[DriftWakeServices]("drift.wake.v1")
Expand Down Expand Up @@ -242,15 +243,16 @@ def _mobile_ui_query(


async def emotion_commit_preference_context(
tool_context: object,
context: object,
arguments: Mapping[str, object],
) -> Mapping[str, object]:
) -> str:
"""Delegate legacy export lookup to the exact Root runtime."""

runtime = _v3_emotion_runtime
if runtime is None:
raise RuntimeError("emotion v3 generation 尚未完成 apply")
return await runtime.commit_preference_context(tool_context, arguments)
result = await runtime.commit_preference_context(context, arguments)
return json.dumps(result, ensure_ascii=False, sort_keys=True)


def _commit_tool_schema() -> dict[str, object]:
Expand Down
22 changes: 22 additions & 0 deletions tests/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,28 @@ def _load_plugin_module():
].refresh_current_context


def test_tool_export_matches_core_contract(monkeypatch: pytest.MonkeyPatch) -> None:
async def commit(
context: object,
arguments: dict[str, object],
) -> dict[str, object]:
assert context is tool_context
assert arguments == {"proposal_id": "proposal-1"}
return {"committed": True}

tool_context = object()
monkeypatch.setattr(
module,
"_v3_emotion_runtime",
SimpleNamespace(commit_preference_context=commit),
)
handler = module.emotion_commit_preference_context
assert tuple(inspect.signature(handler).parameters) == ("context", "arguments")
assert json.loads(
asyncio.run(handler(tool_context, {"proposal_id": "proposal-1"}))
) == {"committed": True}


class DriftServices:
"""Expose both ordinary Drift ports over the real Core store."""

Expand Down
Loading