dsh-privacy-gateway 0.1.8 → 0.1.9

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
@@ -2,7 +2,7 @@
2
2
 
3
3
  [简体中文](README.md) | English
4
4
 
5
- ![The model only sees {{placeholder}}: secrets, credentials and personal data are replaced with placeholders before they are sent, and restored in the replies — one interception point, every provider goes through it](docs/assets/screenshots/0-banner.png)
5
+ ![The model only sees {{placeholder}}: secrets, credentials and personal data go out as placeholders and come back as real values — one interception point, every model request through the global fetch goes through it](docs/assets/screenshots/0-banner-en.png)
6
6
 
7
7
  A redaction gateway on the host process's undici global dispatcher. Secrets in outgoing model request bodies are replaced with placeholders, and placeholders in the replies are replaced back with the real values. The agent, adapters and providers don't notice it, and one interception point covers every provider that goes through `fetch()`, including adapters that plugins provide.
8
8
 
@@ -42,7 +42,7 @@ In the default web profile the first install works at once, with no restart of t
42
42
  | `EMAIL` / `PHONE` / `ID_CARD` / `BANK_CARD` | Email addresses, mainland China mobile numbers, ID card numbers (check digit), bank card numbers (Luhn) | `personal` |
43
43
  | `TERM` | The words listed in the `words` config | whenever there are words |
44
44
 
45
- A value masked once is masked with the same placeholder wherever else the request has it (its finder is `known`). History sent to the same host again keeps the bytes it went with before, so the prompt cache still hits.
45
+ A value masked once is masked with the same placeholder wherever else the request has it (its finder is `known`), `url` / `image_url` included; a signed URL (an S3 presigned one, say) goes as it is, since masking one character breaks it ([ADR-0004](docs/adr/0004-protected-regions.md)). History sent to the same host again keeps the bytes it went with before, so the prompt cache still hits.
46
46
 
47
47
  To try it: every line below is a **fake** value; paste one into a session and the matching record on the card shows the placeholder it became. Neither the records, the stats, the log nor the vendorView copy holds the value, only the placeholder and a few characters at each end.
48
48
 
@@ -96,7 +96,7 @@ The everyday settings can be changed on the Configure page of this plugin's row
96
96
  | `shape` | `false` | Send a key as a made-up key of its own form (same prefix, length and kinds of character) instead of a `{{…}}` placeholder; a value under 8 characters, or holding anything but letters, digits, `-`, `_` and `.`, keeps the placeholder; replies put it back the same way ([ADR-0015](docs/adr/0015-shape.md)) |
97
97
  | `cookieNames` | `[]` | More cookie names to mask |
98
98
  | `cookieKeep` | `['lang', 'locale', 'theme', 'tz']` | Cookie names never masked |
99
- | `protectEnvBlock` | `true` | Send `<env>` … `</env>` blocks as written, for providers that check them ([ADR-0004](docs/adr/0004-protected-regions.md)) |
99
+ | `protectEnvBlock` | `true` | Send `<env>` … `</env>` blocks as written, for providers that check them; only in text the host writes (the system prompt, `system`, `instructions`, `systemInstruction`), never in a user message or a tool result ([ADR-0004](docs/adr/0004-protected-regions.md) supplement) |
100
100
  | `protectTools` | `true` | Send the request's `tools` array as written |
101
101
  | `excludeHosts` | `[]` | `host` or `host:port` entries that are never rewritten |
102
102
  | `excludeProviders` | `[]` | Provider ids whose requests are not masked; checked on the Configure page from the providers registered now. Their requests go out as they are, replies are not restored, nothing is recorded, and the log says so once for each provider ([ADR-0018](docs/adr/0018-exclude-providers.md), [ADR-0034](docs/adr/0034-log-excluded-provider.md)) |
@@ -122,7 +122,7 @@ No answer of the command has a value in it.
122
122
 
123
123
  ## Records and statistics
124
124
 
125
- Only a model request that had something masked or restored makes a record, one each: its time and duration, host, model, session with its workspace and title, places replaced, each value's placeholder / kind / finder / head / length / every place it was at, the turn and step the request went out in, the turn and step the value was first sent in this run, the places restored in the reply (those in tool arguments counted apart), and the placeholders the value table does not know. A record never holds a value, nor a URL's query ([ADR-0008](docs/adr/0008-masking-records.md), [ADR-0020](docs/adr/0020-record-attribution.md)).
125
+ Only a model request that had something masked or restored makes a record, one each: its time and duration, host, model, session with its workspace and title, places replaced, each value's placeholder / kind / finder / head / length / every place it was at (up to 8 per value, the rest counted), the turn and step the request went out in, the turn and step the value was first sent in this run, the places restored in the reply (those in tool arguments counted apart), and the placeholders the value table does not know. A record never holds a value, nor a URL's query ([ADR-0008](docs/adr/0008-masking-records.md), [ADR-0020](docs/adr/0020-record-attribution.md)).
126
126
 
127
127
  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, and personal data and your words keep one ([ADR-0019](docs/adr/0019-hint.md)).
128
128
 
