From d01da7b0508c3663556fcd1978c2d4ba899b0dbf Mon Sep 17 00:00:00 2001 From: Codex Local Date: Fri, 31 Jul 2026 20:06:43 +0800 Subject: [PATCH] fix: keep capability probe static --- core/bridge.py | 9 +++------ main.py | 2 +- metadata.yaml | 4 ++-- tests/test_plugin_metadata_identity.py | 14 ++++++++++++++ 4 files changed, 20 insertions(+), 9 deletions(-) create mode 100644 tests/test_plugin_metadata_identity.py diff --git a/core/bridge.py b/core/bridge.py index d1923b6..a22d099 100644 --- a/core/bridge.py +++ b/core/bridge.py @@ -649,12 +649,9 @@ class MemoryCompanionBridge: result["capability_schema_version"] = bot_personal_contract.BOT_PERSONAL_CAPABILITY_SCHEMA_VERSION result["payload_schema_version"] = bot_personal_contract.BOT_PERSONAL_PAYLOAD_SCHEMA_VERSION result["capability_state"] = "available" - p5_status = getattr(self._plugin, "p5_capability_status", None) - if callable(p5_status): - try: - result["p5"] = dict(p5_status() or {}) - except Exception: - result["p5"] = {"state": "degraded", "error_code": "p5_status_exception"} + # Capability discovery must remain static: callers use it before the + # plugin service is safe to query, and C1 guarantees no storage access. + result["p5"] = {"state": "unprobed", "error_code": "p5_status_not_probed"} self._capability_cache.mark_available(c4_snapshot) result.setdefault("warnings", []) return result diff --git a/main.py b/main.py index e281e37..9a3afab 100644 --- a/main.py +++ b/main.py @@ -16,7 +16,7 @@ from .core.models import json_dumps from .core.service import MemoryCompanionService PLUGIN_NAME = "astrbot_plugin_memory_companion" -PLUGIN_VERSION = "1.6.5" +PLUGIN_VERSION = "1.6.7" _ACTIVE_BRIDGE: MemoryCompanionBridge | None = None diff --git a/metadata.yaml b/metadata.yaml index 763b4d9..5ae8e7e 100644 --- a/metadata.yaml +++ b/metadata.yaml @@ -1,8 +1,8 @@ name: astrbot_plugin_memory_companion -display_name: 我会牢牢记住你 +display_name: 雪色的记忆插件-聊天侧 author: menglimi author_url: https://github.com/menglimi -version: 1.6.5 +version: 1.6.7 description: 我会牢牢记住你是面向 AstrBot 陪伴体系的记忆陪伴中枢。它统一管理长期记忆、历史对话整理、群聊连续对话记忆、主链注入、权限边界、知识图谱、陪伴插件桥接、自然衰减、可移植数据和运行诊断。 desc: 为 AstrBot 提供主链记忆注入、历史聊天整理导入、连续对话记忆、陪伴插件协同、主动记忆/回忆工具、知识图谱、权限边界、自我时间线、自然衰减、迁移导出和成本诊断。 repo: https://github.com/menglimi/astrbot_plugin_memory_companion diff --git a/tests/test_plugin_metadata_identity.py b/tests/test_plugin_metadata_identity.py new file mode 100644 index 0000000..190fdf8 --- /dev/null +++ b/tests/test_plugin_metadata_identity.py @@ -0,0 +1,14 @@ +from pathlib import Path + + +ROOT = Path(__file__).resolve().parents[1] + + +def test_chat_side_display_name_preserves_stable_plugin_identity(): + metadata = (ROOT / "metadata.yaml").read_text(encoding="utf-8") + main = (ROOT / "main.py").read_text(encoding="utf-8") + + assert "name: astrbot_plugin_memory_companion" in metadata + assert "display_name: 雪色的记忆插件-聊天侧" in metadata + assert 'version: 1.6.7' in metadata + assert 'PLUGIN_VERSION = "1.6.7"' in main