ReMe/integrations/codex/plugins/reme/reme_mcp.py
Sen Huang 749c653f23
feat(integrations): add automatic memory plugins for Claude Code and Codex (#575)
* feat(integrations): add native Claude Code and Codex memory plugins

* docs(integrations): make plugin installation the coding agent entry point

* feat(integrations): configure plugin connections from user settings

* refactor(codex): use MCP tools and native plugin settings

* fix(codex): restore plugin hooks on current runtimes

* docs(codex): expand setup guide and reserve screenshot slots

* feat(codex): add configurable memory consolidation and status

* feat(codex): merge connection checks into a tabbed status app

* docs(codex): diagnose blocked status panel sandbox loading

* fix(codex): simplify status panel layout for narrow cards

* docs(codex): focus guides on connecting and using ReMe

* docs(codex): specify validated CLI and desktop version requirements

* feat(codex): add ReMe branding to plugin icons

* docs(codex): prepare manual screenshot workflow

* fix(codex): simplify ReMe status layout and activity

* docs(codex): explain Hook loading and local project context

* fix(codex): keep status refresh clear of host close control

* fix(codex): retain status resources for active MCP connections

* docs(codex): add real desktop screenshots to usage guides

* fix(integrations): address memory capture and consolidation review

* fix(codex): preserve capture endpoint during background delivery
2026-10-12 20:12:47 +08:00

29 lines
1.2 KiB
Python

"""ReMe MCP calls shared by hooks and the plugin's connection check."""
from __future__ import annotations
import asyncio
async def call_async(config: dict, action: str, payload: dict, timeout: float) -> dict:
"""Acknowledge a write only after a successful MCP result, including connection time."""
from fastmcp import Client
async with asyncio.timeout(timeout):
async with Client(config["mcpUrl"], timeout=timeout) as client:
result = await client.call_tool(action, payload, raise_on_error=True)
if result.is_error:
raise RuntimeError("ReMe MCP did not acknowledge the action")
answer = result.data
if answer is None:
answer = "\n".join(block.text for block in result.content if block.type == "text")
return {"success": True, "answer": answer}
def call(config: dict, action: str, payload: dict, timeout: float) -> dict:
"""Run one bounded MCP operation in a short-lived native hook process."""
try:
return asyncio.run(call_async(config, action, payload, timeout))
except Exception as exc:
# Keep the hook's retry loop independent of MCP transport exception classes.
raise RuntimeError("ReMe MCP request failed") from exc