@@ -135,7 +135,7 @@ With `vendorView` on (「保留发出内容,供对照查看」 on the config p
135
135
  ## Notes
136
136
 
137
137
  - The session log holds the real values: replies are restored before the log is written ([ADR-0003](docs/adr/0003-restore-before-session-log.md)). Session sync, backups and shares carry the real values.
138
- - Only traffic through the global `fetch()` is covered; direct `node:http`, worker threads and separate processes bypass the gateway ([ADR-0001](docs/adr/0001-intercept-at-undici-global-dispatcher.md)).
138
+ - Only traffic through the global `fetch()` is covered; direct `node:http`, worker threads and separate processes bypass the gateway ([ADR-0001](docs/adr/0001-intercept-at-undici-global-dispatcher.md)). Only JSON model requests it recognizes are rewritten (array `messages`, array or string `input`, `contents`, string `prompt`); multipart, forms and non-JSON bodies go as written and leave no record ([ADR-0001](docs/adr/0001-intercept-at-undici-global-dispatcher.md)).
139
139
  - Compressed requests and replies are decompressed before they are masked or restored; a `content-encoding` with no decoder fails the request ([ADR-0025](docs/adr/0025-compression-and-upgrades.md)). An upgrade (the WebSocket handshake) or a `CONNECT` tunnel inside a model call is refused as well: Codex falls back to SSE the first time and takes SSE from then on in that session. One opened by a plugin outside a model call (dsh-im-infoflow's inbound, say) is let through, its messages unmasked, with one warning per host ([ADR-0032](docs/adr/0032-upgrade-scoped-to-masked-calls.md)) — a fail-closed to fail-open trade whose cost the ADR records; a host that needs a transparent link can still go into `excludeHosts`.
140
140
  - The value table is in memory only ([ADR-0009](docs/adr/0009-value-table-and-restore-exfiltration.md)). After a restart, a value no rule finds, masked only because it was remembered, goes as written the first time it is sent again.
141
141
  - Replies are restored everywhere, tool call arguments included: a model led into writing a placeholder into a command such as `curl` runs the tool with the real value. The plugin counts these places (the tool-argument count on the card and in `/privacy status`) and does not block them ([ADR-0009](docs/adr/0009-value-table-and-restore-exfiltration.md)).
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [English](README.en.md) | 简体中文
4
4
 
5
- ![模型只看见 {{占位符}}:密钥、凭据、个人信息发出前换成占位符,回复里再换回原值,一处拦截,所有 provider 都经过它](docs/assets/screenshots/0-banner.png)
5
+ ![模型只看见 {{占位符}}:密钥、凭据、个人信息发出前换成占位符,回复里再换回原值,一处拦截,每个走全局 fetch 的模型请求都经过它](docs/assets/screenshots/0-banner.png)
6
6
 
7
7
  在宿主进程的 undici 全局 dispatcher 上装一层脱敏网关。出站把模型请求体里的密钥换成占位符,入站把回流里的占位符换回真值。对 agent、adapter、provider 都无感,一处拦截覆盖所有走 `fetch()` 的 provider,包括插件提供的 adapter。
8
8
 
@@ -42,7 +42,7 @@ dsh plugin --profile web add https://github.com/xbzbing/dsh-privacy-gateway/rele
42
42
  | `EMAIL` / `PHONE` / `ID_CARD` / `BANK_CARD` | 邮箱、大陆手机号、身份证号(校验位)、银行卡号(Luhn) | `personal` |
43
43
  | `TERM` | 配置里 `words` 列出的词 | 有词就脱敏 |
44
44
 
45
- 脱敏过的值在请求的其它地方再出现,也按同一个占位符脱敏(finder 记为 `known`)。同一个 host 重发的历史保持原来的字节,prompt cache 照样命中。
45
+ 脱敏过的值在请求的其它地方再出现,也按同一个占位符脱敏(finder 记为 `known`),`url` / `image_url` 里的也算;带签名的 URL(S3 预签名等)原样发出,改了会失效([ADR-0004](docs/adr/0004-protected-regions.md))。同一个 host 重发的历史保持原来的字节,prompt cache 照样命中。
46
46
 
47
47
  照着试:下面每行都是**假值**,复制进会话发出去,统计卡的对应记录里就会出现替换后的占位符。记录、统计、日志和 vendorView 副本里都没有原值,只有占位符和首尾几个字符。
48
48
 
@@ -94,7 +94,7 @@ someone@gmail.com → EMAIL
94
94
  | `shape` | `false` | 密钥换成同形的假 key(前缀、长度、字符类别不变),而不是 `{{…}}` 占位符;不足 8 个字符、或含字母数字与 `-` `_` `.` 以外字符的值仍用占位符;回复里照样还原([ADR-0015](docs/adr/0015-shape.md)) |
95
95
  | `cookieNames` | `[]` | 追加要脱敏的 cookie 名 |
96
96
  | `cookieKeep` | `['lang', 'locale', 'theme', 'tz']` | 永不脱敏的 cookie 名 |
97
- | `protectEnvBlock` | `true` | `<env>` … `</env>` 块原样发出,供会校验它的 provider 使用([ADR-0004](docs/adr/0004-protected-regions.md)) |
97
+ | `protectEnvBlock` | `true` | `<env>` … `</env>` 块原样发出,供会校验它的 provider 使用;只保护宿主生成的文本(系统提示词、`system`、`instructions`、`systemInstruction`),用户消息和工具结果里的 `<env>` 不算([ADR-0004](docs/adr/0004-protected-regions.md) 补充) |
98
98
  | `protectTools` | `true` | 请求的 `tools` 数组原样发出 |
99
99
  | `excludeHosts` | `[]` | 不改写的 `host` 或 `host:port` |
100
100
  | `excludeProviders` | `[]` | 不脱敏的 provider id;「配置」页里从当前注册的 provider 中勾选。放行的请求原样发出、回复不还原、不留记录,有请求发出时日志里每个 provider 提示一次([ADR-0018](docs/adr/0018-exclude-providers.md)、[ADR-0034](docs/adr/0034-log-excluded-provider.md)) |
@@ -120,7 +120,7 @@ someone@gmail.com → EMAIL
120
120
 
121
121
  ## 记录与统计
122
122
 
123
- 只记有脱敏或还原的模型请求,一条请求一条:时间与耗时、host、model、会话及其工作区与标题、替换处数、每个值的占位符 / kind / finder / 开头 / 长度 / 出现过的每一处、请求所在的轮次与步数、值首次被发出的轮次与步数、回复里还原的处数(工具参数里的另计),以及值表里没有的占位符数。记录里不写值本身,也不记 URL 的 query([ADR-0008](docs/adr/0008-masking-records.md)、[ADR-0020](docs/adr/0020-record-attribution.md))。
123
+ 只记有脱敏或还原的模型请求,一条请求一条:时间与耗时、host、model、会话及其工作区与标题、替换处数、每个值的占位符 / kind / finder / 开头 / 长度 / 出现过的每一处(每值最多 8 处,其余只计数)、请求所在的轮次与步数、值首次被发出的轮次与步数、回复里还原的处数(工具参数里的另计),以及值表里没有的占位符数。记录里不写值本身,也不记 URL 的 query([ADR-0008](docs/adr/0008-masking-records.md)、[ADR-0020](docs/adr/0020-record-attribution.md))。
124
124
 
125
125
  「开头」只留辨识用的几个字符:有前缀的留下前缀和其后 4 个,没有的留前 4 个,长值再加末尾 2 个(`sk-proj-g6sx…3QaZ`),短值更少;个人信息和自定义词只留 1 个([ADR-0019](docs/adr/0019-hint.md))。
126
126
 
@@ -133,7 +133,7 @@ someone@gmail.com → EMAIL
133
133
  ## 须知
134
134
 
135
135
  - 会话日志里是真值:还原发生在日志落盘之前([ADR-0003](docs/adr/0003-restore-before-session-log.md))。会话同步、备份、分享带走的是真值。
136
- - 覆盖面只有走全局 `fetch()` 的流量;`node:http` 直连、worker 线程、独立进程不经过网关([ADR-0001](docs/adr/0001-intercept-at-undici-global-dispatcher.md))。
136
+ - 覆盖面只有走全局 `fetch()` 的流量;`node:http` 直连、worker 线程、独立进程不经过网关([ADR-0001](docs/adr/0001-intercept-at-undici-global-dispatcher.md))。只改写识别得出的 JSON 模型请求(数组 `messages`、数组或字符串 `input`、`contents`、字符串 `prompt`);multipart、表单、非 JSON body 原样发出,也不留记录([ADR-0001](docs/adr/0001-intercept-at-undici-global-dispatcher.md))。
137
137
  - 压缩的请求与回复先解压再脱敏、还原;认不出的 `content-encoding` 不发([ADR-0025](docs/adr/0025-compression-and-upgrades.md))。模型调用里的 `upgrade` 握手(WebSocket)与 `CONNECT` 隧道也不发:Codex 第一次被拒后回落到 SSE,之后同一会话直接走 SSE;模型调用之外的升级与隧道(别的插件自己的连接,如 dsh-im-infoflow 的入站)放行,消息不脱敏,每个 host 提示一次([ADR-0032](docs/adr/0032-upgrade-scoped-to-masked-calls.md))——这是 fail-closed 往 fail-open 的取舍,代价见 ADR;需要整条链路放行的 host 仍可加进 `excludeHosts`。
138
138
  - 值表只在内存里([ADR-0009](docs/adr/0009-value-table-and-restore-exfiltration.md))。重启后,规则命不中、只靠记忆兜住的值第一次出站会按原文发出。
139
139
  - 还原发生在回复里,包括工具调用参数:模型被诱导把占位符写进 `curl` 之类的命令时,工具执行时用的是真值。插件只记账(统计卡与 `/privacy status` 里的「工具参数」计数),不拦截([ADR-0009](docs/adr/0009-value-table-and-restore-exfiltration.md))。
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
- "use strict";var ge=require("react");var St=require("@deepseek-ai/dsh-client-ui-primitives"),p=require("react");var O=require("@deepseek-ai/dsh-client-ui-primitives"),w=require("react");var ne=["mask","lists","record","view"],re=[{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:"maskKeys",group:"mask",kind:"switch",default:!0,risk:"send"},{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 Oe(e,t,n){if(e.risk)switch(e.kind){case"switch":return Z(t,e.default)&&!Z(n,e.default)?{risk:e.risk}:void 0;case"list":case"providers":{let r=e.kind==="providers"||e.anyCase,a=f=>r?f.trim().toLowerCase():f.trim(),s=(f,m)=>{let _=new Set(f.map(a));return m.filter(b=>!_.has(a(b)))},i=z(t,e.default),d=z(n,e.default);if(e.kind==="list"&&e.risky==="remove"){let f=s(d,i);return f.length>0?{risk:e.risk,removed:f}:void 0}let l=s(i,d);return l.length>0?{risk:e.risk,added:l}:void 0}case"count":{let r=ee(t,e.min,e.default),a=ee(n,e.min,e.default);return a<r?{risk:e.risk,from:r,to:a}:void 0}case"choice":return}}function Ee(e){return e.kind==="switch"||e.kind==="choice"||e.kind==="count"}function Y(e,t){let n=re.find(r=>r.key===e&&r.kind===t);if(!n)throw new Error(`no ${t} field ${e}`);return n}function Pe(e,t){let n=r=>Z(t[r],Y(r,"switch").default);switch(e){case"mask":{if(!n("enabled"))return[{key:"cfg.s.maskOff",off:!0}];let r=["secrets","personal"].filter(n),a=r.length===0?[{key:"cfg.s.maskNothing",off:!0}]:r.map(i=>({key:`cfg.s.${i}`}));n("shape")&&a.push({key:"cfg.s.shape"});let s=Y("toolGuard","choice");return a.push({key:`cfg.s.toolGuard.${we(t.toolGuard,s.choices,s.default)}`}),a}case"lists":return[{key:"cfg.s.words",params:{n:z(t.words,Y("words","list").default).length}},{key:"cfg.s.allow",params:{n:z(t.allow,Y("allow","list").default).length}}];case"record":{let r=Y("keepDays","count"),a=n("record")?[{key:"cfg.s.record",params:{n:ee(t.keepDays,r.min,r.default)}}]:[{key:"cfg.s.recordOff",off:!0}];return n("vendorView")&&a.push({key:"cfg.s.vendorView"}),a}case"view":{let r=z(t.excludeProviders,Y("excludeProviders","providers").default).length;return[n("showPanel")?{key:"cfg.s.panel"}:{key:"cfg.s.panelOff",off:!0},r===0?{key:"cfg.s.providersAll"}:{key:"cfg.s.providersSome",params:{n:r}}]}}}function Z(e,t){return typeof e=="boolean"?e:t}function we(e,t,n){return typeof e=="string"&&t.includes(e)?e:n}function z(e,t){return Array.isArray(e)?e.filter(n=>typeof n=="string"):[...t]}function ee(e,t,n){return typeof e=="number"&&Number.isFinite(e)&&e>=t?Math.floor(e):n}function Fe(e,t,n){let r=t.trim();if(r==="")return;let a=n?s=>s.trim().toLowerCase()===r.toLowerCase():s=>s.trim()===r;return e.some(a)?void 0:[...e,r]}function Me(e,t){return e.filter(n=>n!==t)}function Ke(e,t){let n=e.trim();if(!/^\d+$/.test(n))return;let r=Number(n);return Number.isSafeInteger(r)&&r>=t?r:void 0}function De(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 Ve(e){let t=["pgw-cfg__row",e.inline?"pgw-cfg__row--inline":"",e.half?"pgw-cfg__row--half":""].filter(Boolean).join(" ");return(0,w.createElement)("div",{className:t},(0,w.createElement)("div",{className:"pgw-cfg__text"},(0,w.createElement)("div",{className:"pgw-cfg__name",id:e.titleId},e.title),(0,w.createElement)("div",{className:"pgw-cfg__desc"},e.hint),e.note??null),(0,w.createElement)("div",{className:"pgw-cfg__control"},e.children))}function Le(e){let t=(0,w.useId)();return(0,w.createElement)("section",{className:"pgw-fold","data-open":e.open||void 0},(0,w.createElement)("h4",{className:"pgw-fold__heading"},(0,w.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,w.createElement)(O.IconChevronDownOutlineRegular,{className:"pgw-fold__chevron"}),(0,w.createElement)("span",{className:"pgw-fold__title"},e.title),e.open?null:(0,w.createElement)("span",{className:"pgw-fold__summary"},e.summary))),e.open?(0,w.createElement)("div",{id:`${t}-b`,role:"region","aria-labelledby":`${t}-h`,className:"pgw-fold__body"},(0,w.createElement)("div",{className:"pgw-fold__grid"},e.children)):null)}function $e(e){return(0,w.createElement)(O.Switch,{checked:e.checked,label:e.label,disabled:e.disabled,onChange:e.onChange})}function ye(e){let[t,n]=(0,w.useState)(!1),r=(0,w.useId)();return(0,w.useEffect)(()=>{e.disabled&&n(!1)},[e.disabled]),(0,w.createElement)(O.Menu,{open:t,onClose:()=>n(!1),items:e.items,...e.multi?{selectedIds:e.selectedIds??[],selection:"check"}:{selectedId:e.selectedId},onSelect:a=>{e.multi||n(!1),e.onSelect(a)},align:"start",portal:!0,anchor:(0,w.createElement)("button",{type:"button",className:"pgw-select","aria-haspopup":"menu","aria-expanded":t,"aria-labelledby":e.labelledBy?`${e.labelledBy} ${r}`:void 0,disabled:e.disabled||e.items.length===0,onClick:()=>n(a=>!a)},(0,w.createElement)("span",{className:"pgw-select__label",id:r},e.label),(0,w.createElement)(O.IconChevronDownOutlineRegular,{className:"pgw-select__chevron"}))})}function ze(e){let{t}=e,[n,r]=(0,w.useState)(""),[a,s]=(0,w.useState)(!1),i=Fe(e.list,n,e.anyCase),d=()=>{if(!i||e.disabled||a)return;let l=n;s(!0),e.onChange(i).then(f=>{s(!1),f&&r(m=>m===l?"":m)})};return(0,w.createElement)("div",{className:"pgw-cfg__list"},(0,w.createElement)("div",{className:"pgw-cfg__add"},(0,w.createElement)(O.Input,{className:"pgw-cfg__input",type:"text",value:n,placeholder:e.placeholder,"aria-label":e.placeholder,disabled:e.disabled,onChange:l=>r(l.target.value),onKeyDown:l=>{l.key==="Enter"&&(l.preventDefault(),d())}}),(0,w.createElement)(O.Button,{variant:"outline",size:"sm",disabled:e.disabled||a||!i,onClick:d},t("cfg.add"))),e.list.length===0?(0,w.createElement)("div",{className:"pgw-cfg__desc"},t("cfg.listEmpty")):(0,w.createElement)("div",{className:"pgw-cfg__tags"},e.list.map(l=>(0,w.createElement)(O.Tag,{key:l,tone:"neutral",className:"pgw-cfg__tag",title:l},(0,w.createElement)("span",{className:"pgw-cfg__tagText"},l),(0,w.createElement)("button",{type:"button",className:"pgw-cfg__tagX","aria-label":t("cfg.remove",{name:l}),disabled:e.disabled,onClick:()=>{e.onChange(Me(e.list,l))}},(0,w.createElement)(O.IconCloseOutlineRegular,{size:12}))))))}function Be(e){let[t,n]=(0,w.useState)(String(e.value)),r=(0,w.useRef)(void 0);(0,w.useEffect)(()=>n(String(e.value)),[e.value]);let a=Ke(t,e.min),s=()=>{if(a===void 0||a===e.value||a===r.current)return;let i=e.value;r.current=a,e.onChange(a).then(d=>{r.current=void 0,d||n(String(i))})};return(0,w.createElement)("div",{className:"pgw-cfg__list"},(0,w.createElement)(O.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":a===void 0,disabled:e.disabled,onChange:i=>n(i.target.value),onBlur:s,onKeyDown:i=>{i.key==="Enter"&&s()}}),a===void 0?(0,w.createElement)("div",{className:"pgw-cfg__desc pgw-cfg__desc--error",role:"alert"},e.t("cfg.countInvalid",{min:e.min})):null)}function He(e,t=6,n="\u2026"){let r=Object.entries(e).filter(([,d])=>d>0).sort((d,l)=>l[1]-d[1]||(d[0]<l[0]?-1:1)),a=r.slice(0,t),s=r.slice(t).reduce((d,[,l])=>d+l,0);s>0&&a.push([n,s]);let i=a.reduce((d,[,l])=>Math.max(d,l),0);return a.map(([d,l])=>({label:d,value:l,pct:i>0?Math.max(2,Math.round(l/i*100)):0}))}var Dt={SECRET:"hint.kind.SECRET",PASSWORD:"hint.kind.PASSWORD",API_KEY:"hint.kind.API_KEY",TOKEN:"hint.kind.TOKEN",PRIVATE_KEY:"hint.kind.PRIVATE_KEY",COOKIE:"hint.kind.COOKIE",EMAIL:"hint.kind.EMAIL",PHONE:"hint.kind.PHONE",ID_CARD:"hint.kind.ID_CARD",BANK_CARD:"hint.kind.BANK_CARD",TERM:"hint.kind.TERM"},Vt={rule:"hint.finder.rule",word:"hint.finder.word",known:"hint.finder.known",cookie:"hint.finder.cookie"};function je(e){return Dt[e]}function Ge(e){return Vt[e]}function We(e,t){return e.filter(n=>(t.kind===void 0||n.kind===t.kind)&&(t.finder===void 0||n.finder===t.finder))}function ve(e,t){return[...new Set(e.map(n=>n[t]).filter(n=>n!==""))].sort()}function qe(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 Ye(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 xe(e,t=new Date){let n=new Date(e);if(Number.isNaN(n.getTime()))return"";let r=s=>String(s).padStart(2,"0");return n.getFullYear()===t.getFullYear()&&n.getMonth()===t.getMonth()&&n.getDate()===t.getDate()?`${r(n.getHours())}:${r(n.getMinutes())}:${r(n.getSeconds())}`:`${r(n.getMonth()+1)}-${r(n.getDate())} ${r(n.getHours())}:${r(n.getMinutes())}`}var H=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),R=e=>typeof e=="number"&&Number.isFinite(e)?e:0;function ae(e){let t={};if(H(e))for(let[n,r]of Object.entries(e))typeof r=="number"&&Number.isFinite(r)&&(t[n]=r);return t}function ke(e){if(!H(e))return;let t=H(e.tookMs)?e.tookMs:{};return{requests:R(e.requests),masked:R(e.masked),n:R(e.n),restored:R(e.restored),restoredInTools:R(e.restoredInTools),unmapped:R(e.unmapped),failed:R(e.failed),warned:R(e.warned),blocked:R(e.blocked),exfil:R(e.exfil),exfilBlocked:R(e.exfilBlocked),tookMs:{sum:R(t.sum),max:R(t.max)},kinds:ae(e.kinds),finders:ae(e.finders),hosts:ae(e.hosts),models:ae(e.models)}}function Lt(e){return H(e)&&typeof e.key=="number"&&typeof e.time=="string"&&Array.isArray(e.values)&&e.values.every(H)}function Je(e){if(!(!H(e)||typeof e.path!="string"||e.path===""))return{path:e.path,...typeof e.role=="string"?{role:e.role}:{},...typeof e.type=="string"?{type:e.type}:{}}}function $t(e){if(!Array.isArray(e))return[];let t=[],n=new Set;for(let r of e){let a=Je(r);a===void 0||n.has(a.path)||(n.add(a.path),t.push(a))}return t}var zt=7,Bt=["rule","word","known","cookie"],be=e=>Math.max(0,Math.floor(R(e)));function Ht(e){if(typeof e.placeholder!="string"||e.placeholder==="")return;let t=m=>typeof m=="string"?m:void 0,n=t(e.tail),r=t(e.before),a=t(e.after),s=Je(e.at),i=oe(e.first??{}),d=$t(e.elsewhere),l=d.slice(0,zt),f=be(e.elsewhereOmitted)+d.length-l.length;return{placeholder:e.placeholder,kind:t(e.kind)??"",finder:Bt.find(m=>m===e.finder)??"rule",head:t(e.head)??"",...n!==void 0?{tail:n}:{},len:be(e.len),n:be(e.n),...e.action==="warn"||e.action==="block"?{action:e.action}:{},...r!==void 0?{before:r}:{},...a!==void 0?{after:a}:{},...s?{at:s}:{},...i?{first:i}:{},...l.length>0?{elsewhere:l}:{},...f>0?{elsewhereOmitted:f}:{}}}function oe(e){let t=e.turn,n=e.step;if(!(typeof t!="number"||typeof n!="number")&&!(!Number.isSafeInteger(t)||!Number.isSafeInteger(n)||t<1||n<1))return{turn:t,step:n}}function Ue(e){return`${e.turn}\xB7${e.step}`}function jt(e){let{valuesOmitted:t,turn:n,step:r,...a}=e,s=R(t),i=oe({turn:n,step:r});return{...a,n:R(e.n),restored:R(e.restored),unmapped:R(e.unmapped),values:e.values.map(Ht).filter(d=>d!==void 0),...s>0?{valuesOmitted:s}:{},...i??{}}}function Qe(e){if(!H(e)||typeof e.active!="boolean"||!H(e.stats)||!Array.isArray(e.recent))return;let t=ke(e.stats.today),n=ke(e.stats.week),r=ke(e.stats.month);if(!(!t||!n||!r))return{...e,values:R(e.values),stats:{today:t,week:n,month:r,failStreak:R(e.stats.failStreak)},recent:e.recent.filter(Lt).map(jt),...Array.isArray(e.views)?{views:e.views.filter(a=>typeof a=="number")}:{}}}function Xe(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 Gt=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");function Ze(e){let t=e;try{t=JSON.stringify(JSON.parse(e),null,2)}catch{}return t.split(`
4
- `)}function et(e){return e.map(t=>t.placeholder).join("\0")}function tt(e,t,n,r=400){let a=[...new Set(t.filter(l=>l!==""))].sort((l,f)=>f.length-l.length),s=a.length>0?new RegExp(a.map(Gt).join("|"),"g"):void 0,i=[],d=!1;for(let l=0;l<e.length;l++){let f=e[l],m=[],_=0;if(s)for(let b of f.matchAll(s))b.index>_&&m.push({text:f.slice(_,b.index)}),m.push({text:b[0],id:b[0]}),_=b.index+b[0].length;if(!(n&&_===0)){if((_<f.length||m.length===0)&&m.push({text:f.slice(_)}),i.length>=r){d=!0;break}i.push({n:l+1,parts:m})}}return{lines:i,truncated:d}}function nt(e,t,n){let r=Math.max(1,Math.ceil(e.length/n)),a=Math.min(Math.max(0,Math.floor(t)),r-1);return{items:e.slice(a*n,a*n+n),page:a,pages:r}}function rt(e){let{path:t,role:n,type:r}=e,a=t.split(".")[0]??"";return n==="system"||n==="developer"||a==="system"||a==="instructions"||a==="systemInstruction"?"place.system":n==="tool"||r==="tool_result"||r==="function_call_output"||r==="functionResponse"?"place.toolResult":r==="tool_use"||r==="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 _e(e){let t=e.split("."),n=t[0]??"",r=t[1]??"";return n!==""&&/^\d+$/.test(r)?`${n}.${r}`:n}function at(e,t){let n=[...new Set((e.elsewhere??[]).map(a=>_e(a.path)))].filter(a=>a!=="").join(t("recent.placeSep")),r=e.elsewhereOmitted??0;return n===""?r>0?t("recent.elsewhereOmitted",{n:r}):"":r>0?t("recent.elsewhereMore",{paths:n,n:r}):t("recent.elsewhere",{paths:n})}function se(e){return e.head?e.tail?`${e.head}\u2026${e.tail}`:`${e.head}\u2026`:""}function J(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 te(e,t,n,r,a){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},d=await s.call("/api",`privacyGateway/${t}`,{args:i},a);if(d?.ok!==!0){let f=d?.error?.message;return{ok:!1,failure:typeof f=="string"&&f!==""?{code:"remote",message:f}:{code:"malformed"}}}let l=r(d.value);return l===void 0?{ok:!1,failure:{code:"malformed"}}:{ok:!0,value:l}}catch(i){return{ok:!1,failure:{code:"thrown",message:i instanceof Error?i.message:String(i)}}}}function ie(e,t,n,r){return te(e,"overview",r?{limit:t,session:r}:{limit:t},Qe,n)}function ot(e,t,n){return te(e,"vendorView",{key:t},r=>{let a=r?.body;return r!==null&&typeof r=="object"&&typeof a=="string"?a:null},n)}function st(e){return te(e,"reset",void 0,t=>{let n=t?.files;return typeof n=="number"?n:0})}function it(e,t,n){return te(e,"sessionMasking",{session:t,on:n},r=>{let a=r?.on;return typeof a=="boolean"?a:void 0})}function lt(e,t){return te(e,"providers",void 0,n=>Array.isArray(n)?n.flatMap(Wt):void 0,t)}function Wt(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 le(e){let t=e,n=new Set;return{get:()=>t,set(r){if(!Object.is(r,t)){t=r;for(let a of[...n])try{a()}catch{}}},subscribe(r){return n.add(r),()=>{n.delete(r)}}}}var qt="Show the Privacy tab at the top of the session";function Yt(e){let t=e,n=t?.refs,a=(n!==null&&typeof n=="object"&&typeof t?.uid<"u"?n[String(t.uid)]:void 0)?.dict??t?.dict;return a!==null&&typeof a=="object"?Object.keys(a):[]}function Ne(e){for(let t of e){let n=Yt(t.schema);if(n.includes("showPanel")&&(t.ns.includes("privacy-gateway")||n.includes("excludeProviders")||JSON.stringify(t.schema??null).includes(qt)))return t.ns}}function Jt(e){let t=Ne(e);if(t===void 0)return;let n=e.find(r=>r.ns===t)?.value;return typeof n=="object"&&n!==null&&n.showPanel===!0}function Ut(e){let t=e;return t!=null&&typeof t.describe=="function"&&typeof t.get=="function"?t:void 0}var G=le(void 0);function dt(e){let t=n=>n.effect(()=>{let r;try{r=Ut(n.get("configForms"))}catch{r=void 0}return G.set(r),()=>{G.get()===r&&G.set(void 0)}},"dsh-privacy-gateway: settings service");typeof e.inject=="function"?e.inject(["configForms"],t):t(e)}var Qt=6e4;function Xt(e,t){return t===void 0?e:t||e===!0?!0:e===!1?!1:void 0}function ct(e,t,n=G){let r=!1,a,s,i,d=()=>{if(r)return;let y=Xt(s,i);y===void 0||y===a||(a=y,t(y))},l=()=>{ie(e,1).then(y=>{r||!y.ok||(s=y.value.showPanel===!0,d())})},f,m=y=>{try{f?.()}catch{}f=void 0,i=void 0;let h;try{h=y?.describe()}catch{h=void 0}if(h){let P=h,F=()=>{if(r)return;let D=P.getSnapshot().view;if(!D)return;let V=Jt(D.namespaces);V!==void 0&&(i=V,d())};f=P.subscribe(F),Promise.resolve(P.ensure()).then(F,F),F()}d()},_=n.subscribe(()=>m(n.get()));m(n.get()),l();let b=setInterval(l,Qt);return()=>{r=!0,clearInterval(b),_();try{f?.()}catch{}}}function ut(e,t){let n=a=>t.some(s=>s.toLowerCase()===a.toLowerCase()),r=e.map(a=>({id:a.id,name:a.name,excluded:n(a.id),registered:!0}));for(let a of t)r.some(s=>s.id.toLowerCase()===a.toLowerCase())||r.push({id:a,name:a,excluded:!0,registered:!1});return r}function ft(e,t){let n=t.toLowerCase();return e.some(r=>r.toLowerCase()===n)?e.filter(r=>r.toLowerCase()!==n):[...e,t]}var _t=require("react");var j="privacyGateway",Zt={"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.step":"\u8F6E\xB7\u6B65","recent.stepHint":"\u8FD9\u6B21\u8BF7\u6C42\u5728\u7B2C\u51E0\u8F6E\u7B2C\u51E0\u6B65\u53D1\u51FA\uFF0C\u7F16\u53F7\u4E0E\u300C\u8F68\u8FF9\u300D\u6807\u7B7E\u9875\u4E00\u81F4\u3002\u6CE8\u610F\u8BB0\u7684\u662F\u300C\u53D1\u51FA\u300D\u7684\u90A3\u4E00\u6B65\uFF1A\u67D0\u4E00\u6B65\u7684\u8F93\u51FA\u8981\u5230\u4E0B\u4E00\u6B65\u7684\u8BF7\u6C42\u91CC\u624D\u53D1\u51FA\u53BB\uFF0C\u6240\u4EE5\u6309\u503C\u5728\u8F68\u8FF9\u91CC\u641C\u5230\u7684\u5F80\u5F80\u662F\u66F4\u65E9\u4E00\u6B65","recent.stepAt":"\u7B2C {turn} \u8F6E \xB7 \u7B2C {step} \u6B65\u53D1\u51FA","recent.stepSent":"\u8FD9\u6B21\u8BF7\u6C42\u5728\u7B2C {turn} \u8F6E \xB7 \u7B2C {step} \u6B65\u53D1\u51FA\uFF1B\u503C\u672C\u8EAB\u53EF\u80FD\u6765\u81EA\u66F4\u65E9\u7684\u67D0\u4E00\u6B65\uFF08\u770B\u5B83\u4E0B\u9762\u7684\u4F4D\u7F6E\uFF09","recent.valueFirst":"\u503C\u9996\u6B21\u88AB\u53D1\u51FA\uFF1A\u7B2C {turn} \u8F6E \xB7 \u7B2C {step} \u6B65","recent.valueFirstHere":"\u672C\u6B21\u8FD0\u884C\u5185\u9996\u6B21\u88AB\u53D1\u51FA","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","dist.others.kind":"\u5176\u4F59 kind","dist.others.finder":"\u5176\u4F59 finder","dist.others.host":"\u5176\u4F59 host","hint.kind.title":"kind\uFF1A\u503C\u7684\u7C7B\u522B","hint.kind.body":"\u89C4\u5219\u6216\u8BCD\u8868\u8BA4\u51FA\u503C\u540E\u5B9A\u7684\u7C7B\u522B\uFF1B\u5360\u4F4D\u7B26\u6309\u5B83\u547D\u540D\uFF0C\u52A8\u4F5C\u4E5F\u6309 kind \u914D\u7F6E\u3002","hint.finder.title":"finder\uFF1A\u8C01\u627E\u5230\u7684","hint.finder.body":"\u8FD9\u6761\u503C\u7531\u8C01\u627E\u5230\uFF1A\u5185\u7F6E\u89C4\u5219\u3001\u81EA\u5B9A\u4E49\u8BCD\u3001\u4E4B\u524D\u8131\u654F\u8FC7\u7684\u503C\u6216 cookie\u3002","hint.count":"\u6570\u5B57\u662F\u66FF\u6362\u5904\u6570\uFF0C\u4E0D\u662F\u8BF7\u6C42\u6570\uFF1Bwarn / block \u4E0D\u8BA1\u5165\u3002","hint.kind.SECRET":"\u5176\u5B83\u5BC6\u94A5\u7C7B\u5B57\u6BB5\uFF1Asecret / token / key=\u2026\uFF0C\u4EE5\u53CA\u4E2D\u6587\u300C\u5BC6\u94A5\u662F\u2026\u300D","hint.kind.PASSWORD":"\u5BC6\u7801\uFF1AURL \u91CC\u7684\u51ED\u636E\u3001password=\u2026 \u5B57\u6BB5\u3001\u4E2D\u6587\u300C\u5BC6\u7801\u4E3A\u2026\u300D","hint.kind.API_KEY":"\u5404\u5E73\u53F0\u7684\u5BC6\u94A5\uFF1AOpenAI / Anthropic sk-\u2026\u3001GitHub \u4EE4\u724C\u3001AWS AKIA\u2026\u3001Google AIza\u2026 \u7B49","hint.kind.TOKEN":"JWT\uFF08eyJ\u2026 \u4E09\u6BB5\u70B9\u5206\uFF09\uFF0C\u4EE5\u53CA Authorization \u5934\u91CC Bearer / Token \u540E\u9762\u7684\u4EE4\u724C","hint.kind.PRIVATE_KEY":"PEM \u79C1\u94A5\u5757","hint.kind.COOKIE":"Cookie \u5934\u3001curl -b\u3001cookies.txt \u91CC\u7684\u4F1A\u8BDD\u503C\uFF08BDUSS\u3001JSESSIONID \u7B49\uFF09","hint.kind.EMAIL":"\u90AE\u7BB1\u5730\u5740","hint.kind.PHONE":"\u5927\u9646\u624B\u673A\u53F7","hint.kind.ID_CARD":"\u8EAB\u4EFD\u8BC1\u53F7\uFF08\u6821\u9A8C\u4F4D\u6709\u6548\uFF09","hint.kind.BANK_CARD":"\u94F6\u884C\u5361\u53F7\uFF08Luhn \u6821\u9A8C\uFF09","hint.kind.TERM":"\u914D\u7F6E words \u91CC\u5217\u51FA\u7684\u81EA\u5B9A\u4E49\u654F\u611F\u8BCD","hint.finder.rule":"\u5185\u7F6E\u6B63\u5219\u89C4\u5219\u8BA4\u51FA\u7684\u503C\uFF1A\u5404\u7C7B\u5BC6\u94A5\u3001\u5BC6\u7801\u3001\u4E2A\u4EBA\u4FE1\u606F","hint.finder.word":"\u914D\u7F6E words \u91CC\u5217\u51FA\u7684\u8BCD","hint.finder.known":"\u672C\u6B21\u8FD0\u884C\u91CC\u5DF2\u7ECF\u8131\u654F\u8FC7\u7684\u503C\u53C8\u5728\u8BF7\u6C42\u522B\u5904\u51FA\u73B0\uFF08\u91CD\u53D1\u7684\u5386\u53F2\u591A\u8D70\u8FD9\u6761\uFF09","hint.finder.cookie":"\u6309 Cookie \u5934\u3001curl -b\u3001cookies.txt \u6216 cookie \u540D\u8BA4\u51FA\u7684\u4F1A\u8BDD\u503C","filter.kind":"\u6309 kind \u7B5B\u9009","filter.finder":"\u6309 finder \u7B5B\u9009","filter.all":"\u5168\u90E8","filter.none":"\u6CA1\u6709\u7B26\u5408\u7B5B\u9009\u7684\u503C\u3002","filter.aria":"{name}\uFF1A{value}","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\uFF1B\u6709\u8BF7\u6C42\u53D1\u51FA\u65F6\uFF0C\u65E5\u5FD7\u91CC\u6BCF\u4E2A provider \u63D0\u793A\u4E00\u6B21\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.maskKeys":"JSON \u952E\u4E5F\u8131\u654F","cfg.f.maskKeys.hint":'\u8BF7\u6C42 body \u91CC\u8BFB\u8D77\u6765\u50CF\u5BC6\u94A5\u6216\u4E2A\u4EBA\u4FE1\u606F\u7684\u952E\u540D\uFF08\u4F8B\u5982 {"sk-\u2026": \u2026}\uFF09\u548C\u503C\u4E00\u6837\u6362\u6210\u5360\u4F4D\u7B26\uFF0C\u56DE\u590D\u91CC\u518D\u6362\u56DE\u6765\u3002\u534F\u8BAE\u81EA\u8EAB\u7684\u952E\uFF08model\u3001role\u3001type\u3001name \u7B49\uFF09\u3001\u5DE5\u5177\u5B9A\u4E49\u4EE5\u53CA\u5DE5\u5177\u8C03\u7528\u7684\u53C2\u6570\u540D\u4E0D\u52A8\uFF0C\u5426\u5219\u4F9B\u5E94\u5546\u8BFB\u4E0D\u61C2\u8FD9\u4EFD\u8BF7\u6C42\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","recent.elsewhere":"\u8FD8\u51FA\u73B0\u5728 {paths}","recent.elsewhereMore":"\u8FD8\u51FA\u73B0\u5728 {paths}\uFF08\u53E6\u6709 {n} \u5904\u6CA1\u5217\u51FA\uFF09","recent.elsewhereOmitted":"\u53E6\u6709 {n} \u5904\u6CA1\u5217\u51FA","recent.placeSep":"\u3001","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.maskKeys":"\u5173\u95ED\u540E\uFF0C\u8BF7\u6C42\u91CC\u8BFB\u8D77\u6765\u50CF\u5BC6\u94A5\u6216\u4E2A\u4EBA\u4FE1\u606F\u7684\u952E\u540D\u4E0D\u518D\u66FF\u6362\uFF0C\u539F\u6837\u53D1\u7ED9\u6A21\u578B\u670D\u52A1\uFF1B\u5DE5\u5177\u5B9A\u4E49\u548C\u5DE5\u5177\u53C2\u6570\u540D\u672C\u6765\u5C31\u4E0D\u52A8\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"},en={"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.step":"Turn\xB7Step","recent.stepHint":"The turn and step this request went out in, numbered as the Trajectory tab numbers them. It is the step that SENT it: a step\u2019s output only reaches the next step\u2019s request, so searching the trajectory for a value usually finds it one step earlier","recent.stepAt":"sent in turn {turn}, step {step}","recent.stepSent":"This request went out in turn {turn}, step {step}; a value in it may come from an earlier step (see the place under it)","recent.valueFirst":"first sent in turn {turn}, step {step}","recent.valueFirstHere":"first sent by this request, in this run","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","dist.others.kind":"Other kinds","dist.others.finder":"Other finders","dist.others.host":"Other hosts","hint.kind.title":"kind: the value\u2019s kind","hint.kind.body":"The kind given to a value a rule or your words find; placeholders are named by it and actions are set per kind.","hint.finder.title":"finder: what found it","hint.finder.body":"What found the value: a built-in rule, your words, a value masked earlier, or a cookie.","hint.count":"Places replaced, not requests; warn / block values are not counted.","hint.kind.SECRET":"Other secret fields: secret / token / key=\u2026, and the Chinese \u201C\u5BC6\u94A5\u662F\u2026\u201D","hint.kind.PASSWORD":"A password: credentials in a URL, password=\u2026 fields, the Chinese \u201C\u5BC6\u7801\u4E3A\u2026\u201D","hint.kind.API_KEY":"Keys of the platforms: OpenAI / Anthropic sk-\u2026, GitHub tokens, AWS AKIA\u2026, Google AIza\u2026 and so on","hint.kind.TOKEN":"A JWT (three dot-separated eyJ\u2026 parts), and the token after Bearer / Token in an Authorization header","hint.kind.PRIVATE_KEY":"A PEM private-key block","hint.kind.COOKIE":"Session values in Cookie headers, curl -b and cookies.txt (BDUSS, JSESSIONID \u2026)","hint.kind.EMAIL":"An email address","hint.kind.PHONE":"A mainland China mobile number","hint.kind.ID_CARD":"A Chinese ID number with a valid checksum","hint.kind.BANK_CARD":"A bank card number that passes the Luhn check","hint.kind.TERM":"A word from the configured words","hint.finder.rule":"Values the built-in rules recognize: keys, passwords, personal data","hint.finder.word":"A word from the configured words","hint.finder.known":"A value masked earlier in this run, met again elsewhere in a request (resent history mostly goes this way)","hint.finder.cookie":"A session value recognized by Cookie headers, curl -b, cookies.txt or a cookie name","filter.kind":"Filter by kind","filter.finder":"Filter by finder","filter.all":"All","filter.none":"No values match the filter.","filter.aria":"{name}: {value}","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; the log says so once for each provider. 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.maskKeys":"Mask JSON keys too","cfg.f.maskKeys.hint":'A key in a request body that reads like a secret or personal data ({"sk-\u2026": \u2026}) goes as a placeholder the way a value does, and comes back in the reply. The protocol\u2019s own keys (model, role, type, name and so on), the tool definitions and the argument names of a tool call are left alone, or the vendor could not read the request.',"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","recent.elsewhere":"Also at {paths}","recent.elsewhereMore":"Also at {paths} ({n} more places not listed)","recent.elsewhereOmitted":"{n} more places not listed","recent.placeSep":", ","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.maskKeys":"Off, a key that reads like a secret or personal data is no longer replaced and goes to the model service as it is; the tool definitions and a tool call\u2019s argument names were never touched.","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."},pt={zh:Zt,en};var T=require("@deepseek-ai/dsh-client-ui-primitives"),u=require("react");var x=require("@deepseek-ai/dsh-client-ui-primitives"),o=require("react");var de=require("@deepseek-ai/dsh-client-ui-primitives"),k=require("react");function tn(e,t){if(!e)return t("view.unknown");let n=e.action?` \xB7 ${t(e.action==="warn"?"action.warn":"action.block")}`:"",r=se(e);return`\u2039${e.kind} \xB7 ${r?`${r} \xB7 `:""}${e.len}${n}\u203A`}function gt(e,t,n,r){return e.parts.map((a,s)=>a.id===void 0?a.text:(0,k.createElement)("mark",{key:s,className:`pgw-view__mark${n?" pgw-view__mark--agent":""}`,title:a.id},n?tn(t.get(a.id),r):a.text))}function mt(e){let{ctx:t,t:n,record:r}=e,[a,s]=(0,k.useState)({status:"loading"}),[i,d]=(0,k.useState)(!0);(0,k.useEffect)(()=>{let h=new AbortController;return s({status:"loading"}),ot(t,r.key,h.signal).then(P=>{h.signal.aborted||s(P.ok?P.value===null?{status:"gone"}:{status:"ready",body:P.value}:{status:"error"})}),()=>h.abort()},[t,r.key]);let l=et(r.values),f=(0,k.useMemo)(()=>new Map(r.values.map(h=>[h.placeholder,h])),[r.key,l]),m=a.status==="ready"?a.body:void 0,_=(0,k.useMemo)(()=>m!==void 0?Ze(m):void 0,[m]),b=(0,k.useMemo)(()=>_?tt(_,[...f.keys()],i):void 0,[_,f,i]),y=(0,k.createElement)("div",{className:"pgw-head"},(0,k.createElement)("span",{className:"pgw-dist__title"},n("view.title")),(0,k.createElement)(de.Checkbox,{checked:i,label:n("view.onlyChanged"),className:"pgw-meta",onChange:d}),(0,k.createElement)("span",{className:"pgw-spacer"}),(0,k.createElement)(de.Button,{variant:"outline",size:"sm",onClick:e.onClose},n("view.close")));if(!b){let h=a.status==="loading"?"view.loading":a.status==="gone"?"view.gone":"card.unavailable";return(0,k.createElement)("div",{className:"pgw-view"},y,(0,k.createElement)("div",{className:"pgw-empty"},n(h)))}return(0,k.createElement)("div",{className:"pgw-view"},y,b.lines.length===0?(0,k.createElement)("div",{className:"pgw-empty"},n("view.none")):(0,k.createElement)("div",{className:"pgw-view__scroll"},(0,k.createElement)("table",{className:"pgw-view__table"},(0,k.createElement)("thead",null,(0,k.createElement)("tr",null,(0,k.createElement)("th",null,n("view.line")),(0,k.createElement)("th",null,n("view.agent")),(0,k.createElement)("th",null,n("view.vendor")))),(0,k.createElement)("tbody",null,b.lines.map(h=>(0,k.createElement)("tr",{key:h.n},(0,k.createElement)("td",{className:"pgw-view__n"},h.n),(0,k.createElement)("td",{className:"pgw-view__code"},...gt(h,f,!0,n)),(0,k.createElement)("td",{className:"pgw-view__code"},...gt(h,f,!1,n))))))),b.truncated?(0,k.createElement)("div",{className:"pgw-meta"},n("view.truncated",{n:b.lines.length})):null)}function wt(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)(x.IconWarningOutlineRegular,{size:14,className:"pgw-notice__icon"}),(0,o.createElement)("span",null,e.t(t.key,{n:t.n})))))}function yt(e){let{totals:t,t:n}=e,r=i=>(i??0).toLocaleString(),a=Ye(t),s=[{label:n("stat.requests"),value:r(t.requests)},{label:n("stat.masked"),value:r(t.masked)},{label:n("stat.n"),value:r(t.n)},{label:n("stat.restored"),value:r(t.restored),...t.restoredInTools>0?{sub:n("stat.inTools",{n:t.restoredInTools})}:{}},{label:n("stat.unmapped"),value:r(t.unmapped),...t.unmapped>0?{tone:"warn"}:{}},{label:n("stat.failed"),value:r(t.failed),...t.failed>0?{tone:"error"}:{}}];return(t.warned??0)>0&&s.push({label:n("stat.warned"),value:r(t.warned),tone:"warn"}),(t.blocked??0)>0&&s.push({label:n("stat.blocked"),value:r(t.blocked),tone:"warn"}),(t.exfil??0)>0&&s.push({label:n("stat.exfil"),value:r(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:a.avg}),sub:n("stat.tookMax",{max:a.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 Se(e){let{t,field:n}=e;return(0,o.createElement)("div",{className:"pgw-hint"},(0,o.createElement)("div",{className:"pgw-hint__title"},t(n==="kind"?"hint.kind.title":"hint.finder.title")),(0,o.createElement)("div",{className:"pgw-hint__body"},t(n==="kind"?"hint.kind.body":"hint.finder.body")),e.note===!0?(0,o.createElement)("div",{className:"pgw-hint__note"},t("hint.count")):null)}function nn(e){return(0,o.createElement)("div",{className:"pgw-hint"},(0,o.createElement)("div",{className:"pgw-hint__title pgw-mono"},e.name),(0,o.createElement)("div",{className:"pgw-hint__body"},e.t(e.meaning)))}function ce(e){let{t,field:n}=e,r=He(e.data,6,e.others),a=n===void 0?e.title:(0,o.createElement)(x.HoverCard,{anchor:(0,o.createElement)("span",{className:"pgw-dist__anchor"},e.title,(0,o.createElement)(x.IconInfoOutlineRegular,{size:12,className:"pgw-dist__info"})),content:(0,o.createElement)(Se,{t,field:n,note:!0})});return(0,o.createElement)("div",{className:"pgw-dist"},(0,o.createElement)("div",{className:"pgw-section__title"},a),r.length===0?(0,o.createElement)("div",{className:"pgw-empty"},e.empty):r.map(s=>{let i=n===void 0?void 0:(n==="kind"?je:Ge)(s.label),d=(0,o.createElement)("span",i===void 0?{className:"pgw-bar__label",title:s.label}:{className:"pgw-bar__label pgw-bar__label--hint"},s.label),l=i===void 0||n===void 0?d:(0,o.createElement)(x.HoverCard,{anchor:d,content:(0,o.createElement)(nn,{t,name:s.label,meaning:i})});return(0,o.createElement)("div",{className:"pgw-bar",key:s.label},(0,o.createElement)("div",{className:"pgw-bar__head"},l,(0,o.createElement)("span",{className:"pgw-bar__value"},s.value.toLocaleString())),(0,o.createElement)("div",{className:"pgw-bar__track"},(0,o.createElement)("div",{className:"pgw-bar__fill",style:{width:`${s.pct}%`}})))}))}function kt(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",{title:t("recent.stepHint")},t("recent.col.step")),(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")))}var Ce="*";function ht(e){let{t,field:n}=e,[r,a]=(0,o.useState)(!1),s=t(n==="kind"?"col.kind":"col.finder"),i=[{id:Ce,label:t("filter.all")},...e.names.map(l=>({id:l,label:l}))],d=(0,o.createElement)("button",{type:"button",className:`pgw-filter${e.value===void 0?"":" pgw-filter--on"}`,"aria-haspopup":"menu","aria-expanded":r,"aria-label":t("filter.aria",{name:t(n==="kind"?"filter.kind":"filter.finder"),value:e.value??t("filter.all")}),onClick:()=>a(l=>!l)},e.value===void 0?s:`${s} \xB7 ${e.value}`,(0,o.createElement)(x.IconChevronDownOutlineRegular,{size:10,className:"pgw-filter__chevron"}));return(0,o.createElement)(x.Menu,{open:r,onClose:()=>a(!1),items:i,selectedId:e.value??Ce,onSelect:l=>{a(!1),e.onChange(l===Ce?void 0:l)},align:"start",portal:!0,anchor:(0,o.createElement)(x.HoverCard,{anchor:d,content:e.hint,disabled:r})})}function bt(e){let{r:t,t:n}=e,[r,a]=(0,o.useState)(!1),[s,i]=(0,o.useState)(void 0),[d,l]=(0,o.useState)(void 0),f=We(t.values,{...s===void 0?{}:{kind:s},...d===void 0?{}:{finder:d}}),m=ve(t.values,"kind"),_=ve(t.values,"finder"),b=(0,o.useId)(),y=oe(t),h=y?n("recent.stepAt",y):"",P=y?n("recent.stepSent",y):"",F=[t.workspace,t.title??t.session].filter(g=>typeof g=="string"&&g!=="").join(" \xB7 "),D=t.failed?(0,o.createElement)(x.Tag,{tone:"danger"},n("recent.failed")):t.blocked?(0,o.createElement)(x.Tag,{tone:"danger"},n("recent.blocked")):(0,o.createElement)("span",{className:t.exfil?"pgw-rec__bad":void 0},t.n.toLocaleString()),V=t.failed?n("recent.failed"):t.blocked?n("recent.blocked"):t.n.toLocaleString(),W=[[n("recent.col.time"),xe(t.time)],[n("recent.col.step"),h],[n("recent.col.where"),[t.model??t.what,t.host].filter(Boolean).join(" \xB7 ")],[n("recent.col.from"),F],[n("recent.col.places"),V],[n("recent.col.restored"),t.restored.toLocaleString()]].filter(([,g])=>g!=="").map(([g,M])=>n("recent.cell",{name:g,value:M})).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?b:void 0,"aria-label":W,onClick:e.toggle},(0,o.createElement)(x.IconChevronRightOutlineRegular,{size:12,className:"pgw-rec__chevron"}),(0,o.createElement)("span",{className:"pgw-rec__time"},xe(t.time)),(0,o.createElement)("span",{className:"pgw-rec__step",title:h||void 0},y?Ue(y):""),(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:F},F),(0,o.createElement)("span",{className:"pgw-rec__num"},D),(0,o.createElement)("span",{className:"pgw-rec__num pgw-rec__dim"},t.restored.toLocaleString())),e.open?(0,o.createElement)("div",{className:"pgw-detail",id:b},t.exfil?(0,o.createElement)("div",{className:"pgw-notice pgw-notice--error"},(0,o.createElement)(x.IconWarningOutlineRegular,{size:14,className:"pgw-notice__icon"}),n("recent.exfil",{hosts:(t.exfilHosts??[]).join(", ")})):null,y?(0,o.createElement)("div",{className:"pgw-meta"},P):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,(0,o.createElement)("th",{key:"col.placeholder"},n("col.placeholder")),(0,o.createElement)("th",{key:"col.kind"},(0,o.createElement)(ht,{t:n,field:"kind",names:m,value:s,hint:(0,o.createElement)(Se,{t:n,field:"kind"}),onChange:i})),(0,o.createElement)("th",{key:"col.finder"},(0,o.createElement)(ht,{t:n,field:"finder",names:_,value:d,hint:(0,o.createElement)(Se,{t:n,field:"finder"}),onChange:l})),(0,o.createElement)("th",{key:"col.head"},n("col.head")),(0,o.createElement)("th",{key:"col.len"},n("col.len")),(0,o.createElement)("th",{key:"col.n"},n("col.n")),(0,o.createElement)("th",{key:"col.action"},n("col.action")))),(0,o.createElement)("tbody",null,f.length===0?(0,o.createElement)("tr",{key:"none",className:"pgw-values__empty"},(0,o.createElement)("td",{colSpan:7},n("filter.none"))):f.flatMap(g=>{let M=at(g,n),L=g.first?n("recent.valueFirst",{turn:g.first.turn,step:g.first.step}):y?n("recent.valueFirstHere"):"",E=g.at!==void 0||g.before!==void 0||g.after!==void 0||M!==""||L!=="";return[(0,o.createElement)("tr",{key:g.placeholder,className:g.before!==void 0||g.after!==void 0?"pgw-values__has":void 0},(0,o.createElement)("td",{className:"pgw-mono"},g.placeholder),(0,o.createElement)("td",null,g.kind),(0,o.createElement)("td",null,g.finder),(0,o.createElement)("td",{className:"pgw-mono"},se(g)),(0,o.createElement)("td",null,g.len),(0,o.createElement)("td",null,g.n),(0,o.createElement)("td",null,g.action?n(g.action==="warn"?"action.warn":"action.block"):"")),E?(0,o.createElement)("tr",{key:`${g.placeholder}:ctx`,className:"pgw-values__ctx"},(0,o.createElement)("td",{colSpan:7},(0,o.createElement)("div",{className:"pgw-ctx"},(0,o.createElement)("div",{className:"pgw-ctx__line"},g.at?(0,o.createElement)(x.Tag,{tone:"neutral",className:"pgw-ctx__place",title:g.at.path},n(rt(g.at)),(0,o.createElement)("span",{className:"pgw-ctx__path pgw-mono"},`\xB7 ${_e(g.at.path)}`)):null,g.before!==void 0||g.after!==void 0?(0,o.createElement)("span",{className:"pgw-ctx__text",title:n("recent.contextHint")},g.before??"",(0,o.createElement)("mark",{className:"pgw-ctx__mark pgw-mono"},g.placeholder),g.after??""):null),M!==""?(0,o.createElement)("div",{className:"pgw-ctx__more"},M):null,L!==""?(0,o.createElement)("div",{className:"pgw-ctx__more"},L):null))):null]}))),t.valuesOmitted?(0,o.createElement)("div",{className:"pgw-meta"},n("recent.omitted",{n:t.valuesOmitted.toLocaleString()})):null,e.viewable&&!r?(0,o.createElement)("div",null,(0,o.createElement)(x.Button,{variant:"outline",size:"sm",onClick:()=>a(!0)},n("view.open"))):null,e.viewable&&r?(0,o.createElement)(mt,{ctx:e.ctx,t:n,record:t,onClose:()=>a(!1)}):null):null)}function vt(e){let{t}=e,[n,r]=(0,o.useState)(!1),[a,s]=(0,o.useState)(!1),[i,d]=(0,o.useState)(!1),l=()=>{r(!1),s(!1)},f=()=>{d(!0),st(e.ctx).then(m=>{d(!1),l(),e.onDone(m.ok?t("card.resetDone",{n:m.value}):t("card.resetFailed",{message:J(m.failure,t)}),m.ok)})};return(0,o.createElement)(o.Fragment,null,(0,o.createElement)(x.Button,{variant:"ghost",size:"sm",className:"pgw-reset",disabled:i,onClick:()=>r(!0)},(0,o.createElement)(x.IconTrashOutlineRegular,{size:14}),(0,o.createElement)("span",null,t("card.reset"))),(0,o.createElement)(x.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:a,disabled:i,onAcknowledgedChange:s,onCancel:l,onConfirm:f}))}function xt(e){let{t}=e,[n,r]=(0,o.useState)(e.on),[a,s]=(0,o.useState)(!1),[i,d]=(0,o.useState)(!1),[l,f]=(0,o.useState)(!1);(0,o.useEffect)(()=>r(e.on),[e.on]);let m=()=>{s(!1),d(!1)},_=b=>{f(!0),it(e.ctx,e.session,b).then(y=>{f(!1),m(),y.ok&&r(y.value),e.onDone(y.ok?null:t("session.failed",{message:J(y.failure,t)}))})};return(0,o.createElement)(o.Fragment,null,(0,o.createElement)("label",{className:"pgw-session"},(0,o.createElement)(x.Switch,{checked:n,disabled:l,onChange:b=>b?_(!0):s(!0)}),(0,o.createElement)("span",{className:"pgw-session__label"},t("session.mask"))),(0,o.createElement)(x.RiskConfirmation,{open:a,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:l,onAcknowledgedChange:d,onCancel:m,onConfirm:()=>_(!1)}))}var rn=15e3,an=200,on=10,sn=["today","week","month"];function ln(e,t){let[n,r]=(0,u.useState)({status:"loading"}),[a,s]=(0,u.useState)(!1),i=(0,u.useRef)(null),d=(0,u.useCallback)(()=>{i.current?.abort();let l=new AbortController;i.current=l,s(!0),ie(e,an,l.signal,t).then(f=>{l.signal.aborted||(s(!1),r(m=>Xe(m,f)))})},[e,t]);return(0,u.useEffect)(()=>{d();let l=setInterval(()=>{(typeof document>"u"||document.visibilityState==="visible")&&d()},rn);return()=>{clearInterval(l),i.current?.abort()}},[d]),[n,d,a]}function ue(e){return(0,u.createElement)(dn,{key:e.sessionId??"",...e})}function dn(e){let{t}=e,[n,r,a]=ln(e.ctx,e.sessionId),[s,i]=(0,u.useState)("today"),[d,l]=(0,u.useState)(null),[f,m]=(0,u.useState)(0),[_,b]=(0,u.useState)(null),y=`pgw-card${e.panel?" pgw-card--panel":""}`,h=n.status==="ready"?n.data:void 0,P=!e.sessionId&&h!==void 0,F=(0,u.createElement)("div",{className:"pgw-head"},(0,u.createElement)("div",{className:"pgw-head__main"},e.panel?null:(0,u.createElement)("h3",{className:"pgw-title"},t("card.title")),e.sessionId&&h&&typeof h.sessionMasking=="boolean"?(0,u.createElement)(xt,{ctx:e.ctx,t,session:e.sessionId,on:h.sessionMasking,onDone:S=>{b(S===null?null:{text:S,ok:!1}),r()}}):null,h&&(!e.sessionId||!h.active)?(0,u.createElement)(T.Tag,{tone:h.active?"success":"warning"},t(h.active?"card.on":"card.off")):null,e.sessionId&&h&&h.sessionMasking===void 0?(0,u.createElement)(T.Tag,{tone:"outline"},t("panel.session")):null,h&&!e.sessionId?(0,u.createElement)("span",{className:"pgw-meta",title:t("card.valuesHint")},t("card.values",{n:h.values})):null,h&&!h.record?(0,u.createElement)("span",{className:"pgw-meta"},t("card.memoryOnly")):null),(0,u.createElement)("div",{className:"pgw-head__actions"},h?(0,u.createElement)(T.SegmentedControl,{id:`pgw-range-${e.sessionId??"all"}`,label:t("card.range"),value:s,options:sn.map(S=>({value:S,label:t(`range.${S}`)})),onChange:i}):null,(0,u.createElement)(T.Button,{variant:"ghost",size:"sm",disabled:a,title:t("card.refresh"),"aria-label":t("card.refresh"),onClick:r},(0,u.createElement)(T.IconRefreshOutlineRegular,{size:14})),P?(0,u.createElement)(vt,{ctx:e.ctx,t,onDone:(S,K)=>{b({text:S,ok:K}),l(null),m(0),r()}}):null)),D=_?(0,u.createElement)("div",{className:`pgw-flash${_.ok?"":" pgw-flash--error"}`,role:"status"},_.text):null,V=n.status==="ready"&&n.stale?(0,u.createElement)("div",{className:"pgw-notice pgw-notice--error",role:"status"},(0,u.createElement)(T.IconWarningOutlineRegular,{size:14,className:"pgw-notice__icon"}),(0,u.createElement)("span",null,t("card.stale",{reason:J(n.stale,t)}))):null,W=e.sessionId&&h?.sessionMasking===!1?(0,u.createElement)("div",{className:"pgw-notice",role:"status"},(0,u.createElement)(T.IconWarningOutlineRegular,{size:14,className:"pgw-notice__icon"}),(0,u.createElement)("span",null,t("session.offNotice"))):null;if(!h){let S=n.status==="error"?`${t("card.unavailable")} ${t("card.reason",{reason:J(n.failure,t)})}`:t("card.loading");return(0,u.createElement)("section",{className:y},F,(0,u.createElement)("div",{className:"pgw-empty pgw-empty--block"},S))}if(e.sessionId&&h.recent.length===0)return(0,u.createElement)("section",{className:y},F,V,D,W,(0,u.createElement)("div",{className:"pgw-empty pgw-empty--block"},t("panel.empty")));let g=h,M=g.stats[s],L=new Set(g.vendorView?g.views??[]:[]),E=nt(g.recent,f,on),Q=S=>{m(S),l(null)};return(0,u.createElement)("section",{className:y},F,V,D,W,(0,u.createElement)(wt,{t,items:qe(g,M)}),(0,u.createElement)(yt,{totals:M,t}),(0,u.createElement)("div",{className:"pgw-dists"},(0,u.createElement)(ce,{t,title:t("dist.kind"),data:M.kinds,others:t("dist.others.kind"),empty:t("dist.empty"),field:"kind"}),(0,u.createElement)(ce,{t,title:t("dist.finder"),data:M.finders,others:t("dist.others.finder"),empty:t("dist.empty"),field:"finder"}),(0,u.createElement)(ce,{t,title:t("dist.host"),data:M.hosts,others:t("dist.others.host"),empty:t("dist.empty")})),(0,u.createElement)("div",{className:"pgw-section"},(0,u.createElement)("div",{className:"pgw-section__head"},(0,u.createElement)("span",{className:"pgw-section__title"},t("recent.title")),g.recent.length>0?(0,u.createElement)("span",{className:"pgw-meta"},t("recent.count",{n:g.recent.length})):null),g.recent.length===0?(0,u.createElement)("div",{className:"pgw-empty pgw-empty--block"},t("recent.empty")):(0,u.createElement)("div",{className:"pgw-recs"},(0,u.createElement)(kt,{t}),(0,u.createElement)("ul",{className:"pgw-recs__list","aria-label":t("recent.title")},E.items.map(S=>(0,u.createElement)(bt,{key:S.key,ctx:e.ctx,r:S,open:d===S.key,toggle:()=>l(d===S.key?null:S.key),t,viewable:L.has(S.key)})))),E.pages>1?(0,u.createElement)("div",{className:"pgw-pager"},(0,u.createElement)(T.Button,{variant:"ghost",size:"sm",disabled:E.page===0,onClick:()=>Q(0)},t("page.first")),(0,u.createElement)(T.Button,{variant:"ghost",size:"sm",disabled:E.page===0,"aria-label":t("page.prev"),title:t("page.prev"),onClick:()=>Q(E.page-1)},(0,u.createElement)(T.IconChevronLeftOutlineRegular,{size:14})),(0,u.createElement)("span",{className:"pgw-meta pgw-pager__at"},t("page.at",{page:E.page+1,pages:E.pages})),(0,u.createElement)(T.Button,{variant:"ghost",size:"sm",disabled:E.page>=E.pages-1,"aria-label":t("page.next"),title:t("page.next"),onClick:()=>Q(E.page+1)},(0,u.createElement)(T.IconChevronRightOutlineRegular,{size:14}))):null))}var cn="dsh-privacy-gateway",U=le(void 0);function Nt(e,t){return e.code==="noDisposer"?t("err.noDisposer"):t("err.thrown",{message:e.message})}function Ct(e,t){U.set(void 0);let n;try{let r=e.slots.inject("conversation.view",()=>e.slots.register({name:"conversation.view",id:cn,order:35,locale:j,label:()=>t("panel.tab")},a=>(0,_t.createElement)(ue,{ctx:e,t,panel:!0,...a?.sessionId?{sessionId:a.sessionId}:{}})));if(typeof r!="function"){U.set({code:"noDisposer"});return}n=r}catch(r){U.set({code:"thrown",message:r instanceof Error?r.message:String(r)});return}return()=>{let r=n;n=void 0;try{r?.()}catch{}}}var fe=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 r=this.waiting.length-1;r>=0;r--)if(this.waiting[r]?.path===t)return this.waiting[r]?.value;return this.current?.path===t?this.current.value:n}write(t,n){return new Promise(r=>{let a=this.waiting.find(s=>s.path===t);a?(a.value=n,a.done.push(r)):this.waiting.push({path:t,value:n,done:[r]}),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 r;try{r=await this.send(n.path,n.value,t)}catch{r=!1}this.current=void 0,t=!0;for(let a of n.done)a(r);if(!r){this.failed=!0;for(let a of this.waiting.splice(0))for(let s of a.done)s(!1)}this.notify()}}notify(){this.onState(this.state)}};function un(){let[,e]=(0,p.useState)(0),t=(0,p.useSyncExternalStore)(G.subscribe,G.get),n=(0,p.useMemo)(()=>{try{return t?.describe()}catch{return}},[t]);(0,p.useEffect)(()=>{if(n)return Promise.resolve(n.ensure()).catch(()=>{}),n.subscribe(()=>e(d=>d+1))},[n]);let r=n?.getSnapshot().view,a=(0,p.useMemo)(()=>r?Ne(r.namespaces):void 0,[r]),s=(0,p.useMemo)(()=>{try{return t&&a!==void 0?t.get(a):void 0}catch{return}},[t,a]);(0,p.useEffect)(()=>s?s.subscribe(()=>e(d=>d+1)):void 0,[s]);let i=s?.getSnapshot();return(0,p.useMemo)(()=>{if(!s||!i)return;let d=s.mutate,l=d?(f,m)=>d.call(s,f,m):async f=>{for(let m of f)if(!await s.set(m.path.join("."),m.value))return!1;return!0};return{state:{status:i.status,value:i.value,revision:i.revision,writable:i.writable!==!1},mutate:l}},[s,i])}var Rt="dsh-privacy-gateway.config.open",fn=["mask"];function pn(){try{let e=JSON.parse(globalThis.localStorage?.getItem(Rt)??"null");if(Array.isArray(e))return ne.filter(t=>e.includes(t))}catch{}return[...fn]}function gn(e){try{globalThis.localStorage?.setItem(Rt,JSON.stringify(e))}catch{}}var B=e=>e;function Re(e){let{ctx:t,t:n}=e,r=un(),a=e.form??r,s=(0,p.useRef)(a);s.current=a;let[i,d]=(0,p.useState)({busy:!1,failed:!1}),[l]=(0,p.useState)(()=>new fe((c,v,N)=>{let C=s.current;return C?C.mutate([{op:"set",path:[c],value:v}],N?void 0:C.state.revision):Promise.resolve(!1)},d)),[f,m]=(0,p.useState)(null),[_,b]=(0,p.useState)(!1),y=(0,p.useSyncExternalStore)(U.subscribe,U.get),h=(0,p.useId)(),[P,F]=(0,p.useState)(null),[D,V]=(0,p.useState)(!1),[W,g]=(0,p.useState)(pn),M=c=>g(v=>{let N=v.includes(c)?v.filter(C=>C!==c):ne.filter(C=>C===c||v.includes(C));return gn(N),N}),L=a?.state,E=L?.status==="ready",Q=L?.writable!==!1,S=L?.value??{},K=c=>l.latest(c,S[c]);if((0,p.useEffect)(()=>{let c=new AbortController;return lt(t,c.signal).then(v=>{c.signal.aborted||(V(!v.ok),F(v.ok?v.value:[]))}),()=>c.abort()},[t]),!a)return(0,p.createElement)("div",{className:"pgw-empty"},n("cfg.unavailable"));let q=!E||!Q,Ot=c=>P?.find(v=>v.id.toLowerCase()===c.toLowerCase())?.name??c,X=(c,v)=>{if(q)return Promise.resolve(!1);let N=Oe(c,K(c.key),v);return N?new Promise(C=>{b(!1),m($=>($?.resolve(!1),{f:c,next:v,change:N,resolve:C}))}):l.write(c.key,v)},Ie=c=>{let v=f;m(null),b(!1),v&&(c?l.write(v.f.key,v.next).then(v.resolve):v.resolve(!1))},Et=c=>{let v=n(B(`cfg.f.${c.key}`));switch(c.kind){case"switch":return(0,p.createElement)($e,{label:v,checked:Z(K(c.key),c.default),disabled:q,onChange:N=>{X(c,N)}});case"choice":{let N=we(K(c.key),c.choices,c.default);return(0,p.createElement)(ye,{label:n(B(`cfg.f.${c.key}.${N}`)),labelledBy:`${h}${c.key}`,items:c.choices.map(C=>({id:C,label:n(B(`cfg.f.${c.key}.${C}`))})),selectedId:N,disabled:q,onSelect:C=>{C!==N&&X(c,C)}})}case"list":return(0,p.createElement)(ze,{t:n,list:z(K(c.key),c.default),anyCase:c.anyCase,placeholder:n(B(`cfg.f.${c.key}.placeholder`)),disabled:q,onChange:N=>X(c,N)});case"count":return(0,p.createElement)(Be,{t:n,value:ee(K(c.key),c.min,c.default),min:c.min,label:v,disabled:q,onChange:N=>X(c,N)});case"providers":return Pt(c)}},Pt=c=>{let v=z(K(c.key),[]),N=ut(P??[],v),C=N.filter(I=>I.excluded).map(I=>I.name),$=De(C,n("cfg.sep")),he=$.kind==="none"?n("cfg.excludedNone"):$.kind==="some"?$.names:n("cfg.excludedMany",{names:$.names,n:$.n});return(0,p.createElement)(ye,{label:he,labelledBy:`${h}${c.key}`,multi:!0,items:N.map(I=>({id:I.id,label:I.registered?I.name:n("cfg.providerAbsent",{name:I.name})})),selectedIds:N.filter(I=>I.excluded).map(I=>I.id),disabled:q,onSelect:I=>{X(c,ft(z(K(c.key),[]),I))}})},Ae=c=>{if(c.key==="showPanel"&&y)return(0,p.createElement)("div",{className:"pgw-cfg__desc pgw-cfg__desc--error"},n("cfg.sidebarFailed",{reason:Nt(y,n)}));if(c.key==="excludeProviders"&&D)return(0,p.createElement)("div",{className:"pgw-cfg__desc pgw-cfg__desc--error"},n("cfg.providerListUnavailable"))},Ft=Object.fromEntries(re.map(c=>[c.key,K(c.key)])),Mt=c=>{let v=re.filter(A=>A.group===c),N=n(B(`cfg.g.${c}`)),C=W.includes(c),$=Pe(c,Ft),he=v.some(A=>Ae(A)!==void 0),I=E?[...$.map((A,Kt)=>(0,p.createElement)("span",{key:Kt,className:A.off?"pgw-fold__part pgw-fold__part--off":"pgw-fold__part"},n(B(A.key),A.params))),he?(0,p.createElement)("span",{key:"problem",className:"pgw-fold__part pgw-fold__part--error"},n("cfg.s.problem")):null]:null;return(0,p.createElement)(Le,{key:c,title:N,summary:I,open:C,toggleLabel:n(C?"cfg.collapse":"cfg.expand",{name:N}),onToggle:()=>M(c)},v.map(A=>(0,p.createElement)(Ve,{key:A.key,title:n(B(`cfg.f.${A.key}`)),titleId:`${h}${A.key}`,hint:n(B(`cfg.f.${A.key}.hint`)),note:Ae(A),inline:Ee(A),half:A.half===!0},Et(A))))},me=f?mn(f,n,f.f.key==="excludeProviders"?Ot:c=>c):null;return(0,p.createElement)(p.Fragment,null,(0,p.createElement)("section",{className:"pgw-cfg","aria-busy":i.busy||void 0},e.form?null:(0,p.createElement)("h3",{className:"pgw-title"},n("cfg.title")),i.failed?(0,p.createElement)("div",{className:"pgw-notice pgw-notice--error",role:"alert"},n("cfg.failed")):null,(0,p.createElement)("div",{className:"pgw-cfg__folds"},ne.map(Mt)),(0,p.createElement)("p",{className:"pgw-cfg__desc pgw-cfg__foot"},n("cfg.applies")," ",n("cfg.others"))),(0,p.createElement)(St.RiskConfirmation,{open:f!==null,title:me?.title??"",description:me?.body??"",acknowledgeLabel:me?.ack??"",cancelLabel:n("card.cancel"),closeLabel:n("card.close"),confirmLabel:n("cfg.risk.confirm"),acknowledged:_,onAcknowledgedChange:b,onCancel:()=>Ie(!1),onConfirm:()=>Ie(!0)}))}function mn(e,t,n){let{change:r}=e,a={},s=r.added??r.removed;return s&&(a.names=s.map(n).join(t("cfg.sep"))),r.from!==void 0&&(a.from=r.from),r.to!==void 0&&(a.to=r.to),{title:t(r.risk==="send"?"cfg.risk.send.title":"cfg.risk.delete.title"),body:t(B(`cfg.r.${e.f.key}`),a),ack:t(r.risk==="send"?"cfg.risk.send.ack":"cfg.risk.delete.ack")}}var pe="dsh-privacy-gateway",Tt="dsh-privacy-gateway";var Te="var(--ds-font-family-code,ui-monospace,monospace)",hn=`
3
+ "use strict";var ye=require("react");var he=require("@deepseek-ai/dsh-client-ui-primitives"),p=require("react");var M=require("@deepseek-ai/dsh-client-ui-primitives"),w=require("react");var oe=["mask","lists","record","view"],se=[{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:"maskKeys",group:"mask",kind:"switch",default:!0,risk:"send"},{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 Fe(e,t,n){if(e.risk)switch(e.kind){case"switch":return te(t,e.default)&&!te(n,e.default)?{risk:e.risk}:void 0;case"list":case"providers":{let r=e.kind==="providers"||e.anyCase,a=f=>r?f.trim().toLowerCase():f.trim(),s=(f,h)=>{let _=new Set(f.map(a));return h.filter(k=>!_.has(a(k)))},i=j(t,e.default),d=j(n,e.default);if(e.kind==="list"&&e.risky==="remove"){let f=s(d,i);return f.length>0?{risk:e.risk,removed:f}:void 0}let l=s(i,d);return l.length>0?{risk:e.risk,added:l}:void 0}case"count":{let r=ne(t,e.min,e.default),a=ne(n,e.min,e.default);return a<r?{risk:e.risk,from:r,to:a}:void 0}case"choice":return}}function Ke(e){return e.kind==="switch"||e.kind==="choice"||e.kind==="count"}function Q(e,t){let n=se.find(r=>r.key===e&&r.kind===t);if(!n)throw new Error(`no ${t} field ${e}`);return n}function De(e,t){let n=r=>te(t[r],Q(r,"switch").default);switch(e){case"mask":{if(!n("enabled"))return[{key:"cfg.s.maskOff",off:!0}];let r=["secrets","personal"].filter(n),a=r.length===0?[{key:n("maskKeys")?"cfg.s.maskKeysOnly":"cfg.s.maskNothing",off:!0}]:r.map(i=>({key:`cfg.s.${i}`}));n("shape")&&a.push({key:"cfg.s.shape"});let s=Q("toolGuard","choice");return a.push({key:`cfg.s.toolGuard.${ve(t.toolGuard,s.choices,s.default)}`}),a}case"lists":return[{key:"cfg.s.words",params:{n:j(t.words,Q("words","list").default).length}},{key:"cfg.s.allow",params:{n:j(t.allow,Q("allow","list").default).length}}];case"record":{let r=Q("keepDays","count"),a=n("record")?[{key:"cfg.s.record",params:{n:ne(t.keepDays,r.min,r.default)}}]:[{key:"cfg.s.recordOff",off:!0}];return n("vendorView")&&a.push({key:"cfg.s.vendorView"}),a}case"view":{let r=j(t.excludeProviders,Q("excludeProviders","providers").default).length;return[n("showPanel")?{key:"cfg.s.panel"}:{key:"cfg.s.panelOff",off:!0},r===0?{key:"cfg.s.providersAll"}:{key:"cfg.s.providersSome",params:{n:r}}]}}}function te(e,t){return typeof e=="boolean"?e:t}function ve(e,t,n){return typeof e=="string"&&t.includes(e)?e:n}function j(e,t){return Array.isArray(e)?e.filter(n=>typeof n=="string"):[...t]}function ne(e,t,n){return typeof e=="number"&&Number.isFinite(e)&&e>=t?Math.floor(e):n}function Ve(e,t,n){let r=t.trim();if(r==="")return;let a=n?s=>s.trim().toLowerCase()===r.toLowerCase():s=>s.trim()===r;return e.some(a)?void 0:[...e,r]}function Le(e,t){return e.filter(n=>n!==t)}function $e(e,t){let n=e.trim();if(!/^\d+$/.test(n))return;let r=Number(n);return Number.isSafeInteger(r)&&r>=t?r:void 0}function ze(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 Be(e){let t=["pgw-cfg__row",e.inline?"pgw-cfg__row--inline":"",e.half?"pgw-cfg__row--half":""].filter(Boolean).join(" ");return(0,w.createElement)("div",{className:t},(0,w.createElement)("div",{className:"pgw-cfg__text"},(0,w.createElement)("div",{className:"pgw-cfg__name",id:e.titleId},e.title),(0,w.createElement)("div",{className:"pgw-cfg__desc"},e.hint),e.note??null),(0,w.createElement)("div",{className:"pgw-cfg__control"},e.children))}function He(e){let t=(0,w.useId)();return(0,w.createElement)("section",{className:"pgw-fold","data-open":e.open||void 0},(0,w.createElement)("h4",{className:"pgw-fold__heading"},(0,w.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,w.createElement)(M.IconChevronDownOutlineRegular,{className:"pgw-fold__chevron"}),(0,w.createElement)("span",{className:"pgw-fold__title"},e.title),e.open?null:(0,w.createElement)("span",{className:"pgw-fold__summary"},e.summary))),e.open?(0,w.createElement)("div",{id:`${t}-b`,role:"region","aria-labelledby":`${t}-h`,className:"pgw-fold__body"},(0,w.createElement)("div",{className:"pgw-fold__grid"},e.children)):null)}function je(e){return(0,w.createElement)(M.Switch,{checked:e.checked,label:e.label,disabled:e.disabled,onChange:e.onChange})}function xe(e){let[t,n]=(0,w.useState)(!1),r=(0,w.useId)();return(0,w.useEffect)(()=>{e.disabled&&n(!1)},[e.disabled]),(0,w.createElement)(M.Menu,{open:t,onClose:()=>n(!1),items:e.items,...e.multi?{selectedIds:e.selectedIds??[],selection:"check"}:{selectedId:e.selectedId},onSelect:a=>{e.multi||n(!1),e.onSelect(a)},align:"start",portal:!0,anchor:(0,w.createElement)("button",{type:"button",className:"pgw-select","aria-haspopup":"menu","aria-expanded":t,"aria-labelledby":e.labelledBy?`${e.labelledBy} ${r}`:void 0,disabled:e.disabled||e.items.length===0,onClick:()=>n(a=>!a)},(0,w.createElement)("span",{className:"pgw-select__label",id:r},e.label),(0,w.createElement)(M.IconChevronDownOutlineRegular,{className:"pgw-select__chevron"}))})}function Ge(e){let{t}=e,[n,r]=(0,w.useState)(""),[a,s]=(0,w.useState)(!1),i=Ve(e.list,n,e.anyCase),d=()=>{if(!i||e.disabled||a)return;let l=n;s(!0),e.onChange(i).then(f=>{s(!1),f&&r(h=>h===l?"":h)})};return(0,w.createElement)("div",{className:"pgw-cfg__list"},(0,w.createElement)("div",{className:"pgw-cfg__add"},(0,w.createElement)(M.Input,{className:"pgw-cfg__input",type:"text",value:n,placeholder:e.placeholder,"aria-label":e.label,disabled:e.disabled,onChange:l=>r(l.target.value),onKeyDown:l=>{l.key==="Enter"&&(l.preventDefault(),d())}}),(0,w.createElement)(M.Button,{variant:"outline",size:"sm",disabled:e.disabled||a||!i,onClick:d},t("cfg.add"))),e.list.length===0?(0,w.createElement)("div",{className:"pgw-cfg__desc"},t("cfg.listEmpty")):(0,w.createElement)("div",{className:"pgw-cfg__tags"},e.list.map(l=>(0,w.createElement)(M.Tag,{key:l,tone:"neutral",className:"pgw-cfg__tag",title:l},(0,w.createElement)("span",{className:"pgw-cfg__tagText"},l),(0,w.createElement)("button",{type:"button",className:"pgw-cfg__tagX","aria-label":t("cfg.remove",{name:l}),disabled:e.disabled,onClick:()=>{e.onChange(Le(e.list,l))}},(0,w.createElement)(M.IconCloseOutlineRegular,{size:12}))))))}function We(e){let[t,n]=(0,w.useState)(String(e.value)),r=(0,w.useRef)(void 0);(0,w.useEffect)(()=>n(String(e.value)),[e.value]);let a=$e(t,e.min),s=()=>{a===void 0||a===e.value||a===r.current||(r.current=a,e.onChange(a).then(()=>{r.current=void 0}))};return(0,w.createElement)("div",{className:"pgw-cfg__list"},(0,w.createElement)(M.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":a===void 0,disabled:e.disabled,onChange:i=>n(i.target.value),onBlur:s,onKeyDown:i=>{i.key==="Enter"&&s()}}),a===void 0?(0,w.createElement)("div",{className:"pgw-cfg__desc pgw-cfg__desc--error",role:"alert"},e.t("cfg.countInvalid",{min:e.min})):null)}function qe(e,t=6,n="\u2026"){let r=Object.entries(e).filter(([,d])=>d>0).sort((d,l)=>l[1]-d[1]||(d[0]<l[0]?-1:1)),a=r.slice(0,t),s=r.slice(t).reduce((d,[,l])=>d+l,0);s>0&&a.push([n,s]);let i=a.reduce((d,[,l])=>Math.max(d,l),0);return a.map(([d,l])=>({label:d,value:l,pct:i>0?Math.max(2,Math.round(l/i*100)):0}))}var $t={SECRET:"hint.kind.SECRET",PASSWORD:"hint.kind.PASSWORD",API_KEY:"hint.kind.API_KEY",TOKEN:"hint.kind.TOKEN",PRIVATE_KEY:"hint.kind.PRIVATE_KEY",COOKIE:"hint.kind.COOKIE",EMAIL:"hint.kind.EMAIL",PHONE:"hint.kind.PHONE",ID_CARD:"hint.kind.ID_CARD",BANK_CARD:"hint.kind.BANK_CARD",TERM:"hint.kind.TERM"},zt={rule:"hint.finder.rule",word:"hint.finder.word",known:"hint.finder.known",cookie:"hint.finder.cookie"};function Ye(e){return $t[e]}function Je(e){return zt[e]}function Ue(e,t){return e.filter(n=>(t.kind===void 0||n.kind===t.kind)&&(t.finder===void 0||n.finder===t.finder))}function Ce(e,t){return[...new Set(e.map(n=>n[t]).filter(n=>n!==""))].sort()}function Qe(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 Xe(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 Se(e,t=new Date){let n=new Date(e);if(Number.isNaN(n.getTime()))return"";let r=s=>String(s).padStart(2,"0");return n.getFullYear()===t.getFullYear()&&n.getMonth()===t.getMonth()&&n.getDate()===t.getDate()?`${r(n.getHours())}:${r(n.getMinutes())}:${r(n.getSeconds())}`:`${r(n.getMonth()+1)}-${r(n.getDate())} ${r(n.getHours())}:${r(n.getMinutes())}`}var W=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),S=e=>typeof e=="number"&&Number.isFinite(e)?e:0;function ie(e){let t={};if(W(e))for(let[n,r]of Object.entries(e))typeof r=="number"&&Number.isFinite(r)&&(t[n]=r);return t}function _e(e){if(!W(e))return;let t=W(e.tookMs)?e.tookMs:{};return{requests:S(e.requests),masked:S(e.masked),n:S(e.n),restored:S(e.restored),restoredInTools:S(e.restoredInTools),unmapped:S(e.unmapped),failed:S(e.failed),warned:S(e.warned),blocked:S(e.blocked),exfil:S(e.exfil),exfilBlocked:S(e.exfilBlocked),tookMs:{sum:S(t.sum),max:S(t.max)},kinds:ie(e.kinds),finders:ie(e.finders),hosts:ie(e.hosts),models:ie(e.models)}}function Bt(e){return W(e)&&typeof e.key=="number"&&typeof e.time=="string"&&Array.isArray(e.values)&&e.values.every(W)}function Ze(e){if(!(!W(e)||typeof e.path!="string"||e.path===""))return{path:e.path,...typeof e.role=="string"?{role:e.role}:{},...typeof e.type=="string"?{type:e.type}:{}}}function Ht(e){if(!Array.isArray(e))return[];let t=[],n=new Set;for(let r of e){let a=Ze(r);a===void 0||n.has(a.path)||(n.add(a.path),t.push(a))}return t}var jt=7,Ne=e=>Math.max(0,Math.floor(S(e)));function Gt(e){if(typeof e.placeholder!="string"||e.placeholder==="")return;let t=h=>typeof h=="string"?h:void 0,n=t(e.tail),r=t(e.before),a=t(e.after),s=Ze(e.at),i=le(e.first??{}),d=Ht(e.elsewhere),l=d.slice(0,jt),f=Ne(e.elsewhereOmitted)+d.length-l.length;return{placeholder:e.placeholder,kind:t(e.kind)??"",finder:t(e.finder)??"",head:t(e.head)??"",...n!==void 0?{tail:n}:{},len:Ne(e.len),n:Ne(e.n),...e.action==="warn"||e.action==="block"?{action:e.action}:{},...r!==void 0?{before:r}:{},...a!==void 0?{after:a}:{},...s?{at:s}:{},...i?{first:i}:{},...l.length>0?{elsewhere:l}:{},...f>0?{elsewhereOmitted:f}:{}}}function le(e){let t=e.turn,n=e.step;if(!(typeof t!="number"||typeof n!="number")&&!(!Number.isSafeInteger(t)||!Number.isSafeInteger(n)||t<1||n<1))return{turn:t,step:n}}function et(e){return`${e.turn}\xB7${e.step}`}function Wt(e){let{valuesOmitted:t,turn:n,step:r,model:a,host:s,what:i,tookMs:d,title:l,workspace:f,session:h,exfil:_,exfilHosts:k,restoredInTools:y,warned:m,failed:I,blocked:A,relay:V,...L}=e,D=K=>typeof K=="string"?K:void 0,g=S(t),F=le({turn:n,step:r}),z=D(a),O=D(l),B=D(f),N=D(h),U=S(_),ae=S(y),$=S(m),Z=Array.isArray(k)?k.filter(K=>typeof K=="string"):void 0;return{...L,host:D(s)??"",what:i==="chat"||i==="embeddings"||i==="count"||i==="search"?i:"chat",tookMs:S(d),n:S(e.n),restored:S(e.restored),unmapped:S(e.unmapped),values:e.values.map(Gt).filter(K=>K!==void 0),...z!==void 0?{model:z}:{},...O!==void 0?{title:O}:{},...B!==void 0?{workspace:B}:{},...N!==void 0?{session:N}:{},...U>0?{exfil:U}:{},...Z!==void 0&&Z.length>0?{exfilHosts:Z}:{},...ae>0?{restoredInTools:ae}:{},...$>0?{warned:$}:{},...I===!0?{failed:!0}:{},...A===!0?{blocked:!0}:{},...V===!0?{relay:!0}:{},...g>0?{valuesOmitted:g}:{},...F??{}}}function tt(e){if(!W(e)||typeof e.active!="boolean"||!W(e.stats)||!Array.isArray(e.recent))return;let t=_e(e.stats.today),n=_e(e.stats.week),r=_e(e.stats.month);if(!(!t||!n||!r))return{...e,values:S(e.values),stats:{today:t,week:n,month:r,failStreak:S(e.stats.failStreak)},recent:e.recent.filter(Bt).map(Wt),...Array.isArray(e.views)?{views:e.views.filter(a=>typeof a=="number")}:{}}}function nt(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 qt=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");function rt(e){let t=e;try{t=JSON.stringify(JSON.parse(e),null,2)}catch{}return t.split(`
4
+ `)}function at(e){return e.map(t=>t.placeholder).join("\0")}function ot(e,t,n,r=400){let a=[...new Set(t.filter(l=>l!==""))].sort((l,f)=>f.length-l.length),s=a.length>0?new RegExp(a.map(qt).join("|"),"g"):void 0,i=[],d=!1;for(let l=0;l<e.length;l++){let f=e[l],h=[],_=0;if(s)for(let k of f.matchAll(s))k.index>_&&h.push({text:f.slice(_,k.index)}),h.push({text:k[0],id:k[0]}),_=k.index+k[0].length;if(!(n&&_===0)){if((_<f.length||h.length===0)&&h.push({text:f.slice(_)}),i.length>=r){d=!0;break}i.push({n:l+1,parts:h})}}return{lines:i,truncated:d}}function st(e,t,n){let r=Math.max(1,Math.ceil(e.length/n)),a=Math.min(Math.max(0,Math.floor(t)),r-1);return{items:e.slice(a*n,a*n+n),page:a,pages:r}}function it(e){let{path:t,role:n,type:r}=e,a=t.split(".")[0]??"";return n==="system"||n==="developer"||a==="system"||a==="instructions"||a==="systemInstruction"?"place.system":n==="tool"||r==="tool_result"||r==="function_call_output"||r==="functionResponse"?"place.toolResult":r==="tool_use"||r==="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 Re(e){let t=e.split("."),n=t[0]??"",r=t[1]??"";return n!==""&&/^\d+$/.test(r)?`${n}.${r}`:n}function lt(e,t){let n=[...new Set((e.elsewhere??[]).map(a=>Re(a.path)))].filter(a=>a!=="").join(t("recent.placeSep")),r=e.elsewhereOmitted??0;return n===""?r>0?t("recent.elsewhereOmitted",{n:r}):"":r>0?t("recent.elsewhereMore",{paths:n,n:r}):t("recent.elsewhere",{paths:n})}function de(e){return e.head?e.tail?`${e.head}\u2026${e.tail}`:`${e.head}\u2026`:""}function q(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 re(e,t,n,r,a){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},d=await s.call("/api",`privacyGateway/${t}`,{args:i},a);if(d?.ok!==!0){let f=d?.error?.message;return{ok:!1,failure:typeof f=="string"&&f!==""?{code:"remote",message:f}:{code:"malformed"}}}let l=r(d.value);return l===void 0?{ok:!1,failure:{code:"malformed"}}:{ok:!0,value:l}}catch(i){return{ok:!1,failure:{code:"thrown",message:i instanceof Error?i.message:String(i)}}}}function ce(e,t,n,r){return re(e,"overview",r?{limit:t,session:r}:{limit:t},tt,n)}function dt(e,t,n){return re(e,"vendorView",{key:t},r=>{if(r===null)return null;let a=r?.body;return typeof a=="string"?a:void 0},n)}function ct(e){return re(e,"reset",void 0,t=>{let n=t?.files;return typeof n=="number"?n:0})}function ut(e,t,n){return re(e,"sessionMasking",{session:t,on:n},r=>{let a=r?.on;return typeof a=="boolean"?a:void 0})}function ft(e,t){return re(e,"providers",void 0,n=>Array.isArray(n)?n.flatMap(Yt):void 0,t)}function Yt(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 ue(e){let t=e,n=new Set;return{get:()=>t,set(r){if(!Object.is(r,t)){t=r;for(let a of[...n])try{a()}catch{}}},subscribe(r){return n.add(r),()=>{n.delete(r)}}}}var Jt="Show the Privacy tab at the top of the session";function Ut(e){let t=e,n=t?.refs,a=(n!==null&&typeof n=="object"&&typeof t?.uid<"u"?n[String(t.uid)]:void 0)?.dict??t?.dict;return a!==null&&typeof a=="object"?Object.keys(a):[]}function Te(e){for(let t of e){let n=Ut(t.schema);if(n.includes("showPanel")&&(t.ns.includes("privacy-gateway")||n.includes("excludeProviders")||JSON.stringify(t.schema??null).includes(Jt)))return t.ns}}function Qt(e){let t=Te(e);if(t===void 0)return;let n=e.find(r=>r.ns===t)?.value;return typeof n=="object"&&n!==null&&n.showPanel===!0}function Xt(e){let t=e;return t!=null&&typeof t.describe=="function"&&typeof t.get=="function"?t:void 0}var J=ue(void 0);function pt(e){let t=n=>n.effect(()=>{let r;try{r=Xt(n.get("configForms"))}catch{r=void 0}return J.set(r),()=>{J.get()===r&&J.set(void 0)}},"dsh-privacy-gateway: settings service");typeof e.inject=="function"?e.inject(["configForms"],t):t(e)}var Zt=6e4;function en(e,t){return t===void 0?e:t||e===!0?!0:e===!1?!1:void 0}function gt(e,t,n=J){let r=!1,a,s,i,d=()=>{if(r)return;let y=en(s,i);y===void 0||y===a||(a=y,t(y))},l=()=>{ce(e,1).then(y=>{r||!y.ok||(s=y.value.showPanel===!0,d())})},f,h=y=>{try{f?.()}catch{}f=void 0,i=void 0;let m;try{m=y?.describe()}catch{m=void 0}if(m){let I=m,A=()=>{if(r)return;let V=I.getSnapshot().view;if(!V)return;let L=Qt(V.namespaces);L!==void 0&&(i=L,d())};f=I.subscribe(A),Promise.resolve(I.ensure()).then(A,A),A()}d()},_=n.subscribe(()=>h(n.get()));h(n.get()),l();let k=setInterval(l,Zt);return()=>{r=!0,clearInterval(k),_();try{f?.()}catch{}}}function mt(e,t){let n=a=>t.some(s=>s.toLowerCase()===a.toLowerCase()),r=e.map(a=>({id:a.id,name:a.name,excluded:n(a.id),registered:!0}));for(let a of t)r.some(s=>s.id.toLowerCase()===a.toLowerCase())||r.push({id:a,name:a,excluded:!0,registered:!1});return r}function ht(e,t){let n=t.toLowerCase();return e.some(r=>r.toLowerCase()===n)?e.filter(r=>r.toLowerCase()!==n):[...e,t]}var Rt=require("react");var Y="privacyGateway",tn={"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":"\u6700\u8FD1 {n} \u6761","recent.col.time":"\u65F6\u95F4","recent.col.step":"\u8F6E\xB7\u6B65","recent.stepHint":"\u8FD9\u6B21\u8BF7\u6C42\u5728\u7B2C\u51E0\u8F6E\u7B2C\u51E0\u6B65\u53D1\u51FA\uFF0C\u7F16\u53F7\u4E0E\u300C\u8F68\u8FF9\u300D\u6807\u7B7E\u9875\u4E00\u81F4\u3002\u6CE8\u610F\u8BB0\u7684\u662F\u300C\u53D1\u51FA\u300D\u7684\u90A3\u4E00\u6B65\uFF1A\u67D0\u4E00\u6B65\u7684\u8F93\u51FA\u8981\u5230\u4E0B\u4E00\u6B65\u7684\u8BF7\u6C42\u91CC\u624D\u53D1\u51FA\u53BB\uFF0C\u6240\u4EE5\u6309\u503C\u5728\u8F68\u8FF9\u91CC\u641C\u5230\u7684\u5F80\u5F80\u662F\u66F4\u65E9\u4E00\u6B65","recent.stepAt":"\u7B2C {turn} \u8F6E \xB7 \u7B2C {step} \u6B65\u53D1\u51FA","recent.stepSent":"\u8FD9\u6B21\u8BF7\u6C42\u5728\u7B2C {turn} \u8F6E \xB7 \u7B2C {step} \u6B65\u53D1\u51FA\uFF1B\u503C\u672C\u8EAB\u53EF\u80FD\u6765\u81EA\u66F4\u65E9\u7684\u67D0\u4E00\u6B65\uFF08\u770B\u5B83\u4E0B\u9762\u7684\u4F4D\u7F6E\uFF09","recent.valueFirst":"\u503C\u9996\u6B21\u88AB\u53D1\u51FA\uFF1A\u7B2C {turn} \u8F6E \xB7 \u7B2C {step} \u6B65","recent.valueFirstHere":"\u672C\u6B21\u8FD0\u884C\u5185\u9996\u6B21\u88AB\u53D1\u51FA","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","dist.others.kind":"\u5176\u4F59 kind","dist.others.finder":"\u5176\u4F59 finder","dist.others.host":"\u5176\u4F59 host","hint.kind.title":"kind\uFF1A\u503C\u7684\u7C7B\u522B","hint.kind.body":"\u89C4\u5219\u6216\u8BCD\u8868\u8BA4\u51FA\u503C\u540E\u5B9A\u7684\u7C7B\u522B\uFF1B\u5360\u4F4D\u7B26\u6309\u5B83\u547D\u540D\uFF0C\u52A8\u4F5C\u4E5F\u6309 kind \u914D\u7F6E\u3002","hint.finder.title":"finder\uFF1A\u8C01\u627E\u5230\u7684","hint.finder.body":"\u8FD9\u6761\u503C\u7531\u8C01\u627E\u5230\uFF1A\u5185\u7F6E\u89C4\u5219\u3001\u81EA\u5B9A\u4E49\u8BCD\u3001\u4E4B\u524D\u8131\u654F\u8FC7\u7684\u503C\u6216 cookie\u3002","hint.count":"\u6570\u5B57\u662F\u66FF\u6362\u5904\u6570\uFF0C\u4E0D\u662F\u8BF7\u6C42\u6570\uFF1Bwarn / block \u4E0D\u8BA1\u5165\u3002","hint.kind.SECRET":"\u5176\u5B83\u5BC6\u94A5\u7C7B\u5B57\u6BB5\uFF1Asecret / token / key=\u2026\uFF0C\u4EE5\u53CA\u4E2D\u6587\u300C\u5BC6\u94A5\u662F\u2026\u300D","hint.kind.PASSWORD":"\u5BC6\u7801\uFF1AURL \u91CC\u7684\u51ED\u636E\u3001password=\u2026 \u5B57\u6BB5\u3001\u4E2D\u6587\u300C\u5BC6\u7801\u4E3A\u2026\u300D","hint.kind.API_KEY":"\u5404\u5E73\u53F0\u7684\u5BC6\u94A5\uFF1AOpenAI / Anthropic sk-\u2026\u3001GitHub \u4EE4\u724C\u3001AWS AKIA\u2026\u3001Google AIza\u2026 \u7B49","hint.kind.TOKEN":"JWT\uFF08eyJ\u2026 \u4E09\u6BB5\u70B9\u5206\uFF09\uFF0C\u4EE5\u53CA Authorization \u5934\u91CC Bearer / Token \u540E\u9762\u7684\u4EE4\u724C","hint.kind.PRIVATE_KEY":"PEM \u79C1\u94A5\u5757","hint.kind.COOKIE":"Cookie \u5934\u3001curl -b\u3001cookies.txt \u91CC\u7684\u4F1A\u8BDD\u503C\uFF08BDUSS\u3001JSESSIONID \u7B49\uFF09","hint.kind.EMAIL":"\u90AE\u7BB1\u5730\u5740","hint.kind.PHONE":"\u5927\u9646\u624B\u673A\u53F7","hint.kind.ID_CARD":"\u8EAB\u4EFD\u8BC1\u53F7\uFF08\u6821\u9A8C\u4F4D\u6709\u6548\uFF09","hint.kind.BANK_CARD":"\u94F6\u884C\u5361\u53F7\uFF08Luhn \u6821\u9A8C\uFF09","hint.kind.TERM":"\u914D\u7F6E words \u91CC\u5217\u51FA\u7684\u81EA\u5B9A\u4E49\u654F\u611F\u8BCD","hint.finder.rule":"\u5185\u7F6E\u6B63\u5219\u89C4\u5219\u8BA4\u51FA\u7684\u503C\uFF1A\u5404\u7C7B\u5BC6\u94A5\u3001\u5BC6\u7801\u3001\u4E2A\u4EBA\u4FE1\u606F","hint.finder.word":"\u914D\u7F6E words \u91CC\u5217\u51FA\u7684\u8BCD","hint.finder.known":"\u672C\u6B21\u8FD0\u884C\u91CC\u5DF2\u7ECF\u8131\u654F\u8FC7\u7684\u503C\u53C8\u5728\u8BF7\u6C42\u522B\u5904\u51FA\u73B0\uFF08\u91CD\u53D1\u7684\u5386\u53F2\u591A\u8D70\u8FD9\u6761\uFF09","hint.finder.cookie":"\u6309 Cookie \u5934\u3001curl -b\u3001cookies.txt \u6216 cookie \u540D\u8BA4\u51FA\u7684\u4F1A\u8BDD\u503C","filter.kind":"\u6309 kind \u7B5B\u9009","filter.finder":"\u6309 finder \u7B5B\u9009","filter.all":"\u5168\u90E8","filter.none":"\u6CA1\u6709\u7B26\u5408\u7B5B\u9009\u7684\u503C\u3002","filter.aria":"{name}\uFF1A{value}","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\u5185\u5BB9\uFF08\u5360\u4F4D\u7B26\u5DF2\u66FF\u6362\uFF09","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.failed":"\u8BFB\u4E0D\u5230\u8FD9\u4EFD\u526F\u672C\uFF1A{reason}","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.loading":"\u6B63\u5728\u8BFB\u53D6\u5F53\u524D\u914D\u7F6E\u2026","cfg.retry":"\u91CD\u8BD5","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\uFF1B\u6709\u8BF7\u6C42\u53D1\u51FA\u65F6\uFF0C\u65E5\u5FD7\u91CC\u6BCF\u4E2A provider \u63D0\u793A\u4E00\u6B21\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.maskKeys":"JSON \u952E\u4E5F\u8131\u654F","cfg.f.maskKeys.hint":'\u8BF7\u6C42 body \u91CC\u8BFB\u8D77\u6765\u50CF\u5BC6\u94A5\u6216\u4E2A\u4EBA\u4FE1\u606F\u7684\u952E\u540D\uFF08\u4F8B\u5982 {"sk-\u2026": \u2026}\uFF09\u548C\u503C\u4E00\u6837\u6362\u6210\u5360\u4F4D\u7B26\uFF0C\u56DE\u590D\u91CC\u518D\u6362\u56DE\u6765\u3002\u534F\u8BAE\u81EA\u8EAB\u7684\u952E\uFF08model\u3001role\u3001type\u3001name \u7B49\uFF09\u3001\u5DE5\u5177\u5B9A\u4E49\u4EE5\u53CA\u5DE5\u5177\u8C03\u7528\u7684\u53C2\u6570\u540D\u4E0D\u52A8\uFF0C\u5426\u5219\u4F9B\u5E94\u5546\u8BFB\u4E0D\u61C2\u8FD9\u4EFD\u8BF7\u6C42\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.maskKeysOnly":"\u53EA\u8131\u654F\u952E\u540D","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","recent.elsewhere":"\u8FD8\u51FA\u73B0\u5728 {paths}","recent.elsewhereMore":"\u8FD8\u51FA\u73B0\u5728 {paths}\uFF08\u53E6\u6709 {n} \u5904\u6CA1\u5217\u51FA\uFF09","recent.elsewhereOmitted":"\u53E6\u6709 {n} \u5904\u6CA1\u5217\u51FA","recent.placeSep":"\u3001","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.maskKeys":"\u5173\u95ED\u540E\uFF0C\u8BF7\u6C42\u91CC\u8BFB\u8D77\u6765\u50CF\u5BC6\u94A5\u6216\u4E2A\u4EBA\u4FE1\u606F\u7684\u952E\u540D\u4E0D\u518D\u66FF\u6362\uFF0C\u539F\u6837\u53D1\u7ED9\u6A21\u578B\u670D\u52A1\uFF1B\u5DE5\u5177\u5B9A\u4E49\u548C\u5DE5\u5177\u53C2\u6570\u540D\u672C\u6765\u5C31\u4E0D\u52A8\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"},nn={"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":"Latest {n}","recent.col.time":"Time","recent.col.step":"Turn\xB7Step","recent.stepHint":"The turn and step this request went out in, numbered as the Trajectory tab numbers them. It is the step that SENT it: a step\u2019s output only reaches the next step\u2019s request, so searching the trajectory for a value usually finds it one step earlier","recent.stepAt":"sent in turn {turn}, step {step}","recent.stepSent":"This request went out in turn {turn}, step {step}; a value in it may come from an earlier step (see the place under it)","recent.valueFirst":"first sent in turn {turn}, step {step}","recent.valueFirstHere":"first sent by this request, in this run","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","dist.others.kind":"Other kinds","dist.others.finder":"Other finders","dist.others.host":"Other hosts","hint.kind.title":"kind: the value\u2019s kind","hint.kind.body":"The kind given to a value a rule or your words find; placeholders are named by it and actions are set per kind.","hint.finder.title":"finder: what found it","hint.finder.body":"What found the value: a built-in rule, your words, a value masked earlier, or a cookie.","hint.count":"Places replaced, not requests; warn / block values are not counted.","hint.kind.SECRET":"Other secret fields: secret / token / key=\u2026, and the Chinese \u201C\u5BC6\u94A5\u662F\u2026\u201D","hint.kind.PASSWORD":"A password: credentials in a URL, password=\u2026 fields, the Chinese \u201C\u5BC6\u7801\u4E3A\u2026\u201D","hint.kind.API_KEY":"Keys of the platforms: OpenAI / Anthropic sk-\u2026, GitHub tokens, AWS AKIA\u2026, Google AIza\u2026 and so on","hint.kind.TOKEN":"A JWT (three dot-separated eyJ\u2026 parts), and the token after Bearer / Token in an Authorization header","hint.kind.PRIVATE_KEY":"A PEM private-key block","hint.kind.COOKIE":"Session values in Cookie headers, curl -b and cookies.txt (BDUSS, JSESSIONID \u2026)","hint.kind.EMAIL":"An email address","hint.kind.PHONE":"A mainland China mobile number","hint.kind.ID_CARD":"A Chinese ID number with a valid checksum","hint.kind.BANK_CARD":"A bank card number that passes the Luhn check","hint.kind.TERM":"A word from the configured words","hint.finder.rule":"Values the built-in rules recognize: keys, passwords, personal data","hint.finder.word":"A word from the configured words","hint.finder.known":"A value masked earlier in this run, met again elsewhere in a request (resent history mostly goes this way)","hint.finder.cookie":"A session value recognized by Cookie headers, curl -b, cookies.txt or a cookie name","filter.kind":"Filter by kind","filter.finder":"Filter by finder","filter.all":"All","filter.none":"No values match the filter.","filter.aria":"{name}: {value}","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":"What the model service received (placeholders replaced)","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.failed":"This copy could not be read: {reason}","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.loading":"Reading the current configuration\u2026","cfg.retry":"Retry","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; the log says so once for each provider. 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.maskKeys":"Mask JSON keys too","cfg.f.maskKeys.hint":'A key in a request body that reads like a secret or personal data ({"sk-\u2026": \u2026}) goes as a placeholder the way a value does, and comes back in the reply. The protocol\u2019s own keys (model, role, type, name and so on), the tool definitions and the argument names of a tool call are left alone, or the vendor could not read the request.',"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.maskKeysOnly":"Keys only","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","recent.elsewhere":"Also at {paths}","recent.elsewhereMore":"Also at {paths} ({n} more places not listed)","recent.elsewhereOmitted":"{n} more places not listed","recent.placeSep":", ","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.maskKeys":"Off, a key that reads like a secret or personal data is no longer replaced and goes to the model service as it is; the tool definitions and a tool call\u2019s argument names were never touched.","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."},wt={zh:tn,en:nn};var T=require("@deepseek-ai/dsh-client-ui-primitives"),u=require("react");var x=require("@deepseek-ai/dsh-client-ui-primitives"),o=require("react");var fe=require("@deepseek-ai/dsh-client-ui-primitives"),b=require("react");function rn(e,t){if(!e)return t("view.unknown");let n=e.action?` \xB7 ${t(e.action==="warn"?"action.warn":"action.block")}`:"",r=de(e);return`\u2039${e.kind} \xB7 ${r?`${r} \xB7 `:""}${e.len}${n}\u203A`}function yt(e,t,n,r){return e.parts.map((a,s)=>a.id===void 0?a.text:(0,b.createElement)("mark",{key:s,className:`pgw-view__mark${n?" pgw-view__mark--agent":""}`,title:a.id},n?rn(t.get(a.id),r):a.text))}function kt(e){let{ctx:t,t:n,record:r}=e,[a,s]=(0,b.useState)({status:"loading"}),[i,d]=(0,b.useState)(!0);(0,b.useEffect)(()=>{let m=new AbortController;return s({status:"loading"}),dt(t,r.key,m.signal).then(I=>{m.signal.aborted||s(I.ok?I.value===null?{status:"gone"}:{status:"ready",body:I.value}:{status:"error",failure:I.failure})}),()=>m.abort()},[t,r.key]);let l=at(r.values),f=(0,b.useMemo)(()=>new Map(r.values.map(m=>[m.placeholder,m])),[r.key,l]),h=a.status==="ready"?a.body:void 0,_=(0,b.useMemo)(()=>h!==void 0?rt(h):void 0,[h]),k=(0,b.useMemo)(()=>_?ot(_,[...f.keys()],i):void 0,[_,f,i]),y=(0,b.createElement)("div",{className:"pgw-head"},(0,b.createElement)("span",{className:"pgw-dist__title"},n("view.title")),(0,b.createElement)(fe.Checkbox,{checked:i,label:n("view.onlyChanged"),className:"pgw-meta",onChange:d}),(0,b.createElement)("span",{className:"pgw-spacer"}),(0,b.createElement)(fe.Button,{variant:"outline",size:"sm",onClick:e.onClose},n("view.close")));if(!k){let m=a.status==="loading"?n("view.loading"):a.status==="gone"?n("view.gone"):a.status==="error"?n("view.failed",{reason:q(a.failure,n)}):n("card.unavailable");return(0,b.createElement)("div",{className:"pgw-view"},y,(0,b.createElement)("div",{className:"pgw-empty"},m))}return(0,b.createElement)("div",{className:"pgw-view"},y,k.lines.length===0?(0,b.createElement)("div",{className:"pgw-empty"},n("view.none")):(0,b.createElement)("div",{className:"pgw-view__scroll"},(0,b.createElement)("table",{className:"pgw-view__table"},(0,b.createElement)("thead",null,(0,b.createElement)("tr",null,(0,b.createElement)("th",null,n("view.line")),(0,b.createElement)("th",null,n("view.agent")),(0,b.createElement)("th",null,n("view.vendor")))),(0,b.createElement)("tbody",null,k.lines.map(m=>(0,b.createElement)("tr",{key:m.n},(0,b.createElement)("td",{className:"pgw-view__n"},m.n),(0,b.createElement)("td",{className:"pgw-view__code"},...yt(m,f,!0,n)),(0,b.createElement)("td",{className:"pgw-view__code"},...yt(m,f,!1,n))))))),k.truncated?(0,b.createElement)("div",{className:"pgw-meta"},n("view.truncated",{n:k.lines.length})):null)}function vt(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)(x.IconWarningOutlineRegular,{size:14,className:"pgw-notice__icon"}),(0,o.createElement)("span",null,e.t(t.key,{n:t.n})))))}function xt(e){let{totals:t,t:n}=e,r=i=>(i??0).toLocaleString(),a=Xe(t),s=[{label:n("stat.requests"),value:r(t.requests)},{label:n("stat.masked"),value:r(t.masked)},{label:n("stat.n"),value:r(t.n)},{label:n("stat.restored"),value:r(t.restored),...t.restoredInTools>0?{sub:n("stat.inTools",{n:t.restoredInTools})}:{}},{label:n("stat.unmapped"),value:r(t.unmapped),...t.unmapped>0?{tone:"warn"}:{}},{label:n("stat.failed"),value:r(t.failed),...t.failed>0?{tone:"error"}:{}}];return(t.warned??0)>0&&s.push({label:n("stat.warned"),value:r(t.warned),tone:"warn"}),(t.blocked??0)>0&&s.push({label:n("stat.blocked"),value:r(t.blocked),tone:"warn"}),(t.exfil??0)>0&&s.push({label:n("stat.exfil"),value:r(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:a.avg}),sub:n("stat.tookMax",{max:a.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 Oe(e){let{t,field:n}=e;return(0,o.createElement)("div",{className:"pgw-hint"},(0,o.createElement)("div",{className:"pgw-hint__title"},t(n==="kind"?"hint.kind.title":"hint.finder.title")),(0,o.createElement)("div",{className:"pgw-hint__body"},t(n==="kind"?"hint.kind.body":"hint.finder.body")),e.note===!0?(0,o.createElement)("div",{className:"pgw-hint__note"},t("hint.count")):null)}function an(e){return(0,o.createElement)("div",{className:"pgw-hint"},(0,o.createElement)("div",{className:"pgw-hint__title pgw-mono"},e.name),(0,o.createElement)("div",{className:"pgw-hint__body"},e.t(e.meaning)))}function pe(e){let{t,field:n}=e,r=qe(e.data,6,e.others),a=n===void 0?e.title:(0,o.createElement)(x.HoverCard,{anchor:(0,o.createElement)("span",{className:"pgw-dist__anchor"},e.title,(0,o.createElement)(x.IconInfoOutlineRegular,{size:12,className:"pgw-dist__info"})),content:(0,o.createElement)(Oe,{t,field:n,note:!0})});return(0,o.createElement)("div",{className:"pgw-dist"},(0,o.createElement)("div",{className:"pgw-section__title"},a),r.length===0?(0,o.createElement)("div",{className:"pgw-empty"},e.empty):r.map(s=>{let i=n===void 0?void 0:(n==="kind"?Ye:Je)(s.label),d=(0,o.createElement)("span",i===void 0?{className:"pgw-bar__label",title:s.label}:{className:"pgw-bar__label pgw-bar__label--hint"},s.label),l=i===void 0||n===void 0?d:(0,o.createElement)(x.HoverCard,{anchor:d,content:(0,o.createElement)(an,{t,name:s.label,meaning:i})});return(0,o.createElement)("div",{className:"pgw-bar",key:s.label},(0,o.createElement)("div",{className:"pgw-bar__head"},l,(0,o.createElement)("span",{className:"pgw-bar__value"},s.value.toLocaleString())),(0,o.createElement)("div",{className:"pgw-bar__track"},(0,o.createElement)("div",{className:"pgw-bar__fill",style:{width:`${s.pct}%`}})))}))}function _t(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",{title:t("recent.stepHint")},t("recent.col.step")),(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")))}var Ie="*";function bt(e){let{t,field:n}=e,[r,a]=(0,o.useState)(!1),s=t(n==="kind"?"col.kind":"col.finder"),i=[{id:Ie,label:t("filter.all")},...e.names.map(l=>({id:l,label:l}))],d=(0,o.createElement)("button",{type:"button",className:`pgw-filter${e.value===void 0?"":" pgw-filter--on"}`,"aria-haspopup":"menu","aria-expanded":r,"aria-label":t("filter.aria",{name:t(n==="kind"?"filter.kind":"filter.finder"),value:e.value??t("filter.all")}),onClick:()=>a(l=>!l)},e.value===void 0?s:`${s} \xB7 ${e.value}`,(0,o.createElement)(x.IconChevronDownOutlineRegular,{size:10,className:"pgw-filter__chevron"}));return(0,o.createElement)(x.Menu,{open:r,onClose:()=>a(!1),items:i,selectedId:e.value??Ie,onSelect:l=>{a(!1),e.onChange(l===Ie?void 0:l)},align:"start",portal:!0,anchor:(0,o.createElement)(x.HoverCard,{anchor:d,content:e.hint,disabled:r})})}function Nt(e){let{r:t,t:n}=e,[r,a]=(0,o.useState)(!1),[s,i]=(0,o.useState)(void 0),[d,l]=(0,o.useState)(void 0),f=Ue(t.values,{...s===void 0?{}:{kind:s},...d===void 0?{}:{finder:d}}),h=Ce(t.values,"kind"),_=Ce(t.values,"finder"),k=(0,o.useId)(),y=le(t),m=y?n("recent.stepAt",y):"",I=y?n("recent.stepSent",y):"",A=[t.workspace,t.title??t.session].filter(g=>typeof g=="string"&&g!=="").join(" \xB7 "),V=t.failed?(0,o.createElement)(x.Tag,{tone:"danger"},n("recent.failed")):t.blocked?(0,o.createElement)(x.Tag,{tone:"danger"},n("recent.blocked")):(0,o.createElement)("span",{className:t.exfil?"pgw-rec__bad":void 0},t.n.toLocaleString()),L=t.failed?n("recent.failed"):t.blocked?n("recent.blocked"):t.n.toLocaleString(),D=[[n("recent.col.time"),Se(t.time)],[n("recent.col.step"),m],[n("recent.col.where"),[t.model??t.what,t.host].filter(Boolean).join(" \xB7 ")],[n("recent.col.from"),A],[n("recent.col.places"),L],[n("recent.col.restored"),t.restored.toLocaleString()]].filter(([,g])=>g!=="").map(([g,F])=>n("recent.cell",{name:g,value:F})).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?k:void 0,"aria-label":D,onClick:e.toggle},(0,o.createElement)(x.IconChevronRightOutlineRegular,{size:12,className:"pgw-rec__chevron"}),(0,o.createElement)("span",{className:"pgw-rec__time"},Se(t.time)),(0,o.createElement)("span",{className:"pgw-rec__step",title:m||void 0},y?et(y):""),(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:A},A),(0,o.createElement)("span",{className:"pgw-rec__num"},V),(0,o.createElement)("span",{className:"pgw-rec__num pgw-rec__dim"},t.restored.toLocaleString())),e.open?(0,o.createElement)("div",{className:"pgw-detail",id:k},t.exfil?(0,o.createElement)("div",{className:"pgw-notice pgw-notice--error"},(0,o.createElement)(x.IconWarningOutlineRegular,{size:14,className:"pgw-notice__icon"}),n("recent.exfil",{hosts:(t.exfilHosts??[]).join(", ")})):null,y?(0,o.createElement)("div",{className:"pgw-meta"},I):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,(0,o.createElement)("th",{key:"col.placeholder"},n("col.placeholder")),(0,o.createElement)("th",{key:"col.kind"},(0,o.createElement)(bt,{t:n,field:"kind",names:h,value:s,hint:(0,o.createElement)(Oe,{t:n,field:"kind"}),onChange:i})),(0,o.createElement)("th",{key:"col.finder"},(0,o.createElement)(bt,{t:n,field:"finder",names:_,value:d,hint:(0,o.createElement)(Oe,{t:n,field:"finder"}),onChange:l})),(0,o.createElement)("th",{key:"col.head"},n("col.head")),(0,o.createElement)("th",{key:"col.len"},n("col.len")),(0,o.createElement)("th",{key:"col.n"},n("col.n")),(0,o.createElement)("th",{key:"col.action"},n("col.action")))),(0,o.createElement)("tbody",null,f.length===0?(0,o.createElement)("tr",{key:"none",className:"pgw-values__empty"},(0,o.createElement)("td",{colSpan:7},n("filter.none"))):f.flatMap(g=>{let F=lt(g,n),z=g.first?n("recent.valueFirst",{turn:g.first.turn,step:g.first.step}):y?n("recent.valueFirstHere"):"",O=g.at!==void 0||g.before!==void 0||g.after!==void 0||F!==""||z!=="";return[(0,o.createElement)("tr",{key:g.placeholder,className:g.before!==void 0||g.after!==void 0?"pgw-values__has":void 0},(0,o.createElement)("td",{className:"pgw-mono"},g.placeholder),(0,o.createElement)("td",null,g.kind),(0,o.createElement)("td",null,g.finder),(0,o.createElement)("td",{className:"pgw-mono"},de(g)),(0,o.createElement)("td",null,g.len),(0,o.createElement)("td",null,g.n),(0,o.createElement)("td",null,g.action?n(g.action==="warn"?"action.warn":"action.block"):"")),O?(0,o.createElement)("tr",{key:`${g.placeholder}:ctx`,className:"pgw-values__ctx"},(0,o.createElement)("td",{colSpan:7},(0,o.createElement)("div",{className:"pgw-ctx"},(0,o.createElement)("div",{className:"pgw-ctx__line"},g.at?(0,o.createElement)(x.Tag,{tone:"neutral",className:"pgw-ctx__place",title:g.at.path},n(it(g.at)),(0,o.createElement)("span",{className:"pgw-ctx__path pgw-mono"},`\xB7 ${Re(g.at.path)}`)):null,g.before!==void 0||g.after!==void 0?(0,o.createElement)("span",{className:"pgw-ctx__text",title:n("recent.contextHint")},g.before??"",(0,o.createElement)("mark",{className:"pgw-ctx__mark pgw-mono"},g.placeholder),g.after??""):null),F!==""?(0,o.createElement)("div",{className:"pgw-ctx__more"},F):null,z!==""?(0,o.createElement)("div",{className:"pgw-ctx__more"},z):null))):null]}))),t.valuesOmitted?(0,o.createElement)("div",{className:"pgw-meta"},n("recent.omitted",{n:t.valuesOmitted.toLocaleString()})):null,e.viewable&&!r?(0,o.createElement)("div",null,(0,o.createElement)(x.Button,{variant:"outline",size:"sm",onClick:()=>a(!0)},n("view.open"))):null,e.viewable&&r?(0,o.createElement)(kt,{ctx:e.ctx,t:n,record:t,onClose:()=>a(!1)}):null):null)}function Ct(e){let{t}=e,[n,r]=(0,o.useState)(!1),[a,s]=(0,o.useState)(!1),[i,d]=(0,o.useState)(!1),l=()=>{r(!1),s(!1)},f=()=>{d(!0),ct(e.ctx).then(h=>{d(!1),l(),e.onDone(h.ok?t("card.resetDone",{n:h.value}):t("card.resetFailed",{message:q(h.failure,t)}),h.ok)})};return(0,o.createElement)(o.Fragment,null,(0,o.createElement)(x.Button,{variant:"ghost",size:"sm",className:"pgw-reset",disabled:i,onClick:()=>r(!0)},(0,o.createElement)(x.IconTrashOutlineRegular,{size:14}),(0,o.createElement)("span",null,t("card.reset"))),(0,o.createElement)(x.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:a,disabled:i,onAcknowledgedChange:s,onCancel:l,onConfirm:f}))}function St(e){let{t}=e,[n,r]=(0,o.useState)(e.on),[a,s]=(0,o.useState)(!1),[i,d]=(0,o.useState)(!1),[l,f]=(0,o.useState)(!1);(0,o.useEffect)(()=>r(e.on),[e.on]);let h=()=>{s(!1),d(!1)},_=k=>{f(!0),ut(e.ctx,e.session,k).then(y=>{f(!1),h(),y.ok&&r(y.value),e.onDone(y.ok?null:t("session.failed",{message:q(y.failure,t)}))})};return(0,o.createElement)(o.Fragment,null,(0,o.createElement)("label",{className:"pgw-session"},(0,o.createElement)(x.Switch,{checked:n,label:t("session.mask"),disabled:l,onChange:k=>k?_(!0):s(!0)}),(0,o.createElement)("span",{className:"pgw-session__label"},t("session.mask"))),(0,o.createElement)(x.RiskConfirmation,{open:a,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:l,onAcknowledgedChange:d,onCancel:h,onConfirm:()=>_(!1)}))}var on=15e3,sn=200,ln=10,dn=["today","week","month"];function cn(e,t){let[n,r]=(0,u.useState)({status:"loading"}),[a,s]=(0,u.useState)(!1),i=(0,u.useRef)(null),d=(0,u.useCallback)(()=>{i.current?.abort();let l=new AbortController;i.current=l,s(!0),ce(e,sn,l.signal,t).then(f=>{l.signal.aborted||(s(!1),r(h=>nt(h,f)))})},[e,t]);return(0,u.useEffect)(()=>{d();let l=setInterval(()=>{(typeof document>"u"||document.visibilityState==="visible")&&d()},on);return()=>{clearInterval(l),i.current?.abort()}},[d]),[n,d,a]}function ge(e){return(0,u.createElement)(un,{key:e.sessionId??"",...e})}function un(e){let{t}=e,[n,r,a]=cn(e.ctx,e.sessionId),[s,i]=(0,u.useState)("today"),[d,l]=(0,u.useState)(null),[f,h]=(0,u.useState)(0),[_,k]=(0,u.useState)(null),y=`pgw-card${e.panel?" pgw-card--panel":""}`,m=n.status==="ready"?n.data:void 0,I=!e.panel&&m!==void 0,A=(0,u.createElement)("div",{className:"pgw-head"},(0,u.createElement)("div",{className:"pgw-head__main"},e.panel?null:(0,u.createElement)("h3",{className:"pgw-title"},t("card.title")),e.sessionId&&m&&typeof m.sessionMasking=="boolean"?(0,u.createElement)(St,{ctx:e.ctx,t,session:e.sessionId,on:m.sessionMasking,onDone:N=>{k(N===null?null:{text:N,ok:!1}),r()}}):null,m&&(!e.sessionId||!m.active)?(0,u.createElement)(T.Tag,{tone:m.active?"success":"warning"},t(m.active?"card.on":"card.off")):null,e.sessionId&&m&&m.sessionMasking===void 0?(0,u.createElement)(T.Tag,{tone:"outline"},t("panel.session")):null,m&&!e.panel?(0,u.createElement)("span",{className:"pgw-meta",title:t("card.valuesHint")},t("card.values",{n:m.values})):null,m&&!m.record?(0,u.createElement)("span",{className:"pgw-meta"},t("card.memoryOnly")):null),(0,u.createElement)("div",{className:"pgw-head__actions"},m?(0,u.createElement)(T.SegmentedControl,{id:`pgw-range-${e.sessionId??"all"}`,label:t("card.range"),value:s,options:dn.map(N=>({value:N,label:t(`range.${N}`)})),onChange:i}):null,(0,u.createElement)(T.Button,{variant:"ghost",size:"sm",disabled:a,title:t("card.refresh"),"aria-label":t("card.refresh"),onClick:r},(0,u.createElement)(T.IconRefreshOutlineRegular,{size:14})),I?(0,u.createElement)(Ct,{ctx:e.ctx,t,onDone:(N,U)=>{k({text:N,ok:U}),l(null),h(0),r()}}):null)),V=_?(0,u.createElement)("div",{className:`pgw-flash${_.ok?"":" pgw-flash--error"}`,role:"status"},_.text):null,L=n.status==="ready"&&n.stale?(0,u.createElement)("div",{className:"pgw-notice pgw-notice--error",role:"status"},(0,u.createElement)(T.IconWarningOutlineRegular,{size:14,className:"pgw-notice__icon"}),(0,u.createElement)("span",null,t("card.stale",{reason:q(n.stale,t)}))):null,D=e.sessionId&&m?.sessionMasking===!1?(0,u.createElement)("div",{className:"pgw-notice",role:"status"},(0,u.createElement)(T.IconWarningOutlineRegular,{size:14,className:"pgw-notice__icon"}),(0,u.createElement)("span",null,t("session.offNotice"))):null;if(!m){let N=n.status==="error"?`${t("card.unavailable")} ${t("card.reason",{reason:q(n.failure,t)})}`:t("card.loading");return(0,u.createElement)("section",{className:y},A,(0,u.createElement)("div",{className:"pgw-empty pgw-empty--block"},N))}if(e.sessionId&&m.recent.length===0)return(0,u.createElement)("section",{className:y},A,L,V,D,(0,u.createElement)("div",{className:"pgw-empty pgw-empty--block"},t("panel.empty")));let g=m,F=g.stats[s],z=new Set(g.vendorView?g.views??[]:[]),O=st(g.recent,f,ln),B=N=>{h(N),l(null)};return(0,u.createElement)("section",{className:y},A,L,V,D,(0,u.createElement)(vt,{t,items:Qe(g,F)}),(0,u.createElement)(xt,{totals:F,t}),(0,u.createElement)("div",{className:"pgw-dists"},(0,u.createElement)(pe,{t,title:t("dist.kind"),data:F.kinds,others:t("dist.others.kind"),empty:t("dist.empty"),field:"kind"}),(0,u.createElement)(pe,{t,title:t("dist.finder"),data:F.finders,others:t("dist.others.finder"),empty:t("dist.empty"),field:"finder"}),(0,u.createElement)(pe,{t,title:t("dist.host"),data:F.hosts,others:t("dist.others.host"),empty:t("dist.empty")})),(0,u.createElement)("div",{className:"pgw-section"},(0,u.createElement)("div",{className:"pgw-section__head"},(0,u.createElement)("span",{className:"pgw-section__title"},t("recent.title")),g.recent.length>0?(0,u.createElement)("span",{className:"pgw-meta"},t("recent.count",{n:g.recent.length})):null),g.recent.length===0?(0,u.createElement)("div",{className:"pgw-empty pgw-empty--block"},t("recent.empty")):(0,u.createElement)("div",{className:"pgw-recs"},(0,u.createElement)(_t,{t}),(0,u.createElement)("ul",{className:"pgw-recs__list","aria-label":t("recent.title")},O.items.map(N=>(0,u.createElement)(Nt,{key:N.key,ctx:e.ctx,r:N,open:d===N.key,toggle:()=>l(d===N.key?null:N.key),t,viewable:z.has(N.key)})))),O.pages>1?(0,u.createElement)("div",{className:"pgw-pager"},(0,u.createElement)(T.Button,{variant:"ghost",size:"sm",disabled:O.page===0,onClick:()=>B(0)},t("page.first")),(0,u.createElement)(T.Button,{variant:"ghost",size:"sm",disabled:O.page===0,"aria-label":t("page.prev"),title:t("page.prev"),onClick:()=>B(O.page-1)},(0,u.createElement)(T.IconChevronLeftOutlineRegular,{size:14})),(0,u.createElement)("span",{className:"pgw-meta pgw-pager__at"},t("page.at",{page:O.page+1,pages:O.pages})),(0,u.createElement)(T.Button,{variant:"ghost",size:"sm",disabled:O.page>=O.pages-1,"aria-label":t("page.next"),title:t("page.next"),onClick:()=>B(O.page+1)},(0,u.createElement)(T.IconChevronRightOutlineRegular,{size:14}))):null))}var fn="dsh-privacy-gateway",X=ue(void 0);function Tt(e,t){return e.code==="noDisposer"?t("err.noDisposer"):t("err.thrown",{message:e.message})}function It(e,t){X.set(void 0);let n;try{let r=e.slots.inject("conversation.view",()=>e.slots.register({name:"conversation.view",id:fn,order:35,locale:Y,label:()=>t("panel.tab")},a=>(0,Rt.createElement)(ge,{ctx:e,t,panel:!0,...a?.sessionId?{sessionId:a.sessionId}:{}})));if(typeof r!="function"){X.set({code:"noDisposer"});return}n=r}catch(r){X.set({code:"thrown",message:r instanceof Error?r.message:String(r)});return}return()=>{let r=n;n=void 0;try{r?.()}catch{}}}var me=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 r=this.waiting.length-1;r>=0;r--)if(this.waiting[r]?.path===t)return this.waiting[r]?.value;return this.current?.path===t?this.current.value:n}write(t,n){return new Promise(r=>{let a=this.waiting.find(s=>s.path===t);a?(a.value=n,a.done.push(r)):this.waiting.push({path:t,value:n,done:[r]}),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 r;try{r=await this.send(n.path,n.value,t)}catch{r=!1}this.current=void 0,t=!0;for(let a of n.done)a(r);if(!r){this.failed=!0;for(let a of this.waiting.splice(0))for(let s of a.done)s(!1)}this.notify()}}notify(){this.onState(this.state)}};function pn(){let[,e]=(0,p.useState)(0),t=(0,p.useSyncExternalStore)(J.subscribe,J.get),n=(0,p.useMemo)(()=>{try{return t?.describe()}catch{return}},[t]);(0,p.useEffect)(()=>{if(n)return Promise.resolve(n.ensure()).catch(()=>{}),n.subscribe(()=>e(d=>d+1))},[n]);let r=n?.getSnapshot().view,a=(0,p.useMemo)(()=>r?Te(r.namespaces):void 0,[r]),s=(0,p.useMemo)(()=>{try{return t&&a!==void 0?t.get(a):void 0}catch{return}},[t,a]);(0,p.useEffect)(()=>s?s.subscribe(()=>e(d=>d+1)):void 0,[s]);let i=s?.getSnapshot();return(0,p.useMemo)(()=>{if(!s||!i)return;let d=s.mutate,l=d?(f,h)=>d.call(s,f,h):async f=>{for(let h of f)if(!await s.set(h.path.join("."),h.value))return!1;return!0};return{state:{status:i.status,value:i.value,revision:i.revision,writable:i.writable!==!1},mutate:l}},[s,i])}var Ot="dsh-privacy-gateway.config.open",gn=["mask"];function mn(){try{let e=JSON.parse(globalThis.localStorage?.getItem(Ot)??"null");if(Array.isArray(e))return oe.filter(t=>e.includes(t))}catch{}return[...gn]}function hn(e){try{globalThis.localStorage?.setItem(Ot,JSON.stringify(e))}catch{}}var G=e=>e;function Ae(e){let{ctx:t,t:n}=e,r=pn(),a=e.form??r,s=(0,p.useRef)(a);s.current=a;let[i,d]=(0,p.useState)({busy:!1,failed:!1}),[l]=(0,p.useState)(()=>new me((c,v,C)=>{let R=s.current;return R?R.mutate([{op:"set",path:[c],value:v}],C?void 0:R.state.revision):Promise.resolve(!1)},d)),[f,h]=(0,p.useState)(null),[_,k]=(0,p.useState)(!1),y=(0,p.useSyncExternalStore)(X.subscribe,X.get),m=(0,p.useId)(),[I,A]=(0,p.useState)(null),[V,L]=(0,p.useState)(!1),[D,g]=(0,p.useState)(0),[F,z]=(0,p.useState)(mn),O=c=>z(v=>{let C=v.includes(c)?v.filter(R=>R!==c):oe.filter(R=>R===c||v.includes(R));return hn(C),C}),B=a?.state,N=B?.status==="ready",U=B?.writable!==!1,ae=B?.value??{},$=c=>l.latest(c,ae[c]);if((0,p.useEffect)(()=>{let c=new AbortController;return ft(t,c.signal).then(v=>{c.signal.aborted||(L(!v.ok),A(v.ok?v.value:[]))}),()=>c.abort()},[t,D]),!a)return(0,p.createElement)("div",{className:"pgw-empty"},n("cfg.unavailable"));let Z=N?null:(0,p.createElement)("div",{className:"pgw-cfg__desc",role:"status"},n("cfg.loading")),K=!N||!U,Mt=c=>I?.find(v=>v.id.toLowerCase()===c.toLowerCase())?.name??c,ee=(c,v)=>{if(K)return Promise.resolve(!1);let C=Fe(c,$(c.key),v);return C?new Promise(R=>{k(!1),h(H=>(H?.resolve(!1),{f:c,next:v,change:C,resolve:R}))}):l.write(c.key,v)},Pe=c=>{let v=f;h(null),k(!1),v&&(c?l.write(v.f.key,v.next).then(v.resolve):v.resolve(!1))},Ft=c=>{let v=n(G(`cfg.f.${c.key}`));switch(c.kind){case"switch":return(0,p.createElement)(je,{label:v,checked:te($(c.key),c.default),disabled:K,onChange:C=>{ee(c,C)}});case"choice":{let C=ve($(c.key),c.choices,c.default);return(0,p.createElement)(xe,{label:n(G(`cfg.f.${c.key}.${C}`)),labelledBy:`${m}${c.key}`,items:c.choices.map(R=>({id:R,label:n(G(`cfg.f.${c.key}.${R}`))})),selectedId:C,disabled:K,onSelect:R=>{R!==C&&ee(c,R)}})}case"list":return(0,p.createElement)(Ge,{t:n,label:v,list:j($(c.key),c.default),anyCase:c.anyCase,placeholder:n(G(`cfg.f.${c.key}.placeholder`)),disabled:K,onChange:C=>ee(c,C)});case"count":return(0,p.createElement)(We,{t:n,value:ne($(c.key),c.min,c.default),min:c.min,label:v,disabled:K,onChange:C=>ee(c,C)});case"providers":return Kt(c)}},Kt=c=>{let v=j($(c.key),[]),C=mt(I??[],v),R=C.filter(E=>E.excluded).map(E=>E.name),H=ze(R,n("cfg.sep")),be=H.kind==="none"?n("cfg.excludedNone"):H.kind==="some"?H.names:n("cfg.excludedMany",{names:H.names,n:H.n});return(0,p.createElement)(xe,{label:be,labelledBy:`${m}${c.key}`,multi:!0,items:C.map(E=>({id:E.id,label:E.registered?E.name:n("cfg.providerAbsent",{name:E.name})})),selectedIds:C.filter(E=>E.excluded).map(E=>E.id),disabled:K,onSelect:E=>{ee(c,ht(j($(c.key),[]),E))}})},Me=c=>{if(c.key==="showPanel"&&y)return(0,p.createElement)("div",{className:"pgw-cfg__desc pgw-cfg__desc--error"},n("cfg.sidebarFailed",{reason:Tt(y,n)}));if(c.key==="excludeProviders"&&V)return(0,p.createElement)("div",{className:"pgw-cfg__desc pgw-cfg__desc--error"},n("cfg.providerListUnavailable")," ",(0,p.createElement)(he.Button,{variant:"outline",size:"sm",onClick:()=>g(v=>v+1)},n("cfg.retry")))},Dt=Object.fromEntries(se.map(c=>[c.key,$(c.key)])),Vt=c=>{let v=se.filter(P=>P.group===c),C=n(G(`cfg.g.${c}`)),R=F.includes(c),H=De(c,Dt),be=v.some(P=>Me(P)!==void 0),E=N?[...H.map((P,Lt)=>(0,p.createElement)("span",{key:Lt,className:P.off?"pgw-fold__part pgw-fold__part--off":"pgw-fold__part"},n(G(P.key),P.params))),be?(0,p.createElement)("span",{key:"problem",className:"pgw-fold__part pgw-fold__part--error"},n("cfg.s.problem")):null]:null;return(0,p.createElement)(He,{key:c,title:C,summary:E,open:R,toggleLabel:n(R?"cfg.collapse":"cfg.expand",{name:C}),onToggle:()=>O(c)},v.map(P=>(0,p.createElement)(Be,{key:P.key,title:n(G(`cfg.f.${P.key}`)),titleId:`${m}${P.key}`,hint:n(G(`cfg.f.${P.key}.hint`)),note:Me(P),inline:Ke(P),half:P.half===!0},Ft(P))))},ke=f?wn(f,n,f.f.key==="excludeProviders"?Mt:c=>c):null;return(0,p.createElement)(p.Fragment,null,(0,p.createElement)("section",{className:"pgw-cfg","aria-busy":i.busy||void 0},e.form?null:(0,p.createElement)("h3",{className:"pgw-title"},n("cfg.title")),i.failed?(0,p.createElement)("div",{className:"pgw-notice pgw-notice--error",role:"alert"},n("cfg.failed")):null,Z,(0,p.createElement)("div",{className:"pgw-cfg__folds"},oe.map(Vt)),(0,p.createElement)("p",{className:"pgw-cfg__desc pgw-cfg__foot"},n("cfg.applies")," ",n("cfg.others"))),(0,p.createElement)(he.RiskConfirmation,{open:f!==null,title:ke?.title??"",description:ke?.body??"",acknowledgeLabel:ke?.ack??"",cancelLabel:n("card.cancel"),closeLabel:n("card.close"),confirmLabel:n("cfg.risk.confirm"),acknowledged:_,onAcknowledgedChange:k,onCancel:()=>Pe(!1),onConfirm:()=>Pe(!0)}))}function wn(e,t,n){let{change:r}=e,a={},s=r.added??r.removed;return s&&(a.names=s.map(n).join(t("cfg.sep"))),r.from!==void 0&&(a.from=r.from),r.to!==void 0&&(a.to=r.to),{title:t(r.risk==="send"?"cfg.risk.send.title":"cfg.risk.delete.title"),body:t(G(`cfg.r.${e.f.key}`),a),ack:t(r.risk==="send"?"cfg.risk.send.ack":"cfg.risk.delete.ack")}}var we="dsh-privacy-gateway",At="dsh-privacy-gateway";var Ee="var(--ds-font-family-code,ui-monospace,monospace)",yn=`
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}
@@ -12,7 +12,7 @@ var module = { exports: {} }; var exports = module.exports;
12
12
  .pgw-title{font-size:15px;font-weight:600;line-height:22px;margin:0}
