mirror of
https://github.com/agentscope-ai/ReMe.git
synced 2026-11-27 23:58:47 +00:00
Some checks failed
CI and Release / Docker / Build and test / amd64 (push) Has been cancelled
CI and Release / Docker / Build and test / arm64 (push) Has been cancelled
Security / CodeQL / Analyze python (push) Has been cancelled
CI / Python quality / Pre-commit (push) Has been cancelled
CI / Python tests / Unit Tests - py3.12 (push) Has been cancelled
CI / Python tests / Unit Tests - py3.13 (push) Has been cancelled
CI / Python tests / Unit Tests - py3.14 (push) Has been cancelled
CI / Python packages / Build and verify distributions (push) Has been cancelled
CI / Python quality / GitHub Actions (push) Has been cancelled
CI / Python tests / Hermes embedded - ubuntu-latest (push) Has been cancelled
CI / Python tests / Hermes embedded - windows-latest (push) Has been cancelled
CI / Python tests / Unit Tests - py3.11 (push) Has been cancelled
CI / ReMe Studio / Studio checks (push) Has been cancelled
Deploy / Documentation / Build documentation (push) Has been cancelled
CI / Windows / CLI smoke - py3.11 (push) Has been cancelled
Security / CodeQL / Analyze javascript-typescript (push) Has been cancelled
CI and Release / Docker / Publish multi-platform tags (push) Has been cancelled
Deploy / Documentation / deploy (push) Has been cancelled
* refactor(core): reorganize the ReMe runtime and shared helpers * test(status): import the base component from its canonical module * test: remove redundant unit checks * refactor(core): use canonical runtime imports and shared CLI discovery Restore evolve behavior to the base branch and update its imports. Use Application as the runtime entry point and encode SSE in the HTTP service. * fix(cli): honor caller config when service replay is incomplete Use partial startup overrides for port probes and resolve named configs before requesting the service process working directory.
23 lines
785 B
Python
23 lines
785 B
Python
"""Shared access to application-lifetime tool context state."""
|
|
|
|
from typing import TYPE_CHECKING, Any, Final
|
|
|
|
if TYPE_CHECKING:
|
|
from ...core.context import ApplicationContext
|
|
|
|
|
|
class _ToolContextMixin:
|
|
"""Share storage access while leaving each step's state format independent."""
|
|
|
|
TOOL_CONTEXTS_KEY: Final[str] = "tool_contexts"
|
|
|
|
if TYPE_CHECKING:
|
|
app_context: "ApplicationContext | None"
|
|
kwargs: dict[str, Any]
|
|
|
|
def _tool_context_store(self, tool_context_id: str) -> dict:
|
|
if self.app_context is not None:
|
|
contexts = self.app_context.metadata.setdefault(self.TOOL_CONTEXTS_KEY, {})
|
|
else:
|
|
contexts = self.kwargs.setdefault(self.TOOL_CONTEXTS_KEY, {})
|
|
return contexts.setdefault(tool_context_id, {})
|