dsh-privacy-gateway 0.1.1 → 0.1.2

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/README.en.md CHANGED
@@ -54,6 +54,7 @@ someone@gmail.com → EMAIL
54
54
  - A word in 「自定义敏感词」 is replaced where it appears and recorded as `TERM`; a value in 「永不脱敏的值」 or `allow` goes out as it is.
55
55
  - A private key goes whole: `-----BEGIN` to `-----END`, or a truncated one with only the opening lines and base64.
56
56
  - A documentation domain (`example.com`, `.example`) is no email; a phone number needs 11 digits, an ID card its check digit, a bank card its Luhn sum.
57
+ - A field's value is no secret when it is a file's name: only a file name's characters, and an extension of a known kind (model weights such as `safetensors`, `gguf`, `ckpt`, archives, pictures, sound and video, documents and data); it goes out as it is ([ADR-0026](docs/adr/0026-file-name-values.md)).
57
58
  - One value seen again gets the same placeholder.
58
59
 
59
60
  ## Screens
@@ -110,7 +111,7 @@ Only a model request that had something masked or restored makes a record, one e
110
111
 
111
112
  The head keeps a few characters to recognize it by: a key with a prefix keeps the prefix and the 4 characters after it, one without keeps its first 4, and a long value also keeps its last 2 (`sk-proj-g6sx…3QaZ`); shorter values keep fewer. Personal data and the user's words still keep one character ([ADR-0019](docs/adr/0019-hint.md)).
112
113
 
113
- Records go to `~/.dsh/privacy-gateway/masking/YYYY-MM-DD.jsonl`, one file a day; the directory is 0700 and the files 0600. A failed write is logged as a warning and the request goes on.
114
+ Records go to a `masking/YYYY-MM-DD.jsonl`, one file a day; the directory is 0700 and the files 0600. State lives in the current instance's own directory (`~/.dsh/profiles/<profile>/plugin-data/dsh-privacy-gateway/`), so two instances never write into each other ([ADR-0027](docs/adr/0027-per-instance-state.md)). A failed write is logged as a warning and the request goes on.
114
115
 
115
116
  The plugin's detail page has a statistics card at the bottom: today / 7 days / 30 days, the counts, the distributions by kind / finder / host, and the latest 200 records, 10 a page, each with its workspace · session title; open one to see each of its values. The card's 「清空数据」 (Clear data) button, once its confirmation box is checked, deletes the records, counts and record files of every session; this cannot be undone ([ADR-0022](docs/adr/0022-reset.md)). With `showPanel` on, the same view is a 「隐私保护」 (Privacy) tab at the top of the session, counting only that session. The tab's 「本会话脱敏」 (Mask this session) switch turns masking off for that one session after a confirmation; other sessions are still masked, and the choice holds across restarts ([ADR-0023](docs/adr/0023-session-switch.md)).
116
117
 