13
13
  .pgw-meta{font-size:12px;line-height:18px;color:var(--dsw-alias-label-tertiary)}
14
14
  .pgw-spacer{flex:1}
15
- .pgw-mono{font-family:${Te}}
15
+ .pgw-mono{font-family:${Ee}}
16
16
  .pgw-reset{display:inline-flex;align-items:center;gap:4px;color:var(--dsw-alias-label-secondary)}
17
17
  @media (hover:hover){.pgw-reset:hover:not(:disabled){color:var(--dsw-alias-state-error-primary)}}
18
18
  .pgw-empty{font-size:12px;color:var(--dsw-alias-label-tertiary)}
@@ -39,7 +39,7 @@ var module = { exports: {} }; var exports = module.exports;
39
39
  .pgw-bar{display:flex;flex-direction:column;gap:4px;font-size:12px}
40
40
  .pgw-bar__head{display:flex;justify-content:space-between;gap:8px}
41
41
  .pgw-bar__head>*{min-width:0}
42
- .pgw-bar__label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:${Te};color:var(--dsw-alias-label-primary)}
42
+ .pgw-bar__label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:${Ee};color:var(--dsw-alias-label-primary)}
43
43
  .pgw-bar__label--hint{cursor:help}
44
44
  .pgw-bar__value{flex:none;font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-secondary)}
