Add Memory Gateway agent plugin

This commit is contained in:
2026-05-06 16:10:04 +08:00
parent e65731a273
commit c44af407d4
48 changed files with 3111 additions and 0 deletions

View File

@ -0,0 +1,24 @@
from __future__ import annotations
from memory_gateway_plugin.output import dumps_safe, redact, short_id
def test_output_redaction_hides_secret_fields():
payload = {
"api_key": "sk-test",
"headers": {"Authorization": "Bearer abc"},
"nested": {"cookie": "sid=abc"},
"safe": "value",
}
text = dumps_safe(payload)
assert "sk-test" not in text
assert "Bearer abc" not in text
assert "sid=abc" not in text
assert "value" in text
assert redact("password=abc") == "<redacted>"
def test_output_redaction_shortens_memory_ids():
assert short_id("mem_1234567890abcdef") == "mem_1234...cdef"