@chatpanel/gateway 0.6.32 → 0.6.33

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chatpanel/gateway",
3
- "version": "0.6.32",
3
+ "version": "0.6.33",
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": {
@@ -66,6 +66,17 @@ export function publicConfig(cfg, { proUnlocked = false } = {}) {
66
66
  };
67
67
  }
68
68
 
69
+ // Selecting a bundled NER model is an explicit request to use that detector, not
70
+ // merely to remember its name. Older configs can carry autostart:false; leaving it
71
+ // untouched makes the selected model work only until restart and then silently
72
+ // falls back to deterministic-only redaction.
73
+ export function applyNerModelSelection(cfg, id) {
74
+ cfg.ner = cfg.ner || { allowDownload: true, enableFullTier: true };
75
+ cfg.ner.model = id;
76
+ cfg.ner.autostart = true;
77
+ return cfg.ner;
78
+ }
79
+
69
80
  // Merge an editable patch into the live cfg. Only known fields; ignores the rest.
70
81
  export function applyConfigPatch(cfg, patch = {}) {
71
82
  if (patch.backend === 'bridge' || patch.backend === 'api') cfg.backend = patch.backend;
package/src/server.js CHANGED
@@ -39,13 +39,13 @@ import * as diarizeEngine from './diarize-engine.js';
39
39
  import { MODEL_CATALOG, isKnownModel, isValidCustomModelId } from './models.js';
40
40
  import { STT_MODEL_CATALOG, isKnownSttModel, isValidCustomSttId, DEFAULT_STT_MODEL, STT_DTYPES, isValidDtype } from './stt-models.js';
41
41
  import { resolvePro, checkQuota, consume, usage } from './freegate.js';
42
- import { publicConfig, applyConfigPatch, persistConfig, configPath } from './configstore.js';
42
+ import { publicConfig, applyConfigPatch, applyNerModelSelection, persistConfig, configPath } from './configstore.js';
43
43
  import { resolveDestination, aggregateModelsAsync } from './router.js';
44
44
  import * as openai from './openai.js';
45
45
  import * as responses from './responses.js';
46
46
  import * as anthropic from './anthropic.js';
47
47
 
48
- export const VERSION = '0.6.32';
48
+ export const VERSION = '0.6.33';
49
49
 
50
50
  // WARM search tier — SQLite + FTS5 record store (falls back to an encrypted-JSON
51
51
  // store if SQLite can't load), fed by the extension's ingest sync + backup-ingest.
@@ -687,7 +687,7 @@ export function createGateway(cfg = loadConfig()) {
687
687
  if (!id || !(isKnownModel(id) || isValidCustomModelId(id))) return sendJson(res, 400, { error: { message: 'unknown or invalid model id', type: 'bad_model' } });
688
688
  // Persist first so a restart keeps the choice, then (re)load. Don't block the
689
689
  // response on a possibly-long download — the client polls GET for progress.
690
- if (cfg.ner) cfg.ner.model = id; else cfg.ner = { autostart: true, model: id, allowDownload: true, enableFullTier: true };
690
+ applyNerModelSelection(cfg, id);
691
691
  try { persistConfig(cfg, configPath()); } catch { /* best effort */ }
692
692
  nerEngine.setModel(id, { onLog: (m) => console.log(m) }).then((ok) => {
693
693
  if (ok && cfg.ner?.enableFullTier && cfg.redaction.tier !== 'full') cfg.redaction.tier = 'full';