45
45
  .pgw-bar__track{height:4px;border-radius:2px;background:var(--dsw-alias-bg-layer-2);overflow:hidden}
@@ -140,9 +140,9 @@ var module = { exports: {} }; var exports = module.exports;
140
140
  .pgw-view__table th{position:sticky;top:0;background:var(--dsw-alias-bg-layer-2);font-weight:500;color:var(--dsw-alias-label-tertiary);text-align:left;padding:4px 8px}
141
141
  .pgw-view__table th:first-child,.pgw-view__n{width:44px}
142
142
  .pgw-view__n{color:var(--dsw-alias-label-tertiary);text-align:right;font-variant-numeric:tabular-nums;padding:2px 8px;vertical-align:top}
143
- .pgw-detail .pgw-view__code{font-family:${Te};white-space:pre-wrap;word-break:break-all;padding:2px 8px;vertical-align:top;border-left:1px solid var(--dsw-alias-border-l2)}
143
+ .pgw-detail .pgw-view__code{font-family:${Ee};white-space:pre-wrap;word-break:break-all;padding:2px 8px;vertical-align:top;border-left:1px solid var(--dsw-alias-border-l2)}
144
144
  .pgw-view__mark{background:color-mix(in srgb,var(--dsw-alias-state-business-primary) 18%,transparent);color:inherit;border-radius:3px;padding:0 2px}
