Files
Muyangandsiml1169 9f02ad545f privacy-gate: middleware settings page (#1145)
The ShyPie plugin page gets a Middleware settings tab, so privacy-gate's
ctx.options can be set from the page instead of the CLI only. Options are
grouped as Protection, Advanced inspection and Diagnostics; the Agents view
is unchanged and both share one Save.

- Lists are validated (shape, count); a malformed allowModels blocks the
  save instead of turning into an allow-everything list.
- Numbers are floored and clamped to the middleware's own numOpt ranges,
  so a save that only flips an agent keeps the limit that actually runs
  (maxDepth 500 stays 200, not the page default 40).
- An unknown binaryPolicy is reported and blocks the save.
- A save re-reads the options and reports a conflict when another surface
  changed a managed field; options outside the form are kept.
- logEveryRows has one cap, 100000, in resolvedOptions and onUsage.
- privacy-gate 0.4.1.

Run at 9bb381bf on WSL (Ubuntu 24.04, Bun 1.4.2): bun test in
packages/privacy-gate 77 pass, 0 fail; scripts/check.mjs privacy-gate
clean. Broken by hand: page.test.mjs with 7c119f16's settings.js fails
(maxDepth Expected 200, Received 40). The diff adds no network call.
Not tried: the page in a running magpie.

Co-authored-by: siml1169 <siml1169@users.noreply.github.com>
2026-11-14 22:28:47 +08:00

82 lines
2.0 KiB
JSON

{
"name": "@magpie-community/middleware-privacy-gate",
"version": "0.4.1",
"description": "Structural egress gate for Magpie: withholds or rejects image/file/audio parts, encoded blobs and disallowed models, and guides agents toward local extraction when Magpie cannot mask text. Companion to ShyPie for DeepSeek Harness.",
"type": "module",
"files": [
"privacy-gate.middleware.js",
"README.md",
"BRAND.md",
"assets",
"docs",
"page"
],
"keywords": [
"magpie",
"magpie-middleware",
"gateway-middleware",
"privacy",
"pii",
"dlp",
"security",
"shypie"
],
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/magpie-community/plugins.git",
"directory": "packages/privacy-gate"
},
"magpie": {
"middleware": "./privacy-gate.middleware.js",
"icon": "https://raw.githubusercontent.com/magpie-community/plugins/main/packages/privacy-gate/assets/shypie-icon.svg",
"page": {
"title": "ShyPie Filter",
"titles": {
"zh": "ShyPie 防护"
},
"file": "page/index.html",
"icon": "page/icon.svg"
},
"panels": [
{
"slot": "agents",
"file": "page/agents-panel.html",
"title": "ShyPie protection",
"titles": {
"zh": "ShyPie 防护"
}
}
],
"actions": [
{
"id": "shypie-protection",
"menu": "agent",
"title": "ShyPie protection",
"titles": {
"zh": "ShyPie 防护"
}
}
],
"permissions": [],
"options": {
"allowModels": [],
"localModels": [],
"localProviders": [],
"binaryPolicy": "fail",
"disabledAgents": [],
"protectUnknownAgent": true,
"extraAgents": [],
"guideTools": [],
"allowUnknownProtocol": false,
"blobBase64Chars": 400,
"blobHexChars": 400,
"scanChars": 200000,
"maxNodes": 40000,
"maxDepth": 40,
"logMaxLines": 40,
"logEveryRows": 50
}
}
}