nowledge-mem 0.1.0: recall and opt-in capture from your Nowledge Mem, by IceCodeNew (#526)

Adds @magpie-community/gateway-nowledge-mem, an asynchronous gateway hook by
IceCodeNew (#526): before each request it recalls from the user's Nowledge
Mem (and the Context Bundle / Working Memory on a session's first turn), and,
only when `capture` is turned on, imports completed conversations as Mem
Threads. It applies to direct local requests and the `magpie-key` sharing
key this computer writes into the user's own agents; other gateway keys,
remote and unknown origins are never included. A page sets the connection
and runs a real connection test through a loopback service guarded by Host,
Origin and a per-start token. The package writes nothing into magpie's
Library. registry.json gains one compact entry.

Reviewed head 3f4ba91 (f9eb686 plus a maintainer commit adding a test that
starts the service and expects 403 for a foreign Host, Origin and token).
Run at 3f4ba91's tree on mote (macOS, Bun 1.4.2, HOME=$(mktemp -d)):
repo `bun test` 3861 pass, 9 skip, 0 fail; `bun scripts/check.mjs` exit 0;
packages/nowledge-mem 53 pass, 1 skip.
Broken by hand: each of the service's four guards in handle() turns the new
test red; earlier rounds broke the origin gate, the block escaping, the
secret check and the cleartext-HTTP guard, each red.
Not tried: a real Mem server, a real magpie with the plugin installed,
Windows.

Co-authored-by: IceCodeNew <32576256+IceCodeNew@users.noreply.github.com>
This commit is contained in:
IceCodeNew
2026-10-30 21:37:55 +08:00
committed by GitHub
parent 5b4ef414e2
commit c5dc2e691c
20 changed files with 3279 additions and 0 deletions
+2
View File
@@ -4,6 +4,8 @@
{ "package": "@magpie-community/gateway-powercontext", "name": "PowerContext", "kind": "middleware", "community": true,
"icon": "https://raw.githubusercontent.com/oceanbase/powercontext/master/src/powercontext/server/dashboard/static/brand/favicon-color.svg",
"summary": { "en": "Recall from your PowerContext service and optionally save complete conversations. Configure the service URL first; capture is off by default.", "zh": "从自己的 PowerContext 服务召回记忆,并按需存回完整对话。先配置服务地址;对话存回默认关闭。" } },
{ "package": "@magpie-community/gateway-nowledge-mem", "name": "Nowledge Mem", "kind": "middleware", "community": true,
"summary": { "en": "Give every harness behind Magpie Nowledge Mem automatically: recall and the Context Bundle (or Working Memory) before each request, per-harness provenance, optional import of completed conversations as Mem Threads, and a real connection test in the page. A local or remote Mem; saving conversations is off by default.", "zh": "让 Magpie 后面的每个 harness 自动接入 Nowledge Mem:每次请求前召回记忆与 Context Bundle(缺失时用 Working Memory),记录来自哪个 harness,按需把已完成的对话导入为 Mem Thread,并在页面中提供真实的连接测试。本机或远端 Mem 都可用;对话导入默认关闭。" } },
{ "package": "@magpie-community/opencode-copilot-auth", "name": "GitHub Copilot", "icon": "githubcopilot", "providers": ["github-copilot"], "community": true,
"summary": { "en": "GitHub Copilot on GitHub.com or GitHub Enterprise, with premium request or credit usage, remaining allowance and quota reset dates.", "zh": "GitHub Copilot:支持 GitHub.com 与 GitHub Enterprise,显示高级请求或积分用量、剩余额度和重置时间。" } },
{ "package": "@magpie-community/opencode-joycode-auth", "name": "JoyCode", "providers": ["joycode"], "community": true,