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>
60 lines
1.3 KiB
JSON
60 lines
1.3 KiB
JSON
{
|
|
"name": "@magpie-community/gateway-nowledge-mem",
|
|
"version": "0.1.0",
|
|
"description": "Nowledge Mem recall, Context Bundle and optional conversation capture at the Magpie gateway, for every connected harness",
|
|
"type": "module",
|
|
"files": [
|
|
"service.mjs",
|
|
"probe.mjs",
|
|
"mem.mjs",
|
|
"nowledge-mem.hooks.mjs",
|
|
"conversation.mjs",
|
|
"README.md",
|
|
"page"
|
|
],
|
|
"keywords": [
|
|
"magpie",
|
|
"magpie-gateway",
|
|
"nowledge-mem",
|
|
"memory",
|
|
"llm-gateway"
|
|
],
|
|
"license": "MIT",
|
|
"repository": {
|
|
"type": "git",
|
|
"url": "git+https://github.com/magpie-community/plugins.git",
|
|
"directory": "packages/nowledge-mem"
|
|
},
|
|
"magpie": {
|
|
"hooks": "./nowledge-mem.hooks.mjs",
|
|
"options": {
|
|
"apiKeyEnv": "NMEM_API_KEY",
|
|
"recall": true,
|
|
"contextBundle": true,
|
|
"maxMemories": 5,
|
|
"maxBytes": 6000,
|
|
"requestTimeoutMs": 900,
|
|
"recallBackoffMs": 30000,
|
|
"capture": false,
|
|
"captureTools": true,
|
|
"port": 3479
|
|
},
|
|
"page": {
|
|
"title": "Nowledge Mem",
|
|
"file": "page/settings.html",
|
|
"icon": "page/icon.svg",
|
|
"service": {
|
|
"port": 3479,
|
|
"option": "port"
|
|
}
|
|
}
|
|
},
|
|
"scripts": {
|
|
"check": "bun test ./*.test.mjs"
|
|
},
|
|
"engines": {
|
|
"bun": ">=1.4.2"
|
|
},
|
|
"main": "./service.mjs"
|
|
}
|