Files
plugins/packages/nowledge-mem/package.json
T
IceCodeNew c38a364e6a nowledge-mem 0.1.1: return from the connection test page, by IceCodeNew (#537)
The connection test page no longer depends on window.name, which the app's frame navigation drops. The language travels as `/test?lang=xx` and the page always shows Back to settings, which calls history.back() in the frame. The page takes no return address. Host (loopback:<port>), the per-process token and Origin null/self are unchanged in handle(). 0.1.1: package.json and mem.mjs's User-Agent version were bumped together.

Reviewed at 390130262eaaff2bf4bfd16b3483626c0c730d7c (every changed line in packages/nowledge-mem).

Run at that head:
- mote: `HOME=$(mktemp -d) bun test packages/nowledge-mem`: 53 pass, 1 skip (live), 0 fail. `bun scripts/check.mjs`: exit 0.
- Broken by hand: dropping `history.back()` from the test page turned "the running service answers 403 ..." red. Dropping the `lang` query from settings.js turned "configuration page saves the Mem connection ..." red. Both passed again once restored.
- Browser harness: a window frames the real page/settings.html under magpie's plugin-page CSP in an `<iframe sandbox="allow-scripts">` and runs the package's real service. Chromium ran on mote and WebKit on the Linux VM, because WebKit launches time out on mote right now. In both engines: Test connection opened /test?lang=zh, Back read 返回设置, and Back returned the frame to settings.html while the top window stayed at its own URL (it had a pushState entry before). The settings page was usable again afterwards. `lang` set to `"><img onerror>`, `__proto__` and `constructor` injected nothing. `lang` is only used as a key into a fixed table, and the label is set through textContent.

Not tried: the real magpie app (its bridge.js was stubbed) and a real Nowledge Mem server. Nit, not blocking: `?lang=__proto__` or `?lang=constructor` gives empty button labels, because the lookup isn't Object.hasOwn. Only a hand-typed URL can do this.

npm: @magpie-community/gateway-nowledge-mem has never been on npm. Its first version needs an owner (trusted publishing can't create a package), so magpie installs it from dist.
2026-10-31 01:08:33 +08:00

60 lines
1.3 KiB
JSON

{
"name": "@magpie-community/gateway-nowledge-mem",
"version": "0.1.1",
"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"
}