@chatpanel/gateway 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/configstore.js +2 -1
- package/src/ner.js +10 -7
- package/src/server.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chatpanel/gateway",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"description": "Local privacy gateway — redacts PII out of OpenAI/Anthropic API traffic before it reaches a model, then restores it in the reply. Point opencode, codex, aider, Claude Code, etc. at it.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
package/src/configstore.js
CHANGED
|
@@ -34,7 +34,8 @@ export function publicConfig(cfg, { proUnlocked = false } = {}) {
|
|
|
34
34
|
redaction: {
|
|
35
35
|
tier: cfg.redaction?.tier,
|
|
36
36
|
redactSystem: cfg.redaction?.redactSystem !== false,
|
|
37
|
-
|
|
37
|
+
// Never echo the detector's apiKey back (write-only, like the tokens).
|
|
38
|
+
detection: (() => { const { apiKey, ...d } = cfg.redaction?.detection || { backend: 'off' }; return d; })(),
|
|
38
39
|
dictionary: Array.isArray(cfg.redaction?.dictionary) ? cfg.redaction.dictionary : [],
|
|
39
40
|
},
|
|
40
41
|
ner: cfg.ner,
|
package/src/ner.js
CHANGED
|
@@ -58,17 +58,20 @@ export function startNer(cfg) {
|
|
|
58
58
|
const n = cfg.ner;
|
|
59
59
|
if (!n || !n.autostart) return null;
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
const port = n.port || 9009;
|
|
62
|
+
const bundledUrl = `http://127.0.0.1:${port}/ner`;
|
|
63
|
+
|
|
64
|
+
// Respect a USER-configured detector pointing elsewhere (a custom NER, a local
|
|
65
|
+
// LLM) — don't relaunch — but still apply the full-tier bump. If detection is
|
|
66
|
+
// off OR points at our own bundled NER, fall through and (re)launch/adopt it,
|
|
67
|
+
// so a persisted "detection→bundled" config doesn't leave NER actually down.
|
|
64
68
|
const det = cfg.redaction?.detection;
|
|
65
|
-
|
|
69
|
+
const userDetector = det && det.backend && det.backend !== 'off' && det.url !== bundledUrl;
|
|
70
|
+
if (userDetector) {
|
|
66
71
|
if (n.enableFullTier && cfg.redaction.tier !== 'full') cfg.redaction.tier = 'full';
|
|
67
|
-
console.log(`[ner]
|
|
72
|
+
console.log(`[ner] using configured detector (${det.backend} ${det.url || ''}) — full tier ${cfg.redaction.tier === 'full' ? 'on' : 'off'}`);
|
|
68
73
|
return null;
|
|
69
74
|
}
|
|
70
|
-
|
|
71
|
-
const port = n.port || 9009;
|
|
72
75
|
let stopped = false;
|
|
73
76
|
let child = null;
|
|
74
77
|
const ac = new AbortController();
|
package/src/server.js
CHANGED
|
@@ -31,7 +31,7 @@ import * as openai from './openai.js';
|
|
|
31
31
|
import * as responses from './responses.js';
|
|
32
32
|
import * as anthropic from './anthropic.js';
|
|
33
33
|
|
|
34
|
-
export const VERSION = '0.1.
|
|
34
|
+
export const VERSION = '0.1.8';
|
|
35
35
|
|
|
36
36
|
const KNOWN_AGENTS = new Set(['codex', 'claude', 'opencode', 'pi', 'kiro', 'antigravity']);
|
|
37
37
|
|