145
145
  .pgw-view__mark--agent{background:color-mix(in srgb,var(--dsw-alias-state-warn-primary) 18%,transparent)}
146
- `,It="dsh-privacy-gateway-styles";function At(){if(typeof document>"u"||document.getElementById(It))return;let e=document.createElement("style");e.id=It,e.textContent=hn,document.head.appendChild(e)}var wn="dsh-privacy-gateway",yn=["slots","locale","connection"];function kn(e){At(),e.effect(()=>e.locale.register(j,pt)??void 0,"dsh-privacy-gateway: dictionaries");let t=e.locale.bind(j);dt(e),e.effect(()=>{let i=e.slots.inject("plugins.detail.section",()=>e.slots.register({name:"plugins.detail.section",id:"dsh-privacy-gateway-stats",locale:j},d=>d.subject?.kind==="bundle"&&d.subject.pkg?.name===pe?(0,ge.createElement)(ue,{ctx:e,t}):null));return typeof i=="function"?i:void 0},"dsh-privacy-gateway: statistics card"),e.effect(()=>{let i=e.slots.inject("plugins.bundle.config",()=>e.slots.register({name:"plugins.bundle.config",key:pe,locale:j},d=>d.view==="summary"?t("cfg.title"):(0,ge.createElement)(Re,{ctx:e,t})));return typeof i=="function"?i:void 0},"dsh-privacy-gateway: configuration (bundle page)"),e.effect(()=>{let i=e.slots.inject("plugins.row.config",()=>e.slots.register({name:"plugins.row.config",key:`${pe}#${Tt}`,locale:j},d=>d.view==="summary"?t("cfg.title"):(0,ge.createElement)(Re,{ctx:e,t,form:d.form})));return typeof i=="function"?i:void 0},"dsh-privacy-gateway: configuration (row page)");let n=!1,r,a=()=>{let i=r;r=void 0,i?.()},s=()=>{n&&!r?r=Ct(e,t):n||a()};e.effect(()=>{let i=ct(e,d=>{n=d,s()});return()=>{i(),n=!1,a()}},"dsh-privacy-gateway: view tab")}module.exports={name:wn,inject:yn,apply:kn};
146
+ `,Et="dsh-privacy-gateway-styles";function Pt(){if(typeof document>"u"||document.getElementById(Et))return;let e=document.createElement("style");e.id=Et,e.textContent=yn,document.head.appendChild(e)}var kn="dsh-privacy-gateway",bn=["slots","locale","connection"];function vn(e){Pt(),e.effect(()=>e.locale.register(Y,wt)??void 0,"dsh-privacy-gateway: dictionaries");let t=e.locale.bind(Y);pt(e),e.effect(()=>{let i=e.slots.inject("plugins.detail.section",()=>e.slots.register({name:"plugins.detail.section",id:"dsh-privacy-gateway-stats",locale:Y},d=>d.subject?.kind==="bundle"&&d.subject.pkg?.name===we?(0,ye.createElement)(ge,{ctx:e,t}):null));return typeof i=="function"?i:void 0},"dsh-privacy-gateway: statistics card"),e.effect(()=>{let i=e.slots.inject("plugins.bundle.config",()=>e.slots.register({name:"plugins.bundle.config",key:we,locale:Y},d=>d.view==="summary"?t("cfg.title"):(0,ye.createElement)(Ae,{ctx:e,t})));return typeof i=="function"?i:void 0},"dsh-privacy-gateway: configuration (bundle page)"),e.effect(()=>{let i=e.slots.inject("plugins.row.config",()=>e.slots.register({name:"plugins.row.config",key:`${we}#${At}`,locale:Y},d=>d.view==="summary"?t("cfg.title"):(0,ye.createElement)(Ae,{ctx:e,t,form:d.form})));return typeof i=="function"?i:void 0},"dsh-privacy-gateway: configuration (row page)");let n=!1,r,a=()=>{let i=r;r=void 0,i?.()},s=()=>{n&&!r?r=It(e,t):n||a()};e.effect(()=>{let i=gt(e,d=>{n=d,s()});return()=>{i(),n=!1,a()}},"dsh-privacy-gateway: view tab")}module.exports={name:kn,inject:bn,apply:vn};
147
147
  return module.exports;
