feat(adapters): 跨平台记忆适配器 — Claude Code / Codex / Dify (#235) - #656
Open
Elyxiya wants to merge 1 commit into
Open
feat(adapters): 跨平台记忆适配器 — Claude Code / Codex / Dify (#235)#656Elyxiya wants to merge 1 commit into
Elyxiya wants to merge 1 commit into
Conversation
…ify (TencentCloud#235) - Unified Adapter SDK (TypeScript + Python) with MemoryAdapterBase, MemoryGatewayClient, and 4-method platform contract - Claude Code adapter: MCP server over stdio JSON-RPC 2.0, XML-tagged context blocks, no external MCP SDK dependency - Codex CLI adapter: lifecycle hooks (beforePromptBuild, afterResponse, onToolCall), Markdown-formatted context, OpenAI function-calling tools - Dify adapter: Python plugin with XML-tagged context, credential-based config, bilingual (en/zh) tool YAML schemas - Circuit breaker (5 failures / 60s cooldown) inherited by all adapters - Graceful degradation: all methods return empty results on failure - 118 tests passing (82 TypeScript + 36 Python) - Architecture docs with Mermaid diagrams, adaptation guide, platform comparison matrix
Collaborator
|
Thank you for submitting this PR and participating in Tencent Rhino-bird Open-source Training Program! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
描述
本 PR 实现了 Issue #235 所要求的跨平台记忆适配器,为 TencentDB-Agent-Memory 核心记忆引擎提供了统一的多平台接入能力。
核心交付物
1. 统一适配器 SDK(TypeScript + Python 双语言)
MemoryAdapterBase抽象基类:封装全部 Gateway 通信、熔断器(5 次连续失败 / 60 秒冷却)、健康检查和优雅降级MemoryGatewayClient:HTTP v3 API 客户端,支持 L0/L1/L2/L3 四层记忆操作2. Claude Code 适配器(MCP Server)
<relevant-memories>、<user-persona>、<scene-navigation>)tools/list和tools/call方法,暴露 3 个记忆工具3. Codex CLI 适配器
beforePromptBuild、afterResponse、onToolCall)createCodexAdapter()/createCodexHooks()4. Dify 适配器(Python 插件)
self.runtime.credentials覆盖环境变量){query, answer}对、{role, content}列表、纯字符串)设计亮点
formatRecallResult、getToolDefinitions、formatToolResult、normalizeMessages测试
文档
docs/architecture.md:完整架构图(Mermaid),包含高层架构、四层记忆模型、类层次结构、召回/捕获数据流、熔断器状态机docs/adaptation-guide.md:新平台适配指南,含 TypeScript 和 Python 逐步教程、测试骨架、常见陷阱docs/platform-comparison.md:平台对比矩阵,含召回格式、消息归一化、工具定义、配置、性能特征对比关联 Issue
Fix #235
修改类型
自测清单
其他说明
文件清单