feat(adapter): add bridge_adapter Python SDK + TypeScript MemoryAdapter interface#339
Open
gugu23456789 wants to merge 119 commits into
Open
feat(adapter): add bridge_adapter Python SDK + TypeScript MemoryAdapter interface#339gugu23456789 wants to merge 119 commits into
gugu23456789 wants to merge 119 commits into
Conversation
Author
CI Status (final)Latest:
Phase SummaryPhase 1: SDK push (env-var fallback, dual-path) Evidence
|
This was referenced Jul 3, 2026
added 19 commits
July 4, 2026 09:01
G1: RateLimitGate (sliding window + self-fallback) - G2: CircuitBreakerGate (closed-open + cooldown escalation) - G3: AuditGate (ring buffer + ConsoleExporter + sampling 1/10) - 11 tests with mocked time - Wired into BaseMemoryAdapter - package-lock.json tracked, npm ci, npm audit - OpenSSF Scorecard CI job, Dependabot weekly scan
…s) + Scorecard continue-on-error
3 vulnerabilities patched in server.py + mcp_health.py: - Rate limiter self-fallback (3 fails -> 30s fail-open) - CB cooldown escalation (double on rapid cycles, max 300s) - Audit ring buffer (1024 max) + sampling (1/10) Also fixed pre-existing missing def _check_api_key() in mcp_health.py
rainforest888
added a commit
to rainforest888/TencentDB-Agent-Memory
that referenced
this pull request
Jul 4, 2026
rainforest888
added a commit
to rainforest888/TencentDB-Agent-Memory
that referenced
this pull request
Jul 4, 2026
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.
Summary
One engine, three entry points this PR implements a unified access layer for TDAI Memory Gateway v2:
TdaiAdapterABC +BridgeAdapterMemoryAdapterinterface +BaseMemoryAdapter+TdaiHttpClientAll three share the same abstract contract (recall/capture/search) and the same backend (TDAI Gateway). The MCP layer also serves as the integration point for platforms that don't have a native SDK Codex CLI, Claude Code, CodeBuddy, Trae IDE, Cursor, etc. connect with a single line of config.
With MCP gaining traction as an open standard for agent-tool interaction, this PR positions TDAI to be natively accessible from any MCP-compliant platform without per-platform adapter code.
Configuration: Local vs Multi-Tenant
All three entry points share the same
TDAI_*environment variables.Set them once; all three consume them.
Path A: Local Mode (Zero Config)
Path B: Multi-Tenant Mode (Per-Project Isolation)
# Each project gets its own SQLite database on the same Gateway TDAI_SERVICE_ID=repo-spz-gatekeeper python -m bridge.mcp.server TDAI_SERVICE_ID=repo-bridge-core python -m bridge.mcp.server TDAI_SERVICE_ID=repo-zthl-research python -m bridge.mcp.serverPath C: Remote Gateway (Cloud)
API Key Resolution
The MCP server resolves keys in this order:
MCP_BRIDGE_API_KEY(MCP-specific override)TDAI_API_KEY(shared SDK key)Tested by
test_config.py(7 tests) andtest_dual_path.py(4 tests).Python SDK
TypeScript SDK
MCP stdio (any MCP-compliant client)
Then the agent calls
tdai_recall,tdai_capture, etc. as native MCP tools.Deliverables
Python SDK (
bridge_adapter/)bridge_adapter/base.pybridge_adapter/client.pybridge_adapter/errors.pybridge_adapter/base.pycreate("bridge" or "hermes_v2"), list()bridge_adapter/__init__.pybridge_adapter/buffered.pybridge_adapter/hermes_v2.pybridge_adapter/config.pyTypeScript SDK (
src/core/)src/core/types.tssrc/core/base-memory-adapter.tssrc/core/tdai-http-client.tssrc/core/memory-adapter.test.ts(19) +src/core/tdai-http-client.test.ts(10)MCP stdio Transport Layer (
bridge/mcp/)bridge/mcp/server.pybridge/mcp/server.pybridge/mcp_health.pybridge/mcp/tdai-memory-client.tsbridge/mcp/tests/test_protocol.py+test_redteam.pyTest Summary
bridge/mcp/tests/test_protocol.pybridge/mcp/tests/test_redteam.pysrc/core/memory-adapter.test.tssrc/core/tdai-http-client.test.tsDocumentation
bridge/mcp/INTEGRATION.mdbridge/mcp/REDTEAM_FINDINGS.mddocs/tdai-adapter-architecture.mddocs/platform-adapter-comparison.mdKey Design Decisions
_implmethods; the base class provides retry, middleware, caching, and graceful degradation for free.CI Verification
Evidence: https://github.com/gugu23456789/tdai-adapter-evidence (test logs, PR data, commit history)
Closes #235
Progress
CI Status (final)
Latest:
860f225e— 8/8 jobs passingFull CI history in comment below.