148
148
  } });
package/lib/index.js CHANGED
@@ -14,6 +14,8 @@ const TEXT = {
14
14
  zh: {
15
15
  usage: "用法:/privacy [status | on | off | test <文本>]",
16
16
  on: "脱敏已开启。",
17
+ gated: "运行开关已打开,但配置里脱敏是关闭的:模型请求仍按原文发出。请在设置页打开「启用脱敏」。",
18
+ configOff: "配置:脱敏关闭(设置页的「启用脱敏」)",
17
19
  off: "脱敏已关闭:模型请求按原文发出,直到 /privacy on 或重启。配置未改动。",
18
20
  already: (on) => on ? "脱敏本来就是开启的。" : "脱敏本来就是关闭的。",
19
21
  testEmpty: "用法:/privacy test <文本>",
@@ -42,6 +44,8 @@ const TEXT = {
42
44
  en: {
43
45
  usage: "Usage: /privacy [status | on | off | test <text>]",
44
46
  on: "Masking is on.",
47
+ gated: "The run switch is on, but masking is disabled in the configuration: model requests still go as written. Turn on \"Enable masking\" in the settings.",
48
+ configOff: "Config: masking off (the settings page's \"Enable masking\")",
45
49
  off: "Masking is off: model requests go as written until /privacy on or a restart. The config is unchanged.",
46
50
  already: (on) => on ? "Masking was already on." : "Masking was already off.",
47
51
  testEmpty: "Usage: /privacy test <text>",
@@ -78,15 +82,9 @@ function hintOf(h, lang) {
78
82
  function status(face, lang) {
79
83
  const T = TEXT[lang];
80
84
  const s$1 = face.stats();
81
- const out = [
82
- T.state(face.active),
83
- T.covers(face.secrets, face.personal),
84
- T.table(face.values),
85
- "",
86
- T.line(T.today, s$1.today),
87
- T.line(T.week, s$1.week),
88
- T.line(T.month, s$1.month)
89
- ];
85
+ const out = [T.state(face.active)];
86
+ if (!face.configured) out.push(T.configOff);
87
+ out.push(T.covers(face.secrets, face.personal), T.table(face.values), "", T.line(T.today, s$1.today), T.line(T.week, s$1.week), T.line(T.month, s$1.month));
90
88
  if (Object.keys(s$1.today.kinds).length > 0) out.push(T.kinds + counts(s$1.today.kinds));
91
89
  if (Object.keys(s$1.today.finders).length > 0) out.push(T.finders + counts(s$1.today.finders));
92
90
  if (s$1.today.warned > 0 || s$1.today.blocked > 0) out.push(T.actedToday(s$1.today.warned, s$1.today.blocked));
@@ -113,14 +111,16 @@ function runPrivacyCommand(face, rawInput, lang) {
113
111
  case "on":
114
112
  case "off": {
115
113
  const on = sub === "on";
116
- if (face.active === on) return {
114
+ const was = face.active;
115
+ face.active = on;
116
+ const now = face.active;
117
+ if (now === on) return {
117
118
  kind: "success",
118
- text: T.already(on)
119
+ text: was === now ? T.already(on) : on ? T.on : T.off
119
120
  };
120
- face.active = on;
121
121
  return {
122
122
  kind: "success",
123
- text: on ? T.on : T.off
123
+ text: T.gated
124
124
  };
125
125
  }
126
126
  case "test": {
@@ -1030,6 +1030,17 @@ function secretValue(v) {
1030
1030
  if (!notAVariable(v) || v.startsWith("process.env") || v.startsWith("os.")) return false;
1031
1031
  return hasDigit(v) && hasLetter(v);
1032
1032
  }
1033
+ /**
1034
+ * A value of a field already named as a secret (`DB_PASSWORD=…`, `api_key: …`):
1035
+ * the name has done the proving, so a long passphrase of letters only and a
1036
+ * long number count too (ADR-0036). `secretValue` stays the test for a value
1037
+ * found in free text, where a long word is usually just a word.
1038
+ */
1039
+ function namedValue(v) {
1040
+ if (!notAVariable(v) || v.startsWith("process.env") || v.startsWith("os.")) return false;
1041
+ if (keyValue(v)) return true;
1042
+ return /^\d{10,}$/.test(v);
1043
+ }
1033
1044
  const IDENT_PATH = /^[A-Za-z_][A-Za-z0-9_]*(?:\.[A-Za-z0-9_]+)*$/;
1034
1045
  /**
1035
1046
  * Turns away a value that is code naming a secret, not the secret: a call
@@ -1195,6 +1206,16 @@ function fieldAt(s$1, a, b) {
1195
1206
  if (v[0] === "=") return false;
1196
1207
  return !fileField(s$1, a) && !LINE_REF.test(v) && !pathValue(v) && !fileNameValue(v) && !namesASecret(v) && !skillName(s$1, a, b) && !versionValue(v);
1197
1208
  }
1209
+ /**
1210
+ * Where a value of a field already named as a secret starts: `fieldAt`'s
1211
+ * places, plus a long run of digits. A bare number reads as a line reference
1212
+ * elsewhere (`token.go:L643`), but after `password=` it is the password
1213
+ * (ADR-0036).
1214
+ */
1215
+ function namedAt(s$1, a, b) {
1216
+ if (fieldAt(s$1, a, b)) return true;
1217
+ return /^\d{10,}$/.test(s$1.slice(a, b)) && !fileField(s$1, a);
1218
+ }
1198
1219
  /** A field's name's words in lower case: next_page_token, nextPageToken and X-Next-Page-Token are next, page, token. */
1199
1220
  function nameWords(name$1) {
1200
1221
  const out = [];
@@ -1524,6 +1545,17 @@ function shapeOf(key, kind, v) {
1524
1545
  //#region src/redact/known.ts
1525
1546
  /** The shortest value matched as known: shorter ones would turn up all over ordinary text. */
1526
1547
  const MIN_KNOWN = 8;
1548
+ /** The lengths the known index keys its buckets by, longest first: a shared prefix stays a small bucket. */
1549
+ const INDEX_LENGTHS = [
1550
+ 24,
1551
+ 16,
1552
+ MIN_KNOWN
1553
+ ];
1554
+ /** The longest index key a value of `v.length` characters can have. */
1555
+ function indexLen(v) {
1556
+ for (const n of INDEX_LENGTHS) if (v.length >= n) return n;
1557
+ return MIN_KNOWN;
1558
+ }
1527
1559
  const BITS = 1 << 20;
1528
1560
  /** A 20-bit hash of the four characters at s[i]. */
1529
1561
  function gram(s$1, i) {
@@ -1559,7 +1591,10 @@ var ValueTable = class {
1559
1591
  /** placeholder → value, the least recently used first. */
1560
1592
  #values = /* @__PURE__ */ new Map();
1561
1593
  #kinds = /* @__PURE__ */ new Set();
1594
+ /** The first `indexLen(v)` characters of a value → its bucket, one entry per value. */
1562
1595
  #known = /* @__PURE__ */ new Map();
1596
+ /** value → the entry in its bucket, so remembering one twice does not walk the bucket. */
1597
+ #byValue = /* @__PURE__ */ new Map();
1563
1598
  #bits = new Uint32Array(BITS / 32);
1564
1599
  /** made-up key → its kind (docs/adr/0015); their values are in #values with the placeholders'. */
1565
1600
  #shapes = /* @__PURE__ */ new Map();
@@ -1576,7 +1611,9 @@ var ValueTable = class {
1576
1611
  }
1577
1612
  /** Remembers `value` behind `placeholder`, or marks it used now. */
1578
1613
  put(placeholder, kind, value$1) {
1579
- if (this.#values.has(placeholder)) {
1614
+ const have = this.#values.get(placeholder);
1615
+ if (have !== void 0) {
1616
+ if (have !== value$1) throw new Error(`dsh-privacy-gateway: placeholder collision at ${placeholder}`);
1580
1617
  this.#values.delete(placeholder);
1581
1618
  this.#values.set(placeholder, value$1);
1582
1619
  return;
@@ -1678,13 +1715,16 @@ var ValueTable = class {
1678
1715
  for (let i = 0; i + MIN_KNOWN <= s$1.length; i++) {
1679
1716
  const g = gram(s$1, i);
1680
1717
  if ((this.#bits[g >>> 5] >>> (g & 31) & 1) === 0) continue;
1681
- const bucket = this.#known.get(s$1.slice(i, i + MIN_KNOWN));
1682
- if (!bucket) continue;
1683
1718
  let best;
1684
- for (const k of bucket) {
1685
- if (!covers(k.kind)) continue;
1686
- if (best && k.v.length <= best.v.length || !s$1.startsWith(k.v, i) || !standsAlone(k.kind, s$1, i, i + k.v.length)) continue;
1687
- best = k;
1719
+ for (const len of INDEX_LENGTHS) {
1720
+ if (i + len > s$1.length) continue;
1721
+ const bucket = this.#known.get(s$1.slice(i, i + len));
1722
+ if (!bucket) continue;
1723
+ for (const k of bucket) {
1724
+ if (!covers(k.kind)) continue;
1725
+ if (best && k.v.length <= best.v.length || !s$1.startsWith(k.v, i) || !standsAlone(k.kind, s$1, i, i + k.v.length)) continue;
1726
+ best = k;
1727
+ }
1688
1728
  }
1689
1729
  if (best) {
1690
1730
  out.push({
@@ -1699,28 +1739,24 @@ var ValueTable = class {
1699
1739
  }
1700
1740
  #addKnown(p$1, kind, v) {
1701
1741
  if (kind === "TERM" || v.length < MIN_KNOWN) return;
1702
- const head = v.slice(0, MIN_KNOWN);
1703
- const bucket = this.#known.get(head);
1704
- if (bucket) {
1705
- const i = bucket.findIndex((k) => k.v === v);
1706
- if (i >= 0) {
1707
- if (p$1 < bucket[i].p) bucket[i] = {
1708
- v,
1709
- p: p$1,
1710
- kind
1711
- };
1712
- return;
1742
+ const have = this.#byValue.get(v);
1743
+ if (have !== void 0) {
1744
+ if (p$1 < have.p) {
1745
+ have.p = p$1;
1746
+ have.kind = kind;
1713
1747
  }
1714
- bucket.push({
1715
- v,
1716
- p: p$1,
1717
- kind
1718
- });
1719
- } else this.#known.set(head, [{
1748
+ return;
1749
+ }
1750
+ const k = {
1720
1751
  v,
1721
1752
  p: p$1,
1722
1753
  kind
1723
- }]);
1754
+ };
1755
+ this.#byValue.set(v, k);
1756
+ const head = v.slice(0, indexLen(v));
1757
+ const bucket = this.#known.get(head);
1758
+ if (bucket) bucket.push(k);
1759
+ else this.#known.set(head, [k]);
1724
1760
  const g = gram(v, 0);
1725
1761
  this.#bits[g >>> 5] = (this.#bits[g >>> 5] | 1 << (g & 31)) >>> 0;
1726
1762
  }
@@ -1732,6 +1768,7 @@ var ValueTable = class {
1732
1768
  this.#values.delete(k);
1733
1769
  }
1734
1770
  this.#known = /* @__PURE__ */ new Map();
1771
+ this.#byValue = /* @__PURE__ */ new Map();
1735
1772
  this.#bits.fill(0);
1736
1773
  const shapes = this.#shapes;
1737
1774
  this.#shapes = /* @__PURE__ */ new Map();
@@ -1830,6 +1867,19 @@ function value(c, name$1, a, b) {
1830
1867
  });
1831
1868
  }
1832
1869
  /**
1870
+ * The first place at or after `i` that ends a value: a character of `set`, or
1871
+ * a backslash only where it escapes a quote. A backslash before anything else
1872
+ * (a JSON escape the text kept, \u003c) is part of the value, not its end.
1873
+ */
1874
+ function endsAt(c, set, i) {
1875
+ let at$1 = c.next.any(set, i);
1876
+ while (at$1 < c.s.length && c.s[at$1] === "\\") {
1877
+ if (c.s[at$1 + 1] === "\"" || c.s[at$1 + 1] === "'") return at$1;
1878
+ at$1 = c.next.any(set, at$1 + 1);
1879
+ }
1880
+ return at$1;
1881
+ }
1882
+ /**
1833
1883
  * The pairs of a cookie string in s[from:to] (a Cookie: header's, curl -b's):
1834
1884
  * name=value; name=value … until a piece that is no pair (the prose after
1835
1885
  * it). `first` takes only the first, as Set-Cookie's attributes are no
@@ -1848,7 +1898,7 @@ function pairs(c, from, to, first) {
1848
1898
  if (s$1[i] === "\"") {
1849
1899
  const q = c.next.index("\"", i + 1);
1850
1900
  i = q < to ? q + 1 : to;
1851
- } else i = Math.min(c.next.any(VALUE_END, i), to);
1901
+ } else i = Math.min(endsAt(c, VALUE_END, i), to);
1852
1902
  value(c, name$1, vs, i);
1853
1903
  if (first) break;
1854
1904
  }
@@ -1856,7 +1906,7 @@ function pairs(c, from, to, first) {
1856
1906
  }
1857
1907
  /** The end of an unquoted cookie string that starts at s[i]. */
1858
1908
  function regionEnd(c, i) {
1859
- return c.next.any(REGION_END, i);
1909
+ return endsAt(c, REGION_END, i);
1860
1910
  }
1861
1911
  /** The end of the quoted string whose opening quote ends at s[i-1]: its closing quote (`quote`, \" for \"), or the line's end. */
1862
1912
  function quotedEnd(c, i, quote) {
@@ -2001,7 +2051,7 @@ function namedCookies(c, plan) {
2001
2051
  const vs = m.index + m[0].length;
2002
2052
  let i = vs;
2003
2053
  if (m[0].endsWith("=") && s$1[i] === "\"") i = Math.min(c.next.index("\"", i + 1) + 1, s$1.length);
2004
- else i = c.next.any(NAMED_END, i);
2054
+ else i = endsAt(c, NAMED_END, i);
2005
2055
  value(c, m[1], vs, i);
2006
2056
  read = i;
2007
2057
  }
@@ -2137,7 +2187,7 @@ function ruleSpans(r, s$1, lower$1) {
2137
2187
  for (const m of s$1.matchAll(r.re)) push(r, s$1, m, out);
2138
2188
  return out;
2139
2189
  }
2140
- /** Where s has one of the user's words, as written (magpie `Options.Words`, whole words and case folding off). */
2190
+ /** Where s has one of the user's words, as written: a plain substring match, no word boundary or case folding (magpie `Options.Words` with both off). */
2141
2191
  function wordSpans(s$1, words) {
2142
2192
  const out = [];
2143
2193
  for (const raw of words) {
@@ -2937,8 +2987,8 @@ const rules = [
2937
2987
  re: new RegExp(`(?:${SECRET_NAMES.join("|")})[A-Za-z0-9_.-]{0,64}${QUOTE}[ \\t]*[:=][ \\t]*${QUOTE}(${SECRET_CH}{8,${MAX_SECRET}})`, "yid"),
2938
2988
  fold: SECRET_STARTS,
2939
2989
  anchor: at,
2940
- ok: secretValue,
2941
- at: fieldAt
2990
+ ok: namedValue,
2991
+ at: namedAt
2942
2992
  }),
2943
2993
  s({
2944
2994
  kind: "SECRET",
@@ -3285,9 +3335,13 @@ const DEF_ITEMS = new Set(["additional_tools", "tool_search_output"]);
3285
3335
  function isObject(v) {
3286
3336
  return typeof v === "object" && v !== null && !Array.isArray(v);
3287
3337
  }
3288
- /** A chat (`messages`), Responses (`input`) or Gemini and Vertex (`contents`) request: the shapes this gateway rewrites. */
3338
+ /**
3339
+ * A chat (`messages`), Responses (`input`), Gemini and Vertex (`contents`) or
3340
+ * a completion (`prompt`, and `input` as one string) request: the shapes this
3341
+ * gateway rewrites.
3342
+ */
3289
3343
  function isModelRequest(doc) {
3290
- return isObject(doc) && (Array.isArray(doc.messages) || Array.isArray(doc.input) || Array.isArray(doc.contents));
3344
+ return isObject(doc) && (Array.isArray(doc.messages) || Array.isArray(doc.input) || typeof doc.input === "string" || Array.isArray(doc.contents) || typeof doc.prompt === "string");
3291
3345
  }
3292
3346
  function definitions(doc) {
3293
3347
  const defs = [];
@@ -3331,6 +3385,30 @@ function keepIn(path, key, s$1, args, defs) {
3331
3385
  if (under(path, defs)) return key !== "description";
3332
3386
  return KEPT.has(key) || isID(key);
3333
3387
  }
3388
+ /** Keys whose strings are URLs the vendor may fetch: a signed one must go as it is, byte for byte. */
3389
+ const URL_KEYS = new Set(["url", "image_url"]);
3390
+ /** A URL carrying a signature: masking any part of it breaks the fetch it was made for. */
3391
+ const SIGNED_URL = /[?&](?:X-Amz-(?:Signature|Credential|Security-Token)|X-Goog-(?:Signature|Credential)|Signature|sig|hmac|token|access_token)=/i;
3392
+ function isSignedURL(s$1) {
3393
+ return SIGNED_URL.test(s$1);
3394
+ }
3395
+ /**
3396
+ * Whether `path` is text the host writes: the system prompt of a chat, the
3397
+ * `system` blocks of Anthropic, the `instructions` of Responses, Gemini's
3398
+ * `systemInstruction`. Only there is an `<env>` block protected: a user
3399
+ * message, a tool result or a tool's arguments may quote one by accident, and
3400
+ * protecting it would send the rest of that string in the clear (ADR-0004).
3401
+ */
3402
+ function hostEnvPath(path, doc) {
3403
+ if (path === "instructions" || path.startsWith("instructions.")) return true;
3404
+ if (path === "system" || path.startsWith("system.") || path === "systemInstruction" || path.startsWith("systemInstruction.")) return true;
3405
+ const m = /^(messages|input)\.(\d+)\./.exec(path);
3406
+ if (!m) return false;
3407
+ const list = doc[m[1]];
3408
+ const item = Array.isArray(list) ? list[Number(m[2])] : void 0;
3409
+ if (!isObject(item)) return false;
3410
+ return item.role === "system" || item.role === "developer";
3411
+ }
3334
3412
  /**
3335
3413
  * Whether a key goes as it is: the protocol's own keys (a masked `role` or
3336
3414
  * `type` is a request the vendor cannot read), the keys the agent defines for
@@ -3460,8 +3538,10 @@ var Masker = class {
3460
3538
  * The values of a string; with `view` (escaped), the finders read its text
3461
3539
  * and the values come back as places in `raw`. The rules read the view's
3462
3540
  * match text, where a quote an escape wrote inside a value stays in it.
3541
+ * `knownOnly` is for a URL the vendor fetches: only a value already masked
3542
+ * goes back as its placeholder, no rule rewrites a link (ADR-0004).
3463
3543
  */
3464
- #find(raw, view, escaped, pass) {
3544
+ #find(raw, view, escaped, pass, knownOnly = false) {
3465
3545
  const o = this.#options;
3466
3546
  const s$1 = view?.text ?? raw;
3467
3547
  const forRules = view?.match ?? raw;
@@ -3469,9 +3549,9 @@ var Masker = class {
3469
3549
  let lowRules;
3470
3550
  const lower$1 = () => low ??= lowerASCII(s$1);
3471
3551
  const lowerRules = () => lowRules ??= lowerASCII(forRules);
3472
- const cookies = o.secrets ? cookieSpans(s$1, o.cookies, lower$1) : [];
3473
- let found = o.words && o.words.length > 0 ? wordSpans(s$1, o.words) : [];
3474
- for (const r of rules) {
3552
+ const cookies = !knownOnly && o.secrets ? cookieSpans(s$1, o.cookies, lower$1) : [];
3553
+ let found = !knownOnly && o.words && o.words.length > 0 ? wordSpans(s$1, o.words) : [];
3554
+ if (!knownOnly) for (const r of rules) {
3475
3555
  if (r.cat === "secret" ? !o.secrets : !o.personal) continue;
3476
3556
  found.push(...ruleSpans(r, forRules, lowerRules));
3477
3557
  }
@@ -3489,7 +3569,7 @@ var Masker = class {
3489
3569
  return escaped ? inStrings(raw, found) : found;
3490
3570
  }
3491
3571
  /** The masked string, how many values went, and each change as an edit of `raw`. */
3492
- #mask(raw, escaped, keep, pass) {
3572
+ #mask(raw, escaped, keep, pass, knownOnly = false) {
3493
3573
  const o = this.#options;
3494
3574
  const none = {
3495
3575
  text: raw,
@@ -3498,7 +3578,7 @@ var Masker = class {
3498
3578
  };
3499
3579
  if (raw.length < 3 || !o.secrets && !o.personal && !(o.words && o.words.length > 0)) return none;
3500
3580
  const view = escaped && raw.includes("\\") ? decodedView(raw) : void 0;
3501
- let found = this.#find(raw, view, escaped, pass);
3581
+ let found = this.#find(raw, view, escaped, pass, knownOnly);
3502
3582
  if (found.length === 0) return none;
3503
3583
  const fixed = [...keep];
3504
3584
  if (raw.includes("{{")) for (const m of raw.matchAll(PLACEHOLDER_RE)) fixed.push({
@@ -3648,12 +3728,19 @@ var Masker = class {
3648
3728
  };
3649
3729
  const out = walkJSON(body, (path, shown, key, s$1) => {
3650
3730
  if (protectTools && under(path, TOOL_ROOTS)) return s$1;
3651
- if (keepIn(path, key, s$1, args, defs)) return s$1;
3652
3731
  if (this.#options.context) pass.at = shown === path ? placeOf(doc, path) : {
3653
3732
  ...placeOf(doc, path),
3654
3733
  path: shown
3655
3734
  };
3656
- const r$1 = this.#mask(s$1, asJSON(key, ""), protectEnvBlock ? envBlockRanges(s$1) : [], pass);
3735
+ if (URL_KEYS.has(key) && !under(path, args) && !under(path, defs)) {
3736
+ if (s$1.startsWith("data:") || isSignedURL(s$1)) return s$1;
3737
+ const r$2 = this.#mask(s$1, asJSON(key, ""), [], pass, true);
3738
+ n += r$2.n;
3739
+ return r$2.edits;
3740
+ }
3741
+ if (keepIn(path, key, s$1, args, defs)) return s$1;
3742
+ const protect = protectEnvBlock && hostEnvPath(path, doc) ? envBlockRanges(s$1) : [];
3743
+ const r$1 = this.#mask(s$1, asJSON(key, ""), protect, pass);
3657
3744
  n += r$1.n;
3658
3745
  return r$1.edits;
3659
3746
  }, keyFn);
@@ -3820,10 +3907,10 @@ function commentLines(b) {
3820
3907
  }
3821
3908
  return n;
3822
3909
  }
3823
- /** Where the first complete event in b ends, and the length of the blank line that ends it. */
3824
- function eventEnd(b) {
3825
- const i = b.indexOf("\n\n");
3826
- const j = b.indexOf("\r\n\r\n");
3910
+ /** Where the first complete event in b ends, and the length of the blank line that ends it; from `at` on. */
3911
+ function eventEnd(b, at$1 = 0) {
3912
+ const i = b.indexOf("\n\n", at$1);
3913
+ const j = b.indexOf("\r\n\r\n", at$1);
3827
3914
  if (i < 0 && j < 0) return [-1, 0];
3828
3915
  if (j >= 0 && (i < 0 || j < i)) return [j, 4];
3829
3916
  return [i, 2];
@@ -3981,7 +4068,7 @@ var Restorer = class {
3981
4068
  out.push(s$1.slice(last));
3982
4069
  return out.join("");
3983
4070
  }
3984
- /** Restores the strings of a JSON body; text that is not JSON is restored as text. */
4071
+ /** Restores the strings and the keys of a JSON body; text that is not JSON is restored as text. */
3985
4072
  restoreJSON(text, tally) {
3986
4073
  if (this.#table.size === 0 || this.#table.shapes === 0 && !text.includes("_")) return text;
3987
4074
  const type = typeOf(text);
@@ -3990,6 +4077,11 @@ var Restorer = class {
3990
4077
  if (SIGNATURE_KEYS.has(key)) return s$1;
3991
4078
  const tool = inToolCall(path, key, type);
3992
4079
  return this.restoreText(s$1, asJSON(key, type), tally, tool, leave && tool);
4080
+ }, (path, _shown, name$1) => {
4081
+ if (KEPT.has(name$1)) return void 0;
4082
+ const tool = inToolCall(path === "" ? name$1 : `${path}.${name$1}`, name$1, type);
4083
+ const restored = this.restoreText(name$1, false, tally, tool, leave && tool);
4084
+ return restored === name$1 ? void 0 : restored;
3993
4085
  }) ?? this.restoreText(text, false, tally);
3994
4086
  }
3995
4087
  /**
@@ -4132,6 +4224,8 @@ var Restorer = class {
4132
4224
  }
4133
4225
  return event(ev);
4134
4226
  };
4227
+ /** How far into `buf` a blank line was last looked for: a long event in many chunks is searched once. */
4228
+ let scanned = 0;
4135
4229
  const drain = () => {
4136
4230
  let out = "";
4137
4231
  for (;;) {
@@ -4139,12 +4233,17 @@ var Restorer = class {
4139
4233
  if (c > 0) {
4140
4234
  out += buf.slice(0, c);
4141
4235
  buf = buf.slice(c);
4236
+ scanned = 0;
4142
4237
  continue;
4143
4238
  }
4144
- const [i, n] = eventEnd(buf);
4145
- if (i < 0) return out;
4239
+ const [i, n] = eventEnd(buf, scanned);
4240
+ if (i < 0) {
4241
+ scanned = Math.max(0, buf.length - 3);
4242
+ return out;
4243
+ }
4146
4244
  const ev = buf.slice(0, i + n);
4147
4245
  buf = buf.slice(i + n);
4246
+ scanned = 0;
4148
4247
  out += route(ev);
4149
4248
  }
4150
4249
  };
@@ -5444,6 +5543,8 @@ var SessionSwitches = class {
5444
5543
  #logger;
5445
5544
  /** Insertion order is the order the sessions were turned off. */
5446
5545
  #off = /* @__PURE__ */ new Set();
5546
+ /** Choices whose write failed, by session and value: a later save must not drop them. */
5547
+ #unsaved = /* @__PURE__ */ new Map();
5447
5548
  constructor(options = {}) {
5448
5549
  this.#file = options.file;
5449
5550
  this.#logger = options.logger;
@@ -5490,7 +5591,9 @@ var SessionSwitches = class {
5490
5591
  * Writes the one change just made. Another dsh process may have saved its
5491
5592
  * own choices since this one read the file: the file is read again and only
5492
5593
  * this change applied to it, so a session another process turned back on
5493
- * is not turned off again by this one's older copy. The merged list is this
5594
+ * is not turned off again by this one's older copy. A choice this process
5595
+ * could not write earlier is applied too: it is still the user's, and the
5596
+ * next successful save carries it to the file. The merged list is this
5494
5597
  * process's from then on.
5495
5598
  */
5496
5599
  #save(session, on) {
@@ -5501,6 +5604,7 @@ var SessionSwitches = class {
5501
5604
  const onDisk = this.#read(file);
5502
5605
  if (onDisk) {
5503
5606
  const merged = new Set(onDisk);
5607
+ for (const [id, state] of this.#unsaved) if (id !== session) apply$1(merged, id, state);
5504
5608
  apply$1(merged, session, on);
5505
5609
  this.#off.clear();
5506
5610
  for (const id of merged) this.#off.add(id);
@@ -5511,9 +5615,11 @@ var SessionSwitches = class {
5511
5615
  });
5512
5616
  writeFileSync(tmp, `${JSON.stringify({ off: [...this.#off] })}\n`, { mode: 384 });
5513
5617
  renameSync(tmp, file);
5618
+ this.#unsaved.clear();
5514
5619
  } catch (err) {
5515
5620
  rmSync(tmp, { force: true });
5516
- this.#logger?.warn(`dsh-privacy-gateway: could not save ${file}; the choice holds until restart`, err);
5621
+ this.#unsaved.set(session, on);
5622
+ this.#logger?.warn(`dsh-privacy-gateway: could not save ${file}; the choice holds for this run and goes in with the next save`, err);
5517
5623
  }
5518
5624
  }
5519
5625
  };
@@ -5704,6 +5810,9 @@ function apply(ctx, config = {}) {
5704
5810
  engine.active = on;
5705
5811
  ctx.logger.info(`dsh-privacy-gateway: masking turned ${on ? "on" : "off"} by /privacy`);
5706
5812
  },
5813
+ get configured() {
5814
+ return current$1().enabled;
5815
+ },
5707
5816
  get secrets() {
5708
5817
  return current$1().secrets;
5709
5818
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-privacy-gateway",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
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",
@@ -58,7 +58,7 @@
58
58
  ],
59
59
  "dependencies": {
60
60
  "@deepseek-ai/schemastery": "^3.18.4",
61
- "undici": "8.11.2"
61
+ "undici": "8.12.4"
62
62
  },
63
63
  "peerDependencies": {
64
64
  "@deepseek-ai/cordis": ">=4.0.5",