@@ -144,7 +145,7 @@ For CI and releases see [ADR-0007](docs/adr/0007-release-process.md) and [.githu
144
145
  ## Conventions
145
146
 
146
147
  - The package name, cordis row name, loader id and settings namespace are all `dsh-privacy-gateway` (the row name must equal the package name).
147
- - State lives in `~/.dsh/privacy-gateway/`; the `DSH_PRIVACY_GATEWAY_HOME` environment variable moves it.
148
+ - State lives in the current instance's own directory (`plugin-data/dsh-privacy-gateway/` under `ctx.profileContext.dir`), falling back to `~/.dsh/privacy-gateway/` when there is no profile; the `DSH_PRIVACY_GATEWAY_HOME` environment variable wins over both ([ADR-0027](docs/adr/0027-per-instance-state.md)).
148
149
  - The config schema holds no `.transform()` or other callback-bearing node.
149
150
  - `scripts` declares no install-time lifecycle script.
150
151
  - Other dispatcher plugins join under the gateway through the composition contract of [ADR-0012](docs/adr/0012-dispatcher-composition.md) (`chainTo`, `below`, `release`, `downstreams`).
package/README.md CHANGED
@@ -54,6 +54,7 @@ someone@gmail.com → EMAIL
54
54
  - 「自定义敏感词」里的词按词替换,记为 `TERM`;「永不脱敏的值」和 `allow` 里的原样发出。
55
55
  - 私钥整段一起换:`-----BEGIN` 到 `-----END`,或只有开头一段 base64 的截断私钥。
56
56
  - 文档域名(`example.com`、`.example`)不算邮箱;手机号要 11 位、身份证要过校验位、银行卡要过 Luhn,否则不换。
57
+ - 字段的值是一个文件名时不是密钥:只由文件名的字符组成、且扩展名是已知的文件类型(模型权重 `safetensors`/`gguf`/`ckpt` 等、压缩包、图片音视频、文档数据),原样发出([ADR-0026](docs/adr/0026-file-name-values.md))。
57
58
  - 同一个值重复出现,占位符相同。
58
59
 
59
60
  ## 界面
@@ -108,7 +109,7 @@ someone@gmail.com → EMAIL
108
109
 
109
110
  「开头」保留的是辨识用的几个字符:有前缀的密钥留下前缀和它后面的 4 个,没有前缀的留前 4 个,长值再加末尾 2 个(`sk-proj-g6sx…3QaZ`),短值更少;个人信息和自定义词仍只留 1 个([ADR-0019](docs/adr/0019-hint.md))。
110
111
 
111
- 记录按天写在 `~/.dsh/privacy-gateway/masking/YYYY-MM-DD.jsonl`,目录 0700、文件 0600。写盘失败只告警,不影响请求。
112
+ 记录按天写在一个按天命名的 `masking/YYYY-MM-DD.jsonl`,目录 0700、文件 0600。状态放在当前实例自己的目录里(`~/.dsh/profiles/<profile>/plugin-data/dsh-privacy-gateway/`),几个实例不会写到一起([ADR-0027](docs/adr/0027-per-instance-state.md))。写盘失败只告警,不影响请求。
112
113
 
113
114
  插件详情页下方有一张统计卡:今日 / 7 天 / 30 天切换,计数、按 kind / finder / host 的分布、最近 200 条记录(每页 10 条,每条带着工作区 · 会话标题),点开一条看每个值的明细。卡片右上角的「清空数据」勾选确认后,删除所有会话的记录、统计和磁盘上的记录文件,无法恢复([ADR-0022](docs/adr/0022-reset.md))。打开 `showPanel` 后,同样的内容也出现在会话顶部的「隐私保护」标签页里,只统计当前会话。标签页头部的「本会话脱敏」开关可以只关掉这一个会话的脱敏,确认后生效,其他会话照常脱敏,重启后仍然保持([ADR-0023](docs/adr/0023-session-switch.md))。
114
115
 
@@ -142,7 +143,7 @@ CI 与发布见 [ADR-0007](docs/adr/0007-release-process.md) 和 [.github/RELEAS
142
143
  ## 约定
143
144
 
144
145
  - 包名、cordis 行名、loader id、设置命名空间都是 `dsh-privacy-gateway`(行名必须等于包名)。
145
- - 状态目录 `~/.dsh/privacy-gateway/`,可用环境变量 `DSH_PRIVACY_GATEWAY_HOME` 改。
146
+ - 状态目录是当前实例自己的目录(`ctx.profileContext.dir` 下 `plugin-data/dsh-privacy-gateway/`),没有 profile 时退回 `~/.dsh/privacy-gateway/`;环境变量 `DSH_PRIVACY_GATEWAY_HOME` 优先于两者([ADR-0027](docs/adr/0027-per-instance-state.md))。
146
147
  - 配置 schema 里不放 `.transform()` 或任何带回调的节点。
147
148
  - `scripts` 里不挂安装期生命周期脚本。
148
149
  - 其它 dispatcher 插件挂到网关下游时,按 [ADR-0012](docs/adr/0012-dispatcher-composition.md) 的合成契约(`chainTo`、`below`、`release`、`downstreams`)。
package/lib/client.js CHANGED
@@ -1,7 +1,7 @@
1
1
  window.__ModuleLoader__.load({ id: "dsh-privacy-gateway", factory: (require) => {
2
2
  var module = { exports: {} }; var exports = module.exports;
3
3
  "use strict";var pe=require("react");var pt=require("@deepseek-ai/dsh-client-ui-primitives"),g=require("react");var I=require("@deepseek-ai/dsh-client-ui-primitives"),m=require("react");var ne=["mask","lists","record","view"],ae=[{key:"enabled",group:"mask",kind:"switch",default:!0,risk:"send"},{key:"secrets",group:"mask",kind:"switch",default:!0,half:!0,risk:"send"},{key:"personal",group:"mask",kind:"switch",default:!1,half:!0,risk:"send"},{key:"shape",group:"mask",kind:"switch",default:!1,half:!0},{key:"toolGuard",group:"mask",kind:"choice",choices:["off","warn","block"],default:"off",half:!0},{key:"words",group:"lists",kind:"list",default:[],anyCase:!1,half:!0,risk:"send",risky:"remove"},{key:"allow",group:"lists",kind:"list",default:[],anyCase:!0,half:!0,risk:"send",risky:"add"},{key:"record",group:"record",kind:"switch",default:!0,half:!0,risk:"delete"},{key:"keepDays",group:"record",kind:"count",min:1,default:30,half:!0,risk:"delete"},{key:"recordContext",group:"record",kind:"switch",default:!0},{key:"vendorView",group:"record",kind:"switch",default:!1,risk:"delete"},{key:"showPanel",group:"view",kind:"switch",default:!1},{key:"excludeProviders",group:"view",kind:"providers",default:[],risk:"send"}];function Ne(e,t,n){if(e.risk)switch(e.kind){case"switch":return Y(t,e.default)&&!Y(n,e.default)?{risk:e.risk}:void 0;case"list":case"providers":{let a=e.kind==="providers"||e.anyCase,r=p=>a?p.trim().toLowerCase():p.trim(),s=(p,l)=>{let b=new Set(p.map(r));return l.filter(v=>!b.has(r(v)))},i=V(t,e.default),c=V(n,e.default);if(e.kind==="list"&&e.risky==="remove"){let p=s(c,i);return p.length>0?{risk:e.risk,removed:p}:void 0}let u=s(i,c);return u.length>0?{risk:e.risk,added:u}:void 0}case"count":{let a=Z(t,e.min,e.default),r=Z(n,e.min,e.default);return r<a?{risk:e.risk,from:a,to:r}:void 0}case"choice":return}}function Se(e){return e.kind==="switch"||e.kind==="choice"||e.kind==="count"}function W(e,t){let n=ae.find(a=>a.key===e&&a.kind===t);if(!n)throw new Error(`no ${t} field ${e}`);return n}function Re(e,t){let n=a=>Y(t[a],W(a,"switch").default);switch(e){case"mask":{if(!n("enabled"))return[{key:"cfg.s.maskOff",off:!0}];let a=["secrets","personal"].filter(n),r=a.length===0?[{key:"cfg.s.maskNothing",off:!0}]:a.map(i=>({key:`cfg.s.${i}`}));n("shape")&&r.push({key:"cfg.s.shape"});let s=W("toolGuard","choice");return r.push({key:`cfg.s.toolGuard.${we(t.toolGuard,s.choices,s.default)}`}),r}case"lists":return[{key:"cfg.s.words",params:{n:V(t.words,W("words","list").default).length}},{key:"cfg.s.allow",params:{n:V(t.allow,W("allow","list").default).length}}];case"record":{let a=W("keepDays","count"),r=n("record")?[{key:"cfg.s.record",params:{n:Z(t.keepDays,a.min,a.default)}}]:[{key:"cfg.s.recordOff",off:!0}];return n("vendorView")&&r.push({key:"cfg.s.vendorView"}),r}case"view":{let a=V(t.excludeProviders,W("excludeProviders","providers").default).length;return[n("showPanel")?{key:"cfg.s.panel"}:{key:"cfg.s.panelOff",off:!0},a===0?{key:"cfg.s.providersAll"}:{key:"cfg.s.providersSome",params:{n:a}}]}}}function Y(e,t){return typeof e=="boolean"?e:t}function we(e,t,n){return typeof e=="string"&&t.includes(e)?e:n}function V(e,t){return Array.isArray(e)?e.filter(n=>typeof n=="string"):[...t]}function Z(e,t,n){return typeof e=="number"&&Number.isFinite(e)&&e>=t?Math.floor(e):n}function Te(e,t,n){let a=t.trim();if(a==="")return;let r=n?s=>s.trim().toLowerCase()===a.toLowerCase():s=>s.trim()===a;return e.some(r)?void 0:[...e,a]}function Pe(e,t){return e.filter(n=>n!==t)}function Ie(e,t){let n=e.trim();if(!/^\d+$/.test(n))return;let a=Number(n);return Number.isSafeInteger(a)&&a>=t?a:void 0}function Oe(e,t){return e.length===0?{kind:"none"}:e.length<=2?{kind:"some",names:e.join(t)}:{kind:"many",names:e.slice(0,2).join(t),n:e.length}}function Fe(e){let t=["pgw-cfg__row",e.inline?"pgw-cfg__row--inline":"",e.half?"pgw-cfg__row--half":""].filter(Boolean).join(" ");return(0,m.createElement)("div",{className:t},(0,m.createElement)("div",{className:"pgw-cfg__text"},(0,m.createElement)("div",{className:"pgw-cfg__name",id:e.titleId},e.title),(0,m.createElement)("div",{className:"pgw-cfg__desc"},e.hint),e.note??null),(0,m.createElement)("div",{className:"pgw-cfg__control"},e.children))}function Me(e){let t=(0,m.useId)();return(0,m.createElement)("section",{className:"pgw-fold","data-open":e.open||void 0},(0,m.createElement)("h4",{className:"pgw-fold__heading"},(0,m.createElement)("button",{type:"button",id:`${t}-h`,className:"pgw-fold__head","aria-expanded":e.open,"aria-controls":e.open?`${t}-b`:void 0,title:e.toggleLabel,onClick:e.onToggle},(0,m.createElement)(I.IconChevronDownOutlineRegular,{className:"pgw-fold__chevron"}),(0,m.createElement)("span",{className:"pgw-fold__title"},e.title),e.open?null:(0,m.createElement)("span",{className:"pgw-fold__summary"},e.summary))),e.open?(0,m.createElement)("div",{id:`${t}-b`,role:"region","aria-labelledby":`${t}-h`,className:"pgw-fold__body"},(0,m.createElement)("div",{className:"pgw-fold__grid"},e.children)):null)}function Ee(e){return(0,m.createElement)(I.Switch,{checked:e.checked,label:e.label,disabled:e.disabled,onChange:e.onChange})}function he(e){let[t,n]=(0,m.useState)(!1),a=(0,m.useId)();return(0,m.useEffect)(()=>{e.disabled&&n(!1)},[e.disabled]),(0,m.createElement)(I.Menu,{open:t,onClose:()=>n(!1),items:e.items,...e.multi?{selectedIds:e.selectedIds??[],selection:"check"}:{selectedId:e.selectedId},onSelect:r=>{e.multi||n(!1),e.onSelect(r)},align:"start",portal:!0,anchor:(0,m.createElement)("button",{type:"button",className:"pgw-select","aria-haspopup":"menu","aria-expanded":t,"aria-labelledby":e.labelledBy?`${e.labelledBy} ${a}`:void 0,disabled:e.disabled||e.items.length===0,onClick:()=>n(r=>!r)},(0,m.createElement)("span",{className:"pgw-select__label",id:a},e.label),(0,m.createElement)(I.IconChevronDownOutlineRegular,{className:"pgw-select__chevron"}))})}function Ae(e){let{t}=e,[n,a]=(0,m.useState)(""),[r,s]=(0,m.useState)(!1),i=Te(e.list,n,e.anyCase),c=()=>{if(!i||e.disabled||r)return;let u=n;s(!0),e.onChange(i).then(p=>{s(!1),p&&a(l=>l===u?"":l)})};return(0,m.createElement)("div",{className:"pgw-cfg__list"},(0,m.createElement)("div",{className:"pgw-cfg__add"},(0,m.createElement)(I.Input,{className:"pgw-cfg__input",type:"text",value:n,placeholder:e.placeholder,"aria-label":e.placeholder,disabled:e.disabled,onChange:u=>a(u.target.value),onKeyDown:u=>{u.key==="Enter"&&(u.preventDefault(),c())}}),(0,m.createElement)(I.Button,{variant:"outline",size:"sm",disabled:e.disabled||r||!i,onClick:c},t("cfg.add"))),e.list.length===0?(0,m.createElement)("div",{className:"pgw-cfg__desc"},t("cfg.listEmpty")):(0,m.createElement)("div",{className:"pgw-cfg__tags"},e.list.map(u=>(0,m.createElement)(I.Tag,{key:u,tone:"neutral",className:"pgw-cfg__tag",title:u},(0,m.createElement)("span",{className:"pgw-cfg__tagText"},u),(0,m.createElement)("button",{type:"button",className:"pgw-cfg__tagX","aria-label":t("cfg.remove",{name:u}),disabled:e.disabled,onClick:()=>{e.onChange(Pe(e.list,u))}},(0,m.createElement)(I.IconCloseOutlineRegular,{size:12}))))))}function $e(e){let[t,n]=(0,m.useState)(String(e.value)),a=(0,m.useRef)(void 0);(0,m.useEffect)(()=>n(String(e.value)),[e.value]);let r=Ie(t,e.min),s=()=>{if(r===void 0||r===e.value||r===a.current)return;let i=e.value;a.current=r,e.onChange(r).then(c=>{a.current=void 0,c||n(String(i))})};return(0,m.createElement)("div",{className:"pgw-cfg__list"},(0,m.createElement)(I.Input,{className:"pgw-cfg__input pgw-cfg__input--count",type:"number",inputMode:"numeric",min:e.min,step:1,value:t,"aria-label":e.label,"aria-invalid":r===void 0,disabled:e.disabled,onChange:i=>n(i.target.value),onBlur:s,onKeyDown:i=>{i.key==="Enter"&&s()}}),r===void 0?(0,m.createElement)("div",{className:"pgw-cfg__desc pgw-cfg__desc--error",role:"alert"},e.t("cfg.countInvalid",{min:e.min})):null)}function Ve(e,t=6,n="\u2026"){let a=Object.entries(e).filter(([,c])=>c>0).sort((c,u)=>u[1]-c[1]||(c[0]<u[0]?-1:1)),r=a.slice(0,t),s=a.slice(t).reduce((c,[,u])=>c+u,0);s>0&&r.push([n,s]);let i=r.reduce((c,[,u])=>Math.max(c,u),0);return r.map(([c,u])=>({label:c,value:u,pct:i>0?Math.max(2,Math.round(u/i*100)):0}))}function De(e,t){let n=[];return e.stats.failStreak>0&&n.push({key:"warn.streak",n:e.stats.failStreak,tone:"error"}),t.unmapped>0&&n.push({key:"warn.unmapped",n:t.unmapped,tone:"warn"}),(t.exfil??0)>0?n.push({key:"warn.exfil",n:t.exfil,tone:"error"}):t.restoredInTools>0&&n.push({key:"warn.inTools",n:t.restoredInTools,tone:"warn"}),n}function Le(e){let t=n=>Math.round(n*100)/100;return{avg:e.requests>0?t(e.tookMs.sum/e.requests):0,max:t(e.tookMs.max)}}function ve(e,t=new Date){let n=new Date(e);if(Number.isNaN(n.getTime()))return"";let a=s=>String(s).padStart(2,"0");return n.getFullYear()===t.getFullYear()&&n.getMonth()===t.getMonth()&&n.getDate()===t.getDate()?`${a(n.getHours())}:${a(n.getMinutes())}:${a(n.getSeconds())}`:`${a(n.getMonth()+1)}-${a(n.getDate())} ${a(n.getHours())}:${a(n.getMinutes())}`}var j=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),N=e=>typeof e=="number"&&Number.isFinite(e)?e:0;function re(e){let t={};if(j(e))for(let[n,a]of Object.entries(e))typeof a=="number"&&Number.isFinite(a)&&(t[n]=a);return t}function ye(e){if(!j(e))return;let t=j(e.tookMs)?e.tookMs:{};return{requests:N(e.requests),masked:N(e.masked),n:N(e.n),restored:N(e.restored),restoredInTools:N(e.restoredInTools),unmapped:N(e.unmapped),failed:N(e.failed),warned:N(e.warned),blocked:N(e.blocked),exfil:N(e.exfil),exfilBlocked:N(e.exfilBlocked),tookMs:{sum:N(t.sum),max:N(t.max)},kinds:re(e.kinds),finders:re(e.finders),hosts:re(e.hosts),models:re(e.models)}}function Ct(e){return j(e)&&typeof e.key=="number"&&typeof e.time=="string"&&Array.isArray(e.values)&&e.values.every(j)}function Be(e){if(!j(e)||typeof e.active!="boolean"||!j(e.stats)||!Array.isArray(e.recent))return;let t=ye(e.stats.today),n=ye(e.stats.week),a=ye(e.stats.month);if(!(!t||!n||!a))return{...e,values:N(e.values),stats:{today:t,week:n,month:a,failStreak:N(e.stats.failStreak)},recent:e.recent.filter(Ct).map(({valuesOmitted:r,...s})=>{let i=N(r);return{...s,n:N(s.n),restored:N(s.restored),unmapped:N(s.unmapped),...i>0?{valuesOmitted:i}:{}}}),...Array.isArray(e.views)?{views:e.views.filter(r=>typeof r=="number")}:{}}}function ze(e,t){return t.ok?{status:"ready",data:t.value}:e.status==="ready"?{status:"ready",data:e.data,stale:t.failure}:{status:"error",failure:t.failure}}var Nt=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");function Ke(e){let t=e;try{t=JSON.stringify(JSON.parse(e),null,2)}catch{}return t.split(`
4
- `)}function je(e){return e.map(t=>t.placeholder).join("\0")}function Ge(e,t,n,a=400){let r=[...new Set(t.filter(u=>u!==""))].sort((u,p)=>p.length-u.length),s=r.length>0?new RegExp(r.map(Nt).join("|"),"g"):void 0,i=[],c=!1;for(let u=0;u<e.length;u++){let p=e[u],l=[],b=0;if(s)for(let v of p.matchAll(s))v.index>b&&l.push({text:p.slice(b,v.index)}),l.push({text:v[0],id:v[0]}),b=v.index+v[0].length;if(!(n&&b===0)){if((b<p.length||l.length===0)&&l.push({text:p.slice(b)}),i.length>=a){c=!0;break}i.push({n:u+1,parts:l})}}return{lines:i,truncated:c}}function qe(e,t,n){let a=Math.max(1,Math.ceil(e.length/n)),r=Math.min(Math.max(0,Math.floor(t)),a-1);return{items:e.slice(r*n,r*n+n),page:r,pages:a}}function We(e){let{path:t,role:n,type:a}=e,r=t.split(".")[0]??"";return n==="system"||n==="developer"||r==="system"||r==="instructions"||r==="systemInstruction"?"place.system":n==="tool"||a==="tool_result"||a==="function_call_output"||a==="functionResponse"?"place.toolResult":a==="tool_use"||a==="function_call"||/(^|\.)(tool_calls|function_call)(\.|$)/.test(t)||t.endsWith(".arguments")?"place.toolCall":n==="user"?"place.user":n==="assistant"||n==="model"?"place.assistant":"place.other"}function oe(e){return e.head?e.tail?`${e.head}\u2026${e.tail}`:`${e.head}\u2026`:""}function H(e,t){return t({noConnection:"err.noConnection",malformed:"err.malformed",remote:"err.remote",thrown:"err.thrown"}[e.code],"message"in e?{message:e.message}:void 0)}async function ee(e,t,n,a,r){let s;try{s=e.get("connection")?.rpc}catch{s=void 0}if(!s||typeof s.call!="function")return{ok:!1,failure:{code:"noConnection"}};try{let i=n===void 0?{}:{request:n},c=await s.call("/api",`privacyGateway/${t}`,{args:i},r);if(c?.ok!==!0){let p=c?.error?.message;return{ok:!1,failure:typeof p=="string"&&p!==""?{code:"remote",message:p}:{code:"malformed"}}}let u=a(c.value);return u===void 0?{ok:!1,failure:{code:"malformed"}}:{ok:!0,value:u}}catch(i){return{ok:!1,failure:{code:"thrown",message:i instanceof Error?i.message:String(i)}}}}function se(e,t,n,a){return ee(e,"overview",a?{limit:t,session:a}:{limit:t},Be,n)}function He(e,t,n){return ee(e,"vendorView",{key:t},a=>{let r=a?.body;return a!==null&&typeof a=="object"&&typeof r=="string"?r:null},n)}function Ue(e){return ee(e,"reset",void 0,t=>{let n=t?.files;return typeof n=="number"?n:0})}function Qe(e,t,n){return ee(e,"sessionMasking",{session:t,on:n},a=>{let r=a?.on;return typeof r=="boolean"?r:void 0})}function Je(e,t){return ee(e,"providers",void 0,n=>Array.isArray(n)?n.flatMap(St):void 0,t)}function St(e){let t=e;return t!==null&&typeof t=="object"&&typeof t.id=="string"&&t.id!==""?[{id:t.id,name:typeof t.name=="string"&&t.name!==""?t.name:t.id}]:[]}function ie(e){let t=e,n=new Set;return{get:()=>t,set(a){if(!Object.is(a,t)){t=a;for(let r of[...n])try{r()}catch{}}},subscribe(a){return n.add(a),()=>{n.delete(a)}}}}var Rt="Show the Privacy tab at the top of the session";function Tt(e){let t=e,n=t?.refs,r=(n!==null&&typeof n=="object"&&typeof t?.uid<"u"?n[String(t.uid)]:void 0)?.dict??t?.dict;return r!==null&&typeof r=="object"?Object.keys(r):[]}function be(e){for(let t of e){let n=Tt(t.schema);if(n.includes("showPanel")&&(t.ns.includes("privacy-gateway")||n.includes("excludeProviders")||JSON.stringify(t.schema??null).includes(Rt)))return t.ns}}function Pt(e){let t=be(e);if(t===void 0)return;let n=e.find(a=>a.ns===t)?.value;return typeof n=="object"&&n!==null&&n.showPanel===!0}function It(e){let t=e;return t!=null&&typeof t.describe=="function"&&typeof t.get=="function"?t:void 0}var G=ie(void 0);function Xe(e){let t=n=>n.effect(()=>{let a;try{a=It(n.get("configForms"))}catch{a=void 0}return G.set(a),()=>{G.get()===a&&G.set(void 0)}},"dsh-privacy-gateway: settings service");typeof e.inject=="function"?e.inject(["configForms"],t):t(e)}var Ot=6e4;function Ft(e,t){return t===void 0?e:t||e===!0?!0:e===!1?!1:void 0}function Ye(e,t,n=G){let a=!1,r,s,i,c=()=>{if(a)return;let k=Ft(s,i);k===void 0||k===r||(r=k,t(k))},u=()=>{se(e,1).then(k=>{a||!k.ok||(s=k.value.showPanel===!0,c())})},p,l=k=>{try{p?.()}catch{}p=void 0,i=void 0;let w;try{w=k?.describe()}catch{w=void 0}if(w){let F=w,M=()=>{if(a)return;let B=F.getSnapshot().view;if(!B)return;let z=Pt(B.namespaces);z!==void 0&&(i=z,c())};p=F.subscribe(M),Promise.resolve(F.ensure()).then(M,M),M()}c()},b=n.subscribe(()=>l(n.get()));l(n.get()),u();let v=setInterval(u,Ot);return()=>{a=!0,clearInterval(v),b();try{p?.()}catch{}}}function Ze(e,t){let n=r=>t.some(s=>s.toLowerCase()===r.toLowerCase()),a=e.map(r=>({id:r.id,name:r.name,excluded:n(r.id),registered:!0}));for(let r of t)a.some(s=>s.id.toLowerCase()===r.toLowerCase())||a.push({id:r,name:r,excluded:!0,registered:!1});return a}function et(e,t){let n=t.toLowerCase();return e.some(a=>a.toLowerCase()===n)?e.filter(a=>a.toLowerCase()!==n):[...e,t]}var ct=require("react");var L="privacyGateway",Mt={"card.title":"\u8131\u654F\u7EDF\u8BA1","card.on":"\u8131\u654F\u5F00\u542F","card.off":"\u8131\u654F\u5DF2\u5173\u95ED","card.refresh":"\u5237\u65B0","card.loading":"\u6B63\u5728\u8BFB\u53D6\u2026","card.unavailable":"\u8BFB\u4E0D\u5230\u7EDF\u8BA1\uFF1A\u63D2\u4EF6\u7684 host \u7AEF\u6CA1\u6709\u8FD0\u884C\uFF0C\u6216\u9700\u8981\u91CD\u542F dsh\u3002","card.memoryOnly":"\u8BB0\u5F55\u53EA\u5728\u5185\u5B58\uFF08record \u5DF2\u5173\u95ED\uFF09","card.values":"\u5185\u5B58\u91CC\u53EF\u8FD8\u539F\u7684\u503C {n} \u4E2A","card.range":"\u7EDF\u8BA1\u8303\u56F4","card.reset":"\u6E05\u7A7A\u6570\u636E","card.resetTitle":"\u6E05\u7A7A\u9690\u79C1\u4FDD\u62A4\u7684\u5386\u53F2\u6570\u636E\uFF1F","card.resetBody":"\u4F1A\u5220\u9664\u6240\u6709\u4F1A\u8BDD\u7684\u8131\u654F\u8BB0\u5F55\u548C\u7EDF\u8BA1\uFF0C\u5305\u62EC\u78C1\u76D8\u4E0A ~/.dsh/privacy-gateway/masking/ \u91CC\u7684\u8BB0\u5F55\u6587\u4EF6\uFF0C\u4EE5\u53CA\u5185\u5B58\u91CC\u4FDD\u7559\u7684\u53D1\u51FA\u5185\u5BB9\u526F\u672C\u3002\u6E05\u7A7A\u540E\u65E0\u6CD5\u6062\u590D\u3002\u8131\u654F\u89C4\u5219\u3001\u914D\u7F6E\u548C\u6B63\u5728\u8FDB\u884C\u7684\u8BF7\u6C42\u4E0D\u53D7\u5F71\u54CD\u3002","card.resetAck":"\u6211\u77E5\u9053\u6E05\u7A7A\u540E\u65E0\u6CD5\u6062\u590D","card.resetConfirm":"\u6E05\u7A7A","card.cancel":"\u53D6\u6D88","card.close":"\u5173\u95ED","card.resetDone":"\u5DF2\u6E05\u7A7A\uFF0C\u5220\u9664\u4E86 {n} \u4E2A\u8BB0\u5F55\u6587\u4EF6\u3002","card.resetFailed":"\u6CA1\u80FD\u6E05\u7A7A\uFF1A{message}","stat.took":"\u5E73\u5747\u8017\u65F6","stat.tookMax":"\u6700\u957F {max} ms","stat.ms":"{n} ms","recent.count":"\u5171 {n} \u6761","recent.col.time":"\u65F6\u95F4","recent.col.where":"\u6A21\u578B / host","recent.col.from":"\u6765\u6E90","recent.col.places":"\u66FF\u6362","recent.col.restored":"\u8FD8\u539F","page.at":"{page} / {pages}","range.today":"\u4ECA\u65E5","range.week":"7 \u5929","range.month":"30 \u5929","stat.requests":"\u8BB0\u5F55\u7684\u8BF7\u6C42","stat.masked":"\u6709\u8131\u654F","stat.n":"\u66FF\u6362\u5904","stat.restored":"\u8FD8\u539F\u5904","stat.inTools":"\u5176\u4E2D\u5DE5\u5177\u53C2\u6570 {n}","stat.unmapped":"\u672A\u77E5\u5360\u4F4D\u7B26","stat.failed":"\u8131\u654F\u5931\u8D25","dist.kind":"\u6309 kind","dist.finder":"\u6309 finder","dist.host":"\u6309 host","dist.empty":"\u6682\u65E0","warn.streak":"\u8FDE\u7EED {n} \u6B21\u8131\u654F\u5931\u8D25\uFF0C\u8BF7\u6C42\u672A\u53D1\u51FA\u3002\u7528 /privacy off \u6B62\u8840\u3002","warn.unmapped":"\u56DE\u590D\u91CC\u6709 {n} \u4E2A\u503C\u8868\u91CC\u6CA1\u6709\u7684\u5360\u4F4D\u7B26\uFF0C\u53EF\u80FD\u88AB\u6A21\u578B\u6539\u574F\u4E86\u3002","warn.inTools":"\u6709 {n} \u5904\u8FD8\u539F\u843D\u5728\u5DE5\u5177\u8C03\u7528\u53C2\u6570\u91CC\uFF0C\u5DE5\u5177\u6267\u884C\u65F6\u771F\u503C\u4F1A\u88AB\u7528\u5230\uFF1B\u5982\u679C\u4E0D\u662F\u4F60\u9884\u671F\u7684\uFF0C\u68C0\u67E5\u6700\u8FD1\u7684\u5DE5\u5177\u8C03\u7528\u3002","recent.title":"\u6700\u8FD1\u8BB0\u5F55","recent.empty":"\u8FD8\u6CA1\u6709\u8BB0\u5F55\u3002","recent.failed":"\u5931\u8D25","col.placeholder":"\u5360\u4F4D\u7B26","col.kind":"kind","col.finder":"finder","col.head":"\u5F00\u5934","recent.placesHint":"\u8BF7\u6C42\u91CC\u88AB\u6362\u6210\u5360\u4F4D\u7B26\u7684\u5904\u6570\uFF08\u4E0D\u662F\u53D1\u51FA\u53BB\u7684\u503C\u7684\u6570\u91CF\uFF09","recent.restoredHint":"\u56DE\u590D\u91CC\u51FA\u73B0\u5360\u4F4D\u7B26\u3001\u88AB\u6362\u56DE\u771F\u503C\u7684\u5904\u6570\uFF1B\u6A21\u578B\u4E0D\u5FC5\u590D\u8FF0\u6BCF\u4E2A\u503C\uFF0C\u6240\u4EE5\u4E24\u8005\u901A\u5E38\u4E0D\u76F8\u7B49","col.len":"\u957F\u5EA6","col.n":"\u6B21\u6570","recent.noValues":"\u8FD9\u6B21\u8BF7\u6C42\u6CA1\u6709\u8131\u654F\u3002","recent.omitted":"\u53E6\u6709 {n} \u4E2A\u503C\u8D85\u51FA\u5355\u6761\u8BB0\u5F55\u7684\u4E0A\u9650\uFF0C\u6CA1\u6709\u5217\u51FA\u3002","stat.warned":"warn \u7167\u53D1","stat.blocked":"block \u62E6\u4E0B","stat.exfil":"\u5916\u5E26\u5DE5\u5177\u8C03\u7528","stat.exfilBlocked":"\u5176\u4E2D {n} \u5904\u672A\u8FD8\u539F","warn.exfil":"\u6709 {n} \u6B21\u5DE5\u5177\u8C03\u7528\u628A\u8FD8\u539F\u51FA\u7684\u503C\u5199\u8FDB\u4E86\u6307\u5411\u672C\u673A\u4EE5\u5916 host \u7684\u53C2\u6570\uFF0C\u5C55\u5F00\u6700\u8FD1\u8BB0\u5F55\u67E5\u770B host\u3002","recent.blocked":"\u5DF2\u62E6\u4E0B","recent.exfil":"\u5916\u5E26\uFF1A{hosts}","col.action":"\u52A8\u4F5C","action.warn":"warn \u7167\u53D1","action.block":"block \u62E6\u4E0B","view.open":"\u67E5\u770B\u53D1\u51FA\u5185\u5BB9","view.title":"\u8FD9\u6B21\u8BF7\u6C42\u5B9E\u9645\u53D1\u51FA\u7684\u5185\u5BB9","view.agent":"\u66FF\u6362\u5904\u6807\u6CE8\uFF08kind \xB7 \u5F00\u5934 \xB7 \u957F\u5EA6\uFF09","view.vendor":"\u6A21\u578B\u670D\u52A1\u6536\u5230\u7684\u539F\u6587","view.onlyChanged":"\u53EA\u770B\u6709\u66FF\u6362\u7684\u884C","view.loading":"\u6B63\u5728\u8BFB\u53D6\u2026","view.gone":"\u8FD9\u4EFD\u526F\u672C\u5DF2\u4E0D\u5728\u5185\u5B58\u91CC\uFF1A\u8D85\u51FA\u4E86\u4FDD\u7559\u4E0A\u9650\uFF0C\u6216 dsh \u5DF2\u91CD\u542F\u3002","view.truncated":"\u53EA\u663E\u793A\u524D {n} \u884C\u3002","view.none":"\u6CA1\u6709\u6709\u66FF\u6362\u7684\u884C\u3002","view.close":"\u6536\u8D77","panel.tab":"\u9690\u79C1\u4FDD\u62A4","panel.session":"\u672C\u4F1A\u8BDD","panel.empty":"\u672C\u4F1A\u8BDD\u8FD8\u6CA1\u6709\u8BB0\u5F55\u3002\u53EA\u6709\u53D1\u751F\u8131\u654F\u6216\u8FD8\u539F\u7684\u6A21\u578B\u8BF7\u6C42\u624D\u4F1A\u7559\u4E0B\u8BB0\u5F55\u3002","page.first":"\u9996\u9875","page.prev":"\u4E0A\u4E00\u9875","page.next":"\u4E0B\u4E00\u9875","cfg.title":"\u914D\u7F6E","cfg.f.showPanel":"\u5728\u4F1A\u8BDD\u9876\u90E8\u663E\u793A\u300C\u9690\u79C1\u4FDD\u62A4\u300D\u6807\u7B7E\u9875","cfg.f.showPanel.hint":"\u6253\u5F00\u540E\uFF0C\u5BF9\u8BDD / \u8F68\u8FF9 \u65C1\u8FB9\u591A\u4E00\u4E2A\u300C\u9690\u79C1\u4FDD\u62A4\u300D\uFF0C\u5185\u5BB9\u662F\u672C\u4F1A\u8BDD\u7684\u8131\u654F\u8BB0\u5F55\u4E0E\u7EDF\u8BA1\u3002","cfg.unavailable":"\u8BFB\u4E0D\u5230\u8BBE\u7F6E\uFF1A\u5BBF\u4E3B\u6CA1\u6709\u63D0\u4F9B\u8BBE\u7F6E\u670D\u52A1\uFF0C\u6216\u63D2\u4EF6\u7684 host \u7AEF\u8FD8\u6CA1\u52A0\u8F7D\u65B0\u7248\u672C\u3002","cfg.failed":"\u6CA1\u80FD\u4FDD\u5B58\uFF0C\u8BF7\u91CD\u8BD5\u3002","cfg.sidebarFailed":"\u6807\u7B7E\u9875\u6CE8\u518C\u5931\u8D25\uFF1A{reason}","cfg.f.excludeProviders":"\u4E0D\u8131\u654F\u7684 provider","cfg.excludedNone":"\u4E0D\u9009\uFF1A\u5168\u90E8\u8131\u654F","cfg.sep":"\u3001","cfg.excludedMany":"{names} \u7B49 {n} \u4E2A","cfg.providerListUnavailable":"\u8BFB\u4E0D\u5230 provider \u5217\u8868\uFF1A\u5BBF\u4E3B\u6CA1\u6709\u6CE8\u518C\u4EFB\u4F55 provider\uFF0C\u6216\u8FD9\u6B21\u8C03\u7528\u5931\u8D25\u3002","cfg.remove":"\u79FB\u9664 {name}","cfg.f.excludeProviders.hint":"\u52FE\u9009\u7684 provider \u53D1\u51FA\u7684\u8BF7\u6C42\u539F\u6837\u9001\u51FA\uFF0C\u56DE\u590D\u4E5F\u4E0D\u8FD8\u539F\uFF0C\u4E0D\u7559\u8BB0\u5F55\u3002\u6539\u52A8\u4ECE\u4E0B\u4E00\u6B21\u6A21\u578B\u8C03\u7528\u8D77\u751F\u6548\u3002","cfg.providerAbsent":"{name}\uFF08\u5F53\u524D\u672A\u6CE8\u518C\uFF09","cfg.add":"\u6DFB\u52A0","cfg.listEmpty":"\u8FD8\u6CA1\u6709","cfg.countInvalid":"\u8981\u586B\u4E0D\u5C0F\u4E8E {min} \u7684\u6574\u6570\u3002","cfg.applies":"\u6539\u52A8\u5373\u65F6\u4FDD\u5B58\uFF0C\u4ECE\u4E0B\u4E00\u6B21\u6A21\u578B\u8C03\u7528\u8D77\u751F\u6548\uFF0C\u4E0D\u7528\u91CD\u542F\u3002","cfg.others":"\u5176\u4F59\u914D\u7F6E\u9879\uFF08actions\u3001cookieNames\u3001excludeHosts\u3001maxValues \u7B49\uFF09\u5728 cordis.patch.yml \u91CC\u4FEE\u6539\uFF0C\u8BF4\u660E\u89C1 README\u3002","cfg.g.mask":"\u8131\u654F","cfg.g.lists":"\u8BCD\u8868","cfg.g.record":"\u8BB0\u5F55","cfg.g.view":"\u6807\u7B7E\u9875\u4E0E provider","cfg.f.enabled":"\u542F\u7528\u8131\u654F","cfg.f.enabled.hint":"\u603B\u5F00\u5173\u3002\u5173\u6389\u540E\u7F51\u5173\u4E0D\u518D\u6539\u5199\u8BF7\u6C42\uFF0C\u7EDF\u8BA1\u4E0E\u8BB0\u5F55\u4E5F\u505C\u4E0B\u3002","cfg.f.secrets":"\u8131\u654F\u5BC6\u94A5\u4E0E\u51ED\u636E","cfg.f.secrets.hint":"API key\u3001\u4EE4\u724C\u3001\u5BC6\u7801\u3001\u79C1\u94A5\u3001cookie\u3002","cfg.f.personal":"\u8131\u654F\u4E2A\u4EBA\u4FE1\u606F","cfg.f.personal.hint":"\u90AE\u7BB1\u3001\u5927\u9646\u624B\u673A\u53F7\u3001\u8EAB\u4EFD\u8BC1\u53F7\u3001\u94F6\u884C\u5361\u53F7\u3002","cfg.f.shape":"\u5BC6\u94A5\u6362\u6210\u540C\u5F62\u5047 key","cfg.f.shape.hint":"\u524D\u7F00\u3001\u957F\u5EA6\u3001\u5B57\u7B26\u7C7B\u522B\u4E0D\u53D8\uFF0C\u4EE3\u66FF {{\u2026}} \u5360\u4F4D\u7B26\uFF1B\u4E0D\u8DB3 8 \u5B57\u7B26\u6216\u542B\u7279\u6B8A\u5B57\u7B26\u7684\u503C\u4ECD\u7528\u5360\u4F4D\u7B26\uFF0C\u56DE\u590D\u91CC\u7167\u6837\u8FD8\u539F\u3002","cfg.f.toolGuard":"\u5DE5\u5177\u8C03\u7528\u5916\u53D1\u4FDD\u62A4","cfg.f.toolGuard.hint":"\u5DE5\u5177\u8C03\u7528\u7684\u53C2\u6570\u91CC\u8FD8\u539F\u51FA\u4E86\u503C\u3001\u53C8\u6307\u5411\u672C\u673A\u4EE5\u5916\u7684 host \u65F6\u600E\u4E48\u5904\u7406\u3002","cfg.f.toolGuard.off":"\u53EA\u8BA1\u6570","cfg.f.toolGuard.warn":"\u544A\u8B66\u5E76\u8BB0\u5F55","cfg.f.toolGuard.block":"\u4E0D\u8FD8\u539F","cfg.f.words":"\u81EA\u5B9A\u4E49\u654F\u611F\u8BCD","cfg.f.words.hint":"\u9879\u76EE\u4EE3\u53F7\u3001\u5BA2\u6237\u540D\u7B49\uFF0C\u6309\u539F\u6837\u6362\u6210 TERM \u5360\u4F4D\u7B26\u3002\u56DE\u8F66\u6216\u70B9\u300C\u6DFB\u52A0\u300D\u52A0\u5165\u3002","cfg.f.words.placeholder":"\u8F93\u5165\u4E00\u4E2A\u8BCD","cfg.f.allow":"\u6C38\u4E0D\u8131\u654F\u7684\u503C","cfg.f.allow.hint":"\u6574\u503C\u5339\u914D\uFF0C\u4E0D\u5206\u5927\u5C0F\u5199\uFF0C\u54EA\u6761\u89C4\u5219\u627E\u5230\u90FD\u4E0D\u6362\u3002","cfg.f.allow.placeholder":"\u8F93\u5165\u4E00\u4E2A\u503C","cfg.f.record":"\u8BB0\u5F55\u5199\u76D8","cfg.f.record.hint":"\u5199\u5230 ~/.dsh/privacy-gateway/masking/\uFF0C\u53EA\u8BB0\u5143\u4FE1\u606F\u3001\u4E0D\u8BB0\u503C\u672C\u8EAB\uFF1B\u5173\u6389\u53EA\u5728\u5185\u5B58\u91CC\u7EDF\u8BA1\u3002","cfg.f.keepDays":"\u8BB0\u5F55\u4FDD\u7559\u5929\u6570","cfg.f.keepDays.hint":"\u8D85\u8FC7\u7684\u6309\u5929\u5220\u9664\uFF0C\u81F3\u5C11 1 \u5929\u3002","cfg.f.vendorView":"\u4FDD\u7559\u53D1\u51FA\u5185\u5BB9\uFF0C\u4F9B\u5BF9\u7167\u67E5\u770B","cfg.f.vendorView.hint":"\u5F00\u542F\u540E\uFF0C\u4E4B\u540E\u7684\u8BB0\u5F55\u591A\u4E00\u4E2A\u300C\u67E5\u770B\u53D1\u51FA\u5185\u5BB9\u300D\u6309\u94AE\uFF0C\u53EF\u4EE5\u6838\u5BF9\u6A21\u578B\u670D\u52A1\u5B9E\u9645\u6536\u5230\u4E86\u4EC0\u4E48\u3001\u6709\u6CA1\u6709\u6F0F\u8131\u654F\u3002\u526F\u672C\u5DF2\u8131\u654F\uFF0C\u4E0D\u542B\u771F\u503C\uFF1B\u53EA\u5B58\u5728\u5185\u5B58\u91CC\uFF0C\u6700\u591A 100 \u4EFD\u3001\u5171 64 MiB\uFF0C\u91CD\u542F\u5373\u6E05\u7A7A\u3002\u526F\u672C\u542B\u5B8C\u6574\u7684\u63D0\u793A\u8BCD\u548C\u5BF9\u8BDD\uFF0C\u5E73\u65F6\u4E0D\u5FC5\u5F00\u3002","cfg.expand":"\u5C55\u5F00\u300C{name}\u300D","cfg.collapse":"\u6536\u8D77\u300C{name}\u300D","cfg.s.maskOff":"\u5DF2\u5173\u95ED\uFF0C\u8BF7\u6C42\u539F\u6837\u53D1\u51FA","cfg.s.maskNothing":"\u6CA1\u6709\u9009\u8131\u654F\u7C7B\u578B","cfg.s.secrets":"\u5BC6\u94A5\u4E0E\u51ED\u636E","cfg.s.personal":"\u4E2A\u4EBA\u4FE1\u606F","cfg.s.shape":"\u540C\u5F62\u5047 key","cfg.s.toolGuard.off":"\u5916\u53D1\u4FDD\u62A4\uFF1A\u53EA\u8BA1\u6570","cfg.s.toolGuard.warn":"\u5916\u53D1\u4FDD\u62A4\uFF1A\u544A\u8B66","cfg.s.toolGuard.block":"\u5916\u53D1\u4FDD\u62A4\uFF1A\u4E0D\u8FD8\u539F","cfg.s.words":"\u654F\u611F\u8BCD {n} \u4E2A","cfg.s.allow":"\u653E\u884C {n} \u4E2A","cfg.s.record":"\u5199\u76D8\uFF0C\u4FDD\u7559 {n} \u5929","cfg.s.recordOff":"\u53EA\u5728\u5185\u5B58","cfg.s.vendorView":"\u4FDD\u7559\u53D1\u51FA\u5185\u5BB9","cfg.s.panel":"\u663E\u793A\u6807\u7B7E\u9875","cfg.s.panelOff":"\u4E0D\u663E\u793A\u6807\u7B7E\u9875","cfg.s.providersAll":"\u5168\u90E8 provider \u8131\u654F","cfg.s.providersSome":"{n} \u4E2A provider \u4E0D\u8131\u654F","cfg.s.problem":"\u6709\u63D0\u793A\uFF0C\u5C55\u5F00\u67E5\u770B","card.valuesHint":"\u88AB\u6362\u4E0B\u6765\u7684\u539F\u503C\u53EA\u5B58\u5728\u5185\u5B58\u91CC\uFF0C\u7528\u6765\u628A\u6A21\u578B\u56DE\u590D\u91CC\u7684\u5360\u4F4D\u7B26\u6362\u56DE\u539F\u503C\u3002\u6240\u6709\u4F1A\u8BDD\u5171\u7528\uFF0C\u91CD\u542F dsh \u540E\u6E05\u7A7A\u3002","session.mask":"\u672C\u4F1A\u8BDD\u8131\u654F","session.offTitle":"\u5173\u95ED\u672C\u4F1A\u8BDD\u7684\u8131\u654F\uFF1F","session.offBody":"\u5173\u95ED\u540E\uFF0C\u672C\u4F1A\u8BDD\u4E4B\u540E\u7684\u6A21\u578B\u8BF7\u6C42\u539F\u6837\u53D1\u7ED9\u6A21\u578B\u670D\u52A1\uFF1A\u5BC6\u94A5\u3001\u51ED\u636E\u3001\u4E2A\u4EBA\u4FE1\u606F\u548C\u81EA\u5B9A\u4E49\u654F\u611F\u8BCD\u90FD\u4E0D\u518D\u66FF\u6362\uFF0C\u56DE\u590D\u4E0D\u518D\u8FD8\u539F\uFF0C\u4E5F\u4E0D\u7559\u8BB0\u5F55\u3002\u5176\u4ED6\u4F1A\u8BDD\u4E0D\u53D7\u5F71\u54CD\uFF0C\u968F\u65F6\u53EF\u4EE5\u5728\u8FD9\u91CC\u91CD\u65B0\u6253\u5F00\u3002","session.offAck":"\u6211\u77E5\u9053\u672C\u4F1A\u8BDD\u7684\u5185\u5BB9\u4F1A\u539F\u6837\u53D1\u7ED9\u6A21\u578B\u670D\u52A1","session.offConfirm":"\u5173\u95ED\u8131\u654F","session.offNotice":"\u672C\u4F1A\u8BDD\u5DF2\u5173\u95ED\u8131\u654F\uFF1A\u8BF7\u6C42\u539F\u6837\u53D1\u7ED9\u6A21\u578B\u670D\u52A1\uFF0C\u4E0D\u7559\u8BB0\u5F55\u3002","session.failed":"\u6CA1\u80FD\u5207\u6362\uFF1A{message}","cfg.f.recordContext":"\u8BB0\u5F55\u66FF\u6362\u5904\u7684\u4E0A\u4E0B\u6587","cfg.f.recordContext.hint":"\u6BCF\u4E2A\u66FF\u6362\u5904\u524D\u540E\u5404\u7EA6 80 \u4E2A\u5B57\u7B26\u548C\u5B83\u6240\u5728\u7684\u4F4D\u7F6E\uFF08\u7528\u6237\u6D88\u606F\u3001\u5DE5\u5177\u7ED3\u679C\u7B49\uFF09\u4E00\u8D77\u8BB0\u4E0B\uFF0C\u65B9\u4FBF\u786E\u8BA4\u662F\u5728\u4EC0\u4E48\u573A\u5408\u66FF\u6362\u7684\u3002\u8FD9\u6BB5\u6587\u5B57\u53D6\u81EA\u53D1\u51FA\u7684\u5185\u5BB9\uFF0C\u91CC\u9762\u88AB\u8131\u654F\u7684\u503C\u90FD\u5DF2\u662F\u5360\u4F4D\u7B26\uFF1B\u6CA1\u5F00\u4E2A\u4EBA\u4FE1\u606F\u8131\u654F\u65F6\uFF0C\u90AE\u7BB1\u3001\u624B\u673A\u53F7\u7B49\u4F1A\u539F\u6837\u51FA\u73B0\u5728\u8FD9\u6BB5\u6587\u5B57\u91CC\u3002","recent.contextHint":"\u66FF\u6362\u5904\u524D\u540E\u7684\u6587\u5B57\uFF0C\u53D6\u81EA\u53D1\u51FA\u7684\u5185\u5BB9\uFF0C\u88AB\u8131\u654F\u7684\u503C\u90FD\u662F\u5360\u4F4D\u7B26","place.system":"\u7CFB\u7EDF\u63D0\u793A","place.toolResult":"\u5DE5\u5177\u7ED3\u679C","place.toolCall":"\u5DE5\u5177\u8C03\u7528","place.user":"\u7528\u6237\u6D88\u606F","place.assistant":"\u6A21\u578B\u56DE\u590D","place.other":"\u5176\u4ED6","err.noConnection":"\u8FD8\u6CA1\u6709\u8FDE\u4E0A dsh","err.malformed":"\u63D2\u4EF6 host \u7AEF\u7684\u56DE\u7B54\u683C\u5F0F\u4E0D\u5BF9\uFF0Chost \u7AEF\u548C\u9875\u9762\u53EF\u80FD\u4E0D\u662F\u540C\u4E00\u7248\u672C","err.remote":"{message}","err.thrown":"{message}","err.noDisposer":"\u4F1A\u8BDD\u89C6\u56FE\u6761\u6CA1\u6709\u4EA4\u56DE\u64A4\u9500\u6CE8\u518C\u7684\u51FD\u6570","card.stale":"\u5237\u65B0\u5931\u8D25\uFF08{reason}\uFF09\u3002\u4E0B\u9762\u662F\u4E0A\u6B21\u8BFB\u5230\u7684\u6570\u636E\uFF0C\u53EF\u80FD\u5DF2\u8FC7\u671F\u3002","card.reason":"\u539F\u56E0\uFF1A{reason}","recent.cell":"{name}\uFF1A{value}","recent.cellSep":"\uFF0C","view.unknown":"\u2039\u672A\u77E5\u5360\u4F4D\u7B26\u203A","view.line":"\u884C","cfg.risk.send.title":"\u8FD9\u9879\u6539\u52A8\u4F1A\u8BA9\u5185\u5BB9\u539F\u6837\u53D1\u7ED9\u6A21\u578B\u670D\u52A1","cfg.risk.delete.title":"\u8FD9\u9879\u6539\u52A8\u4F1A\u5220\u9664\u5DF2\u6709\u6570\u636E","cfg.risk.send.ack":"\u6211\u77E5\u9053\u76F8\u5173\u5185\u5BB9\u4F1A\u539F\u6837\u53D1\u7ED9\u6A21\u578B\u670D\u52A1","cfg.risk.delete.ack":"\u6211\u77E5\u9053\u5220\u9664\u7684\u6570\u636E\u65E0\u6CD5\u6062\u590D","cfg.risk.confirm":"\u786E\u8BA4\u4FEE\u6539","cfg.r.enabled":"\u5173\u95ED\u540E\uFF0C\u6240\u6709\u4F1A\u8BDD\u7684\u6A21\u578B\u8BF7\u6C42\u539F\u6837\u53D1\u7ED9\u6A21\u578B\u670D\u52A1\uFF1A\u5BC6\u94A5\u3001\u51ED\u636E\u3001\u4E2A\u4EBA\u4FE1\u606F\u548C\u81EA\u5B9A\u4E49\u654F\u611F\u8BCD\u90FD\u4E0D\u518D\u66FF\u6362\uFF0C\u56DE\u590D\u4E0D\u518D\u8FD8\u539F\uFF0C\u4E5F\u4E0D\u7559\u8BB0\u5F55\u3002","cfg.r.secrets":"\u5173\u95ED\u540E\uFF0CAPI key\u3001\u4EE4\u724C\u3001\u5BC6\u7801\u3001\u79C1\u94A5\u548C cookie \u4E0D\u518D\u66FF\u6362\uFF0C\u539F\u6837\u53D1\u7ED9\u6A21\u578B\u670D\u52A1\u3002","cfg.r.personal":"\u5173\u95ED\u540E\uFF0C\u90AE\u7BB1\u3001\u624B\u673A\u53F7\u3001\u8EAB\u4EFD\u8BC1\u53F7\u548C\u94F6\u884C\u5361\u53F7\u4E0D\u518D\u66FF\u6362\uFF0C\u539F\u6837\u53D1\u7ED9\u6A21\u578B\u670D\u52A1\u3002","cfg.r.words":"\u53BB\u6389\u7684\u654F\u611F\u8BCD\uFF08{names}\uFF09\u4EE5\u540E\u4E0D\u518D\u8131\u654F\uFF0C\u51FA\u73B0\u5728\u8BF7\u6C42\u91CC\u65F6\u539F\u6837\u53D1\u7ED9\u6A21\u578B\u670D\u52A1\u3002","cfg.r.allow":"\u65B0\u52A0\u7684\u503C\uFF08{names}\uFF09\u4EE5\u540E\u4E0D\u518D\u8131\u654F\uFF0C\u51FA\u73B0\u5728\u8BF7\u6C42\u91CC\u65F6\u539F\u6837\u53D1\u7ED9\u6A21\u578B\u670D\u52A1\u3002","cfg.r.excludeProviders":"\u65B0\u52FE\u9009\u7684 provider\uFF08{names}\uFF09\u53D1\u51FA\u7684\u8BF7\u6C42\u539F\u6837\u9001\u51FA\uFF0C\u56DE\u590D\u4E0D\u8FD8\u539F\uFF0C\u4E5F\u4E0D\u7559\u8BB0\u5F55\u3002","cfg.r.record":"\u5173\u95ED\u540E\uFF0C\u6392\u961F\u7B49\u5F85\u5199\u76D8\u7684\u8BB0\u5F55\u4E0D\u518D\u5199\u5165\uFF0C\u4E4B\u540E\u7684\u8BB0\u5F55\u53EA\u5728\u5185\u5B58\u91CC\u7EDF\u8BA1\uFF0C\u91CD\u542F dsh \u540E\u4E22\u5931\u3002","cfg.r.keepDays":"\u4FDD\u7559\u5929\u6570\u4ECE {from} \u5929\u6539\u4E3A {to} \u5929\uFF0C\u4E0B\u6B21\u5199\u76D8\u65F6\u8D85\u51FA\u7684\u8BB0\u5F55\u6587\u4EF6\u4F1A\u88AB\u5220\u9664\uFF0C\u65E0\u6CD5\u6062\u590D\u3002","cfg.r.vendorView":"\u5173\u95ED\u540E\uFF0C\u5185\u5B58\u91CC\u5DF2\u4FDD\u7559\u7684\u53D1\u51FA\u5185\u5BB9\u526F\u672C\u7ACB\u5373\u6E05\u7A7A\uFF0C\u4E4B\u524D\u7684\u8BB0\u5F55\u4E0D\u80FD\u518D\u67E5\u770B\u53D1\u51FA\u5185\u5BB9\u3002"},Et={"card.title":"Masking statistics","card.on":"Masking on","card.off":"Masking off","card.refresh":"Refresh","card.loading":"Loading\u2026","card.unavailable":"No statistics: the plugin\u2019s host half is not running, or dsh needs a restart.","card.memoryOnly":"Records in memory only (record is off)","card.values":"{n} values kept for restoring","card.range":"Range","card.reset":"Clear data","card.resetTitle":"Clear the Privacy history?","card.resetBody":"This deletes the masking records and counts of every session, including the record files in ~/.dsh/privacy-gateway/masking/ and the copies of what was sent kept in memory. It cannot be undone. The rules, the settings and requests under way are not affected.","card.resetAck":"I understand this cannot be undone","card.resetConfirm":"Clear","card.cancel":"Cancel","card.close":"Close","card.resetDone":"Cleared; {n} record files deleted.","card.resetFailed":"Could not clear: {message}","stat.took":"Mean time","stat.tookMax":"longest {max} ms","stat.ms":"{n} ms","recent.count":"{n} in all","recent.col.time":"Time","recent.col.where":"Model / host","recent.col.from":"From","recent.col.places":"Replaced","recent.col.restored":"Restored","page.at":"{page} / {pages}","range.today":"Today","range.week":"7 days","range.month":"30 days","stat.requests":"Recorded requests","stat.masked":"Masked","stat.n":"Replaced","stat.restored":"Restored","stat.inTools":"{n} in tool arguments","stat.unmapped":"Unknown placeholders","stat.failed":"Failures","dist.kind":"By kind","dist.finder":"By finder","dist.host":"By host","dist.empty":"None yet","warn.streak":"Masking failed {n} times in a row; those requests were not sent. /privacy off stops it.","warn.unmapped":"Replies had {n} placeholders the table has no value for; a model may have changed them.","warn.inTools":"{n} restored places were in tool call arguments, so the tool ran with the real value. If you did not expect that, check the latest tool calls.","recent.title":"Latest records","recent.empty":"No records yet.","recent.failed":"failed","col.placeholder":"Placeholder","col.kind":"Kind","col.finder":"Finder","col.head":"Head","recent.placesHint":"Places in the request that a placeholder replaced (not how many values were sent)","recent.restoredHint":"Places where the reply had a placeholder put back; the model need not repeat every value, so the two counts usually differ","col.len":"Length","col.n":"Times","recent.noValues":"Nothing was masked in this request.","recent.omitted":"{n} more values are past the limit of one record and not listed.","stat.warned":"Warned","stat.blocked":"Blocked","stat.exfil":"Tool calls sending values away","stat.exfilBlocked":"{n} places left unrestored","warn.exfil":"{n} tool calls had a restored value in arguments that name a host off this machine; open the latest records to see the hosts.","recent.blocked":"blocked","recent.exfil":"sent to: {hosts}","col.action":"Action","action.warn":"warn, sent","action.block":"block","view.open":"What was sent","view.title":"What this request actually sent","view.agent":"Replaced places marked (kind \xB7 head \xB7 length)","view.vendor":"As the model service got it","view.onlyChanged":"Only lines with replacements","view.loading":"Loading\u2026","view.gone":"This copy is no longer in memory: past the limits, or dsh restarted.","view.truncated":"First {n} lines only.","view.none":"No line has a replacement.","view.close":"Close","panel.tab":"Privacy","panel.session":"This session","panel.empty":"No records in this session yet. Only a model request that had something masked or restored leaves one.","page.first":"First","page.prev":"Previous","page.next":"Next","cfg.title":"Configure","cfg.f.showPanel":"Show a Privacy tab at the top of the session","cfg.f.showPanel.hint":"When on, a Privacy tab sits beside Chat and Trajectory with this session\u2019s masking records and counts.","cfg.unavailable":"Settings cannot be read: the host offers no settings service, or the plugin\u2019s host half has not loaded the new version yet.","cfg.failed":"Could not save; try again.","cfg.sidebarFailed":"The tab could not be registered: {reason}","cfg.f.excludeProviders":"Providers not masked","cfg.excludedNone":"None: everything is masked","cfg.sep":", ","cfg.excludedMany":"{names} and {n} in all","cfg.providerListUnavailable":"The provider list could not be read: the host has registered none, or the call failed.","cfg.remove":"Remove {name}","cfg.f.excludeProviders.hint":"Requests from a checked provider go out as they are, its replies are not restored, and nothing is recorded. A change applies from the next model call.","cfg.providerAbsent":"{name} (not registered now)","cfg.add":"Add","cfg.listEmpty":"None yet","cfg.countInvalid":"Enter a whole number of at least {min}.","cfg.applies":"Changes are saved at once and apply from the next model call; no restart needed.","cfg.others":"The other settings (actions, cookieNames, excludeHosts, maxValues and so on) are changed in cordis.patch.yml; see the README.","cfg.g.mask":"Masking","cfg.g.lists":"Word lists","cfg.g.record":"Records","cfg.g.view":"Tab and providers","cfg.f.enabled":"Mask requests","cfg.f.enabled.hint":"The master switch. Off, the gateway stops rewriting requests, and counting and recording stop too.","cfg.f.secrets":"Mask secrets","cfg.f.secrets.hint":"API keys, tokens, passwords, private keys, cookies.","cfg.f.personal":"Mask personal data","cfg.f.personal.hint":"Emails, mainland phone numbers, ID card and bank card numbers.","cfg.f.shape":"Same-shape fake keys","cfg.f.shape.hint":"A secret goes as a made-up key with the same prefix, length and kinds of character instead of a {{\u2026}} placeholder; a value under 8 characters, or with unusual characters, keeps the placeholder. Replies are restored as usual.","cfg.f.toolGuard":"Tool call guard","cfg.f.toolGuard.hint":"What happens when a tool call\u2019s arguments would have a value put back and name a host off this machine.","cfg.f.toolGuard.off":"Count only","cfg.f.toolGuard.warn":"Warn and record","cfg.f.toolGuard.block":"Do not restore","cfg.f.words":"Your own words","cfg.f.words.hint":"Code names, customer names and the like, replaced as written with a TERM placeholder. Press Enter or Add.","cfg.f.words.placeholder":"A word","cfg.f.allow":"Values never masked","cfg.f.allow.hint":"Whole values, in any case, left alone whichever rule finds them.","cfg.f.allow.placeholder":"A value","cfg.f.record":"Write records to disk","cfg.f.record.hint":"Into ~/.dsh/privacy-gateway/masking/, metadata only, never the values; off keeps the counts in memory.","cfg.f.keepDays":"Days of records kept","cfg.f.keepDays.hint":"Older days are deleted; at least 1.","cfg.f.vendorView":"Keep what was sent, to compare","cfg.f.vendorView.hint":"When on, records from then on have a \u201CWhat was sent\u201D button to check what the model service actually got and whether anything slipped through. The copy is masked, with no real values; it lives in memory only, at most 100 copies and 64 MiB in all, gone on restart. It holds the whole prompt and conversation, so leave it off unless you need it.","cfg.expand":"Expand {name}","cfg.collapse":"Collapse {name}","cfg.s.maskOff":"Off: requests go out as they are","cfg.s.maskNothing":"No kind chosen","cfg.s.secrets":"Secrets","cfg.s.personal":"Personal data","cfg.s.shape":"Same-shape keys","cfg.s.toolGuard.off":"Tool guard: count","cfg.s.toolGuard.warn":"Tool guard: warn","cfg.s.toolGuard.block":"Tool guard: no restore","cfg.s.words":"{n} words","cfg.s.allow":"{n} allowed","cfg.s.record":"On disk, {n} days","cfg.s.recordOff":"Memory only","cfg.s.vendorView":"Keeping what was sent","cfg.s.panel":"Tab shown","cfg.s.panelOff":"Tab hidden","cfg.s.providersAll":"Every provider masked","cfg.s.providersSome":"{n} providers not masked","cfg.s.problem":"Needs a look; expand","card.valuesHint":"The values swapped out are kept in memory only, to put back in place of the placeholders in replies. Shared by every session; cleared when dsh restarts.","session.mask":"Mask this session","session.offTitle":"Turn masking off for this session?","session.offBody":"From then on this session\u2019s model requests go to the model service as they are: secrets, credentials, personal data and your own words are no longer replaced, replies are not restored, and nothing is recorded. Other sessions are not affected; you can turn it back on here at any time.","session.offAck":"I understand this session\u2019s content goes out as it is","session.offConfirm":"Turn off","session.offNotice":"Masking is off for this session: requests go out as they are and nothing is recorded.","session.failed":"Could not switch: {message}","cfg.f.recordContext":"Record the text around each value","cfg.f.recordContext.hint":"About 80 characters each side of every replaced place, and where it was (a user message, a tool result and so on), are kept with the record, so you can tell what it was replaced in. The text is taken from what was sent, so masked values in it are placeholders; with personal data not masked, emails, phone numbers and the like appear in it as they are.","recent.contextHint":"The text around the place, as sent; masked values in it are placeholders","place.system":"System prompt","place.toolResult":"Tool result","place.toolCall":"Tool call","place.user":"User message","place.assistant":"Model reply","place.other":"Other","err.noConnection":"Not connected to dsh yet","err.malformed":"The plugin\u2019s host half answered in a form this page does not know; the host half and the page may be different versions","err.remote":"{message}","err.thrown":"{message}","err.noDisposer":"The view strip gave back no way to remove the registration","card.stale":"Refresh failed ({reason}). The figures below are the last ones read and may be out of date.","card.reason":"Reason: {reason}","recent.cell":"{name}: {value}","recent.cellSep":", ","view.unknown":"\u2039unknown placeholder\u203A","view.line":"Line","cfg.risk.send.title":"This change sends content to the model service as it is","cfg.risk.delete.title":"This change deletes data already kept","cfg.risk.send.ack":"I understand this content goes to the model service as it is","cfg.risk.delete.ack":"I understand the deleted data cannot be recovered","cfg.risk.confirm":"Change it","cfg.r.enabled":"Off, every session\u2019s model requests go to the model service as they are: secrets, credentials, personal data and your own words are no longer replaced, replies are not restored, and nothing is recorded.","cfg.r.secrets":"Off, API keys, tokens, passwords, private keys and cookies are no longer replaced and go to the model service as they are.","cfg.r.personal":"Off, emails, phone numbers, ID card and bank card numbers are no longer replaced and go to the model service as they are.","cfg.r.words":"The words taken out ({names}) are no longer masked: where a request has them, they go to the model service as they are.","cfg.r.allow":"The values added ({names}) are never masked from now on: where a request has them, they go to the model service as they are.","cfg.r.excludeProviders":"Requests from the providers newly checked ({names}) go out as they are, their replies are not restored, and nothing is recorded.","cfg.r.record":"Off, the records still waiting to be written are not written, and records from then on are counted in memory only and lost when dsh restarts.","cfg.r.keepDays":"Records are kept {to} days instead of {from}: the record files past that are deleted at the next write and cannot be recovered.","cfg.r.vendorView":"Off, the copies of what was sent kept in memory are cleared at once, and earlier records can no longer show what was sent."},tt={zh:Mt,en:Et};var R=require("@deepseek-ai/dsh-client-ui-primitives"),f=require("react");var S=require("@deepseek-ai/dsh-client-ui-primitives"),o=require("react");var le=require("@deepseek-ai/dsh-client-ui-primitives"),h=require("react");function At(e,t){if(!e)return t("view.unknown");let n=e.action?` \xB7 ${t(e.action==="warn"?"action.warn":"action.block")}`:"",a=oe(e);return`\u2039${e.kind} \xB7 ${a?`${a} \xB7 `:""}${e.len}${n}\u203A`}function nt(e,t,n,a){return e.parts.map((r,s)=>r.id===void 0?r.text:(0,h.createElement)("mark",{key:s,className:`pgw-view__mark${n?" pgw-view__mark--agent":""}`,title:r.id},n?At(t.get(r.id),a):r.text))}function at(e){let{ctx:t,t:n,record:a}=e,[r,s]=(0,h.useState)({status:"loading"}),[i,c]=(0,h.useState)(!0);(0,h.useEffect)(()=>{let w=new AbortController;return s({status:"loading"}),He(t,a.key,w.signal).then(F=>{w.signal.aborted||s(F.ok?F.value===null?{status:"gone"}:{status:"ready",body:F.value}:{status:"error"})}),()=>w.abort()},[t,a.key]);let u=je(a.values),p=(0,h.useMemo)(()=>new Map(a.values.map(w=>[w.placeholder,w])),[a.key,u]),l=r.status==="ready"?r.body:void 0,b=(0,h.useMemo)(()=>l!==void 0?Ke(l):void 0,[l]),v=(0,h.useMemo)(()=>b?Ge(b,[...p.keys()],i):void 0,[b,p,i]),k=(0,h.createElement)("div",{className:"pgw-head"},(0,h.createElement)("span",{className:"pgw-dist__title"},n("view.title")),(0,h.createElement)(le.Checkbox,{checked:i,label:n("view.onlyChanged"),className:"pgw-meta",onChange:c}),(0,h.createElement)("span",{className:"pgw-spacer"}),(0,h.createElement)(le.Button,{variant:"outline",size:"sm",onClick:e.onClose},n("view.close")));if(!v){let w=r.status==="loading"?"view.loading":r.status==="gone"?"view.gone":"card.unavailable";return(0,h.createElement)("div",{className:"pgw-view"},k,(0,h.createElement)("div",{className:"pgw-empty"},n(w)))}return(0,h.createElement)("div",{className:"pgw-view"},k,v.lines.length===0?(0,h.createElement)("div",{className:"pgw-empty"},n("view.none")):(0,h.createElement)("div",{className:"pgw-view__scroll"},(0,h.createElement)("table",{className:"pgw-view__table"},(0,h.createElement)("thead",null,(0,h.createElement)("tr",null,(0,h.createElement)("th",null,n("view.line")),(0,h.createElement)("th",null,n("view.agent")),(0,h.createElement)("th",null,n("view.vendor")))),(0,h.createElement)("tbody",null,v.lines.map(w=>(0,h.createElement)("tr",{key:w.n},(0,h.createElement)("td",{className:"pgw-view__n"},w.n),(0,h.createElement)("td",{className:"pgw-view__code"},...nt(w,p,!0,n)),(0,h.createElement)("td",{className:"pgw-view__code"},...nt(w,p,!1,n))))))),v.truncated?(0,h.createElement)("div",{className:"pgw-meta"},n("view.truncated",{n:v.lines.length})):null)}function rt(e){return e.items.length===0?null:(0,o.createElement)("div",{className:"pgw-notices",role:"status"},e.items.map(t=>(0,o.createElement)("div",{key:t.key,className:`pgw-notice pgw-notice--${t.tone}`},(0,o.createElement)(S.IconWarningOutlineRegular,{size:14,className:"pgw-notice__icon"}),(0,o.createElement)("span",null,e.t(t.key,{n:t.n})))))}function ot(e){let{totals:t,t:n}=e,a=i=>(i??0).toLocaleString(),r=Le(t),s=[{label:n("stat.requests"),value:a(t.requests)},{label:n("stat.masked"),value:a(t.masked)},{label:n("stat.n"),value:a(t.n)},{label:n("stat.restored"),value:a(t.restored),...t.restoredInTools>0?{sub:n("stat.inTools",{n:t.restoredInTools})}:{}},{label:n("stat.unmapped"),value:a(t.unmapped),...t.unmapped>0?{tone:"warn"}:{}},{label:n("stat.failed"),value:a(t.failed),...t.failed>0?{tone:"error"}:{}}];return(t.warned??0)>0&&s.push({label:n("stat.warned"),value:a(t.warned),tone:"warn"}),(t.blocked??0)>0&&s.push({label:n("stat.blocked"),value:a(t.blocked),tone:"warn"}),(t.exfil??0)>0&&s.push({label:n("stat.exfil"),value:a(t.exfil),tone:"error",...(t.exfilBlocked??0)>0?{sub:n("stat.exfilBlocked",{n:t.exfilBlocked})}:{}}),t.requests>0&&s.push({label:n("stat.took"),value:n("stat.ms",{n:r.avg}),sub:n("stat.tookMax",{max:r.max})}),(0,o.createElement)("div",{className:"pgw-kpis"},s.map(i=>(0,o.createElement)("div",{key:i.label,className:`pgw-kpi${i.tone?` pgw-kpi--${i.tone}`:""}`},(0,o.createElement)("span",{className:"pgw-kpi__label"},i.label),(0,o.createElement)("span",{className:"pgw-kpi__value"},i.value),i.sub?(0,o.createElement)("span",{className:"pgw-kpi__sub"},i.sub):null)))}function de(e){let t=Ve(e.data);return(0,o.createElement)("div",{className:"pgw-dist"},(0,o.createElement)("div",{className:"pgw-section__title"},e.title),t.length===0?(0,o.createElement)("div",{className:"pgw-empty"},e.empty):t.map(n=>(0,o.createElement)("div",{className:"pgw-bar",key:n.label},(0,o.createElement)("div",{className:"pgw-bar__head"},(0,o.createElement)("span",{className:"pgw-bar__label",title:n.label},n.label),(0,o.createElement)("span",{className:"pgw-bar__value"},n.value.toLocaleString())),(0,o.createElement)("div",{className:"pgw-bar__track"},(0,o.createElement)("div",{className:"pgw-bar__fill",style:{width:`${n.pct}%`}})))))}function st(e){let{t}=e;return(0,o.createElement)("div",{className:"pgw-rec pgw-rec--head","aria-hidden":!0},(0,o.createElement)("span",null),(0,o.createElement)("span",null,t("recent.col.time")),(0,o.createElement)("span",null,t("recent.col.where")),(0,o.createElement)("span",null,t("recent.col.from")),(0,o.createElement)("span",{className:"pgw-rec__num",title:t("recent.placesHint")},t("recent.col.places")),(0,o.createElement)("span",{className:"pgw-rec__num",title:t("recent.restoredHint")},t("recent.col.restored")))}function it(e){let{r:t,t:n}=e,[a,r]=(0,o.useState)(!1),s=(0,o.useId)(),i=[t.workspace,t.title??t.session].filter(l=>typeof l=="string"&&l!=="").join(" \xB7 "),c=t.failed?(0,o.createElement)(S.Tag,{tone:"danger"},n("recent.failed")):t.blocked?(0,o.createElement)(S.Tag,{tone:"danger"},n("recent.blocked")):(0,o.createElement)("span",{className:t.exfil?"pgw-rec__bad":void 0},t.n.toLocaleString()),u=t.failed?n("recent.failed"):t.blocked?n("recent.blocked"):t.n.toLocaleString(),p=[[n("recent.col.time"),ve(t.time)],[n("recent.col.where"),[t.model??t.what,t.host].filter(Boolean).join(" \xB7 ")],[n("recent.col.from"),i],[n("recent.col.places"),u],[n("recent.col.restored"),t.restored.toLocaleString()]].filter(([,l])=>l!=="").map(([l,b])=>n("recent.cell",{name:l,value:b})).join(n("recent.cellSep"));return(0,o.createElement)("li",{className:"pgw-recs__item"},(0,o.createElement)("button",{type:"button",className:`pgw-rec${t.n===0&&!t.failed?" pgw-rec--zero":""}${e.open?" pgw-rec--open":""}`,"aria-expanded":e.open,"aria-controls":e.open?s:void 0,"aria-label":p,onClick:e.toggle},(0,o.createElement)(S.IconChevronRightOutlineRegular,{size:12,className:"pgw-rec__chevron"}),(0,o.createElement)("span",{className:"pgw-rec__time"},ve(t.time)),(0,o.createElement)("span",{className:"pgw-rec__where",title:[t.model,t.host].filter(Boolean).join(" \xB7 ")},(0,o.createElement)("span",{className:"pgw-rec__model"},t.model??t.what),(0,o.createElement)("span",{className:"pgw-rec__host"},t.host)),(0,o.createElement)("span",{className:"pgw-rec__from",title:i},i),(0,o.createElement)("span",{className:"pgw-rec__num"},c),(0,o.createElement)("span",{className:"pgw-rec__num pgw-rec__dim"},t.restored.toLocaleString())),e.open?(0,o.createElement)("div",{className:"pgw-detail",id:s},t.exfil?(0,o.createElement)("div",{className:"pgw-notice pgw-notice--error"},(0,o.createElement)(S.IconWarningOutlineRegular,{size:14,className:"pgw-notice__icon"}),n("recent.exfil",{hosts:(t.exfilHosts??[]).join(", ")})):null,t.values.length===0?(0,o.createElement)("div",{className:"pgw-empty"},n("recent.noValues")):(0,o.createElement)("table",{className:"pgw-values"},(0,o.createElement)("thead",null,(0,o.createElement)("tr",null,...["col.placeholder","col.kind","col.finder","col.head","col.len","col.n","col.action"].map(l=>(0,o.createElement)("th",{key:l},n(l))))),(0,o.createElement)("tbody",null,t.values.flatMap(l=>[(0,o.createElement)("tr",{key:l.placeholder,className:l.before!==void 0||l.after!==void 0?"pgw-values__has":void 0},(0,o.createElement)("td",{className:"pgw-mono"},l.placeholder),(0,o.createElement)("td",null,l.kind),(0,o.createElement)("td",null,l.finder),(0,o.createElement)("td",{className:"pgw-mono"},oe(l)),(0,o.createElement)("td",null,l.len),(0,o.createElement)("td",null,l.n),(0,o.createElement)("td",null,l.action?n(l.action==="warn"?"action.warn":"action.block"):"")),l.before!==void 0||l.after!==void 0?(0,o.createElement)("tr",{key:`${l.placeholder}:ctx`,className:"pgw-values__ctx"},(0,o.createElement)("td",{colSpan:7},l.at?(0,o.createElement)(S.Tag,{tone:"neutral",className:"pgw-ctx__place",title:l.at.path},n(We(l.at))):null,(0,o.createElement)("span",{className:"pgw-ctx__text",title:n("recent.contextHint")},l.before??"",(0,o.createElement)("mark",{className:"pgw-ctx__mark pgw-mono"},l.placeholder),l.after??""))):null]))),t.valuesOmitted?(0,o.createElement)("div",{className:"pgw-meta"},n("recent.omitted",{n:t.valuesOmitted.toLocaleString()})):null,e.viewable&&!a?(0,o.createElement)("div",null,(0,o.createElement)(S.Button,{variant:"outline",size:"sm",onClick:()=>r(!0)},n("view.open"))):null,e.viewable&&a?(0,o.createElement)(at,{ctx:e.ctx,t:n,record:t,onClose:()=>r(!1)}):null):null)}function lt(e){let{t}=e,[n,a]=(0,o.useState)(!1),[r,s]=(0,o.useState)(!1),[i,c]=(0,o.useState)(!1),u=()=>{a(!1),s(!1)},p=()=>{c(!0),Ue(e.ctx).then(l=>{c(!1),u(),e.onDone(l.ok?t("card.resetDone",{n:l.value}):t("card.resetFailed",{message:H(l.failure,t)}),l.ok)})};return(0,o.createElement)(o.Fragment,null,(0,o.createElement)(S.Button,{variant:"ghost",size:"sm",className:"pgw-reset",disabled:i,onClick:()=>a(!0)},(0,o.createElement)(S.IconTrashOutlineRegular,{size:14}),(0,o.createElement)("span",null,t("card.reset"))),(0,o.createElement)(S.RiskConfirmation,{open:n,title:t("card.resetTitle"),description:t("card.resetBody"),acknowledgeLabel:t("card.resetAck"),cancelLabel:t("card.cancel"),closeLabel:t("card.close"),confirmLabel:t("card.resetConfirm"),acknowledged:r,disabled:i,onAcknowledgedChange:s,onCancel:u,onConfirm:p}))}function dt(e){let{t}=e,[n,a]=(0,o.useState)(e.on),[r,s]=(0,o.useState)(!1),[i,c]=(0,o.useState)(!1),[u,p]=(0,o.useState)(!1);(0,o.useEffect)(()=>a(e.on),[e.on]);let l=()=>{s(!1),c(!1)},b=v=>{p(!0),Qe(e.ctx,e.session,v).then(k=>{p(!1),l(),k.ok&&a(k.value),e.onDone(k.ok?null:t("session.failed",{message:H(k.failure,t)}))})};return(0,o.createElement)(o.Fragment,null,(0,o.createElement)("label",{className:"pgw-session"},(0,o.createElement)(S.Switch,{checked:n,disabled:u,onChange:v=>v?b(!0):s(!0)}),(0,o.createElement)("span",{className:"pgw-session__label"},t("session.mask"))),(0,o.createElement)(S.RiskConfirmation,{open:r,title:t("session.offTitle"),description:t("session.offBody"),acknowledgeLabel:t("session.offAck"),cancelLabel:t("card.cancel"),closeLabel:t("card.close"),confirmLabel:t("session.offConfirm"),acknowledged:i,disabled:u,onAcknowledgedChange:c,onCancel:l,onConfirm:()=>b(!1)}))}var $t=15e3,Vt=200,Dt=10,Lt=["today","week","month"];function Bt(e,t){let[n,a]=(0,f.useState)({status:"loading"}),[r,s]=(0,f.useState)(!1),i=(0,f.useRef)(null),c=(0,f.useCallback)(()=>{i.current?.abort();let u=new AbortController;i.current=u,s(!0),se(e,Vt,u.signal,t).then(p=>{u.signal.aborted||(s(!1),a(l=>ze(l,p)))})},[e,t]);return(0,f.useEffect)(()=>{c();let u=setInterval(()=>{(typeof document>"u"||document.visibilityState==="visible")&&c()},$t);return()=>{clearInterval(u),i.current?.abort()}},[c]),[n,c,r]}function ce(e){return(0,f.createElement)(zt,{key:e.sessionId??"",...e})}function zt(e){let{t}=e,[n,a,r]=Bt(e.ctx,e.sessionId),[s,i]=(0,f.useState)("today"),[c,u]=(0,f.useState)(null),[p,l]=(0,f.useState)(0),[b,v]=(0,f.useState)(null),k=`pgw-card${e.panel?" pgw-card--panel":""}`,w=n.status==="ready"?n.data:void 0,F=!e.sessionId&&w!==void 0,M=(0,f.createElement)("div",{className:"pgw-head"},(0,f.createElement)("div",{className:"pgw-head__main"},e.panel?null:(0,f.createElement)("h3",{className:"pgw-title"},t("card.title")),e.sessionId&&w&&typeof w.sessionMasking=="boolean"?(0,f.createElement)(dt,{ctx:e.ctx,t,session:e.sessionId,on:w.sessionMasking,onDone:C=>{v(C===null?null:{text:C,ok:!1}),a()}}):null,w&&(!e.sessionId||!w.active)?(0,f.createElement)(R.Tag,{tone:w.active?"success":"warning"},t(w.active?"card.on":"card.off")):null,e.sessionId&&w&&w.sessionMasking===void 0?(0,f.createElement)(R.Tag,{tone:"outline"},t("panel.session")):null,w&&!e.sessionId?(0,f.createElement)("span",{className:"pgw-meta",title:t("card.valuesHint")},t("card.values",{n:w.values})):null,w&&!w.record?(0,f.createElement)("span",{className:"pgw-meta"},t("card.memoryOnly")):null),(0,f.createElement)("div",{className:"pgw-head__actions"},w?(0,f.createElement)(R.SegmentedControl,{id:`pgw-range-${e.sessionId??"all"}`,label:t("card.range"),value:s,options:Lt.map(C=>({value:C,label:t(`range.${C}`)})),onChange:i}):null,(0,f.createElement)(R.Button,{variant:"ghost",size:"sm",disabled:r,title:t("card.refresh"),"aria-label":t("card.refresh"),onClick:a},(0,f.createElement)(R.IconRefreshOutlineRegular,{size:14})),F?(0,f.createElement)(lt,{ctx:e.ctx,t,onDone:(C,A)=>{v({text:C,ok:A}),u(null),l(0),a()}}):null)),B=b?(0,f.createElement)("div",{className:`pgw-flash${b.ok?"":" pgw-flash--error"}`,role:"status"},b.text):null,z=n.status==="ready"&&n.stale?(0,f.createElement)("div",{className:"pgw-notice pgw-notice--error",role:"status"},(0,f.createElement)(R.IconWarningOutlineRegular,{size:14,className:"pgw-notice__icon"}),(0,f.createElement)("span",null,t("card.stale",{reason:H(n.stale,t)}))):null,te=e.sessionId&&w?.sessionMasking===!1?(0,f.createElement)("div",{className:"pgw-notice",role:"status"},(0,f.createElement)(R.IconWarningOutlineRegular,{size:14,className:"pgw-notice__icon"}),(0,f.createElement)("span",null,t("session.offNotice"))):null;if(!w){let C=n.status==="error"?`${t("card.unavailable")} ${t("card.reason",{reason:H(n.failure,t)})}`:t("card.loading");return(0,f.createElement)("section",{className:k},M,(0,f.createElement)("div",{className:"pgw-empty pgw-empty--block"},C))}if(e.sessionId&&w.recent.length===0)return(0,f.createElement)("section",{className:k},M,z,B,te,(0,f.createElement)("div",{className:"pgw-empty pgw-empty--block"},t("panel.empty")));let E=w,K=E.stats[s],Q=new Set(E.vendorView?E.views??[]:[]),O=qe(E.recent,p,Dt),J=C=>{l(C),u(null)};return(0,f.createElement)("section",{className:k},M,z,B,te,(0,f.createElement)(rt,{t,items:De(E,K)}),(0,f.createElement)(ot,{totals:K,t}),(0,f.createElement)("div",{className:"pgw-dists"},(0,f.createElement)(de,{title:t("dist.kind"),data:K.kinds,empty:t("dist.empty")}),(0,f.createElement)(de,{title:t("dist.finder"),data:K.finders,empty:t("dist.empty")}),(0,f.createElement)(de,{title:t("dist.host"),data:K.hosts,empty:t("dist.empty")})),(0,f.createElement)("div",{className:"pgw-section"},(0,f.createElement)("div",{className:"pgw-section__head"},(0,f.createElement)("span",{className:"pgw-section__title"},t("recent.title")),E.recent.length>0?(0,f.createElement)("span",{className:"pgw-meta"},t("recent.count",{n:E.recent.length})):null),E.recent.length===0?(0,f.createElement)("div",{className:"pgw-empty pgw-empty--block"},t("recent.empty")):(0,f.createElement)("div",{className:"pgw-recs"},(0,f.createElement)(st,{t}),(0,f.createElement)("ul",{className:"pgw-recs__list","aria-label":t("recent.title")},O.items.map(C=>(0,f.createElement)(it,{key:C.key,ctx:e.ctx,r:C,open:c===C.key,toggle:()=>u(c===C.key?null:C.key),t,viewable:Q.has(C.key)})))),O.pages>1?(0,f.createElement)("div",{className:"pgw-pager"},(0,f.createElement)(R.Button,{variant:"ghost",size:"sm",disabled:O.page===0,onClick:()=>J(0)},t("page.first")),(0,f.createElement)(R.Button,{variant:"ghost",size:"sm",disabled:O.page===0,"aria-label":t("page.prev"),title:t("page.prev"),onClick:()=>J(O.page-1)},(0,f.createElement)(R.IconChevronLeftOutlineRegular,{size:14})),(0,f.createElement)("span",{className:"pgw-meta pgw-pager__at"},t("page.at",{page:O.page+1,pages:O.pages})),(0,f.createElement)(R.Button,{variant:"ghost",size:"sm",disabled:O.page>=O.pages-1,"aria-label":t("page.next"),title:t("page.next"),onClick:()=>J(O.page+1)},(0,f.createElement)(R.IconChevronRightOutlineRegular,{size:14}))):null))}var Kt="dsh-privacy-gateway",U=ie(void 0);function ut(e,t){return e.code==="noDisposer"?t("err.noDisposer"):t("err.thrown",{message:e.message})}function ft(e,t){U.set(void 0);let n;try{let a=e.slots.inject("conversation.view",()=>e.slots.register({name:"conversation.view",id:Kt,order:35,locale:L,label:()=>t("panel.tab")},r=>(0,ct.createElement)(ce,{ctx:e,t,panel:!0,...r?.sessionId?{sessionId:r.sessionId}:{}})));if(typeof a!="function"){U.set({code:"noDisposer"});return}n=a}catch(a){U.set({code:"thrown",message:a instanceof Error?a.message:String(a)});return}return()=>{let a=n;n=void 0;try{a?.()}catch{}}}var ue=class{waiting=[];current;failed=!1;send;onState;constructor(t,n=()=>{}){this.send=t,this.onState=n}get state(){return{busy:this.current!==void 0||this.waiting.length>0,failed:this.failed}}latest(t,n){for(let a=this.waiting.length-1;a>=0;a--)if(this.waiting[a]?.path===t)return this.waiting[a]?.value;return this.current?.path===t?this.current.value:n}write(t,n){return new Promise(a=>{let r=this.waiting.find(s=>s.path===t);r?(r.value=n,r.done.push(a)):this.waiting.push({path:t,value:n,done:[a]}),this.failed=!1,this.notify(),this.current||this.drain()})}async drain(){let t=!1;for(;this.waiting.length>0;){let n=this.waiting.shift();this.current=n;let a;try{a=await this.send(n.path,n.value,t)}catch{a=!1}this.current=void 0,t=!0;for(let r of n.done)r(a);if(!a){this.failed=!0;for(let r of this.waiting.splice(0))for(let s of r.done)s(!1)}this.notify()}}notify(){this.onState(this.state)}};function jt(){let[,e]=(0,g.useState)(0),t=(0,g.useSyncExternalStore)(G.subscribe,G.get),n=(0,g.useMemo)(()=>{try{return t?.describe()}catch{return}},[t]);(0,g.useEffect)(()=>{if(n)return Promise.resolve(n.ensure()).catch(()=>{}),n.subscribe(()=>e(c=>c+1))},[n]);let a=n?.getSnapshot().view,r=(0,g.useMemo)(()=>a?be(a.namespaces):void 0,[a]),s=(0,g.useMemo)(()=>{try{return t&&r!==void 0?t.get(r):void 0}catch{return}},[t,r]);(0,g.useEffect)(()=>s?s.subscribe(()=>e(c=>c+1)):void 0,[s]);let i=s?.getSnapshot();return(0,g.useMemo)(()=>{if(!s||!i)return;let c=s.mutate,u=c?(p,l)=>c.call(s,p,l):async p=>{for(let l of p)if(!await s.set(l.path.join("."),l.value))return!1;return!0};return{state:{status:i.status,value:i.value,revision:i.revision,writable:i.writable!==!1},mutate:u}},[s,i])}var gt="dsh-privacy-gateway.config.open",Gt=["mask"];function qt(){try{let e=JSON.parse(globalThis.localStorage?.getItem(gt)??"null");if(Array.isArray(e))return ne.filter(t=>e.includes(t))}catch{}return[...Gt]}function Wt(e){try{globalThis.localStorage?.setItem(gt,JSON.stringify(e))}catch{}}var D=e=>e;function ke(e){let{ctx:t,t:n}=e,a=jt(),r=e.form??a,s=(0,g.useRef)(r);s.current=r;let[i,c]=(0,g.useState)({busy:!1,failed:!1}),[u]=(0,g.useState)(()=>new ue((d,y,x)=>{let _=s.current;return _?_.mutate([{op:"set",path:[d],value:y}],x?void 0:_.state.revision):Promise.resolve(!1)},c)),[p,l]=(0,g.useState)(null),[b,v]=(0,g.useState)(!1),k=(0,g.useSyncExternalStore)(U.subscribe,U.get),w=(0,g.useId)(),[F,M]=(0,g.useState)(null),[B,z]=(0,g.useState)(!1),[te,E]=(0,g.useState)(qt),K=d=>E(y=>{let x=y.includes(d)?y.filter(_=>_!==d):ne.filter(_=>_===d||y.includes(_));return Wt(x),x}),Q=r?.state,O=Q?.status==="ready",J=Q?.writable!==!1,C=Q?.value??{},A=d=>u.latest(d,C[d]);if((0,g.useEffect)(()=>{let d=new AbortController;return Je(t,d.signal).then(y=>{d.signal.aborted||(z(!y.ok),M(y.ok?y.value:[]))}),()=>d.abort()},[t]),!r)return(0,g.createElement)("div",{className:"pgw-empty"},n("cfg.unavailable"));let q=!O||!J,yt=d=>F?.find(y=>y.id.toLowerCase()===d.toLowerCase())?.name??d,X=(d,y)=>{if(q)return Promise.resolve(!1);let x=Ne(d,A(d.key),y);return x?new Promise(_=>{v(!1),l($=>($?.resolve(!1),{f:d,next:y,change:x,resolve:_}))}):u.write(d.key,y)},_e=d=>{let y=p;l(null),v(!1),y&&(d?u.write(y.f.key,y.next).then(y.resolve):y.resolve(!1))},vt=d=>{let y=n(D(`cfg.f.${d.key}`));switch(d.kind){case"switch":return(0,g.createElement)(Ee,{label:y,checked:Y(A(d.key),d.default),disabled:q,onChange:x=>{X(d,x)}});case"choice":{let x=we(A(d.key),d.choices,d.default);return(0,g.createElement)(he,{label:n(D(`cfg.f.${d.key}.${x}`)),labelledBy:`${w}${d.key}`,items:d.choices.map(_=>({id:_,label:n(D(`cfg.f.${d.key}.${_}`))})),selectedId:x,disabled:q,onSelect:_=>{_!==x&&X(d,_)}})}case"list":return(0,g.createElement)(Ae,{t:n,list:V(A(d.key),d.default),anyCase:d.anyCase,placeholder:n(D(`cfg.f.${d.key}.placeholder`)),disabled:q,onChange:x=>X(d,x)});case"count":return(0,g.createElement)($e,{t:n,value:Z(A(d.key),d.min,d.default),min:d.min,label:y,disabled:q,onChange:x=>X(d,x)});case"providers":return bt(d)}},bt=d=>{let y=V(A(d.key),[]),x=Ze(F??[],y),_=x.filter(T=>T.excluded).map(T=>T.name),$=Oe(_,n("cfg.sep")),me=$.kind==="none"?n("cfg.excludedNone"):$.kind==="some"?$.names:n("cfg.excludedMany",{names:$.names,n:$.n});return(0,g.createElement)(he,{label:me,labelledBy:`${w}${d.key}`,multi:!0,items:x.map(T=>({id:T.id,label:T.registered?T.name:n("cfg.providerAbsent",{name:T.name})})),selectedIds:x.filter(T=>T.excluded).map(T=>T.id),disabled:q,onSelect:T=>{X(d,et(V(A(d.key),[]),T))}})},Ce=d=>{if(d.key==="showPanel"&&k)return(0,g.createElement)("div",{className:"pgw-cfg__desc pgw-cfg__desc--error"},n("cfg.sidebarFailed",{reason:ut(k,n)}));if(d.key==="excludeProviders"&&B)return(0,g.createElement)("div",{className:"pgw-cfg__desc pgw-cfg__desc--error"},n("cfg.providerListUnavailable"))},kt=Object.fromEntries(ae.map(d=>[d.key,A(d.key)])),xt=d=>{let y=ae.filter(P=>P.group===d),x=n(D(`cfg.g.${d}`)),_=te.includes(d),$=Re(d,kt),me=y.some(P=>Ce(P)!==void 0),T=O?[...$.map((P,_t)=>(0,g.createElement)("span",{key:_t,className:P.off?"pgw-fold__part pgw-fold__part--off":"pgw-fold__part"},n(D(P.key),P.params))),me?(0,g.createElement)("span",{key:"problem",className:"pgw-fold__part pgw-fold__part--error"},n("cfg.s.problem")):null]:null;return(0,g.createElement)(Me,{key:d,title:x,summary:T,open:_,toggleLabel:n(_?"cfg.collapse":"cfg.expand",{name:x}),onToggle:()=>K(d)},y.map(P=>(0,g.createElement)(Fe,{key:P.key,title:n(D(`cfg.f.${P.key}`)),titleId:`${w}${P.key}`,hint:n(D(`cfg.f.${P.key}.hint`)),note:Ce(P),inline:Se(P),half:P.half===!0},vt(P))))},ge=p?Ht(p,n,p.f.key==="excludeProviders"?yt:d=>d):null;return(0,g.createElement)(g.Fragment,null,(0,g.createElement)("section",{className:"pgw-cfg","aria-busy":i.busy||void 0},e.form?null:(0,g.createElement)("h3",{className:"pgw-title"},n("cfg.title")),i.failed?(0,g.createElement)("div",{className:"pgw-notice pgw-notice--error",role:"alert"},n("cfg.failed")):null,(0,g.createElement)("div",{className:"pgw-cfg__folds"},ne.map(xt)),(0,g.createElement)("p",{className:"pgw-cfg__desc pgw-cfg__foot"},n("cfg.applies")," ",n("cfg.others"))),(0,g.createElement)(pt.RiskConfirmation,{open:p!==null,title:ge?.title??"",description:ge?.body??"",acknowledgeLabel:ge?.ack??"",cancelLabel:n("card.cancel"),closeLabel:n("card.close"),confirmLabel:n("cfg.risk.confirm"),acknowledged:b,onAcknowledgedChange:v,onCancel:()=>_e(!1),onConfirm:()=>_e(!0)}))}function Ht(e,t,n){let{change:a}=e,r={},s=a.added??a.removed;return s&&(r.names=s.map(n).join(t("cfg.sep"))),a.from!==void 0&&(r.from=a.from),a.to!==void 0&&(r.to=a.to),{title:t(a.risk==="send"?"cfg.risk.send.title":"cfg.risk.delete.title"),body:t(D(`cfg.r.${e.f.key}`),r),ack:t(a.risk==="send"?"cfg.risk.send.ack":"cfg.risk.delete.ack")}}var fe="dsh-privacy-gateway",mt="dsh-privacy-gateway";var xe="var(--ds-font-family-code,ui-monospace,monospace)",Ut=`
4
+ `)}function je(e){return e.map(t=>t.placeholder).join("\0")}function Ge(e,t,n,a=400){let r=[...new Set(t.filter(u=>u!==""))].sort((u,p)=>p.length-u.length),s=r.length>0?new RegExp(r.map(Nt).join("|"),"g"):void 0,i=[],c=!1;for(let u=0;u<e.length;u++){let p=e[u],l=[],b=0;if(s)for(let v of p.matchAll(s))v.index>b&&l.push({text:p.slice(b,v.index)}),l.push({text:v[0],id:v[0]}),b=v.index+v[0].length;if(!(n&&b===0)){if((b<p.length||l.length===0)&&l.push({text:p.slice(b)}),i.length>=a){c=!0;break}i.push({n:u+1,parts:l})}}return{lines:i,truncated:c}}function qe(e,t,n){let a=Math.max(1,Math.ceil(e.length/n)),r=Math.min(Math.max(0,Math.floor(t)),a-1);return{items:e.slice(r*n,r*n+n),page:r,pages:a}}function We(e){let{path:t,role:n,type:a}=e,r=t.split(".")[0]??"";return n==="system"||n==="developer"||r==="system"||r==="instructions"||r==="systemInstruction"?"place.system":n==="tool"||a==="tool_result"||a==="function_call_output"||a==="functionResponse"?"place.toolResult":a==="tool_use"||a==="function_call"||/(^|\.)(tool_calls|function_call)(\.|$)/.test(t)||t.endsWith(".arguments")?"place.toolCall":n==="user"?"place.user":n==="assistant"||n==="model"?"place.assistant":"place.other"}function oe(e){return e.head?e.tail?`${e.head}\u2026${e.tail}`:`${e.head}\u2026`:""}function H(e,t){return t({noConnection:"err.noConnection",malformed:"err.malformed",remote:"err.remote",thrown:"err.thrown"}[e.code],"message"in e?{message:e.message}:void 0)}async function ee(e,t,n,a,r){let s;try{s=e.get("connection")?.rpc}catch{s=void 0}if(!s||typeof s.call!="function")return{ok:!1,failure:{code:"noConnection"}};try{let i=n===void 0?{}:{request:n},c=await s.call("/api",`privacyGateway/${t}`,{args:i},r);if(c?.ok!==!0){let p=c?.error?.message;return{ok:!1,failure:typeof p=="string"&&p!==""?{code:"remote",message:p}:{code:"malformed"}}}let u=a(c.value);return u===void 0?{ok:!1,failure:{code:"malformed"}}:{ok:!0,value:u}}catch(i){return{ok:!1,failure:{code:"thrown",message:i instanceof Error?i.message:String(i)}}}}function se(e,t,n,a){return ee(e,"overview",a?{limit:t,session:a}:{limit:t},Be,n)}function He(e,t,n){return ee(e,"vendorView",{key:t},a=>{let r=a?.body;return a!==null&&typeof a=="object"&&typeof r=="string"?r:null},n)}function Ue(e){return ee(e,"reset",void 0,t=>{let n=t?.files;return typeof n=="number"?n:0})}function Qe(e,t,n){return ee(e,"sessionMasking",{session:t,on:n},a=>{let r=a?.on;return typeof r=="boolean"?r:void 0})}function Je(e,t){return ee(e,"providers",void 0,n=>Array.isArray(n)?n.flatMap(St):void 0,t)}function St(e){let t=e;return t!==null&&typeof t=="object"&&typeof t.id=="string"&&t.id!==""?[{id:t.id,name:typeof t.name=="string"&&t.name!==""?t.name:t.id}]:[]}function ie(e){let t=e,n=new Set;return{get:()=>t,set(a){if(!Object.is(a,t)){t=a;for(let r of[...n])try{r()}catch{}}},subscribe(a){return n.add(a),()=>{n.delete(a)}}}}var Rt="Show the Privacy tab at the top of the session";function Tt(e){let t=e,n=t?.refs,r=(n!==null&&typeof n=="object"&&typeof t?.uid<"u"?n[String(t.uid)]:void 0)?.dict??t?.dict;return r!==null&&typeof r=="object"?Object.keys(r):[]}function be(e){for(let t of e){let n=Tt(t.schema);if(n.includes("showPanel")&&(t.ns.includes("privacy-gateway")||n.includes("excludeProviders")||JSON.stringify(t.schema??null).includes(Rt)))return t.ns}}function Pt(e){let t=be(e);if(t===void 0)return;let n=e.find(a=>a.ns===t)?.value;return typeof n=="object"&&n!==null&&n.showPanel===!0}function It(e){let t=e;return t!=null&&typeof t.describe=="function"&&typeof t.get=="function"?t:void 0}var G=ie(void 0);function Xe(e){let t=n=>n.effect(()=>{let a;try{a=It(n.get("configForms"))}catch{a=void 0}return G.set(a),()=>{G.get()===a&&G.set(void 0)}},"dsh-privacy-gateway: settings service");typeof e.inject=="function"?e.inject(["configForms"],t):t(e)}var Ot=6e4;function Ft(e,t){return t===void 0?e:t||e===!0?!0:e===!1?!1:void 0}function Ye(e,t,n=G){let a=!1,r,s,i,c=()=>{if(a)return;let k=Ft(s,i);k===void 0||k===r||(r=k,t(k))},u=()=>{se(e,1).then(k=>{a||!k.ok||(s=k.value.showPanel===!0,c())})},p,l=k=>{try{p?.()}catch{}p=void 0,i=void 0;let w;try{w=k?.describe()}catch{w=void 0}if(w){let F=w,M=()=>{if(a)return;let B=F.getSnapshot().view;if(!B)return;let z=Pt(B.namespaces);z!==void 0&&(i=z,c())};p=F.subscribe(M),Promise.resolve(F.ensure()).then(M,M),M()}c()},b=n.subscribe(()=>l(n.get()));l(n.get()),u();let v=setInterval(u,Ot);return()=>{a=!0,clearInterval(v),b();try{p?.()}catch{}}}function Ze(e,t){let n=r=>t.some(s=>s.toLowerCase()===r.toLowerCase()),a=e.map(r=>({id:r.id,name:r.name,excluded:n(r.id),registered:!0}));for(let r of t)a.some(s=>s.id.toLowerCase()===r.toLowerCase())||a.push({id:r,name:r,excluded:!0,registered:!1});return a}function et(e,t){let n=t.toLowerCase();return e.some(a=>a.toLowerCase()===n)?e.filter(a=>a.toLowerCase()!==n):[...e,t]}var ct=require("react");var L="privacyGateway",Mt={"card.title":"\u8131\u654F\u7EDF\u8BA1","card.on":"\u8131\u654F\u5F00\u542F","card.off":"\u8131\u654F\u5DF2\u5173\u95ED","card.refresh":"\u5237\u65B0","card.loading":"\u6B63\u5728\u8BFB\u53D6\u2026","card.unavailable":"\u8BFB\u4E0D\u5230\u7EDF\u8BA1\uFF1A\u63D2\u4EF6\u7684 host \u7AEF\u6CA1\u6709\u8FD0\u884C\uFF0C\u6216\u9700\u8981\u91CD\u542F dsh\u3002","card.memoryOnly":"\u8BB0\u5F55\u53EA\u5728\u5185\u5B58\uFF08record \u5DF2\u5173\u95ED\uFF09","card.values":"\u5185\u5B58\u91CC\u53EF\u8FD8\u539F\u7684\u503C {n} \u4E2A","card.range":"\u7EDF\u8BA1\u8303\u56F4","card.reset":"\u6E05\u7A7A\u6570\u636E","card.resetTitle":"\u6E05\u7A7A\u9690\u79C1\u4FDD\u62A4\u7684\u5386\u53F2\u6570\u636E\uFF1F","card.resetBody":"\u4F1A\u5220\u9664\u6240\u6709\u4F1A\u8BDD\u7684\u8131\u654F\u8BB0\u5F55\u548C\u7EDF\u8BA1\uFF0C\u5305\u62EC\u78C1\u76D8\u4E0A\u672C\u5B9E\u4F8B\u72B6\u6001\u76EE\u5F55\u91CC masking/ \u4E0B\u7684\u8BB0\u5F55\u6587\u4EF6\uFF0C\u4EE5\u53CA\u5185\u5B58\u91CC\u4FDD\u7559\u7684\u53D1\u51FA\u5185\u5BB9\u526F\u672C\u3002\u6E05\u7A7A\u540E\u65E0\u6CD5\u6062\u590D\u3002\u8131\u654F\u89C4\u5219\u3001\u914D\u7F6E\u548C\u6B63\u5728\u8FDB\u884C\u7684\u8BF7\u6C42\u4E0D\u53D7\u5F71\u54CD\u3002","card.resetAck":"\u6211\u77E5\u9053\u6E05\u7A7A\u540E\u65E0\u6CD5\u6062\u590D","card.resetConfirm":"\u6E05\u7A7A","card.cancel":"\u53D6\u6D88","card.close":"\u5173\u95ED","card.resetDone":"\u5DF2\u6E05\u7A7A\uFF0C\u5220\u9664\u4E86 {n} \u4E2A\u8BB0\u5F55\u6587\u4EF6\u3002","card.resetFailed":"\u6CA1\u80FD\u6E05\u7A7A\uFF1A{message}","stat.took":"\u5E73\u5747\u8017\u65F6","stat.tookMax":"\u6700\u957F {max} ms","stat.ms":"{n} ms","recent.count":"\u5171 {n} \u6761","recent.col.time":"\u65F6\u95F4","recent.col.where":"\u6A21\u578B / host","recent.col.from":"\u6765\u6E90","recent.col.places":"\u66FF\u6362","recent.col.restored":"\u8FD8\u539F","page.at":"{page} / {pages}","range.today":"\u4ECA\u65E5","range.week":"7 \u5929","range.month":"30 \u5929","stat.requests":"\u8BB0\u5F55\u7684\u8BF7\u6C42","stat.masked":"\u6709\u8131\u654F","stat.n":"\u66FF\u6362\u5904","stat.restored":"\u8FD8\u539F\u5904","stat.inTools":"\u5176\u4E2D\u5DE5\u5177\u53C2\u6570 {n}","stat.unmapped":"\u672A\u77E5\u5360\u4F4D\u7B26","stat.failed":"\u8131\u654F\u5931\u8D25","dist.kind":"\u6309 kind","dist.finder":"\u6309 finder","dist.host":"\u6309 host","dist.empty":"\u6682\u65E0","warn.streak":"\u8FDE\u7EED {n} \u6B21\u8131\u654F\u5931\u8D25\uFF0C\u8BF7\u6C42\u672A\u53D1\u51FA\u3002\u7528 /privacy off \u6B62\u8840\u3002","warn.unmapped":"\u56DE\u590D\u91CC\u6709 {n} \u4E2A\u503C\u8868\u91CC\u6CA1\u6709\u7684\u5360\u4F4D\u7B26\uFF0C\u53EF\u80FD\u88AB\u6A21\u578B\u6539\u574F\u4E86\u3002","warn.inTools":"\u6709 {n} \u5904\u8FD8\u539F\u843D\u5728\u5DE5\u5177\u8C03\u7528\u53C2\u6570\u91CC\uFF0C\u5DE5\u5177\u6267\u884C\u65F6\u771F\u503C\u4F1A\u88AB\u7528\u5230\uFF1B\u5982\u679C\u4E0D\u662F\u4F60\u9884\u671F\u7684\uFF0C\u68C0\u67E5\u6700\u8FD1\u7684\u5DE5\u5177\u8C03\u7528\u3002","recent.title":"\u6700\u8FD1\u8BB0\u5F55","recent.empty":"\u8FD8\u6CA1\u6709\u8BB0\u5F55\u3002","recent.failed":"\u5931\u8D25","col.placeholder":"\u5360\u4F4D\u7B26","col.kind":"kind","col.finder":"finder","col.head":"\u5F00\u5934","recent.placesHint":"\u8BF7\u6C42\u91CC\u88AB\u6362\u6210\u5360\u4F4D\u7B26\u7684\u5904\u6570\uFF08\u4E0D\u662F\u53D1\u51FA\u53BB\u7684\u503C\u7684\u6570\u91CF\uFF09","recent.restoredHint":"\u56DE\u590D\u91CC\u51FA\u73B0\u5360\u4F4D\u7B26\u3001\u88AB\u6362\u56DE\u771F\u503C\u7684\u5904\u6570\uFF1B\u6A21\u578B\u4E0D\u5FC5\u590D\u8FF0\u6BCF\u4E2A\u503C\uFF0C\u6240\u4EE5\u4E24\u8005\u901A\u5E38\u4E0D\u76F8\u7B49","col.len":"\u957F\u5EA6","col.n":"\u6B21\u6570","recent.noValues":"\u8FD9\u6B21\u8BF7\u6C42\u6CA1\u6709\u8131\u654F\u3002","recent.omitted":"\u53E6\u6709 {n} \u4E2A\u503C\u8D85\u51FA\u5355\u6761\u8BB0\u5F55\u7684\u4E0A\u9650\uFF0C\u6CA1\u6709\u5217\u51FA\u3002","stat.warned":"warn \u7167\u53D1","stat.blocked":"block \u62E6\u4E0B","stat.exfil":"\u5916\u5E26\u5DE5\u5177\u8C03\u7528","stat.exfilBlocked":"\u5176\u4E2D {n} \u5904\u672A\u8FD8\u539F","warn.exfil":"\u6709 {n} \u6B21\u5DE5\u5177\u8C03\u7528\u628A\u8FD8\u539F\u51FA\u7684\u503C\u5199\u8FDB\u4E86\u6307\u5411\u672C\u673A\u4EE5\u5916 host \u7684\u53C2\u6570\uFF0C\u5C55\u5F00\u6700\u8FD1\u8BB0\u5F55\u67E5\u770B host\u3002","recent.blocked":"\u5DF2\u62E6\u4E0B","recent.exfil":"\u5916\u5E26\uFF1A{hosts}","col.action":"\u52A8\u4F5C","action.warn":"warn \u7167\u53D1","action.block":"block \u62E6\u4E0B","view.open":"\u67E5\u770B\u53D1\u51FA\u5185\u5BB9","view.title":"\u8FD9\u6B21\u8BF7\u6C42\u5B9E\u9645\u53D1\u51FA\u7684\u5185\u5BB9","view.agent":"\u66FF\u6362\u5904\u6807\u6CE8\uFF08kind \xB7 \u5F00\u5934 \xB7 \u957F\u5EA6\uFF09","view.vendor":"\u6A21\u578B\u670D\u52A1\u6536\u5230\u7684\u539F\u6587","view.onlyChanged":"\u53EA\u770B\u6709\u66FF\u6362\u7684\u884C","view.loading":"\u6B63\u5728\u8BFB\u53D6\u2026","view.gone":"\u8FD9\u4EFD\u526F\u672C\u5DF2\u4E0D\u5728\u5185\u5B58\u91CC\uFF1A\u8D85\u51FA\u4E86\u4FDD\u7559\u4E0A\u9650\uFF0C\u6216 dsh \u5DF2\u91CD\u542F\u3002","view.truncated":"\u53EA\u663E\u793A\u524D {n} \u884C\u3002","view.none":"\u6CA1\u6709\u6709\u66FF\u6362\u7684\u884C\u3002","view.close":"\u6536\u8D77","panel.tab":"\u9690\u79C1\u4FDD\u62A4","panel.session":"\u672C\u4F1A\u8BDD","panel.empty":"\u672C\u4F1A\u8BDD\u8FD8\u6CA1\u6709\u8BB0\u5F55\u3002\u53EA\u6709\u53D1\u751F\u8131\u654F\u6216\u8FD8\u539F\u7684\u6A21\u578B\u8BF7\u6C42\u624D\u4F1A\u7559\u4E0B\u8BB0\u5F55\u3002","page.first":"\u9996\u9875","page.prev":"\u4E0A\u4E00\u9875","page.next":"\u4E0B\u4E00\u9875","cfg.title":"\u914D\u7F6E","cfg.f.showPanel":"\u5728\u4F1A\u8BDD\u9876\u90E8\u663E\u793A\u300C\u9690\u79C1\u4FDD\u62A4\u300D\u6807\u7B7E\u9875","cfg.f.showPanel.hint":"\u6253\u5F00\u540E\uFF0C\u5BF9\u8BDD / \u8F68\u8FF9 \u65C1\u8FB9\u591A\u4E00\u4E2A\u300C\u9690\u79C1\u4FDD\u62A4\u300D\uFF0C\u5185\u5BB9\u662F\u672C\u4F1A\u8BDD\u7684\u8131\u654F\u8BB0\u5F55\u4E0E\u7EDF\u8BA1\u3002","cfg.unavailable":"\u8BFB\u4E0D\u5230\u8BBE\u7F6E\uFF1A\u5BBF\u4E3B\u6CA1\u6709\u63D0\u4F9B\u8BBE\u7F6E\u670D\u52A1\uFF0C\u6216\u63D2\u4EF6\u7684 host \u7AEF\u8FD8\u6CA1\u52A0\u8F7D\u65B0\u7248\u672C\u3002","cfg.failed":"\u6CA1\u80FD\u4FDD\u5B58\uFF0C\u8BF7\u91CD\u8BD5\u3002","cfg.sidebarFailed":"\u6807\u7B7E\u9875\u6CE8\u518C\u5931\u8D25\uFF1A{reason}","cfg.f.excludeProviders":"\u4E0D\u8131\u654F\u7684 provider","cfg.excludedNone":"\u4E0D\u9009\uFF1A\u5168\u90E8\u8131\u654F","cfg.sep":"\u3001","cfg.excludedMany":"{names} \u7B49 {n} \u4E2A","cfg.providerListUnavailable":"\u8BFB\u4E0D\u5230 provider \u5217\u8868\uFF1A\u5BBF\u4E3B\u6CA1\u6709\u6CE8\u518C\u4EFB\u4F55 provider\uFF0C\u6216\u8FD9\u6B21\u8C03\u7528\u5931\u8D25\u3002","cfg.remove":"\u79FB\u9664 {name}","cfg.f.excludeProviders.hint":"\u52FE\u9009\u7684 provider \u53D1\u51FA\u7684\u8BF7\u6C42\u539F\u6837\u9001\u51FA\uFF0C\u56DE\u590D\u4E5F\u4E0D\u8FD8\u539F\uFF0C\u4E0D\u7559\u8BB0\u5F55\u3002\u6539\u52A8\u4ECE\u4E0B\u4E00\u6B21\u6A21\u578B\u8C03\u7528\u8D77\u751F\u6548\u3002","cfg.providerAbsent":"{name}\uFF08\u5F53\u524D\u672A\u6CE8\u518C\uFF09","cfg.add":"\u6DFB\u52A0","cfg.listEmpty":"\u8FD8\u6CA1\u6709","cfg.countInvalid":"\u8981\u586B\u4E0D\u5C0F\u4E8E {min} \u7684\u6574\u6570\u3002","cfg.applies":"\u6539\u52A8\u5373\u65F6\u4FDD\u5B58\uFF0C\u4ECE\u4E0B\u4E00\u6B21\u6A21\u578B\u8C03\u7528\u8D77\u751F\u6548\uFF0C\u4E0D\u7528\u91CD\u542F\u3002","cfg.others":"\u5176\u4F59\u914D\u7F6E\u9879\uFF08actions\u3001cookieNames\u3001excludeHosts\u3001maxValues \u7B49\uFF09\u5728 cordis.patch.yml \u91CC\u4FEE\u6539\uFF0C\u8BF4\u660E\u89C1 README\u3002","cfg.g.mask":"\u8131\u654F","cfg.g.lists":"\u8BCD\u8868","cfg.g.record":"\u8BB0\u5F55","cfg.g.view":"\u6807\u7B7E\u9875\u4E0E provider","cfg.f.enabled":"\u542F\u7528\u8131\u654F","cfg.f.enabled.hint":"\u603B\u5F00\u5173\u3002\u5173\u6389\u540E\u7F51\u5173\u4E0D\u518D\u6539\u5199\u8BF7\u6C42\uFF0C\u7EDF\u8BA1\u4E0E\u8BB0\u5F55\u4E5F\u505C\u4E0B\u3002","cfg.f.secrets":"\u8131\u654F\u5BC6\u94A5\u4E0E\u51ED\u636E","cfg.f.secrets.hint":"API key\u3001\u4EE4\u724C\u3001\u5BC6\u7801\u3001\u79C1\u94A5\u3001cookie\u3002","cfg.f.personal":"\u8131\u654F\u4E2A\u4EBA\u4FE1\u606F","cfg.f.personal.hint":"\u90AE\u7BB1\u3001\u5927\u9646\u624B\u673A\u53F7\u3001\u8EAB\u4EFD\u8BC1\u53F7\u3001\u94F6\u884C\u5361\u53F7\u3002","cfg.f.shape":"\u5BC6\u94A5\u6362\u6210\u540C\u5F62\u5047 key","cfg.f.shape.hint":"\u524D\u7F00\u3001\u957F\u5EA6\u3001\u5B57\u7B26\u7C7B\u522B\u4E0D\u53D8\uFF0C\u4EE3\u66FF {{\u2026}} \u5360\u4F4D\u7B26\uFF1B\u4E0D\u8DB3 8 \u5B57\u7B26\u6216\u542B\u7279\u6B8A\u5B57\u7B26\u7684\u503C\u4ECD\u7528\u5360\u4F4D\u7B26\uFF0C\u56DE\u590D\u91CC\u7167\u6837\u8FD8\u539F\u3002","cfg.f.toolGuard":"\u5DE5\u5177\u8C03\u7528\u5916\u53D1\u4FDD\u62A4","cfg.f.toolGuard.hint":"\u5DE5\u5177\u8C03\u7528\u7684\u53C2\u6570\u91CC\u8FD8\u539F\u51FA\u4E86\u503C\u3001\u53C8\u6307\u5411\u672C\u673A\u4EE5\u5916\u7684 host \u65F6\u600E\u4E48\u5904\u7406\u3002","cfg.f.toolGuard.off":"\u53EA\u8BA1\u6570","cfg.f.toolGuard.warn":"\u544A\u8B66\u5E76\u8BB0\u5F55","cfg.f.toolGuard.block":"\u4E0D\u8FD8\u539F","cfg.f.words":"\u81EA\u5B9A\u4E49\u654F\u611F\u8BCD","cfg.f.words.hint":"\u9879\u76EE\u4EE3\u53F7\u3001\u5BA2\u6237\u540D\u7B49\uFF0C\u6309\u539F\u6837\u6362\u6210 TERM \u5360\u4F4D\u7B26\u3002\u56DE\u8F66\u6216\u70B9\u300C\u6DFB\u52A0\u300D\u52A0\u5165\u3002","cfg.f.words.placeholder":"\u8F93\u5165\u4E00\u4E2A\u8BCD","cfg.f.allow":"\u6C38\u4E0D\u8131\u654F\u7684\u503C","cfg.f.allow.hint":"\u6574\u503C\u5339\u914D\uFF0C\u4E0D\u5206\u5927\u5C0F\u5199\uFF0C\u54EA\u6761\u89C4\u5219\u627E\u5230\u90FD\u4E0D\u6362\u3002","cfg.f.allow.placeholder":"\u8F93\u5165\u4E00\u4E2A\u503C","cfg.f.record":"\u8BB0\u5F55\u5199\u76D8","cfg.f.record.hint":"\u5199\u5230\u672C\u5B9E\u4F8B\u72B6\u6001\u76EE\u5F55\u7684 masking/ \u4E0B\uFF08\u6BCF\u4E2A\u5B9E\u4F8B\u4E00\u4E2A\u76EE\u5F55\uFF09\uFF0C\u53EA\u8BB0\u5143\u4FE1\u606F\u3001\u4E0D\u8BB0\u503C\u672C\u8EAB\uFF1B\u5173\u6389\u53EA\u5728\u5185\u5B58\u91CC\u7EDF\u8BA1\u3002","cfg.f.keepDays":"\u8BB0\u5F55\u4FDD\u7559\u5929\u6570","cfg.f.keepDays.hint":"\u8D85\u8FC7\u7684\u6309\u5929\u5220\u9664\uFF0C\u81F3\u5C11 1 \u5929\u3002","cfg.f.vendorView":"\u4FDD\u7559\u53D1\u51FA\u5185\u5BB9\uFF0C\u4F9B\u5BF9\u7167\u67E5\u770B","cfg.f.vendorView.hint":"\u5F00\u542F\u540E\uFF0C\u4E4B\u540E\u7684\u8BB0\u5F55\u591A\u4E00\u4E2A\u300C\u67E5\u770B\u53D1\u51FA\u5185\u5BB9\u300D\u6309\u94AE\uFF0C\u53EF\u4EE5\u6838\u5BF9\u6A21\u578B\u670D\u52A1\u5B9E\u9645\u6536\u5230\u4E86\u4EC0\u4E48\u3001\u6709\u6CA1\u6709\u6F0F\u8131\u654F\u3002\u526F\u672C\u5DF2\u8131\u654F\uFF0C\u4E0D\u542B\u771F\u503C\uFF1B\u53EA\u5B58\u5728\u5185\u5B58\u91CC\uFF0C\u6700\u591A 100 \u4EFD\u3001\u5171 64 MiB\uFF0C\u91CD\u542F\u5373\u6E05\u7A7A\u3002\u526F\u672C\u542B\u5B8C\u6574\u7684\u63D0\u793A\u8BCD\u548C\u5BF9\u8BDD\uFF0C\u5E73\u65F6\u4E0D\u5FC5\u5F00\u3002","cfg.expand":"\u5C55\u5F00\u300C{name}\u300D","cfg.collapse":"\u6536\u8D77\u300C{name}\u300D","cfg.s.maskOff":"\u5DF2\u5173\u95ED\uFF0C\u8BF7\u6C42\u539F\u6837\u53D1\u51FA","cfg.s.maskNothing":"\u6CA1\u6709\u9009\u8131\u654F\u7C7B\u578B","cfg.s.secrets":"\u5BC6\u94A5\u4E0E\u51ED\u636E","cfg.s.personal":"\u4E2A\u4EBA\u4FE1\u606F","cfg.s.shape":"\u540C\u5F62\u5047 key","cfg.s.toolGuard.off":"\u5916\u53D1\u4FDD\u62A4\uFF1A\u53EA\u8BA1\u6570","cfg.s.toolGuard.warn":"\u5916\u53D1\u4FDD\u62A4\uFF1A\u544A\u8B66","cfg.s.toolGuard.block":"\u5916\u53D1\u4FDD\u62A4\uFF1A\u4E0D\u8FD8\u539F","cfg.s.words":"\u654F\u611F\u8BCD {n} \u4E2A","cfg.s.allow":"\u653E\u884C {n} \u4E2A","cfg.s.record":"\u5199\u76D8\uFF0C\u4FDD\u7559 {n} \u5929","cfg.s.recordOff":"\u53EA\u5728\u5185\u5B58","cfg.s.vendorView":"\u4FDD\u7559\u53D1\u51FA\u5185\u5BB9","cfg.s.panel":"\u663E\u793A\u6807\u7B7E\u9875","cfg.s.panelOff":"\u4E0D\u663E\u793A\u6807\u7B7E\u9875","cfg.s.providersAll":"\u5168\u90E8 provider \u8131\u654F","cfg.s.providersSome":"{n} \u4E2A provider \u4E0D\u8131\u654F","cfg.s.problem":"\u6709\u63D0\u793A\uFF0C\u5C55\u5F00\u67E5\u770B","card.valuesHint":"\u88AB\u6362\u4E0B\u6765\u7684\u539F\u503C\u53EA\u5B58\u5728\u5185\u5B58\u91CC\uFF0C\u7528\u6765\u628A\u6A21\u578B\u56DE\u590D\u91CC\u7684\u5360\u4F4D\u7B26\u6362\u56DE\u539F\u503C\u3002\u6240\u6709\u4F1A\u8BDD\u5171\u7528\uFF0C\u91CD\u542F dsh \u540E\u6E05\u7A7A\u3002","session.mask":"\u672C\u4F1A\u8BDD\u8131\u654F","session.offTitle":"\u5173\u95ED\u672C\u4F1A\u8BDD\u7684\u8131\u654F\uFF1F","session.offBody":"\u5173\u95ED\u540E\uFF0C\u672C\u4F1A\u8BDD\u4E4B\u540E\u7684\u6A21\u578B\u8BF7\u6C42\u539F\u6837\u53D1\u7ED9\u6A21\u578B\u670D\u52A1\uFF1A\u5BC6\u94A5\u3001\u51ED\u636E\u3001\u4E2A\u4EBA\u4FE1\u606F\u548C\u81EA\u5B9A\u4E49\u654F\u611F\u8BCD\u90FD\u4E0D\u518D\u66FF\u6362\uFF0C\u56DE\u590D\u4E0D\u518D\u8FD8\u539F\uFF0C\u4E5F\u4E0D\u7559\u8BB0\u5F55\u3002\u5176\u4ED6\u4F1A\u8BDD\u4E0D\u53D7\u5F71\u54CD\uFF0C\u968F\u65F6\u53EF\u4EE5\u5728\u8FD9\u91CC\u91CD\u65B0\u6253\u5F00\u3002","session.offAck":"\u6211\u77E5\u9053\u672C\u4F1A\u8BDD\u7684\u5185\u5BB9\u4F1A\u539F\u6837\u53D1\u7ED9\u6A21\u578B\u670D\u52A1","session.offConfirm":"\u5173\u95ED\u8131\u654F","session.offNotice":"\u672C\u4F1A\u8BDD\u5DF2\u5173\u95ED\u8131\u654F\uFF1A\u8BF7\u6C42\u539F\u6837\u53D1\u7ED9\u6A21\u578B\u670D\u52A1\uFF0C\u4E0D\u7559\u8BB0\u5F55\u3002","session.failed":"\u6CA1\u80FD\u5207\u6362\uFF1A{message}","cfg.f.recordContext":"\u8BB0\u5F55\u66FF\u6362\u5904\u7684\u4E0A\u4E0B\u6587","cfg.f.recordContext.hint":"\u6BCF\u4E2A\u66FF\u6362\u5904\u524D\u540E\u5404\u7EA6 80 \u4E2A\u5B57\u7B26\u548C\u5B83\u6240\u5728\u7684\u4F4D\u7F6E\uFF08\u7528\u6237\u6D88\u606F\u3001\u5DE5\u5177\u7ED3\u679C\u7B49\uFF09\u4E00\u8D77\u8BB0\u4E0B\uFF0C\u65B9\u4FBF\u786E\u8BA4\u662F\u5728\u4EC0\u4E48\u573A\u5408\u66FF\u6362\u7684\u3002\u8FD9\u6BB5\u6587\u5B57\u53D6\u81EA\u53D1\u51FA\u7684\u5185\u5BB9\uFF0C\u91CC\u9762\u88AB\u8131\u654F\u7684\u503C\u90FD\u5DF2\u662F\u5360\u4F4D\u7B26\uFF1B\u6CA1\u5F00\u4E2A\u4EBA\u4FE1\u606F\u8131\u654F\u65F6\uFF0C\u90AE\u7BB1\u3001\u624B\u673A\u53F7\u7B49\u4F1A\u539F\u6837\u51FA\u73B0\u5728\u8FD9\u6BB5\u6587\u5B57\u91CC\u3002","recent.contextHint":"\u66FF\u6362\u5904\u524D\u540E\u7684\u6587\u5B57\uFF0C\u53D6\u81EA\u53D1\u51FA\u7684\u5185\u5BB9\uFF0C\u88AB\u8131\u654F\u7684\u503C\u90FD\u662F\u5360\u4F4D\u7B26","place.system":"\u7CFB\u7EDF\u63D0\u793A","place.toolResult":"\u5DE5\u5177\u7ED3\u679C","place.toolCall":"\u5DE5\u5177\u8C03\u7528","place.user":"\u7528\u6237\u6D88\u606F","place.assistant":"\u6A21\u578B\u56DE\u590D","place.other":"\u5176\u4ED6","err.noConnection":"\u8FD8\u6CA1\u6709\u8FDE\u4E0A dsh","err.malformed":"\u63D2\u4EF6 host \u7AEF\u7684\u56DE\u7B54\u683C\u5F0F\u4E0D\u5BF9\uFF0Chost \u7AEF\u548C\u9875\u9762\u53EF\u80FD\u4E0D\u662F\u540C\u4E00\u7248\u672C","err.remote":"{message}","err.thrown":"{message}","err.noDisposer":"\u4F1A\u8BDD\u89C6\u56FE\u6761\u6CA1\u6709\u4EA4\u56DE\u64A4\u9500\u6CE8\u518C\u7684\u51FD\u6570","card.stale":"\u5237\u65B0\u5931\u8D25\uFF08{reason}\uFF09\u3002\u4E0B\u9762\u662F\u4E0A\u6B21\u8BFB\u5230\u7684\u6570\u636E\uFF0C\u53EF\u80FD\u5DF2\u8FC7\u671F\u3002","card.reason":"\u539F\u56E0\uFF1A{reason}","recent.cell":"{name}\uFF1A{value}","recent.cellSep":"\uFF0C","view.unknown":"\u2039\u672A\u77E5\u5360\u4F4D\u7B26\u203A","view.line":"\u884C","cfg.risk.send.title":"\u8FD9\u9879\u6539\u52A8\u4F1A\u8BA9\u5185\u5BB9\u539F\u6837\u53D1\u7ED9\u6A21\u578B\u670D\u52A1","cfg.risk.delete.title":"\u8FD9\u9879\u6539\u52A8\u4F1A\u5220\u9664\u5DF2\u6709\u6570\u636E","cfg.risk.send.ack":"\u6211\u77E5\u9053\u76F8\u5173\u5185\u5BB9\u4F1A\u539F\u6837\u53D1\u7ED9\u6A21\u578B\u670D\u52A1","cfg.risk.delete.ack":"\u6211\u77E5\u9053\u5220\u9664\u7684\u6570\u636E\u65E0\u6CD5\u6062\u590D","cfg.risk.confirm":"\u786E\u8BA4\u4FEE\u6539","cfg.r.enabled":"\u5173\u95ED\u540E\uFF0C\u6240\u6709\u4F1A\u8BDD\u7684\u6A21\u578B\u8BF7\u6C42\u539F\u6837\u53D1\u7ED9\u6A21\u578B\u670D\u52A1\uFF1A\u5BC6\u94A5\u3001\u51ED\u636E\u3001\u4E2A\u4EBA\u4FE1\u606F\u548C\u81EA\u5B9A\u4E49\u654F\u611F\u8BCD\u90FD\u4E0D\u518D\u66FF\u6362\uFF0C\u56DE\u590D\u4E0D\u518D\u8FD8\u539F\uFF0C\u4E5F\u4E0D\u7559\u8BB0\u5F55\u3002","cfg.r.secrets":"\u5173\u95ED\u540E\uFF0CAPI key\u3001\u4EE4\u724C\u3001\u5BC6\u7801\u3001\u79C1\u94A5\u548C cookie \u4E0D\u518D\u66FF\u6362\uFF0C\u539F\u6837\u53D1\u7ED9\u6A21\u578B\u670D\u52A1\u3002","cfg.r.personal":"\u5173\u95ED\u540E\uFF0C\u90AE\u7BB1\u3001\u624B\u673A\u53F7\u3001\u8EAB\u4EFD\u8BC1\u53F7\u548C\u94F6\u884C\u5361\u53F7\u4E0D\u518D\u66FF\u6362\uFF0C\u539F\u6837\u53D1\u7ED9\u6A21\u578B\u670D\u52A1\u3002","cfg.r.words":"\u53BB\u6389\u7684\u654F\u611F\u8BCD\uFF08{names}\uFF09\u4EE5\u540E\u4E0D\u518D\u8131\u654F\uFF0C\u51FA\u73B0\u5728\u8BF7\u6C42\u91CC\u65F6\u539F\u6837\u53D1\u7ED9\u6A21\u578B\u670D\u52A1\u3002","cfg.r.allow":"\u65B0\u52A0\u7684\u503C\uFF08{names}\uFF09\u4EE5\u540E\u4E0D\u518D\u8131\u654F\uFF0C\u51FA\u73B0\u5728\u8BF7\u6C42\u91CC\u65F6\u539F\u6837\u53D1\u7ED9\u6A21\u578B\u670D\u52A1\u3002","cfg.r.excludeProviders":"\u65B0\u52FE\u9009\u7684 provider\uFF08{names}\uFF09\u53D1\u51FA\u7684\u8BF7\u6C42\u539F\u6837\u9001\u51FA\uFF0C\u56DE\u590D\u4E0D\u8FD8\u539F\uFF0C\u4E5F\u4E0D\u7559\u8BB0\u5F55\u3002","cfg.r.record":"\u5173\u95ED\u540E\uFF0C\u6392\u961F\u7B49\u5F85\u5199\u76D8\u7684\u8BB0\u5F55\u4E0D\u518D\u5199\u5165\uFF0C\u4E4B\u540E\u7684\u8BB0\u5F55\u53EA\u5728\u5185\u5B58\u91CC\u7EDF\u8BA1\uFF0C\u91CD\u542F dsh \u540E\u4E22\u5931\u3002","cfg.r.keepDays":"\u4FDD\u7559\u5929\u6570\u4ECE {from} \u5929\u6539\u4E3A {to} \u5929\uFF0C\u4E0B\u6B21\u5199\u76D8\u65F6\u8D85\u51FA\u7684\u8BB0\u5F55\u6587\u4EF6\u4F1A\u88AB\u5220\u9664\uFF0C\u65E0\u6CD5\u6062\u590D\u3002","cfg.r.vendorView":"\u5173\u95ED\u540E\uFF0C\u5185\u5B58\u91CC\u5DF2\u4FDD\u7559\u7684\u53D1\u51FA\u5185\u5BB9\u526F\u672C\u7ACB\u5373\u6E05\u7A7A\uFF0C\u4E4B\u524D\u7684\u8BB0\u5F55\u4E0D\u80FD\u518D\u67E5\u770B\u53D1\u51FA\u5185\u5BB9\u3002"},Et={"card.title":"Masking statistics","card.on":"Masking on","card.off":"Masking off","card.refresh":"Refresh","card.loading":"Loading\u2026","card.unavailable":"No statistics: the plugin\u2019s host half is not running, or dsh needs a restart.","card.memoryOnly":"Records in memory only (record is off)","card.values":"{n} values kept for restoring","card.range":"Range","card.reset":"Clear data","card.resetTitle":"Clear the Privacy history?","card.resetBody":"This deletes the masking records and counts of every session, including the record files under this instance's masking/ and the copies of what was sent kept in memory. It cannot be undone. The rules, the settings and requests under way are not affected.","card.resetAck":"I understand this cannot be undone","card.resetConfirm":"Clear","card.cancel":"Cancel","card.close":"Close","card.resetDone":"Cleared; {n} record files deleted.","card.resetFailed":"Could not clear: {message}","stat.took":"Mean time","stat.tookMax":"longest {max} ms","stat.ms":"{n} ms","recent.count":"{n} in all","recent.col.time":"Time","recent.col.where":"Model / host","recent.col.from":"From","recent.col.places":"Replaced","recent.col.restored":"Restored","page.at":"{page} / {pages}","range.today":"Today","range.week":"7 days","range.month":"30 days","stat.requests":"Recorded requests","stat.masked":"Masked","stat.n":"Replaced","stat.restored":"Restored","stat.inTools":"{n} in tool arguments","stat.unmapped":"Unknown placeholders","stat.failed":"Failures","dist.kind":"By kind","dist.finder":"By finder","dist.host":"By host","dist.empty":"None yet","warn.streak":"Masking failed {n} times in a row; those requests were not sent. /privacy off stops it.","warn.unmapped":"Replies had {n} placeholders the table has no value for; a model may have changed them.","warn.inTools":"{n} restored places were in tool call arguments, so the tool ran with the real value. If you did not expect that, check the latest tool calls.","recent.title":"Latest records","recent.empty":"No records yet.","recent.failed":"failed","col.placeholder":"Placeholder","col.kind":"Kind","col.finder":"Finder","col.head":"Head","recent.placesHint":"Places in the request that a placeholder replaced (not how many values were sent)","recent.restoredHint":"Places where the reply had a placeholder put back; the model need not repeat every value, so the two counts usually differ","col.len":"Length","col.n":"Times","recent.noValues":"Nothing was masked in this request.","recent.omitted":"{n} more values are past the limit of one record and not listed.","stat.warned":"Warned","stat.blocked":"Blocked","stat.exfil":"Tool calls sending values away","stat.exfilBlocked":"{n} places left unrestored","warn.exfil":"{n} tool calls had a restored value in arguments that name a host off this machine; open the latest records to see the hosts.","recent.blocked":"blocked","recent.exfil":"sent to: {hosts}","col.action":"Action","action.warn":"warn, sent","action.block":"block","view.open":"What was sent","view.title":"What this request actually sent","view.agent":"Replaced places marked (kind \xB7 head \xB7 length)","view.vendor":"As the model service got it","view.onlyChanged":"Only lines with replacements","view.loading":"Loading\u2026","view.gone":"This copy is no longer in memory: past the limits, or dsh restarted.","view.truncated":"First {n} lines only.","view.none":"No line has a replacement.","view.close":"Close","panel.tab":"Privacy","panel.session":"This session","panel.empty":"No records in this session yet. Only a model request that had something masked or restored leaves one.","page.first":"First","page.prev":"Previous","page.next":"Next","cfg.title":"Configure","cfg.f.showPanel":"Show a Privacy tab at the top of the session","cfg.f.showPanel.hint":"When on, a Privacy tab sits beside Chat and Trajectory with this session\u2019s masking records and counts.","cfg.unavailable":"Settings cannot be read: the host offers no settings service, or the plugin\u2019s host half has not loaded the new version yet.","cfg.failed":"Could not save; try again.","cfg.sidebarFailed":"The tab could not be registered: {reason}","cfg.f.excludeProviders":"Providers not masked","cfg.excludedNone":"None: everything is masked","cfg.sep":", ","cfg.excludedMany":"{names} and {n} in all","cfg.providerListUnavailable":"The provider list could not be read: the host has registered none, or the call failed.","cfg.remove":"Remove {name}","cfg.f.excludeProviders.hint":"Requests from a checked provider go out as they are, its replies are not restored, and nothing is recorded. A change applies from the next model call.","cfg.providerAbsent":"{name} (not registered now)","cfg.add":"Add","cfg.listEmpty":"None yet","cfg.countInvalid":"Enter a whole number of at least {min}.","cfg.applies":"Changes are saved at once and apply from the next model call; no restart needed.","cfg.others":"The other settings (actions, cookieNames, excludeHosts, maxValues and so on) are changed in cordis.patch.yml; see the README.","cfg.g.mask":"Masking","cfg.g.lists":"Word lists","cfg.g.record":"Records","cfg.g.view":"Tab and providers","cfg.f.enabled":"Mask requests","cfg.f.enabled.hint":"The master switch. Off, the gateway stops rewriting requests, and counting and recording stop too.","cfg.f.secrets":"Mask secrets","cfg.f.secrets.hint":"API keys, tokens, passwords, private keys, cookies.","cfg.f.personal":"Mask personal data","cfg.f.personal.hint":"Emails, mainland phone numbers, ID card and bank card numbers.","cfg.f.shape":"Same-shape fake keys","cfg.f.shape.hint":"A secret goes as a made-up key with the same prefix, length and kinds of character instead of a {{\u2026}} placeholder; a value under 8 characters, or with unusual characters, keeps the placeholder. Replies are restored as usual.","cfg.f.toolGuard":"Tool call guard","cfg.f.toolGuard.hint":"What happens when a tool call\u2019s arguments would have a value put back and name a host off this machine.","cfg.f.toolGuard.off":"Count only","cfg.f.toolGuard.warn":"Warn and record","cfg.f.toolGuard.block":"Do not restore","cfg.f.words":"Your own words","cfg.f.words.hint":"Code names, customer names and the like, replaced as written with a TERM placeholder. Press Enter or Add.","cfg.f.words.placeholder":"A word","cfg.f.allow":"Values never masked","cfg.f.allow.hint":"Whole values, in any case, left alone whichever rule finds them.","cfg.f.allow.placeholder":"A value","cfg.f.record":"Write records to disk","cfg.f.record.hint":"Into this instance's own masking/ (one directory per instance), metadata only, never the values; off keeps the counts in memory.","cfg.f.keepDays":"Days of records kept","cfg.f.keepDays.hint":"Older days are deleted; at least 1.","cfg.f.vendorView":"Keep what was sent, to compare","cfg.f.vendorView.hint":"When on, records from then on have a \u201CWhat was sent\u201D button to check what the model service actually got and whether anything slipped through. The copy is masked, with no real values; it lives in memory only, at most 100 copies and 64 MiB in all, gone on restart. It holds the whole prompt and conversation, so leave it off unless you need it.","cfg.expand":"Expand {name}","cfg.collapse":"Collapse {name}","cfg.s.maskOff":"Off: requests go out as they are","cfg.s.maskNothing":"No kind chosen","cfg.s.secrets":"Secrets","cfg.s.personal":"Personal data","cfg.s.shape":"Same-shape keys","cfg.s.toolGuard.off":"Tool guard: count","cfg.s.toolGuard.warn":"Tool guard: warn","cfg.s.toolGuard.block":"Tool guard: no restore","cfg.s.words":"{n} words","cfg.s.allow":"{n} allowed","cfg.s.record":"On disk, {n} days","cfg.s.recordOff":"Memory only","cfg.s.vendorView":"Keeping what was sent","cfg.s.panel":"Tab shown","cfg.s.panelOff":"Tab hidden","cfg.s.providersAll":"Every provider masked","cfg.s.providersSome":"{n} providers not masked","cfg.s.problem":"Needs a look; expand","card.valuesHint":"The values swapped out are kept in memory only, to put back in place of the placeholders in replies. Shared by every session; cleared when dsh restarts.","session.mask":"Mask this session","session.offTitle":"Turn masking off for this session?","session.offBody":"From then on this session\u2019s model requests go to the model service as they are: secrets, credentials, personal data and your own words are no longer replaced, replies are not restored, and nothing is recorded. Other sessions are not affected; you can turn it back on here at any time.","session.offAck":"I understand this session\u2019s content goes out as it is","session.offConfirm":"Turn off","session.offNotice":"Masking is off for this session: requests go out as they are and nothing is recorded.","session.failed":"Could not switch: {message}","cfg.f.recordContext":"Record the text around each value","cfg.f.recordContext.hint":"About 80 characters each side of every replaced place, and where it was (a user message, a tool result and so on), are kept with the record, so you can tell what it was replaced in. The text is taken from what was sent, so masked values in it are placeholders; with personal data not masked, emails, phone numbers and the like appear in it as they are.","recent.contextHint":"The text around the place, as sent; masked values in it are placeholders","place.system":"System prompt","place.toolResult":"Tool result","place.toolCall":"Tool call","place.user":"User message","place.assistant":"Model reply","place.other":"Other","err.noConnection":"Not connected to dsh yet","err.malformed":"The plugin\u2019s host half answered in a form this page does not know; the host half and the page may be different versions","err.remote":"{message}","err.thrown":"{message}","err.noDisposer":"The view strip gave back no way to remove the registration","card.stale":"Refresh failed ({reason}). The figures below are the last ones read and may be out of date.","card.reason":"Reason: {reason}","recent.cell":"{name}: {value}","recent.cellSep":", ","view.unknown":"\u2039unknown placeholder\u203A","view.line":"Line","cfg.risk.send.title":"This change sends content to the model service as it is","cfg.risk.delete.title":"This change deletes data already kept","cfg.risk.send.ack":"I understand this content goes to the model service as it is","cfg.risk.delete.ack":"I understand the deleted data cannot be recovered","cfg.risk.confirm":"Change it","cfg.r.enabled":"Off, every session\u2019s model requests go to the model service as they are: secrets, credentials, personal data and your own words are no longer replaced, replies are not restored, and nothing is recorded.","cfg.r.secrets":"Off, API keys, tokens, passwords, private keys and cookies are no longer replaced and go to the model service as they are.","cfg.r.personal":"Off, emails, phone numbers, ID card and bank card numbers are no longer replaced and go to the model service as they are.","cfg.r.words":"The words taken out ({names}) are no longer masked: where a request has them, they go to the model service as they are.","cfg.r.allow":"The values added ({names}) are never masked from now on: where a request has them, they go to the model service as they are.","cfg.r.excludeProviders":"Requests from the providers newly checked ({names}) go out as they are, their replies are not restored, and nothing is recorded.","cfg.r.record":"Off, the records still waiting to be written are not written, and records from then on are counted in memory only and lost when dsh restarts.","cfg.r.keepDays":"Records are kept {to} days instead of {from}: the record files past that are deleted at the next write and cannot be recovered.","cfg.r.vendorView":"Off, the copies of what was sent kept in memory are cleared at once, and earlier records can no longer show what was sent."},tt={zh:Mt,en:Et};var R=require("@deepseek-ai/dsh-client-ui-primitives"),f=require("react");var S=require("@deepseek-ai/dsh-client-ui-primitives"),o=require("react");var le=require("@deepseek-ai/dsh-client-ui-primitives"),h=require("react");function At(e,t){if(!e)return t("view.unknown");let n=e.action?` \xB7 ${t(e.action==="warn"?"action.warn":"action.block")}`:"",a=oe(e);return`\u2039${e.kind} \xB7 ${a?`${a} \xB7 `:""}${e.len}${n}\u203A`}function nt(e,t,n,a){return e.parts.map((r,s)=>r.id===void 0?r.text:(0,h.createElement)("mark",{key:s,className:`pgw-view__mark${n?" pgw-view__mark--agent":""}`,title:r.id},n?At(t.get(r.id),a):r.text))}function at(e){let{ctx:t,t:n,record:a}=e,[r,s]=(0,h.useState)({status:"loading"}),[i,c]=(0,h.useState)(!0);(0,h.useEffect)(()=>{let w=new AbortController;return s({status:"loading"}),He(t,a.key,w.signal).then(F=>{w.signal.aborted||s(F.ok?F.value===null?{status:"gone"}:{status:"ready",body:F.value}:{status:"error"})}),()=>w.abort()},[t,a.key]);let u=je(a.values),p=(0,h.useMemo)(()=>new Map(a.values.map(w=>[w.placeholder,w])),[a.key,u]),l=r.status==="ready"?r.body:void 0,b=(0,h.useMemo)(()=>l!==void 0?Ke(l):void 0,[l]),v=(0,h.useMemo)(()=>b?Ge(b,[...p.keys()],i):void 0,[b,p,i]),k=(0,h.createElement)("div",{className:"pgw-head"},(0,h.createElement)("span",{className:"pgw-dist__title"},n("view.title")),(0,h.createElement)(le.Checkbox,{checked:i,label:n("view.onlyChanged"),className:"pgw-meta",onChange:c}),(0,h.createElement)("span",{className:"pgw-spacer"}),(0,h.createElement)(le.Button,{variant:"outline",size:"sm",onClick:e.onClose},n("view.close")));if(!v){let w=r.status==="loading"?"view.loading":r.status==="gone"?"view.gone":"card.unavailable";return(0,h.createElement)("div",{className:"pgw-view"},k,(0,h.createElement)("div",{className:"pgw-empty"},n(w)))}return(0,h.createElement)("div",{className:"pgw-view"},k,v.lines.length===0?(0,h.createElement)("div",{className:"pgw-empty"},n("view.none")):(0,h.createElement)("div",{className:"pgw-view__scroll"},(0,h.createElement)("table",{className:"pgw-view__table"},(0,h.createElement)("thead",null,(0,h.createElement)("tr",null,(0,h.createElement)("th",null,n("view.line")),(0,h.createElement)("th",null,n("view.agent")),(0,h.createElement)("th",null,n("view.vendor")))),(0,h.createElement)("tbody",null,v.lines.map(w=>(0,h.createElement)("tr",{key:w.n},(0,h.createElement)("td",{className:"pgw-view__n"},w.n),(0,h.createElement)("td",{className:"pgw-view__code"},...nt(w,p,!0,n)),(0,h.createElement)("td",{className:"pgw-view__code"},...nt(w,p,!1,n))))))),v.truncated?(0,h.createElement)("div",{className:"pgw-meta"},n("view.truncated",{n:v.lines.length})):null)}function rt(e){return e.items.length===0?null:(0,o.createElement)("div",{className:"pgw-notices",role:"status"},e.items.map(t=>(0,o.createElement)("div",{key:t.key,className:`pgw-notice pgw-notice--${t.tone}`},(0,o.createElement)(S.IconWarningOutlineRegular,{size:14,className:"pgw-notice__icon"}),(0,o.createElement)("span",null,e.t(t.key,{n:t.n})))))}function ot(e){let{totals:t,t:n}=e,a=i=>(i??0).toLocaleString(),r=Le(t),s=[{label:n("stat.requests"),value:a(t.requests)},{label:n("stat.masked"),value:a(t.masked)},{label:n("stat.n"),value:a(t.n)},{label:n("stat.restored"),value:a(t.restored),...t.restoredInTools>0?{sub:n("stat.inTools",{n:t.restoredInTools})}:{}},{label:n("stat.unmapped"),value:a(t.unmapped),...t.unmapped>0?{tone:"warn"}:{}},{label:n("stat.failed"),value:a(t.failed),...t.failed>0?{tone:"error"}:{}}];return(t.warned??0)>0&&s.push({label:n("stat.warned"),value:a(t.warned),tone:"warn"}),(t.blocked??0)>0&&s.push({label:n("stat.blocked"),value:a(t.blocked),tone:"warn"}),(t.exfil??0)>0&&s.push({label:n("stat.exfil"),value:a(t.exfil),tone:"error",...(t.exfilBlocked??0)>0?{sub:n("stat.exfilBlocked",{n:t.exfilBlocked})}:{}}),t.requests>0&&s.push({label:n("stat.took"),value:n("stat.ms",{n:r.avg}),sub:n("stat.tookMax",{max:r.max})}),(0,o.createElement)("div",{className:"pgw-kpis"},s.map(i=>(0,o.createElement)("div",{key:i.label,className:`pgw-kpi${i.tone?` pgw-kpi--${i.tone}`:""}`},(0,o.createElement)("span",{className:"pgw-kpi__label"},i.label),(0,o.createElement)("span",{className:"pgw-kpi__value"},i.value),i.sub?(0,o.createElement)("span",{className:"pgw-kpi__sub"},i.sub):null)))}function de(e){let t=Ve(e.data);return(0,o.createElement)("div",{className:"pgw-dist"},(0,o.createElement)("div",{className:"pgw-section__title"},e.title),t.length===0?(0,o.createElement)("div",{className:"pgw-empty"},e.empty):t.map(n=>(0,o.createElement)("div",{className:"pgw-bar",key:n.label},(0,o.createElement)("div",{className:"pgw-bar__head"},(0,o.createElement)("span",{className:"pgw-bar__label",title:n.label},n.label),(0,o.createElement)("span",{className:"pgw-bar__value"},n.value.toLocaleString())),(0,o.createElement)("div",{className:"pgw-bar__track"},(0,o.createElement)("div",{className:"pgw-bar__fill",style:{width:`${n.pct}%`}})))))}function st(e){let{t}=e;return(0,o.createElement)("div",{className:"pgw-rec pgw-rec--head","aria-hidden":!0},(0,o.createElement)("span",null),(0,o.createElement)("span",null,t("recent.col.time")),(0,o.createElement)("span",null,t("recent.col.where")),(0,o.createElement)("span",null,t("recent.col.from")),(0,o.createElement)("span",{className:"pgw-rec__num",title:t("recent.placesHint")},t("recent.col.places")),(0,o.createElement)("span",{className:"pgw-rec__num",title:t("recent.restoredHint")},t("recent.col.restored")))}function it(e){let{r:t,t:n}=e,[a,r]=(0,o.useState)(!1),s=(0,o.useId)(),i=[t.workspace,t.title??t.session].filter(l=>typeof l=="string"&&l!=="").join(" \xB7 "),c=t.failed?(0,o.createElement)(S.Tag,{tone:"danger"},n("recent.failed")):t.blocked?(0,o.createElement)(S.Tag,{tone:"danger"},n("recent.blocked")):(0,o.createElement)("span",{className:t.exfil?"pgw-rec__bad":void 0},t.n.toLocaleString()),u=t.failed?n("recent.failed"):t.blocked?n("recent.blocked"):t.n.toLocaleString(),p=[[n("recent.col.time"),ve(t.time)],[n("recent.col.where"),[t.model??t.what,t.host].filter(Boolean).join(" \xB7 ")],[n("recent.col.from"),i],[n("recent.col.places"),u],[n("recent.col.restored"),t.restored.toLocaleString()]].filter(([,l])=>l!=="").map(([l,b])=>n("recent.cell",{name:l,value:b})).join(n("recent.cellSep"));return(0,o.createElement)("li",{className:"pgw-recs__item"},(0,o.createElement)("button",{type:"button",className:`pgw-rec${t.n===0&&!t.failed?" pgw-rec--zero":""}${e.open?" pgw-rec--open":""}`,"aria-expanded":e.open,"aria-controls":e.open?s:void 0,"aria-label":p,onClick:e.toggle},(0,o.createElement)(S.IconChevronRightOutlineRegular,{size:12,className:"pgw-rec__chevron"}),(0,o.createElement)("span",{className:"pgw-rec__time"},ve(t.time)),(0,o.createElement)("span",{className:"pgw-rec__where",title:[t.model,t.host].filter(Boolean).join(" \xB7 ")},(0,o.createElement)("span",{className:"pgw-rec__model"},t.model??t.what),(0,o.createElement)("span",{className:"pgw-rec__host"},t.host)),(0,o.createElement)("span",{className:"pgw-rec__from",title:i},i),(0,o.createElement)("span",{className:"pgw-rec__num"},c),(0,o.createElement)("span",{className:"pgw-rec__num pgw-rec__dim"},t.restored.toLocaleString())),e.open?(0,o.createElement)("div",{className:"pgw-detail",id:s},t.exfil?(0,o.createElement)("div",{className:"pgw-notice pgw-notice--error"},(0,o.createElement)(S.IconWarningOutlineRegular,{size:14,className:"pgw-notice__icon"}),n("recent.exfil",{hosts:(t.exfilHosts??[]).join(", ")})):null,t.values.length===0?(0,o.createElement)("div",{className:"pgw-empty"},n("recent.noValues")):(0,o.createElement)("table",{className:"pgw-values"},(0,o.createElement)("thead",null,(0,o.createElement)("tr",null,...["col.placeholder","col.kind","col.finder","col.head","col.len","col.n","col.action"].map(l=>(0,o.createElement)("th",{key:l},n(l))))),(0,o.createElement)("tbody",null,t.values.flatMap(l=>[(0,o.createElement)("tr",{key:l.placeholder,className:l.before!==void 0||l.after!==void 0?"pgw-values__has":void 0},(0,o.createElement)("td",{className:"pgw-mono"},l.placeholder),(0,o.createElement)("td",null,l.kind),(0,o.createElement)("td",null,l.finder),(0,o.createElement)("td",{className:"pgw-mono"},oe(l)),(0,o.createElement)("td",null,l.len),(0,o.createElement)("td",null,l.n),(0,o.createElement)("td",null,l.action?n(l.action==="warn"?"action.warn":"action.block"):"")),l.before!==void 0||l.after!==void 0?(0,o.createElement)("tr",{key:`${l.placeholder}:ctx`,className:"pgw-values__ctx"},(0,o.createElement)("td",{colSpan:7},l.at?(0,o.createElement)(S.Tag,{tone:"neutral",className:"pgw-ctx__place",title:l.at.path},n(We(l.at))):null,(0,o.createElement)("span",{className:"pgw-ctx__text",title:n("recent.contextHint")},l.before??"",(0,o.createElement)("mark",{className:"pgw-ctx__mark pgw-mono"},l.placeholder),l.after??""))):null]))),t.valuesOmitted?(0,o.createElement)("div",{className:"pgw-meta"},n("recent.omitted",{n:t.valuesOmitted.toLocaleString()})):null,e.viewable&&!a?(0,o.createElement)("div",null,(0,o.createElement)(S.Button,{variant:"outline",size:"sm",onClick:()=>r(!0)},n("view.open"))):null,e.viewable&&a?(0,o.createElement)(at,{ctx:e.ctx,t:n,record:t,onClose:()=>r(!1)}):null):null)}function lt(e){let{t}=e,[n,a]=(0,o.useState)(!1),[r,s]=(0,o.useState)(!1),[i,c]=(0,o.useState)(!1),u=()=>{a(!1),s(!1)},p=()=>{c(!0),Ue(e.ctx).then(l=>{c(!1),u(),e.onDone(l.ok?t("card.resetDone",{n:l.value}):t("card.resetFailed",{message:H(l.failure,t)}),l.ok)})};return(0,o.createElement)(o.Fragment,null,(0,o.createElement)(S.Button,{variant:"ghost",size:"sm",className:"pgw-reset",disabled:i,onClick:()=>a(!0)},(0,o.createElement)(S.IconTrashOutlineRegular,{size:14}),(0,o.createElement)("span",null,t("card.reset"))),(0,o.createElement)(S.RiskConfirmation,{open:n,title:t("card.resetTitle"),description:t("card.resetBody"),acknowledgeLabel:t("card.resetAck"),cancelLabel:t("card.cancel"),closeLabel:t("card.close"),confirmLabel:t("card.resetConfirm"),acknowledged:r,disabled:i,onAcknowledgedChange:s,onCancel:u,onConfirm:p}))}function dt(e){let{t}=e,[n,a]=(0,o.useState)(e.on),[r,s]=(0,o.useState)(!1),[i,c]=(0,o.useState)(!1),[u,p]=(0,o.useState)(!1);(0,o.useEffect)(()=>a(e.on),[e.on]);let l=()=>{s(!1),c(!1)},b=v=>{p(!0),Qe(e.ctx,e.session,v).then(k=>{p(!1),l(),k.ok&&a(k.value),e.onDone(k.ok?null:t("session.failed",{message:H(k.failure,t)}))})};return(0,o.createElement)(o.Fragment,null,(0,o.createElement)("label",{className:"pgw-session"},(0,o.createElement)(S.Switch,{checked:n,disabled:u,onChange:v=>v?b(!0):s(!0)}),(0,o.createElement)("span",{className:"pgw-session__label"},t("session.mask"))),(0,o.createElement)(S.RiskConfirmation,{open:r,title:t("session.offTitle"),description:t("session.offBody"),acknowledgeLabel:t("session.offAck"),cancelLabel:t("card.cancel"),closeLabel:t("card.close"),confirmLabel:t("session.offConfirm"),acknowledged:i,disabled:u,onAcknowledgedChange:c,onCancel:l,onConfirm:()=>b(!1)}))}var $t=15e3,Vt=200,Dt=10,Lt=["today","week","month"];function Bt(e,t){let[n,a]=(0,f.useState)({status:"loading"}),[r,s]=(0,f.useState)(!1),i=(0,f.useRef)(null),c=(0,f.useCallback)(()=>{i.current?.abort();let u=new AbortController;i.current=u,s(!0),se(e,Vt,u.signal,t).then(p=>{u.signal.aborted||(s(!1),a(l=>ze(l,p)))})},[e,t]);return(0,f.useEffect)(()=>{c();let u=setInterval(()=>{(typeof document>"u"||document.visibilityState==="visible")&&c()},$t);return()=>{clearInterval(u),i.current?.abort()}},[c]),[n,c,r]}function ce(e){return(0,f.createElement)(zt,{key:e.sessionId??"",...e})}function zt(e){let{t}=e,[n,a,r]=Bt(e.ctx,e.sessionId),[s,i]=(0,f.useState)("today"),[c,u]=(0,f.useState)(null),[p,l]=(0,f.useState)(0),[b,v]=(0,f.useState)(null),k=`pgw-card${e.panel?" pgw-card--panel":""}`,w=n.status==="ready"?n.data:void 0,F=!e.sessionId&&w!==void 0,M=(0,f.createElement)("div",{className:"pgw-head"},(0,f.createElement)("div",{className:"pgw-head__main"},e.panel?null:(0,f.createElement)("h3",{className:"pgw-title"},t("card.title")),e.sessionId&&w&&typeof w.sessionMasking=="boolean"?(0,f.createElement)(dt,{ctx:e.ctx,t,session:e.sessionId,on:w.sessionMasking,onDone:C=>{v(C===null?null:{text:C,ok:!1}),a()}}):null,w&&(!e.sessionId||!w.active)?(0,f.createElement)(R.Tag,{tone:w.active?"success":"warning"},t(w.active?"card.on":"card.off")):null,e.sessionId&&w&&w.sessionMasking===void 0?(0,f.createElement)(R.Tag,{tone:"outline"},t("panel.session")):null,w&&!e.sessionId?(0,f.createElement)("span",{className:"pgw-meta",title:t("card.valuesHint")},t("card.values",{n:w.values})):null,w&&!w.record?(0,f.createElement)("span",{className:"pgw-meta"},t("card.memoryOnly")):null),(0,f.createElement)("div",{className:"pgw-head__actions"},w?(0,f.createElement)(R.SegmentedControl,{id:`pgw-range-${e.sessionId??"all"}`,label:t("card.range"),value:s,options:Lt.map(C=>({value:C,label:t(`range.${C}`)})),onChange:i}):null,(0,f.createElement)(R.Button,{variant:"ghost",size:"sm",disabled:r,title:t("card.refresh"),"aria-label":t("card.refresh"),onClick:a},(0,f.createElement)(R.IconRefreshOutlineRegular,{size:14})),F?(0,f.createElement)(lt,{ctx:e.ctx,t,onDone:(C,A)=>{v({text:C,ok:A}),u(null),l(0),a()}}):null)),B=b?(0,f.createElement)("div",{className:`pgw-flash${b.ok?"":" pgw-flash--error"}`,role:"status"},b.text):null,z=n.status==="ready"&&n.stale?(0,f.createElement)("div",{className:"pgw-notice pgw-notice--error",role:"status"},(0,f.createElement)(R.IconWarningOutlineRegular,{size:14,className:"pgw-notice__icon"}),(0,f.createElement)("span",null,t("card.stale",{reason:H(n.stale,t)}))):null,te=e.sessionId&&w?.sessionMasking===!1?(0,f.createElement)("div",{className:"pgw-notice",role:"status"},(0,f.createElement)(R.IconWarningOutlineRegular,{size:14,className:"pgw-notice__icon"}),(0,f.createElement)("span",null,t("session.offNotice"))):null;if(!w){let C=n.status==="error"?`${t("card.unavailable")} ${t("card.reason",{reason:H(n.failure,t)})}`:t("card.loading");return(0,f.createElement)("section",{className:k},M,(0,f.createElement)("div",{className:"pgw-empty pgw-empty--block"},C))}if(e.sessionId&&w.recent.length===0)return(0,f.createElement)("section",{className:k},M,z,B,te,(0,f.createElement)("div",{className:"pgw-empty pgw-empty--block"},t("panel.empty")));let E=w,K=E.stats[s],Q=new Set(E.vendorView?E.views??[]:[]),O=qe(E.recent,p,Dt),J=C=>{l(C),u(null)};return(0,f.createElement)("section",{className:k},M,z,B,te,(0,f.createElement)(rt,{t,items:De(E,K)}),(0,f.createElement)(ot,{totals:K,t}),(0,f.createElement)("div",{className:"pgw-dists"},(0,f.createElement)(de,{title:t("dist.kind"),data:K.kinds,empty:t("dist.empty")}),(0,f.createElement)(de,{title:t("dist.finder"),data:K.finders,empty:t("dist.empty")}),(0,f.createElement)(de,{title:t("dist.host"),data:K.hosts,empty:t("dist.empty")})),(0,f.createElement)("div",{className:"pgw-section"},(0,f.createElement)("div",{className:"pgw-section__head"},(0,f.createElement)("span",{className:"pgw-section__title"},t("recent.title")),E.recent.length>0?(0,f.createElement)("span",{className:"pgw-meta"},t("recent.count",{n:E.recent.length})):null),E.recent.length===0?(0,f.createElement)("div",{className:"pgw-empty pgw-empty--block"},t("recent.empty")):(0,f.createElement)("div",{className:"pgw-recs"},(0,f.createElement)(st,{t}),(0,f.createElement)("ul",{className:"pgw-recs__list","aria-label":t("recent.title")},O.items.map(C=>(0,f.createElement)(it,{key:C.key,ctx:e.ctx,r:C,open:c===C.key,toggle:()=>u(c===C.key?null:C.key),t,viewable:Q.has(C.key)})))),O.pages>1?(0,f.createElement)("div",{className:"pgw-pager"},(0,f.createElement)(R.Button,{variant:"ghost",size:"sm",disabled:O.page===0,onClick:()=>J(0)},t("page.first")),(0,f.createElement)(R.Button,{variant:"ghost",size:"sm",disabled:O.page===0,"aria-label":t("page.prev"),title:t("page.prev"),onClick:()=>J(O.page-1)},(0,f.createElement)(R.IconChevronLeftOutlineRegular,{size:14})),(0,f.createElement)("span",{className:"pgw-meta pgw-pager__at"},t("page.at",{page:O.page+1,pages:O.pages})),(0,f.createElement)(R.Button,{variant:"ghost",size:"sm",disabled:O.page>=O.pages-1,"aria-label":t("page.next"),title:t("page.next"),onClick:()=>J(O.page+1)},(0,f.createElement)(R.IconChevronRightOutlineRegular,{size:14}))):null))}var Kt="dsh-privacy-gateway",U=ie(void 0);function ut(e,t){return e.code==="noDisposer"?t("err.noDisposer"):t("err.thrown",{message:e.message})}function ft(e,t){U.set(void 0);let n;try{let a=e.slots.inject("conversation.view",()=>e.slots.register({name:"conversation.view",id:Kt,order:35,locale:L,label:()=>t("panel.tab")},r=>(0,ct.createElement)(ce,{ctx:e,t,panel:!0,...r?.sessionId?{sessionId:r.sessionId}:{}})));if(typeof a!="function"){U.set({code:"noDisposer"});return}n=a}catch(a){U.set({code:"thrown",message:a instanceof Error?a.message:String(a)});return}return()=>{let a=n;n=void 0;try{a?.()}catch{}}}var ue=class{waiting=[];current;failed=!1;send;onState;constructor(t,n=()=>{}){this.send=t,this.onState=n}get state(){return{busy:this.current!==void 0||this.waiting.length>0,failed:this.failed}}latest(t,n){for(let a=this.waiting.length-1;a>=0;a--)if(this.waiting[a]?.path===t)return this.waiting[a]?.value;return this.current?.path===t?this.current.value:n}write(t,n){return new Promise(a=>{let r=this.waiting.find(s=>s.path===t);r?(r.value=n,r.done.push(a)):this.waiting.push({path:t,value:n,done:[a]}),this.failed=!1,this.notify(),this.current||this.drain()})}async drain(){let t=!1;for(;this.waiting.length>0;){let n=this.waiting.shift();this.current=n;let a;try{a=await this.send(n.path,n.value,t)}catch{a=!1}this.current=void 0,t=!0;for(let r of n.done)r(a);if(!a){this.failed=!0;for(let r of this.waiting.splice(0))for(let s of r.done)s(!1)}this.notify()}}notify(){this.onState(this.state)}};function jt(){let[,e]=(0,g.useState)(0),t=(0,g.useSyncExternalStore)(G.subscribe,G.get),n=(0,g.useMemo)(()=>{try{return t?.describe()}catch{return}},[t]);(0,g.useEffect)(()=>{if(n)return Promise.resolve(n.ensure()).catch(()=>{}),n.subscribe(()=>e(c=>c+1))},[n]);let a=n?.getSnapshot().view,r=(0,g.useMemo)(()=>a?be(a.namespaces):void 0,[a]),s=(0,g.useMemo)(()=>{try{return t&&r!==void 0?t.get(r):void 0}catch{return}},[t,r]);(0,g.useEffect)(()=>s?s.subscribe(()=>e(c=>c+1)):void 0,[s]);let i=s?.getSnapshot();return(0,g.useMemo)(()=>{if(!s||!i)return;let c=s.mutate,u=c?(p,l)=>c.call(s,p,l):async p=>{for(let l of p)if(!await s.set(l.path.join("."),l.value))return!1;return!0};return{state:{status:i.status,value:i.value,revision:i.revision,writable:i.writable!==!1},mutate:u}},[s,i])}var gt="dsh-privacy-gateway.config.open",Gt=["mask"];function qt(){try{let e=JSON.parse(globalThis.localStorage?.getItem(gt)??"null");if(Array.isArray(e))return ne.filter(t=>e.includes(t))}catch{}return[...Gt]}function Wt(e){try{globalThis.localStorage?.setItem(gt,JSON.stringify(e))}catch{}}var D=e=>e;function ke(e){let{ctx:t,t:n}=e,a=jt(),r=e.form??a,s=(0,g.useRef)(r);s.current=r;let[i,c]=(0,g.useState)({busy:!1,failed:!1}),[u]=(0,g.useState)(()=>new ue((d,y,x)=>{let _=s.current;return _?_.mutate([{op:"set",path:[d],value:y}],x?void 0:_.state.revision):Promise.resolve(!1)},c)),[p,l]=(0,g.useState)(null),[b,v]=(0,g.useState)(!1),k=(0,g.useSyncExternalStore)(U.subscribe,U.get),w=(0,g.useId)(),[F,M]=(0,g.useState)(null),[B,z]=(0,g.useState)(!1),[te,E]=(0,g.useState)(qt),K=d=>E(y=>{let x=y.includes(d)?y.filter(_=>_!==d):ne.filter(_=>_===d||y.includes(_));return Wt(x),x}),Q=r?.state,O=Q?.status==="ready",J=Q?.writable!==!1,C=Q?.value??{},A=d=>u.latest(d,C[d]);if((0,g.useEffect)(()=>{let d=new AbortController;return Je(t,d.signal).then(y=>{d.signal.aborted||(z(!y.ok),M(y.ok?y.value:[]))}),()=>d.abort()},[t]),!r)return(0,g.createElement)("div",{className:"pgw-empty"},n("cfg.unavailable"));let q=!O||!J,yt=d=>F?.find(y=>y.id.toLowerCase()===d.toLowerCase())?.name??d,X=(d,y)=>{if(q)return Promise.resolve(!1);let x=Ne(d,A(d.key),y);return x?new Promise(_=>{v(!1),l($=>($?.resolve(!1),{f:d,next:y,change:x,resolve:_}))}):u.write(d.key,y)},_e=d=>{let y=p;l(null),v(!1),y&&(d?u.write(y.f.key,y.next).then(y.resolve):y.resolve(!1))},vt=d=>{let y=n(D(`cfg.f.${d.key}`));switch(d.kind){case"switch":return(0,g.createElement)(Ee,{label:y,checked:Y(A(d.key),d.default),disabled:q,onChange:x=>{X(d,x)}});case"choice":{let x=we(A(d.key),d.choices,d.default);return(0,g.createElement)(he,{label:n(D(`cfg.f.${d.key}.${x}`)),labelledBy:`${w}${d.key}`,items:d.choices.map(_=>({id:_,label:n(D(`cfg.f.${d.key}.${_}`))})),selectedId:x,disabled:q,onSelect:_=>{_!==x&&X(d,_)}})}case"list":return(0,g.createElement)(Ae,{t:n,list:V(A(d.key),d.default),anyCase:d.anyCase,placeholder:n(D(`cfg.f.${d.key}.placeholder`)),disabled:q,onChange:x=>X(d,x)});case"count":return(0,g.createElement)($e,{t:n,value:Z(A(d.key),d.min,d.default),min:d.min,label:y,disabled:q,onChange:x=>X(d,x)});case"providers":return bt(d)}},bt=d=>{let y=V(A(d.key),[]),x=Ze(F??[],y),_=x.filter(T=>T.excluded).map(T=>T.name),$=Oe(_,n("cfg.sep")),me=$.kind==="none"?n("cfg.excludedNone"):$.kind==="some"?$.names:n("cfg.excludedMany",{names:$.names,n:$.n});return(0,g.createElement)(he,{label:me,labelledBy:`${w}${d.key}`,multi:!0,items:x.map(T=>({id:T.id,label:T.registered?T.name:n("cfg.providerAbsent",{name:T.name})})),selectedIds:x.filter(T=>T.excluded).map(T=>T.id),disabled:q,onSelect:T=>{X(d,et(V(A(d.key),[]),T))}})},Ce=d=>{if(d.key==="showPanel"&&k)return(0,g.createElement)("div",{className:"pgw-cfg__desc pgw-cfg__desc--error"},n("cfg.sidebarFailed",{reason:ut(k,n)}));if(d.key==="excludeProviders"&&B)return(0,g.createElement)("div",{className:"pgw-cfg__desc pgw-cfg__desc--error"},n("cfg.providerListUnavailable"))},kt=Object.fromEntries(ae.map(d=>[d.key,A(d.key)])),xt=d=>{let y=ae.filter(P=>P.group===d),x=n(D(`cfg.g.${d}`)),_=te.includes(d),$=Re(d,kt),me=y.some(P=>Ce(P)!==void 0),T=O?[...$.map((P,_t)=>(0,g.createElement)("span",{key:_t,className:P.off?"pgw-fold__part pgw-fold__part--off":"pgw-fold__part"},n(D(P.key),P.params))),me?(0,g.createElement)("span",{key:"problem",className:"pgw-fold__part pgw-fold__part--error"},n("cfg.s.problem")):null]:null;return(0,g.createElement)(Me,{key:d,title:x,summary:T,open:_,toggleLabel:n(_?"cfg.collapse":"cfg.expand",{name:x}),onToggle:()=>K(d)},y.map(P=>(0,g.createElement)(Fe,{key:P.key,title:n(D(`cfg.f.${P.key}`)),titleId:`${w}${P.key}`,hint:n(D(`cfg.f.${P.key}.hint`)),note:Ce(P),inline:Se(P),half:P.half===!0},vt(P))))},ge=p?Ht(p,n,p.f.key==="excludeProviders"?yt:d=>d):null;return(0,g.createElement)(g.Fragment,null,(0,g.createElement)("section",{className:"pgw-cfg","aria-busy":i.busy||void 0},e.form?null:(0,g.createElement)("h3",{className:"pgw-title"},n("cfg.title")),i.failed?(0,g.createElement)("div",{className:"pgw-notice pgw-notice--error",role:"alert"},n("cfg.failed")):null,(0,g.createElement)("div",{className:"pgw-cfg__folds"},ne.map(xt)),(0,g.createElement)("p",{className:"pgw-cfg__desc pgw-cfg__foot"},n("cfg.applies")," ",n("cfg.others"))),(0,g.createElement)(pt.RiskConfirmation,{open:p!==null,title:ge?.title??"",description:ge?.body??"",acknowledgeLabel:ge?.ack??"",cancelLabel:n("card.cancel"),closeLabel:n("card.close"),confirmLabel:n("cfg.risk.confirm"),acknowledged:b,onAcknowledgedChange:v,onCancel:()=>_e(!1),onConfirm:()=>_e(!0)}))}function Ht(e,t,n){let{change:a}=e,r={},s=a.added??a.removed;return s&&(r.names=s.map(n).join(t("cfg.sep"))),a.from!==void 0&&(r.from=a.from),a.to!==void 0&&(r.to=a.to),{title:t(a.risk==="send"?"cfg.risk.send.title":"cfg.risk.delete.title"),body:t(D(`cfg.r.${e.f.key}`),r),ack:t(a.risk==="send"?"cfg.risk.send.ack":"cfg.risk.delete.ack")}}var fe="dsh-privacy-gateway",mt="dsh-privacy-gateway";var xe="var(--ds-font-family-code,ui-monospace,monospace)",Ut=`
5
5
  .pgw-card{display:flex;flex-direction:column;gap:16px;padding:16px 20px 20px;border:.5px solid var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-lg,12px);background:var(--dsw-alias-bg-layer-1,transparent);color:var(--dsw-alias-label-primary);font-size:13px}
6
6
  .pgw-card--panel{box-sizing:border-box;width:min(calc(100% - 32px),var(--dsh-chat-content-width,920px));margin:0 auto;border:none;border-radius:0;background:transparent;padding:12px 0 20px}
7
7
  .pgw-session{display:inline-flex;align-items:center;gap:8px;font-size:13px;line-height:20px;color:var(--dsw-alias-label-primary);cursor:pointer}
package/lib/index.d.ts CHANGED
@@ -238,6 +238,10 @@ interface PluginContext {
238
238
  provider?: unknown;
239
239
  sessionId?: unknown;
240
240
  }, next: () => AsyncIterable<unknown>) => AsyncIterable<unknown>): unknown;
241
+ /** dsh: the profile this instance runs from; absent in a run with no profile (state then goes to ~/.dsh). */
242
+ profileContext?: {
243
+ dir?: string;
244
+ };
241
245
  }
