修复了一些错误 更新了AI.md(给ai看的)

This commit is contained in:
Falck
2026-05-02 19:21:50 +08:00
parent 0783428f80
commit 70c531860b
240 changed files with 5626 additions and 10790 deletions

View File

@@ -1,11 +0,0 @@
"""核心模块"""
from .context import Context
# 配置验证器(内部使用)
# 注意:该模块包含系统完整性检查功能
try:
from .achievements import get_validator, init_achievements
except ImportError:
pass
__all__ = ["Context"]

View File

@@ -1,54 +1,17 @@
"""Context class for plugin execution environment."""
from typing import Any, Dict, Optional
class Context:
"""Execution context for plugins.
Provides access to configuration, state, and utilities during plugin execution.
"""
def __init__(self, config: Optional[Dict[str, Any]] = None):
"""Initialize the context.
Args:
config: Optional configuration dictionary.
"""
self.config = config or {}
self._state: Dict[str, Any] = {}
def get(self, key: str, default: Any = None) -> Any:
"""Get a configuration value.
Args:
key: Configuration key.
default: Default value if key not found.
Returns:
The configuration value or default.
"""
return self.config.get(key, default)
def set_state(self, key: str, value: Any) -> None:
"""Set a state value.
Args:
key: State key.
value: State value.
"""
self._state[key] = value
def get_state(self, key: str, default: Any = None) -> Any:
"""Get a state value.
Args:
key: State key.
default: Default value if key not found.
Returns:
The state value or default.
"""
return self._state.get(key, default)
def __repr__(self) -> str: