@chatpanel/gateway 0.6.2 → 0.6.4

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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/src/server.js +13 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chatpanel/gateway",
3
- "version": "0.6.2",
3
+ "version": "0.6.4",
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": {
@@ -27,7 +27,7 @@
27
27
  "node": ">=18"
28
28
  },
29
29
  "dependencies": {
30
- "@chatpanel/pii": "^0.2.5",
30
+ "@chatpanel/pii": "^0.2.6",
31
31
  "@huggingface/transformers": "^4.2.0",
32
32
  "onnxruntime-web": "1.26.0-dev.20260416-b7804b056c"
33
33
  },
package/src/server.js CHANGED
@@ -35,7 +35,7 @@ import * as openai from './openai.js';
35
35
  import * as responses from './responses.js';
36
36
  import * as anthropic from './anthropic.js';
37
37
 
38
- export const VERSION = '0.6.2';
38
+ export const VERSION = '0.6.4';
39
39
 
40
40
  const KNOWN_AGENTS = new Set(['codex', 'claude', 'opencode', 'pi', 'kiro', 'antigravity']);
41
41
 
@@ -473,6 +473,18 @@ export function createGateway(cfg = loadConfig()) {
473
473
  if (!patch || typeof patch !== 'object') return sendJson(res, 400, { error: 'invalid config patch' });
474
474
  applyConfigPatch(cfg, patch);
475
475
  try { persistConfig(cfg, configPath()); } catch (e) { return sendJson(res, 500, { error: `could not persist config: ${e.message}` }); }
476
+ // The bundled NER engine only auto-loads at startup. If the user just switched
477
+ // detection BACK to the bundled engine (or it never loaded because an external
478
+ // detector was configured at boot), load it now so it doesn't stay "not running"
479
+ // until a restart. (An external detector needs no engine.) Fire-and-forget.
480
+ const det = cfg.redaction?.detection;
481
+ const usingBundled = !det || !det.backend || det.backend === 'off';
482
+ const st = nerEngine.state();
483
+ if (cfg.ner?.autostart && usingBundled && st !== 'ready' && st !== 'loading' && st !== 'downloading') {
484
+ nerEngine.setModel(cfg.ner.model, { onLog: (m) => console.log(m) }).then((ok) => {
485
+ if (ok && cfg.ner?.enableFullTier && cfg.redaction.tier !== 'full') cfg.redaction.tier = 'full';
486
+ });
487
+ }
476
488
  const proUnlocked = await resolvePro(cfg.pro?.entitlementToken);
477
489
  return sendJson(res, 200, publicConfig(cfg, { proUnlocked }));
478
490
  }