@chatpanel/pii 0.2.5 → 0.2.7

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/pii",
3
- "version": "0.2.5",
3
+ "version": "0.2.7",
4
4
  "description": "The canonical ChatPanel privacy engine — reversible PII redaction + pseudonymization with local entity detection. Pure, dependency-free ESM shared by the ChatPanel extension, gateway, and bridge.",
5
5
  "type": "module",
6
6
  "main": "index.js",
package/pii-detect.js CHANGED
@@ -116,7 +116,13 @@ async function detectViaEndpoint(text, det, signal, fetchImpl) {
116
116
 
117
117
  async function detectViaOpenAI(text, det, signal, fetchImpl) {
118
118
  const base = String(det.url || '').replace(/\/$/, '');
119
- const url = /\/chat\/completions$/.test(base) ? base : `${base}/v1/chat/completions`;
119
+ // Build the chat URL the SAME way the chat path does. An OpenAI-compatible baseUrl
120
+ // already ends in /v1 (Ollama, OpenRouter, NVIDIA, OpenAI…) → only add
121
+ // /chat/completions (appending /v1/chat/completions would 404 on /v1/v1/…). A bare
122
+ // host gets /v1/chat/completions; a full chat URL is used as-is.
123
+ const url = /\/chat\/completions$/.test(base) ? base
124
+ : /\/v\d+$/.test(base) ? `${base}/chat/completions`
125
+ : `${base}/v1/chat/completions`;
120
126
  const res = await fetchImpl(url, {
121
127
  method: 'POST',
122
128
  headers: { 'Content-Type': 'application/json', ...(det.apiKey ? { Authorization: `Bearer ${det.apiKey}` } : {}) },
package/pipeline.js CHANGED
@@ -22,10 +22,11 @@ export function effectiveTier(cfg, isPro) {
22
22
  return t === 'full' && !isPro ? 'basic' : t;
23
23
  }
24
24
 
25
- // Free ceiling: deterministic SECRET redaction on CHAT only, with a small
26
- // dictionary. Names/orgs (full tier), wider scope, an unlimited dictionary, and
27
- // the model layer are Pro. Enforced here as defense-in-depth.
28
- export const FREE_DICT_LIMIT = 3;
25
+ // Free ceiling: a generous custom dictionary so Free users can fully experience
26
+ // the feature. The first FREE_DICT_LIMIT entries apply; an unlimited dictionary
27
+ // (plus wider scope and the model layer) is Pro. Enforced here as defense-in-
28
+ // depth the UI also surfaces the cap, but never trust the UI alone.
29
+ export const FREE_DICT_LIMIT = 100;
29
30
 
30
31
  export function gatedDictionary(cfg, isPro) {
31
32
  const d = Array.isArray(cfg?.dictionary) ? cfg.dictionary : [];