242
246
  /** The slice of dsh-commands the plugin uses. */
243
247
  interface CommandsService {
package/lib/index.js CHANGED
@@ -1027,6 +1027,19 @@ function pathValue(v) {
1027
1027
  if (cut < 0 || cut === v.length - 1) return false;
1028
1028
  return PATH_ROOTS.has(v.slice(1, cut));
1029
1029
  }
1030
+ const FILE_EXT$1 = new Set("safetensors ckpt pt pth bin gguf ggml onnx sft h5 pb tflite mlmodel npz npy pkl msgpack engine plan trt zip tar gz tgz bz2 xz zst 7z rar lz4 whl png jpg jpeg webp gif bmp svg ico tif tiff avif heic mp4 mov mkv webm avi m4v wav mp3 flac ogg m4a txt md pdf doc docx xls xlsx ppt pptx csv tsv json jsonl yaml yml xml html toml ini cfg conf log sqlite db parquet".split(" "));
1031
+ /**
1032
+ * A file's name, not a value: a field called key or password holding a model's
1033
+ * file name (ComfyUI's PowerShell dump of a workflow has one after $key for
1034
+ * every node it loads, issue #1) names a model a run loads, and no secret is
1035
+ * kept in a file of one of these kinds. A file's name has only its name's
1036
+ * characters, so a key of its own that merely contains a dot stays masked.
1037
+ */
1038
+ function fileNameValue(v) {
1039
+ if (!/^[A-Za-z0-9._-]+$/.test(v)) return false;
1040
+ const dot = v.lastIndexOf(".");
1041
+ return dot > 0 && dot < v.length - 1 && FILE_EXT$1.has(v.slice(dot + 1).toLowerCase());
1042
+ }
1030
1043
  const SECRET_WORDS = new Set([
1031
1044
  "token",
1032
1045
  "tokens",
@@ -1071,12 +1084,12 @@ function namesASecret(v) {
1071
1084
  }
1072
1085
  return words >= 2 && named;
1073
1086
  }
1074
- /** Where a value the SECRET rules found can be a secret: not code, a place in a file, a path, a name in code or a version. */
1087
+ /** Where a value the SECRET rules found can be a secret: not code, a place in a file, a path, a file's name, a name in code or a version. */
1075
1088
  function fieldAt(s$1, a, b) {
1076
1089
  if (!notCode(s$1, a, b)) return false;
1077
1090
  const v = s$1.slice(a, b);
1078
1091
  if (v[0] === "=") return false;
1079
- return !fileField(s$1, a) && !LINE_REF.test(v) && !pathValue(v) && !namesASecret(v) && !skillName(s$1, a, b) && !versionValue(v);
1092
+ return !fileField(s$1, a) && !LINE_REF.test(v) && !pathValue(v) && !fileNameValue(v) && !namesASecret(v) && !skillName(s$1, a, b) && !versionValue(v);
1080
1093
  }
1081
1094
  /** A field's name's words in lower case: next_page_token, nextPageToken and X-Next-Page-Token are next, page, token. */
1082
1095
  function nameWords(name$1) {
@@ -5064,15 +5077,24 @@ function installGateway(engine, options = {}) {
5064
5077
 
5065
5078
  //#endregion
5066
5079
  //#region src/paths.ts
5080
+ /** The directory the plugin keeps its data in, under an instance's profile. */
5081
+ const PLUGIN_DIR = "dsh-privacy-gateway";
5067
5082
  /**
5068
- * The plugin's on-disk state root: `~/.dsh/privacy-gateway` unless
5069
- * `DSH_PRIVACY_GATEWAY_HOME` redirects it. Holds the HMAC key (`redact.key`)
5070
- * and the masking records (`masking/`). The env is read lazily so a test that
5071
- * sets it after import still gets the redirect.
5083
+ * The plugin's on-disk state root, the first of: `DSH_PRIVACY_GATEWAY_HOME`
5084
+ * when it is set, the running instance's own directory
5085
+ * (`<profile>/plugin-data/dsh-privacy-gateway`), or `~/.dsh/privacy-gateway`
5086
+ * for a run that has no profile. It holds the HMAC key (`redact.key`), the
5087
+ * masking records (`masking/`) and the session switches (`sessions.json`).
5088
+ *
5089
+ * The instance's own directory keeps two instances on one machine from writing
5090
+ * each other's key, records and session list (docs/adr/0027). The env is read
5091
+ * lazily so a test that sets it after import still gets the redirect.
5072
5092
  */
5073
- function stateDir() {
5093
+ function stateDir(instance) {
5074
5094
  const configured = process.env.DSH_PRIVACY_GATEWAY_HOME?.trim();
5075
5095
  if (configured) return configured;
5096
+ const dir = instance?.dir?.trim();
5097
+ if (dir) return join(dir, "plugin-data", PLUGIN_DIR);
5076
5098
  return join(homedir(), ".dsh", "privacy-gateway");
5077
5099
  }
5078
5100
 
@@ -5210,10 +5232,12 @@ function clipChars(text, max) {
5210
5232
  function apply(ctx, config = {}) {
5211
5233
  let cfg = resolveConfig(config);
5212
5234
  if (!cfg.enabled) ctx.logger.info("dsh-privacy-gateway: disabled by config");
5213
- const keyPath = join(stateDir(), "redact.key");
5235
+ const home = stateDir(ctx.profileContext);
5236
+ ctx.logger.info(`dsh-privacy-gateway: state in ${home}`);
5237
+ const keyPath = join(home, "redact.key");
5214
5238
  const { key, persisted } = loadKey(keyPath);
5215
5239
  if (!persisted) ctx.logger.warn(`dsh-privacy-gateway: could not keep the placeholder key at ${keyPath}; placeholders change on restart`);
5216
- const recordDir = join(stateDir(), "masking");
5240
+ const recordDir = join(home, "masking");
5217
5241
  const records = new RecordStore({
5218
5242
  ...cfg.record ? { dir: recordDir } : {},
5219
5243
  keepDays: cfg.keepDays,
@@ -5223,7 +5247,7 @@ function apply(ctx, config = {}) {
5223
5247
  });
5224
5248
  const views = new ViewStore();
5225
5249
  const sessions = new SessionSwitches({
5226
- file: join(stateDir(), "sessions.json"),
5250
+ file: join(home, "sessions.json"),
5227
5251
  logger: ctx.logger
5228
5252
  });
5229
5253
  const optional = (name$1) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-privacy-gateway",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
5
  "description": "Process-wide HTTP redaction gateway for DSH: masks secrets in outgoing model requests and restores placeholders in the replies, for every provider.",
6
6
  "icon": "./assets/icon.svg",