dsh-privacy-gateway 0.1.9 → 0.2.1
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 +34 -12
- package/README.md +34 -12
- package/docs/details/DETAIL.en.md +3 -3
- package/docs/details/DETAIL.md +3 -3
- package/lib/client.js +23 -6
- package/lib/index.d.ts +12 -4
- package/lib/index.js +35 -14
- package/locale/en.json +1 -1
- package/locale/zh.json +1 -1
- package/package.json +2 -2
package/README.en.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
[简体中文](README.md) | English
|
|
4
4
|
|
|
5
|
-

|
|
5
|
+

|
|
6
6
|
|
|
7
|
-
A redaction gateway on the host process's undici global dispatcher. Secrets in outgoing model request bodies are replaced with placeholders
|
|
7
|
+
A redaction gateway on the host process's undici global dispatcher. Secrets in outgoing model request bodies are replaced with placeholders; by default the placeholders in the replies go into the session log as they are, so no plaintext reaches it, and `restoreLog` puts them back with the real values on request. Adapters and providers don't notice it; by default the agent gets placeholders, and with `restoreLog` on it gets the real values as before. One interception point covers every provider that goes through `fetch()`, including adapters that plugins provide.
|
|
8
8
|
|
|
9
9
|
If you are using an **API relay**, or you are working with **sensitive information** or **production data**, please be sure to protect information security.
|
|
10
10
|
|
|
@@ -15,7 +15,7 @@ If you are using an **API relay**, or you are working with **sensitive informati
|
|
|
15
15
|
dsh plugin --profile web add dsh-privacy-gateway@latest
|
|
16
16
|
|
|
17
17
|
# The same version as a GitHub Release asset (prereleases get one too)
|
|
18
|
-
dsh plugin --profile web add https://github.com/xbzbing/dsh-privacy-gateway/releases/download/v0.1
|
|
18
|
+
dsh plugin --profile web add https://github.com/xbzbing/dsh-privacy-gateway/releases/download/v0.2.1/dsh-privacy-gateway-0.2.1.tgz
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
A prerelease version has a `-` in it and goes to GitHub Releases only, never to npm. The repository does not commit `lib/`, so `dsh plugin add github:…` cannot load the plugin ([ADR-0006](docs/adr/0006-distribution-and-build-artifacts.md)).
|
|
@@ -26,10 +26,30 @@ In the default web profile the first install works at once, with no restart of t
|
|
|
26
26
|
|
|
27
27
|
- **What is masked**: keys, tokens, passwords, private keys, cookies, email addresses, phone numbers, ID card and bank card numbers, and your own words — each with its own switch.
|
|
28
28
|
- **Actions**: pick `mask` / `warn` / `block` per kind; a key can be sent as a made-up key of its own form (`shape`).
|
|
29
|
+
- **No plaintext in the session log**: restore is off by default, so a reply's placeholders go into the session log as they are; turn `restoreLog` on to put the real values back, and the agent gets them too.
|
|
29
30
|
- **Records and statistics**: records written to disk by the day, a statistics card, and the session's 「隐私保护」 (Privacy) tab; a record holds placeholders, never a value.
|
|
30
31
|
- **The `/privacy` command**: status, a temporary on / off, and `test` to preview how a text would go out.
|
|
31
32
|
- **Live configuration**: everyday items are changed on the plugin page and apply from the next call; when masking fails, the request is not sent.
|
|
32
33
|
|
|
34
|
+
## How it works
|
|
35
|
+
|
|
36
|
+
The gateway has this one interception point, and both directions happen at the HTTP layer:
|
|
37
|
+
|
|
38
|
+
```mermaid
|
|
39
|
+
flowchart LR
|
|
40
|
+
A["agent / adapter<br/>(through the global fetch)"] -->|"① model request"| G["privacy gateway<br/>undici dispatcher"]
|
|
41
|
+
G -->|"② secrets, credentials, personal data<br/>and your own words become placeholders"| M["model service"]
|
|
42
|
+
M -->|"③ reply (with placeholders)"| G
|
|
43
|
+
G -->|"④ default: placeholders as they are"| L["agent and session log"]
|
|
44
|
+
G -->|"④ restoreLog on: the real values"| L
|
|
45
|
+
G -.->|"metadata only, never a value"| R["records / statistics"]
|
|
46
|
+
G -.->|"placeholder ↔ value"| T["value table (memory only)"]
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
- **Outbound (①②)**: a value a rule finds becomes a placeholder, so the model service only ever gets placeholders; the values stay in the in-memory table, which is what makes the same value the same placeholder every turn.
|
|
50
|
+
- **Inbound (③④)**: with `restoreLog` off (the default) the placeholders reach the agent and the session log as they are; with it on they become the real values before the log is written, so the agent and the log agree — the reply has this one restore point.
|
|
51
|
+
- **Sideways**: a request records metadata only (placeholder, kind, head, length); the records, the statistics and the Remote answers never hold a value.
|
|
52
|
+
|
|
33
53
|
## What is masked
|
|
34
54
|
|
|
35
55
|
| Kind | What | Switch |
|
|
@@ -44,7 +64,7 @@ In the default web profile the first install works at once, with no restart of t
|
|
|
44
64
|
|
|
45
65
|
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
66
|
|
|
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
|
|
67
|
+
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 nor the vendorView copy holds the value, just the placeholder and a few characters at each end; the session log holds no value either while `restoreLog` is off (the default), and does once it is on ([ADR-0003](docs/adr/0003-restore-before-session-log.md)).
|
|
48
68
|
|
|
49
69
|
```text
|
|
50
70
|
sk-proj-Zq7Lr2Vt9mK1Px3aB5cD8eF0gH4jN6wY → API_KEY
|
|
@@ -69,7 +89,7 @@ someone@gmail.com → EMAIL
|
|
|
69
89
|
- A secret shorter than 8 characters (`abc123`, `666666`, `888888`: a short password) is no value: it goes as written and makes no record. It is guessed in no time, so masking it only promises a protection that is not there — and the value table never matched anything that short as known anyway ([ADR-0031](docs/adr/0031-no-short-or-template-values.md)).
|
|
70
90
|
- A value typed to stand for a key is no value: eight or more of one character in a row (`sk-proj-xxxx…`, `AKIA0000…`), or one that says what it is (`your_api_key`, `example`, `changeme`, `placeholder`, `dummy`, `***`). A random key has such a run with a chance below one in a billion, and a vendor's real test key (`sk_test_…`) is still masked ([ADR-0031](docs/adr/0031-no-short-or-template-values.md)).
|
|
71
91
|
- The name of a cryptographic algorithm is no value: names like `SCRAM-SHA-512` and `PBKDF2WithHmacSHA256` are published in a spec for anyone to read, so masking one hides nothing; they go as they are ([ADR-0033](docs/adr/0033-algorithm-names.md)).
|
|
72
|
-
- A key is masked the way a value is: the key in `{"metadata": {"sk-…": …}}` goes as a placeholder and comes back in the reply. The protocol's own keys (`model`, `role`, `type`, `name`, `id` and so on), the tool definitions and a tool call's argument names are never touched ([ADR-0029](docs/adr/0029-mask-json-keys.md)).
|
|
92
|
+
- A key is masked the way a value is: the key in `{"metadata": {"sk-…": …}}` goes as a placeholder and comes back in the reply when `restoreLog` is on. The protocol's own keys (`model`, `role`, `type`, `name`, `id` and so on), the tool definitions and a tool call's argument names are never touched ([ADR-0029](docs/adr/0029-mask-json-keys.md)).
|
|
73
93
|
|
|
74
94
|
## Screens
|
|
75
95
|
|
|
@@ -81,7 +101,7 @@ The screenshots show the Chinese interface.
|
|
|
81
101
|
|
|
82
102
|
## Configuration
|
|
83
103
|
|
|
84
|
-
The everyday settings can be changed on the Configure page of this plugin's row on the plugin page: `enabled`, `secrets`, `personal`, `shape`, `toolGuard`, `maskKeys`, `words`, `allow`, `record`, `keepDays`, `recordContext`, `vendorView`, `showPanel`, `excludeProviders`. A change is saved at once and applies from the next model call, with no restart ([ADR-0021](docs/adr/0021-live-settings.md)). The others are changed in the profile's `~/.dsh/profiles/<profile>/cordis.patch.yml`, under `config` of the `id: dsh-privacy-gateway` row; the `cordis.patch.yml` shipped in the package is replaced on upgrade, so do not edit it.
|
|
104
|
+
The everyday settings can be changed on the Configure page of this plugin's row on the plugin page: `enabled`, `secrets`, `personal`, `shape`, `toolGuard`, `restoreLog`, `maskKeys`, `words`, `allow`, `record`, `keepDays`, `recordContext`, `vendorView`, `showPanel`, `excludeProviders`. A change is saved at once and applies from the next model call, with no restart ([ADR-0021](docs/adr/0021-live-settings.md)). The others are changed in the profile's `~/.dsh/profiles/<profile>/cordis.patch.yml`, under `config` of the `id: dsh-privacy-gateway` row; the `cordis.patch.yml` shipped in the package is replaced on upgrade, so do not edit it.
|
|
85
105
|
|
|
86
106
|
| Key | Default | Description |
|
|
87
107
|
| --- | --- | --- |
|
|
@@ -92,8 +112,9 @@ The everyday settings can be changed on the Configure page of this plugin's row
|
|
|
92
112
|
| `allow` | `[]` | Values never masked: whole values, in any case |
|
|
93
113
|
| `actions` | `{}` | An action per kind: `mask` (the default, a placeholder), `warn` (sent as written and recorded) or `block` (the whole request is not sent). For example `{ PRIVATE_KEY: block, EMAIL: warn }` ([ADR-0013](docs/adr/0013-actions.md)) |
|
|
94
114
|
| `maskKeys` | `true` | A **JSON key** that reads like a secret or personal data goes as a placeholder too (`{"sk-…": …}`). The protocol's own keys (`model`, `role`, `type`, `name`, `id` and so on), the tool definitions and a tool call's argument names are never touched, or the vendor could not read the request. When off, such keys go as they are ([ADR-0029](docs/adr/0029-mask-json-keys.md)) |
|
|
95
|
-
| `toolGuard` | `off` | When a tool call's arguments would have a value restored and name a host off this machine: `off` only counts it, `warn` logs and records it, `block` leaves the placeholders in that call's arguments, so the tool gets the placeholder ([ADR-0014](docs/adr/0014-tool-guard.md)) |
|
|
96
|
-
| `
|
|
115
|
+
| `toolGuard` | `off` | When a tool call's arguments would have a value restored and name a host off this machine: `off` only counts it, `warn` logs and records it, `block` leaves the placeholders in that call's arguments, so the tool gets the placeholder. A reply holds a restored value only with `restoreLog` on; with it off this guard never runs ([ADR-0014](docs/adr/0014-tool-guard.md)) |
|
|
116
|
+
| `restoreLog` | `false` | Whether a reply's placeholders are put back before the session log is written. Off (the default): the placeholders go into the log as they are, no plaintext reaches it, and the agent sees placeholders too; on, the log and the agent both hold the real values, and session sync, backups, shares and exports carry them too ([ADR-0003](docs/adr/0003-restore-before-session-log.md)) |
|
|
117
|
+
| `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; with `restoreLog` on, replies put it back the same way ([ADR-0015](docs/adr/0015-shape.md)) |
|
|
97
118
|
| `cookieNames` | `[]` | More cookie names to mask |
|
|
98
119
|
| `cookieKeep` | `['lang', 'locale', 'theme', 'tz']` | Cookie names never masked |
|
|
99
120
|
| `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) |
|
|
@@ -122,7 +143,7 @@ No answer of the command has a value in it.
|
|
|
122
143
|
|
|
123
144
|
## Records and statistics
|
|
124
145
|
|
|
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)).
|
|
146
|
+
Only a model request that had something masked or restored makes a record (with `restoreLog` off nothing is restored, so only a masked one does), 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; always 0 with `restoreLog` off), 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
147
|
|
|
127
148
|
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
149
|
|
|
@@ -134,11 +155,12 @@ With `vendorView` on (「保留发出内容,供对照查看」 on the config p
|
|
|
134
155
|
|
|
135
156
|
## Notes
|
|
136
157
|
|
|
137
|
-
-
|
|
158
|
+
- Upgrading from 0.1.x: replies are no longer restored by default, so the agent gets placeholders. For the old behaviour (the agent and the log both hold the real values), turn `restoreLog` on in the config page.
|
|
159
|
+
- By default the session log holds placeholders: with `restoreLog` off (the default), a reply's placeholders go into the log as they are, no plaintext reaches it, and the agent sees placeholders too; with it on, replies are restored before the log is written, so the log and the agent both hold the real values, and session sync, backups, shares and exports carry them too ([ADR-0003](docs/adr/0003-restore-before-session-log.md)).
|
|
138
160
|
- 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
|
-
- Compressed requests
|
|
161
|
+
- Compressed requests are decompressed before they are masked; with `restoreLog` on, a compressed reply is decoded before it is restored, and with it off the reply passes through the gateway compressed, so an adapter reading it with `undici.request` must decompress it itself (`fetch` does it for the caller). A request's `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
162
|
- 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
|
-
-
|
|
163
|
+
- With `restoreLog` on, 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)); with it off, no reply holds a real value and this path does not exist.
|
|
142
164
|
- When masking fails, the request is not sent and fails with `dsh-privacy-gateway: masking failed, request not sent` ([ADR-0005](docs/adr/0005-fail-closed.md)). To recover, run `/privacy off`, or disable the plugin on the Plugins page or set `enabled` to `false`.
|
|
143
165
|
|
|
144
166
|
## Development
|
package/README.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
[English](README.en.md) | 简体中文
|
|
4
4
|
|
|
5
|
-

|
|
6
6
|
|
|
7
|
-
在宿主进程的 undici 全局 dispatcher
|
|
7
|
+
在宿主进程的 undici 全局 dispatcher 上装一层脱敏网关。出站把模型请求体里的密钥换成占位符;入站默认让回流里的占位符原样进会话日志,明文不进日志,打开 `restoreLog` 才换回真值。对 adapter、provider 无感;agent 在默认关闭时拿到的是占位符,打开 `restoreLog` 后与以前一样拿到真值。一处拦截覆盖所有走 `fetch()` 的 provider,包括插件提供的 adapter。
|
|
8
8
|
|
|
9
9
|
如果你在用**中转站**或者在处理**敏感信息**、**线上数据**,请务必注意保护信息安全。
|
|
10
10
|
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
dsh plugin --profile web add dsh-privacy-gateway@latest
|
|
16
16
|
|
|
17
17
|
# 同一版本的 GitHub Release 附件(预发布也发在这里)
|
|
18
|
-
dsh plugin --profile web add https://github.com/xbzbing/dsh-privacy-gateway/releases/download/v0.1
|
|
18
|
+
dsh plugin --profile web add https://github.com/xbzbing/dsh-privacy-gateway/releases/download/v0.2.1/dsh-privacy-gateway-0.2.1.tgz
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
预发布版本号带 `-`,只发 GitHub Release、不发 npm。仓库不提交 `lib/`,`dsh plugin add github:…` 拿到的树加载不了([ADR-0006](docs/adr/0006-distribution-and-build-artifacts.md))。
|
|
@@ -26,10 +26,30 @@ dsh plugin --profile web add https://github.com/xbzbing/dsh-privacy-gateway/rele
|
|
|
26
26
|
|
|
27
27
|
- **脱敏范围**:密钥、token、密码、私钥、cookie、邮箱、手机号、身份证、银行卡、自定义敏感词,各有开关。
|
|
28
28
|
- **动作可选**:按 kind 选 `mask` / `warn` / `block`,密钥可换成同形的假 key(`shape`)。
|
|
29
|
+
- **日志不写真值**:默认不还原,回复里的占位符原样进会话日志,明文不进日志;打开 `restoreLog` 才把真值写回,agent 同时拿到真值。
|
|
29
30
|
- **记录与统计**:按天落盘的脱敏记录、统计卡、会话「隐私保护」标签页;记录里只有占位符,没有真值。
|
|
30
31
|
- **`/privacy` 命令**:查状态、临时开关、`test` 预览一段文本会怎样发出。
|
|
31
32
|
- **配置热更新**:日常项在插件页上改,下一次调用即生效;脱敏出错时请求不发出。
|
|
32
33
|
|
|
34
|
+
## 原理
|
|
35
|
+
|
|
36
|
+
网关只有这一个拦截点,出站与入站都在 HTTP 层完成:
|
|
37
|
+
|
|
38
|
+
```mermaid
|
|
39
|
+
flowchart LR
|
|
40
|
+
A["agent / adapter<br/>(走全局 fetch)"] -->|"① 模型请求"| G["隐私网关<br/>undici dispatcher"]
|
|
41
|
+
G -->|"② 密钥、凭据、个人信息、<br/>自定义词换成占位符"| M["模型服务"]
|
|
42
|
+
M -->|"③ 回复(含占位符)"| G
|
|
43
|
+
G -->|"④ 默认:占位符原样"| L["agent 与会话日志"]
|
|
44
|
+
G -->|"④ 打开 restoreLog:换回真值"| L
|
|
45
|
+
G -.->|"只记元信息,不含真值"| R["脱敏记录 / 统计"]
|
|
46
|
+
G -.->|"占位符 ↔ 真值"| T["值表(只在内存)"]
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
- **出站(①②)**:请求体里命中规则的值换成占位符,模型服务只拿到占位符;原值只留在内存的值表里,同一个值每轮都是同一个占位符。
|
|
50
|
+
- **入站(③④)**:`restoreLog` 关闭(默认)时占位符原样交给 agent、原样写进会话日志;打开后在日志落盘前换回真值,agent 与日志都拿到真值——回复方向只有这一个还原点,两边必然一致。
|
|
51
|
+
- **旁路**:每个请求只记元信息(占位符、kind、开头、长度),记录、统计和 Remote 返回值里都没有真值。
|
|
52
|
+
|
|
33
53
|
## 脱敏范围
|
|
34
54
|
|
|
35
55
|
| kind | 内容 | 开关 |
|
|
@@ -44,7 +64,7 @@ dsh plugin --profile web add https://github.com/xbzbing/dsh-privacy-gateway/rele
|
|
|
44
64
|
|
|
45
65
|
脱敏过的值在请求的其它地方再出现,也按同一个占位符脱敏(finder 记为 `known`),`url` / `image_url` 里的也算;带签名的 URL(S3 预签名等)原样发出,改了会失效([ADR-0004](docs/adr/0004-protected-regions.md))。同一个 host 重发的历史保持原来的字节,prompt cache 照样命中。
|
|
46
66
|
|
|
47
|
-
|
|
67
|
+
照着试:下面每行都是**假值**,复制进会话发出去,统计卡的对应记录里就会出现替换后的占位符。记录、统计和 vendorView 副本里都没有原值;会话日志在 `restoreLog` 关闭(默认)时也没有,只有占位符,打开后才有真值([ADR-0003](docs/adr/0003-restore-before-session-log.md))。
|
|
48
68
|
|
|
49
69
|
```text
|
|
50
70
|
sk-proj-Zq7Lr2Vt9mK1Px3aB5cD8eF0gH4jN6wY → API_KEY
|
|
@@ -69,7 +89,7 @@ someone@gmail.com → EMAIL
|
|
|
69
89
|
- 短于 8 个字符的秘密(`abc123`、`666666`、`888888` 这类口令)不算值:照原样发出,也不进记录。它们随时能被爆破,遮住只是给人一种并不存在的保护;值表本来也不把这么短的值当作已知值([ADR-0031](docs/adr/0031-no-short-or-template-values.md))。
|
|
70
90
|
- 明显是占位写法的值不算值:8 个以上相同字符连排(`sk-proj-xxxx…`、`AKIA0000…`),或自带「这是占位」说明(`your_api_key`、`example`、`changeme`、`placeholder`、`dummy`、`***`)。随机 key 出现 8 连排的概率低于十亿分之一,`sk_test_…` 这种真测试 key 照旧脱敏([ADR-0031](docs/adr/0031-no-short-or-template-values.md))。
|
|
71
91
|
- 加密算法的名字不算值:`SCRAM-SHA-512`、`PBKDF2WithHmacSHA256` 这类名字写在规范里、人人可读,遮住什么都不保护,原样发出([ADR-0033](docs/adr/0033-algorithm-names.md))。
|
|
72
|
-
- 键名和值一样脱敏:`{"metadata": {"sk-…": …}}`
|
|
92
|
+
- 键名和值一样脱敏:`{"metadata": {"sk-…": …}}` 里的键名也换成占位符,`restoreLog` 打开时回复里再换回来;协议自身的键(`model`、`role`、`type`、`name`、`id` 等)、工具定义和工具调用的参数名不动([ADR-0029](docs/adr/0029-mask-json-keys.md))。
|
|
73
93
|
|
|
74
94
|
## 界面
|
|
75
95
|
|
|
@@ -79,7 +99,7 @@ someone@gmail.com → EMAIL
|
|
|
79
99
|
|
|
80
100
|
## 配置
|
|
81
101
|
|
|
82
|
-
插件页面里本插件那一行的「配置」页上可以直接改日常项:`enabled`、`secrets`、`personal`、`shape`、`toolGuard`、`maskKeys`、`words`、`allow`、`record`、`keepDays`、`recordContext`、`vendorView`、`showPanel`、`excludeProviders`。改了即时保存,从下一次模型调用起生效,不用重启([ADR-0021](docs/adr/0021-live-settings.md))。其余项在 profile 的 `~/.dsh/profiles/<profile>/cordis.patch.yml` 里改,写在 `id: dsh-privacy-gateway` 那一行的 `config` 下;插件包自带的 `cordis.patch.yml` 升级时会被覆盖,不要改它。
|
|
102
|
+
插件页面里本插件那一行的「配置」页上可以直接改日常项:`enabled`、`secrets`、`personal`、`shape`、`toolGuard`、`restoreLog`、`maskKeys`、`words`、`allow`、`record`、`keepDays`、`recordContext`、`vendorView`、`showPanel`、`excludeProviders`。改了即时保存,从下一次模型调用起生效,不用重启([ADR-0021](docs/adr/0021-live-settings.md))。其余项在 profile 的 `~/.dsh/profiles/<profile>/cordis.patch.yml` 里改,写在 `id: dsh-privacy-gateway` 那一行的 `config` 下;插件包自带的 `cordis.patch.yml` 升级时会被覆盖,不要改它。
|
|
83
103
|
|
|
84
104
|
| 键 | 默认 | 说明 |
|
|
85
105
|
| --- | --- | --- |
|
|
@@ -90,8 +110,9 @@ someone@gmail.com → EMAIL
|
|
|
90
110
|
| `allow` | `[]` | 永不脱敏的值:整值匹配,不分大小写 |
|
|
91
111
|
| `actions` | `{}` | 按 kind 选动作:`mask`(默认,换成占位符)、`warn`(照发并记一条)、`block`(整个请求不发)。例:`{ PRIVATE_KEY: block, EMAIL: warn }`([ADR-0013](docs/adr/0013-actions.md)) |
|
|
92
112
|
| `maskKeys` | `true` | 读起来像密钥或个人信息的 **JSON 键名**也换成占位符(`{"sk-…": …}`);协议自身的键(`model`、`role`、`type`、`name`、`id` 等)、工具定义和工具调用的参数名永不动,否则供应商读不懂请求。关闭后这类键名原样发出([ADR-0029](docs/adr/0029-mask-json-keys.md)) |
|
|
93
|
-
| `toolGuard` | `off` | 工具调用参数里还原出值、又指向本机以外的 host 时怎么办:`off` 只计数,`warn` 告警并记一条,`block`
|
|
94
|
-
| `
|
|
113
|
+
| `toolGuard` | `off` | 工具调用参数里还原出值、又指向本机以外的 host 时怎么办:`off` 只计数,`warn` 告警并记一条,`block` 这次调用的参数里不还原,工具拿到占位符。只有 `restoreLog` 打开时回复里才会有还原值,关闭时这一项不会生效([ADR-0014](docs/adr/0014-tool-guard.md)) |
|
|
114
|
+
| `restoreLog` | `false` | 回复里的占位符在写入会话日志前是否换回真值。默认关闭:占位符原样进日志,明文不进日志,agent 拿到的也是占位符;打开后日志与 agent 都拿到真值,会话同步、备份、分享、导出带走的也是真值([ADR-0003](docs/adr/0003-restore-before-session-log.md)) |
|
|
115
|
+
| `shape` | `false` | 密钥换成同形的假 key(前缀、长度、字符类别不变),而不是 `{{…}}` 占位符;不足 8 个字符、或含字母数字与 `-` `_` `.` 以外字符的值仍用占位符;`restoreLog` 打开时回复里照样还原([ADR-0015](docs/adr/0015-shape.md)) |
|
|
95
116
|
| `cookieNames` | `[]` | 追加要脱敏的 cookie 名 |
|
|
96
117
|
| `cookieKeep` | `['lang', 'locale', 'theme', 'tz']` | 永不脱敏的 cookie 名 |
|
|
97
118
|
| `protectEnvBlock` | `true` | `<env>` … `</env>` 块原样发出,供会校验它的 provider 使用;只保护宿主生成的文本(系统提示词、`system`、`instructions`、`systemInstruction`),用户消息和工具结果里的 `<env>` 不算([ADR-0004](docs/adr/0004-protected-regions.md) 补充) |
|
|
@@ -120,7 +141,7 @@ someone@gmail.com → EMAIL
|
|
|
120
141
|
|
|
121
142
|
## 记录与统计
|
|
122
143
|
|
|
123
|
-
|
|
144
|
+
只记有脱敏或还原的模型请求(`restoreLog` 关闭时没有还原,只记有脱敏的),一条请求一条:时间与耗时、host、model、会话及其工作区与标题、替换处数、每个值的占位符 / kind / finder / 开头 / 长度 / 出现过的每一处(每值最多 8 处,其余只计数)、请求所在的轮次与步数、值首次被发出的轮次与步数、回复里还原的处数(工具参数里的另计,`restoreLog` 关闭时恒为 0),以及值表里没有的占位符数。记录里不写值本身,也不记 URL 的 query([ADR-0008](docs/adr/0008-masking-records.md)、[ADR-0020](docs/adr/0020-record-attribution.md))。
|
|
124
145
|
|
|
125
146
|
「开头」只留辨识用的几个字符:有前缀的留下前缀和其后 4 个,没有的留前 4 个,长值再加末尾 2 个(`sk-proj-g6sx…3QaZ`),短值更少;个人信息和自定义词只留 1 个([ADR-0019](docs/adr/0019-hint.md))。
|
|
126
147
|
|
|
@@ -132,11 +153,12 @@ someone@gmail.com → EMAIL
|
|
|
132
153
|
|
|
133
154
|
## 须知
|
|
134
155
|
|
|
135
|
-
-
|
|
156
|
+
- 从 0.1.x 升级上来:默认不再还原,agent 拿到的是占位符。需要旧行为(agent 与日志都拿到真值)时,在配置页打开 `restoreLog`(「会话日志写入真值」)。
|
|
157
|
+
- 会话日志默认是占位符:`restoreLog` 关闭(默认)时,回复里的占位符原样进日志,明文不进日志,agent 拿到的也是占位符;打开后还原发生在日志落盘之前,日志与 agent 都是真值,会话同步、备份、分享、导出带走的也是真值([ADR-0003](docs/adr/0003-restore-before-session-log.md))。
|
|
136
158
|
- 覆盖面只有走全局 `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
|
-
-
|
|
159
|
+
- 压缩的请求先解压再脱敏;`restoreLog` 打开时压缩的回复也先解码再还原,关闭时压缩的回复原样穿过网关、由适配器按 `content-encoding` 自己解压(用 `undici.request` 直连的 adapter 要自己解压,`fetch` 会自动解)。请求里认不出的 `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
160
|
- 值表只在内存里([ADR-0009](docs/adr/0009-value-table-and-restore-exfiltration.md))。重启后,规则命不中、只靠记忆兜住的值第一次出站会按原文发出。
|
|
139
|
-
-
|
|
161
|
+
- `restoreLog` 打开时,还原发生在回复里,包括工具调用参数:模型被诱导把占位符写进 `curl` 之类的命令时,工具执行时用的是真值。插件只记账(统计卡与 `/privacy status` 里的「工具参数」计数),不拦截([ADR-0009](docs/adr/0009-value-table-and-restore-exfiltration.md));关闭时回复里没有真值,这条路径不存在。
|
|
140
162
|
- 脱敏出错时请求不会发出,报错 `dsh-privacy-gateway: masking failed, request not sent`([ADR-0005](docs/adr/0005-fail-closed.md))。止血办法是 `/privacy off`,或在插件页停用本插件、把配置 `enabled` 设为 `false`。
|
|
141
163
|
|
|
142
164
|
## 开发
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Privacy Gateway
|
|
2
2
|
|
|
3
|
-
Adds a redaction gateway to the dsh process. When a request to a model has a secret in it, such as an API key, a token or a cookie, the value goes out as a placeholder; placeholders in the model's reply are
|
|
3
|
+
Adds a redaction gateway to the dsh process. When a request to a model has a secret in it, such as an API key, a token or a cookie, the value goes out as a placeholder; by default the placeholders in the model's reply reach the agent and the session log as they are, so no plaintext reaches the log, and `restoreLog` puts them back with the real values before the log is written.
|
|
4
4
|
|
|
5
5
|
## Repository
|
|
6
6
|
|
|
@@ -11,10 +11,10 @@ If this project helps you, please give it a star 🌟
|
|
|
11
11
|
## Features
|
|
12
12
|
|
|
13
13
|
- **Masking**: API keys (OpenAI, Anthropic, GitHub, AWS, Alibaba Cloud, Tencent Cloud and other prefixes), JWTs, PEM private keys, passwords in URLs and fields, and cookies; optionally email addresses, phone numbers, ID card and bank card numbers, and your own words.
|
|
14
|
-
- **
|
|
14
|
+
- **No plaintext in the session log**: restore is off by default, so a reply's placeholders reach the agent and the session log as they are; with `restoreLog` on, JSON replies are restored whole and SSE replies event by event, including a placeholder split between two events.
|
|
15
15
|
- **Cache-friendly**: one value is the same placeholder every turn, so the prompt cache still hits.
|
|
16
16
|
- **An action per kind**: mask, send as written and record (warn), or not send the request at all (block).
|
|
17
|
-
- **Exfiltration guard**: when a tool call's arguments would get a real value back and name a host off this machine, warn, or leave the placeholder in.
|
|
17
|
+
- **Exfiltration guard**: with `restoreLog` on, when a tool call's arguments would get a real value back and name a host off this machine, warn, or leave the placeholder in.
|
|
18
18
|
- **Look-alike keys**: optionally send a key as a made-up one with the same prefix, length and kinds of character, so the model cannot tell it was masked; a value under 8 characters, or with unusual characters, keeps the placeholder.
|
|
19
19
|
- **Records and statistics**: only requests with something masked or restored are recorded, and a record never holds a value. The `/privacy` command shows the state and a preview; the plugin's detail page has a statistics card, and a Privacy tab can be turned on at the top of the session.
|
|
20
20
|
- **Fails closed**: when masking fails, the request is not sent; `/privacy off` turns masking off for the moment.
|
package/docs/details/DETAIL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# 隐私网关
|
|
2
2
|
|
|
3
|
-
在 dsh 的进程里装一层脱敏网关:发给模型的请求里出现密钥、令牌、cookie
|
|
3
|
+
在 dsh 的进程里装一层脱敏网关:发给模型的请求里出现密钥、令牌、cookie 等敏感值时,先换成占位符再发出;模型回复里的占位符默认原样交给 agent、原样写进会话日志(明文不进日志),打开 `restoreLog` 才在落盘前换回真值。
|
|
4
4
|
|
|
5
5
|
## 项目仓库
|
|
6
6
|
|
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
## 功能
|
|
12
12
|
|
|
13
13
|
- **脱敏**:API key(OpenAI、Anthropic、GitHub、AWS、阿里云、腾讯云等前缀)、JWT、PEM 私钥、URL 和字段里的密码、cookie;可选脱敏邮箱、手机号、身份证号、银行卡号,以及自己配置的词。
|
|
14
|
-
-
|
|
14
|
+
- **日志不写真值**:默认不还原,回复里的占位符原样进会话日志和 agent;打开 `restoreLog` 后 JSON 回复整包还原,SSE 流式回复逐条事件还原,占位符被切在两条事件之间也能拼回。
|
|
15
15
|
- **保持缓存**:同一个值每轮都是同一个占位符,prompt cache 照常命中。
|
|
16
16
|
- **按 kind 选动作**:脱敏、照发并记录(warn),或整个请求不发(block)。
|
|
17
|
-
-
|
|
17
|
+
- **外带守卫**:`restoreLog` 打开时,工具调用参数里还原出真值、又指向本机以外的 host 时,告警,或者不还原。
|
|
18
18
|
- **同形伪装**:可选把密钥换成前缀、长度、字符类别都相同的假 key,模型看不出被脱敏过;不足 8 个字符或含特殊字符的值仍用占位符。
|
|
19
19
|
- **记录与统计**:只记脱敏和还原过的请求,记录里不写值本身;`/privacy` 命令查看状态和预览,插件详情页有统计卡,也可以在会话顶部打开「隐私保护」标签页。
|
|
20
20
|
- **失败不放行**:脱敏出错时请求不发出;`/privacy off` 可以临时关掉。
|
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 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=`
|
|
3
|
+
"use strict";var be=require("react");var ye=require("@deepseek-ai/dsh-client-ui-primitives"),g=require("react");var L=require("@deepseek-ai/dsh-client-ui-primitives"),w=require("react");var ie=["mask","lists","record","view"],le=[{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:"restoreLog",group:"mask",kind:"switch",default:!1,risk:"log",riskWhen:"on"},{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 Ke(e,t,n){if(e.risk)switch(e.kind){case"switch":{let a=ae(t,e.default),r=ae(n,e.default);return(e.riskWhen==="on"?!a&&r:a&&!r)?{risk:e.risk}:void 0}case"list":case"providers":{let a=e.kind==="providers"||e.anyCase,r=u=>a?u.trim().toLowerCase():u.trim(),s=(u,h)=>{let _=new Set(u.map(r));return h.filter(k=>!_.has(r(k)))},i=W(t,e.default),l=W(n,e.default);if(e.kind==="list"&&e.risky==="remove"){let u=s(l,i);return u.length>0?{risk:e.risk,removed:u}:void 0}let d=s(i,l);return d.length>0?{risk:e.risk,added:d}:void 0}case"count":{let a=re(t,e.min,e.default),r=re(n,e.min,e.default);return r<a?{risk:e.risk,from:a,to:r}:void 0}case"choice":return}}function De(e){return e.kind==="switch"||e.kind==="choice"||e.kind==="count"}function Z(e,t){let n=le.find(a=>a.key===e&&a.kind===t);if(!n)throw new Error(`no ${t} field ${e}`);return n}function Ve(e,t){let n=a=>ae(t[a],Z(a,"switch").default);switch(e){case"mask":{if(!n("enabled"))return[{key:"cfg.s.maskOff",off:!0}];let a=["secrets","personal"].filter(n),r=a.length===0?[{key:n("maskKeys")?"cfg.s.maskKeysOnly":"cfg.s.maskNothing",off:!0}]:a.map(i=>({key:`cfg.s.${i}`}));n("shape")&&r.push({key:"cfg.s.shape"});let s=Z("toolGuard","choice");return r.push({key:`cfg.s.toolGuard.${_e(t.toolGuard,s.choices,s.default)}`}),n("restoreLog")&&r.push({key:"cfg.s.restoreLog"}),r}case"lists":return[{key:"cfg.s.words",params:{n:W(t.words,Z("words","list").default).length}},{key:"cfg.s.allow",params:{n:W(t.allow,Z("allow","list").default).length}}];case"record":{let a=Z("keepDays","count"),r=n("record")?[{key:"cfg.s.record",params:{n:re(t.keepDays,a.min,a.default)}}]:[{key:"cfg.s.recordOff",off:!0}];return n("vendorView")&&r.push({key:"cfg.s.vendorView"}),r}case"view":{let a=W(t.excludeProviders,Z("excludeProviders","providers").default).length;return[n("showPanel")?{key:"cfg.s.panel"}:{key:"cfg.s.panelOff",off:!0},a===0?{key:"cfg.s.providersAll"}:{key:"cfg.s.providersSome",params:{n:a}}]}}}function ae(e,t){return typeof e=="boolean"?e:t}function _e(e,t,n){return typeof e=="string"&&t.includes(e)?e:n}function W(e,t){return Array.isArray(e)?e.filter(n=>typeof n=="string"):[...t]}function re(e,t,n){return typeof e=="number"&&Number.isFinite(e)&&e>=t?Math.floor(e):n}function $e(e,t,n){let a=t.trim();if(a==="")return;let r=n?s=>s.trim().toLowerCase()===a.toLowerCase():s=>s.trim()===a;return e.some(r)?void 0:[...e,a]}function ze(e,t){return e.filter(n=>n!==t)}function Be(e,t){let n=e.trim();if(!/^\d+$/.test(n))return;let a=Number(n);return Number.isSafeInteger(a)&&a>=t?a:void 0}function He(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 Ge(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 We(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)(L.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)(L.Switch,{checked:e.checked,label:e.label,disabled:e.disabled,onChange:e.onChange})}function Ne(e){let[t,n]=(0,w.useState)(!1),a=(0,w.useId)();return(0,w.useEffect)(()=>{e.disabled&&n(!1)},[e.disabled]),(0,w.createElement)(L.Menu,{open:t,onClose:()=>n(!1),items:e.items,...e.multi?{selectedIds:e.selectedIds??[],selection:"check"}:{selectedId:e.selectedId},onSelect:r=>{e.multi||n(!1),e.onSelect(r)},align:"start",portal:!0,anchor:(0,w.createElement)("button",{type:"button",className:"pgw-select","aria-haspopup":"menu","aria-expanded":t,"aria-labelledby":e.labelledBy?`${e.labelledBy} ${a}`:void 0,disabled:e.disabled||e.items.length===0,onClick:()=>n(r=>!r)},(0,w.createElement)("span",{className:"pgw-select__label",id:a},e.label),(0,w.createElement)(L.IconChevronDownOutlineRegular,{className:"pgw-select__chevron"}))})}function qe(e){let{t}=e,[n,a]=(0,w.useState)(""),[r,s]=(0,w.useState)(!1),i=$e(e.list,n,e.anyCase),l=()=>{if(!i||e.disabled||r)return;let d=n;s(!0),e.onChange(i).then(u=>{s(!1),u&&a(h=>h===d?"":h)})};return(0,w.createElement)("div",{className:"pgw-cfg__list"},(0,w.createElement)("div",{className:"pgw-cfg__add"},(0,w.createElement)(L.Input,{className:"pgw-cfg__input",type:"text",value:n,placeholder:e.placeholder,"aria-label":e.label,disabled:e.disabled,onChange:d=>a(d.target.value),onKeyDown:d=>{d.key==="Enter"&&(d.preventDefault(),l())}}),(0,w.createElement)(L.Button,{variant:"outline",size:"sm",disabled:e.disabled||r||!i,onClick:l},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(d=>(0,w.createElement)(L.Tag,{key:d,tone:"neutral",className:"pgw-cfg__tag",title:d},(0,w.createElement)("span",{className:"pgw-cfg__tagText"},d),(0,w.createElement)("button",{type:"button",className:"pgw-cfg__tagX","aria-label":t("cfg.remove",{name:d}),disabled:e.disabled,onClick:()=>{e.onChange(ze(e.list,d))}},(0,w.createElement)(L.IconCloseOutlineRegular,{size:12}))))))}function Ye(e){let[t,n]=(0,w.useState)(String(e.value)),a=(0,w.useRef)(void 0);(0,w.useEffect)(()=>n(String(e.value)),[e.value]);let r=Be(t,e.min),s=()=>{r===void 0||r===e.value||r===a.current||(a.current=r,e.onChange(r).then(()=>{a.current=void 0}))};return(0,w.createElement)("div",{className:"pgw-cfg__list"},(0,w.createElement)(L.Input,{className:"pgw-cfg__input pgw-cfg__input--count",type:"number",inputMode:"numeric",min:e.min,step:1,value:t,"aria-label":e.label,"aria-invalid":r===void 0,disabled:e.disabled,onChange:i=>n(i.target.value),onBlur:s,onKeyDown:i=>{i.key==="Enter"&&s()}}),r===void 0?(0,w.createElement)("div",{className:"pgw-cfg__desc pgw-cfg__desc--error",role:"alert"},e.t("cfg.countInvalid",{min:e.min})):null)}function Je(e,t=6,n="\u2026"){let a=Object.entries(e).filter(([,l])=>l>0).sort((l,d)=>d[1]-l[1]||(l[0]<d[0]?-1:1)),r=a.slice(0,t),s=a.slice(t).reduce((l,[,d])=>l+d,0);s>0&&r.push([n,s]);let i=r.reduce((l,[,d])=>Math.max(l,d),0);return r.map(([l,d])=>({label:l,value:d,pct:i>0?Math.max(2,Math.round(d/i*100)):0}))}var qt={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"},Yt={rule:"hint.finder.rule",word:"hint.finder.word",known:"hint.finder.known",cookie:"hint.finder.cookie"};function Ue(e){return qt[e]}function Qe(e){return Yt[e]}function Xe(e,t){return e.filter(n=>(t.kind===void 0||n.kind===t.kind)&&(t.finder===void 0||n.finder===t.finder))}function Se(e,t){return[...new Set(e.map(n=>n[t]).filter(n=>n!==""))].sort()}function Ze(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 et(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 Te(e,t=new Date){let n=new Date(e);if(Number.isNaN(n.getTime()))return"";let a=s=>String(s).padStart(2,"0");return n.getFullYear()===t.getFullYear()&&n.getMonth()===t.getMonth()&&n.getDate()===t.getDate()?`${a(n.getHours())}:${a(n.getMinutes())}:${a(n.getSeconds())}`:`${a(n.getMonth()+1)}-${a(n.getDate())} ${a(n.getHours())}:${a(n.getMinutes())}`}var q=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),R=e=>typeof e=="number"&&Number.isFinite(e)?e:0;function de(e){let t={};if(q(e))for(let[n,a]of Object.entries(e))typeof a=="number"&&Number.isFinite(a)&&(t[n]=a);return t}function Ce(e){if(!q(e))return;let t=q(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:de(e.kinds),finders:de(e.finders),hosts:de(e.hosts),models:de(e.models)}}function Jt(e){return q(e)&&typeof e.key=="number"&&typeof e.time=="string"&&Array.isArray(e.values)&&e.values.every(q)}function tt(e){if(!(!q(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 Ut(e){if(!Array.isArray(e))return[];let t=[],n=new Set;for(let a of e){let r=tt(a);r===void 0||n.has(r.path)||(n.add(r.path),t.push(r))}return t}var Qt=7,Re=e=>Math.max(0,Math.floor(R(e)));function Xt(e){if(typeof e.placeholder!="string"||e.placeholder==="")return;let t=h=>typeof h=="string"?h:void 0,n=t(e.tail),a=t(e.before),r=t(e.after),s=tt(e.at),i=ce(e.first??{}),l=Ut(e.elsewhere),d=l.slice(0,Qt),u=Re(e.elsewhereOmitted)+l.length-d.length;return{placeholder:e.placeholder,kind:t(e.kind)??"",finder:t(e.finder)??"",head:t(e.head)??"",...n!==void 0?{tail:n}:{},len:Re(e.len),n:Re(e.n),...e.action==="warn"||e.action==="block"?{action:e.action}:{},...a!==void 0?{before:a}:{},...r!==void 0?{after:r}:{},...s?{at:s}:{},...i?{first:i}:{},...d.length>0?{elsewhere:d}:{},...u>0?{elsewhereOmitted:u}:{}}}function ce(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 nt(e){return`${e.turn}\xB7${e.step}`}function Zt(e){let{valuesOmitted:t,turn:n,step:a,model:r,host:s,what:i,tookMs:l,title:d,workspace:u,session:h,exfil:_,exfilHosts:k,restoredInTools:y,warned:m,failed:A,blocked:E,relay:V,...$}=e,D=K=>typeof K=="string"?K:void 0,f=R(t),F=ce({turn:n,step:a}),B=D(r),I=D(d),H=D(u),N=D(h),X=R(_),se=R(y),z=R(m),te=Array.isArray(k)?k.filter(K=>typeof K=="string"):void 0;return{...$,host:D(s)??"",what:i==="chat"||i==="embeddings"||i==="count"||i==="search"?i:"chat",tookMs:R(l),n:R(e.n),restored:R(e.restored),unmapped:R(e.unmapped),values:e.values.map(Xt).filter(K=>K!==void 0),...B!==void 0?{model:B}:{},...I!==void 0?{title:I}:{},...H!==void 0?{workspace:H}:{},...N!==void 0?{session:N}:{},...X>0?{exfil:X}:{},...te!==void 0&&te.length>0?{exfilHosts:te}:{},...se>0?{restoredInTools:se}:{},...z>0?{warned:z}:{},...A===!0?{failed:!0}:{},...E===!0?{blocked:!0}:{},...V===!0?{relay:!0}:{},...f>0?{valuesOmitted:f}:{},...F??{}}}function at(e){if(!q(e)||typeof e.active!="boolean"||!q(e.stats)||!Array.isArray(e.recent))return;let t=Ce(e.stats.today),n=Ce(e.stats.week),a=Ce(e.stats.month);if(!t||!n||!a)return;let{restoreLog:r,...s}=e;return{...s,...typeof r=="boolean"?{restoreLog:r}:{},values:R(e.values),stats:{today:t,week:n,month:a,failStreak:R(e.stats.failStreak)},recent:e.recent.filter(Jt).map(Zt),...Array.isArray(e.views)?{views:e.views.filter(i=>typeof i=="number")}:{}}}function rt(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}}function ot(e){return e.n===0&&e.failed!==!0&&(e.unmapped??0)===0}var en=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");function st(e){let t=e;try{t=JSON.stringify(JSON.parse(e),null,2)}catch{}return t.split(`
|
|
4
|
+
`)}function it(e){return e.map(t=>t.placeholder).join("\0")}function lt(e,t,n,a=400){let r=[...new Set(t.filter(d=>d!==""))].sort((d,u)=>u.length-d.length),s=r.length>0?new RegExp(r.map(en).join("|"),"g"):void 0,i=[],l=!1;for(let d=0;d<e.length;d++){let u=e[d],h=[],_=0;if(s)for(let k of u.matchAll(s))k.index>_&&h.push({text:u.slice(_,k.index)}),h.push({text:k[0],id:k[0]}),_=k.index+k[0].length;if(!(n&&_===0)){if((_<u.length||h.length===0)&&h.push({text:u.slice(_)}),i.length>=a){l=!0;break}i.push({n:d+1,parts:h})}}return{lines:i,truncated:l}}function dt(e,t,n){let a=Math.max(1,Math.ceil(e.length/n)),r=Math.min(Math.max(0,Math.floor(t)),a-1);return{items:e.slice(r*n,r*n+n),page:r,pages:a}}function ct(e){let{path:t,role:n,type:a}=e,r=t.split(".")[0]??"";return n==="system"||n==="developer"||r==="system"||r==="instructions"||r==="systemInstruction"?"place.system":n==="tool"||a==="tool_result"||a==="function_call_output"||a==="functionResponse"?"place.toolResult":a==="tool_use"||a==="function_call"||/(^|\.)(tool_calls|function_call)(\.|$)/.test(t)||t.endsWith(".arguments")?"place.toolCall":n==="user"?"place.user":n==="assistant"||n==="model"?"place.assistant":"place.other"}function Oe(e){let t=e.split("."),n=t[0]??"",a=t[1]??"";return n!==""&&/^\d+$/.test(a)?`${n}.${a}`:n}function pt(e,t){let n=[...new Set((e.elsewhere??[]).map(r=>Oe(r.path)))].filter(r=>r!=="").join(t("recent.placeSep")),a=e.elsewhereOmitted??0;return n===""?a>0?t("recent.elsewhereOmitted",{n:a}):"":a>0?t("recent.elsewhereMore",{paths:n,n:a}):t("recent.elsewhere",{paths:n})}function pe(e){return e.head?e.tail?`${e.head}\u2026${e.tail}`:`${e.head}\u2026`:""}function Y(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 oe(e,t,n,a,r){let s;try{s=e.get("connection")?.rpc}catch{s=void 0}if(!s||typeof s.call!="function")return{ok:!1,failure:{code:"noConnection"}};try{let i=n===void 0?{}:{request:n},l=await s.call("/api",`privacyGateway/${t}`,{args:i},r);if(l?.ok!==!0){let u=l?.error?.message;return{ok:!1,failure:typeof u=="string"&&u!==""?{code:"remote",message:u}:{code:"malformed"}}}let d=a(l.value);return d===void 0?{ok:!1,failure:{code:"malformed"}}:{ok:!0,value:d}}catch(i){return{ok:!1,failure:{code:"thrown",message:i instanceof Error?i.message:String(i)}}}}function ue(e,t,n,a){return oe(e,"overview",a?{limit:t,session:a}:{limit:t},at,n)}function ut(e,t,n){return oe(e,"vendorView",{key:t},a=>{if(a===null)return null;let r=a?.body;return typeof r=="string"?r:void 0},n)}function ft(e){return oe(e,"reset",void 0,t=>{let n=t?.files;return typeof n=="number"?n:0})}function gt(e,t,n){return oe(e,"sessionMasking",{session:t,on:n},a=>{let r=a?.on;return typeof r=="boolean"?r:void 0})}function mt(e,t){return oe(e,"providers",void 0,n=>Array.isArray(n)?n.flatMap(tn):void 0,t)}function tn(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 fe(e){let t=e,n=new Set;return{get:()=>t,set(a){if(!Object.is(a,t)){t=a;for(let r of[...n])try{r()}catch{}}},subscribe(a){return n.add(a),()=>{n.delete(a)}}}}var nn="Show the Privacy tab at the top of the session";function an(e){let t=e,n=t?.refs,r=(n!==null&&typeof n=="object"&&typeof t?.uid<"u"?n[String(t.uid)]:void 0)?.dict??t?.dict;return r!==null&&typeof r=="object"?Object.keys(r):[]}function Ae(e){for(let t of e){let n=an(t.schema);if(n.includes("showPanel")&&(t.ns.includes("privacy-gateway")||n.includes("excludeProviders")||JSON.stringify(t.schema??null).includes(nn)))return t.ns}}function rn(e){let t=Ae(e);if(t===void 0)return;let n=e.find(a=>a.ns===t)?.value;return typeof n=="object"&&n!==null&&n.showPanel===!0}function on(e){let t=e;return t!=null&&typeof t.describe=="function"&&typeof t.get=="function"?t:void 0}var Q=fe(void 0);function ht(e){let t=n=>n.effect(()=>{let a;try{a=on(n.get("configForms"))}catch{a=void 0}return Q.set(a),()=>{Q.get()===a&&Q.set(void 0)}},"dsh-privacy-gateway: settings service");typeof e.inject=="function"?e.inject(["configForms"],t):t(e)}var sn=6e4;function ln(e,t){return t===void 0?e:t||e===!0?!0:e===!1?!1:void 0}function wt(e,t,n=Q){let a=!1,r,s,i,l=()=>{if(a)return;let y=ln(s,i);y===void 0||y===r||(r=y,t(y))},d=()=>{ue(e,1).then(y=>{a||!y.ok||(s=y.value.showPanel===!0,l())})},u,h=y=>{try{u?.()}catch{}u=void 0,i=void 0;let m;try{m=y?.describe()}catch{m=void 0}if(m){let A=m,E=()=>{if(a)return;let V=A.getSnapshot().view;if(!V)return;let $=rn(V.namespaces);$!==void 0&&(i=$,l())};u=A.subscribe(E),Promise.resolve(A.ensure()).then(E,E),E()}l()},_=n.subscribe(()=>h(n.get()));h(n.get()),d();let k=setInterval(d,sn);return()=>{a=!0,clearInterval(k),_();try{u?.()}catch{}}}function yt(e,t){let n=r=>t.some(s=>s.toLowerCase()===r.toLowerCase()),a=e.map(r=>({id:r.id,name:r.name,excluded:n(r.id),registered:!0}));for(let r of t)a.some(s=>s.id.toLowerCase()===r.toLowerCase())||a.push({id:r,name:r,excluded:!0,registered:!1});return a}function kt(e,t){let n=t.toLowerCase();return e.some(a=>a.toLowerCase()===n)?e.filter(a=>a.toLowerCase()!==n):[...e,t]}var Mt=require("react");var bt={"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.restoreOff":"\u5DF2\u5173\u95ED","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.unmapped":"\u56DE\u590D\u91CC\u6709 {n} \u4E2A\u503C\u8868\u91CC\u6CA1\u6709\u7684\u5360\u4F4D\u7B26\uFF1A\u53EF\u80FD\u662F\u6A21\u578B\u628A\u5360\u4F4D\u7B26\u6539\u574F\u4E86\uFF0C\u4E5F\u53EF\u80FD\u5B83\u5728\u590D\u8FF0\u793A\u4F8B\u6216\u91CD\u542F\u524D\u7684\u503C\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","panel.diagramAgent":"agent / adapter","panel.diagramGateway":"\u9690\u79C1\u7F51\u5173","panel.diagramGatewaySub":"\u8131\u654F \xB7 \u8FD8\u539F","panel.diagramVendor":"\u6A21\u578B\u670D\u52A1","panel.diagramRequest":"\u2460 \u8BF7\u6C42","panel.diagramReply":"\u2461 \u56DE\u590D","panel.diagramPlaceholder":"\u5360\u4F4D\u7B26","panel.diagramNote":"\u5BC6\u94A5\u3001\u51ED\u636E\u3001\u4E2A\u4EBA\u4FE1\u606F\u5728\u79BB\u5F00\u672C\u673A\u524D\u6362\u6210\u5360\u4F4D\u7B26\uFF1B\u56DE\u590D\u9ED8\u8BA4\u4E0D\u8FD8\u539F\uFF0C\u5360\u4F4D\u7B26\u539F\u6837\u8FDB\u4F1A\u8BDD\u65E5\u5FD7\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\u3002restoreLog \u6253\u5F00\u65F6\uFF0C\u56DE\u590D\u91CC\u7684\u5047 key \u7167\u6837\u6362\u56DE\u771F\u503C\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\uFF1BrestoreLog \u6253\u5F00\u65F6\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\u53EA\u6709 restoreLog \u6253\u5F00\u65F6\u624D\u53EF\u80FD\u6709\u8FD8\u539F\u503C\uFF0C\u5173\u95ED\u65F6\u5B83\u4E0D\u4F1A\u751F\u6548\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.restoreLog":"\u4F1A\u8BDD\u65E5\u5FD7\u5199\u5165\u771F\u503C","cfg.f.restoreLog.hint":"\u5173\u95ED\uFF08\u9ED8\u8BA4\uFF09\u65F6\uFF0C\u56DE\u590D\u91CC\u7684\u5360\u4F4D\u7B26\u539F\u6837\u5199\u8FDB\u4F1A\u8BDD\u65E5\u5FD7\uFF0C\u660E\u6587\u4E0D\u8FDB\u65E5\u5FD7\uFF0Cagent \u62FF\u5230\u7684\u4E5F\u662F\u5360\u4F4D\u7B26\uFF1B\u6253\u5F00\u540E\u5360\u4F4D\u7B26\u5728\u843D\u76D8\u524D\u6362\u56DE\u771F\u503C\uFF0Cagent \u4E0E\u65E5\u5FD7\u90FD\u62FF\u5230\u771F\u503C\u2014\u2014\u56DE\u590D\u65B9\u5411\u53EA\u6709\u8FD9\u4E00\u4E2A\u8FD8\u539F\u70B9\uFF0C\u4E24\u8FB9\u5FC5\u7136\u4E00\u81F4\u3002\u6253\u5F00\u540E\u4F1A\u8BDD\u540C\u6B65\u3001\u5907\u4EFD\u3001\u5206\u4EAB\u3001\u5BFC\u51FA\u4F1A\u5E26\u8D70\u771F\u503C\uFF0C\u6240\u4EE5\u6253\u5F00\u524D\u8981\u786E\u8BA4\u3002","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.restoreLog":"\u65E5\u5FD7\u5199\u771F\u503C","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\uFF0CrestoreLog \u6253\u5F00\u65F6\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.log.title":"\u8FD9\u9879\u6539\u52A8\u4F1A\u8BA9\u771F\u503C\u5199\u8FDB\u4F1A\u8BDD\u65E5\u5FD7","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.log.ack":"\u6211\u77E5\u9053\u771F\u503C\u4F1A\u5199\u8FDB\u4F1A\u8BDD\u65E5\u5FD7\uFF0C\u5E76\u968F\u540C\u6B65\u3001\u5907\u4EFD\u3001\u5206\u4EAB\u3001\u5BFC\u51FA\u5E26\u8D70","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.restoreLog":"\u6253\u5F00\u540E\uFF0C\u56DE\u590D\u91CC\u7684\u5360\u4F4D\u7B26\u5728\u5199\u5165\u4F1A\u8BDD\u65E5\u5FD7\u524D\u6362\u56DE\u771F\u503C\uFF1A\u771F\u503C\u4F1A\u5199\u8FDB\u4F1A\u8BDD\u65E5\u5FD7\uFF0C\u5E76\u968F\u5B83\u7684\u540C\u6B65\u3001\u5907\u4EFD\u3001\u5206\u4EAB\u3001\u5BFC\u51FA\u5E26\u8D70\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"};var vt={"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.restoreOff":"Off","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.unmapped":"The reply has {n} placeholders the value table has no value for: a model may have changed them, or be repeating an example or a value from before the restart.","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.","panel.diagramAgent":"agent / adapter","panel.diagramGateway":"privacy gateway","panel.diagramGatewaySub":"mask \xB7 restore","panel.diagramVendor":"model service","panel.diagramRequest":"\u2460 request","panel.diagramReply":"\u2461 reply","panel.diagramPlaceholder":"placeholder","panel.diagramNote":"Secrets, credentials and personal data leave this machine as placeholders; by default a reply is not restored, so the session log keeps the placeholders.","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. With restoreLog on, replies put the made-up key back the same way.","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 with restoreLog on. 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. A reply holds a real value only with restoreLog on; with it off this guard never runs.","cfg.f.toolGuard.off":"Count only","cfg.f.toolGuard.warn":"Warn and record","cfg.f.toolGuard.block":"Do not restore","cfg.f.restoreLog":"Real values in the session log","cfg.f.restoreLog.hint":"Off (the default), a reply\u2019s placeholders go into the session log as they are: no plaintext reaches the log, and the agent sees placeholders too. On, they are put back before the log is written, so the agent and the log both hold the real values \u2014 the reply has this one restore point, so the two cannot differ. With it on, session sync, backups, shares and exports carry the real values, so turning it on asks first.","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.restoreLog":"Real values in log","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; with restoreLog on they are 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.log.title":"This change writes real values into the session log","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.log.ack":"I understand the real values go into the session log and travel with its sync, backups, shares and exports","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.restoreLog":"On, a reply\u2019s placeholders become the real values before the session log is written: those values go into the log and travel with its sync, backups, shares and exports.","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."};var J="privacyGateway";var xt={zh:bt,en:vt};var T=require("@deepseek-ai/dsh-client-ui-primitives"),p=require("react");var x=require("@deepseek-ai/dsh-client-ui-primitives"),o=require("react");var ge=require("@deepseek-ai/dsh-client-ui-primitives"),b=require("react");function dn(e,t){if(!e)return t("view.unknown");let n=e.action?` \xB7 ${t(e.action==="warn"?"action.warn":"action.block")}`:"",a=pe(e);return`\u2039${e.kind} \xB7 ${a?`${a} \xB7 `:""}${e.len}${n}\u203A`}function _t(e,t,n,a){return e.parts.map((r,s)=>r.id===void 0?r.text:(0,b.createElement)("mark",{key:s,className:`pgw-view__mark${n?" pgw-view__mark--agent":""}`,title:r.id},n?dn(t.get(r.id),a):r.text))}function Nt(e){let{ctx:t,t:n,record:a}=e,[r,s]=(0,b.useState)({status:"loading"}),[i,l]=(0,b.useState)(!0);(0,b.useEffect)(()=>{let m=new AbortController;return s({status:"loading"}),ut(t,a.key,m.signal).then(A=>{m.signal.aborted||s(A.ok?A.value===null?{status:"gone"}:{status:"ready",body:A.value}:{status:"error",failure:A.failure})}),()=>m.abort()},[t,a.key]);let d=it(a.values),u=(0,b.useMemo)(()=>new Map(a.values.map(m=>[m.placeholder,m])),[a.key,d]),h=r.status==="ready"?r.body:void 0,_=(0,b.useMemo)(()=>h!==void 0?st(h):void 0,[h]),k=(0,b.useMemo)(()=>_?lt(_,[...u.keys()],i):void 0,[_,u,i]),y=(0,b.createElement)("div",{className:"pgw-head"},(0,b.createElement)("span",{className:"pgw-dist__title"},n("view.title")),(0,b.createElement)(ge.Checkbox,{checked:i,label:n("view.onlyChanged"),className:"pgw-meta",onChange:l}),(0,b.createElement)("span",{className:"pgw-spacer"}),(0,b.createElement)(ge.Button,{variant:"outline",size:"sm",onClick:e.onClose},n("view.close")));if(!k){let m=r.status==="loading"?n("view.loading"):r.status==="gone"?n("view.gone"):r.status==="error"?n("view.failed",{reason:Y(r.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"},..._t(m,u,!0,n)),(0,b.createElement)("td",{className:"pgw-view__code"},..._t(m,u,!1,n))))))),k.truncated?(0,b.createElement)("div",{className:"pgw-meta"},n("view.truncated",{n:k.lines.length})):null)}function Rt(e){return e.items.length===0?null:(0,o.createElement)("div",{className:"pgw-notices",role:"status"},e.items.map(t=>(0,o.createElement)("div",{key:t.key,className:`pgw-notice pgw-notice--${t.tone}`},(0,o.createElement)(x.IconWarningOutlineRegular,{size:14,className:"pgw-notice__icon"}),(0,o.createElement)("span",null,e.t(t.key,{n:t.n})))))}function St(e){let{totals:t,t:n}=e,a=l=>(l??0).toLocaleString(),r=et(t),s=e.restoreLog===!1,i=[{label:n("stat.requests"),value:a(t.requests)},{label:n("stat.masked"),value:a(t.masked)},{label:n("stat.n"),value:a(t.n)},{label:n("stat.restored"),value:s?n("stat.restoreOff"):a(t.restored),...!s&&t.restoredInTools>0?{sub:n("stat.inTools",{n:t.restoredInTools})}:{}},{label:n("stat.unmapped"),value:s?n("stat.restoreOff"):a(t.unmapped),...!s&&t.unmapped>0?{tone:"warn"}:{}},{label:n("stat.failed"),value:a(t.failed),...t.failed>0?{tone:"error"}:{}}];return(t.warned??0)>0&&i.push({label:n("stat.warned"),value:a(t.warned),tone:"warn"}),(t.blocked??0)>0&&i.push({label:n("stat.blocked"),value:a(t.blocked),tone:"warn"}),(t.exfil??0)>0&&i.push({label:n("stat.exfil"),value:a(t.exfil),tone:"error",...(t.exfilBlocked??0)>0?{sub:n("stat.exfilBlocked",{n:t.exfilBlocked})}:{}}),t.requests>0&&i.push({label:n("stat.took"),value:n("stat.ms",{n:r.avg}),sub:n("stat.tookMax",{max:r.max})}),(0,o.createElement)("div",{className:"pgw-kpis"},i.map(l=>(0,o.createElement)("div",{key:l.label,className:`pgw-kpi${l.tone?` pgw-kpi--${l.tone}`:""}`},(0,o.createElement)("span",{className:"pgw-kpi__label"},l.label),(0,o.createElement)("span",{className:"pgw-kpi__value"},l.value),l.sub?(0,o.createElement)("span",{className:"pgw-kpi__sub"},l.sub):null)))}function Ee(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 cn(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 me(e){let{t,field:n}=e,a=Je(e.data,6,e.others),r=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)(Ee,{t,field:n,note:!0})});return(0,o.createElement)("div",{className:"pgw-dist"},(0,o.createElement)("div",{className:"pgw-section__title"},r),a.length===0?(0,o.createElement)("div",{className:"pgw-empty"},e.empty):a.map(s=>{let i=n===void 0?void 0:(n==="kind"?Ue:Qe)(s.label),l=(0,o.createElement)("span",i===void 0?{className:"pgw-bar__label",title:s.label}:{className:"pgw-bar__label pgw-bar__label--hint"},s.label),d=i===void 0||n===void 0?l:(0,o.createElement)(x.HoverCard,{anchor:l,content:(0,o.createElement)(cn,{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"},d,(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 Tt(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 Ct(e){let{t,field:n}=e,[a,r]=(0,o.useState)(!1),s=t(n==="kind"?"col.kind":"col.finder"),i=[{id:Ie,label:t("filter.all")},...e.names.map(d=>({id:d,label:d}))],l=(0,o.createElement)("button",{type:"button",className:`pgw-filter${e.value===void 0?"":" pgw-filter--on"}`,"aria-haspopup":"menu","aria-expanded":a,"aria-label":t("filter.aria",{name:t(n==="kind"?"filter.kind":"filter.finder"),value:e.value??t("filter.all")}),onClick:()=>r(d=>!d)},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:a,onClose:()=>r(!1),items:i,selectedId:e.value??Ie,onSelect:d=>{r(!1),e.onChange(d===Ie?void 0:d)},align:"start",portal:!0,anchor:(0,o.createElement)(x.HoverCard,{anchor:l,content:e.hint,disabled:a})})}function Ot(e){let{r:t,t:n}=e,[a,r]=(0,o.useState)(!1),[s,i]=(0,o.useState)(void 0),[l,d]=(0,o.useState)(void 0),u=Xe(t.values,{...s===void 0?{}:{kind:s},...l===void 0?{}:{finder:l}}),h=Se(t.values,"kind"),_=Se(t.values,"finder"),k=(0,o.useId)(),y=ce(t),m=y?n("recent.stepAt",y):"",A=y?n("recent.stepSent",y):"",E=[t.workspace,t.title??t.session].filter(f=>typeof f=="string"&&f!=="").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()),$=t.failed?n("recent.failed"):t.blocked?n("recent.blocked"):t.n.toLocaleString(),D=[[n("recent.col.time"),Te(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"),E],[n("recent.col.places"),$],[n("recent.col.restored"),t.unmapped>0?`${t.restored.toLocaleString()} (+${t.unmapped})`:t.restored.toLocaleString()]].filter(([,f])=>f!=="").map(([f,F])=>n("recent.cell",{name:f,value:F})).join(n("recent.cellSep"));return(0,o.createElement)("li",{className:"pgw-recs__item"},(0,o.createElement)("button",{type:"button",className:`pgw-rec${ot(t)?" 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"},Te(t.time)),(0,o.createElement)("span",{className:"pgw-rec__step",title:m||void 0},y?nt(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:E},E),(0,o.createElement)("span",{className:"pgw-rec__num"},V),(0,o.createElement)("span",{className:"pgw-rec__num pgw-rec__dim"},t.restored.toLocaleString(),t.unmapped>0?(0,o.createElement)("span",{className:"pgw-rec__unknown",title:n("recent.unmapped",{n:t.unmapped})},` ?${t.unmapped}`):null)),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,t.unmapped>0?(0,o.createElement)("div",{className:"pgw-notice pgw-notice--warn"},(0,o.createElement)(x.IconWarningOutlineRegular,{size:14,className:"pgw-notice__icon"}),(0,o.createElement)("span",null,n("recent.unmapped",{n:t.unmapped}))):null,y?(0,o.createElement)("div",{className:"pgw-meta"},A):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)(Ct,{t:n,field:"kind",names:h,value:s,hint:(0,o.createElement)(Ee,{t:n,field:"kind"}),onChange:i})),(0,o.createElement)("th",{key:"col.finder"},(0,o.createElement)(Ct,{t:n,field:"finder",names:_,value:l,hint:(0,o.createElement)(Ee,{t:n,field:"finder"}),onChange:d})),(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,u.length===0?(0,o.createElement)("tr",{key:"none",className:"pgw-values__empty"},(0,o.createElement)("td",{colSpan:7},n("filter.none"))):u.flatMap(f=>{let F=pt(f,n),B=f.first?n("recent.valueFirst",{turn:f.first.turn,step:f.first.step}):y?n("recent.valueFirstHere"):"",I=f.at!==void 0||f.before!==void 0||f.after!==void 0||F!==""||B!=="";return[(0,o.createElement)("tr",{key:f.placeholder,className:f.before!==void 0||f.after!==void 0?"pgw-values__has":void 0},(0,o.createElement)("td",{className:"pgw-mono"},f.placeholder),(0,o.createElement)("td",null,f.kind),(0,o.createElement)("td",null,f.finder),(0,o.createElement)("td",{className:"pgw-mono"},pe(f)),(0,o.createElement)("td",null,f.len),(0,o.createElement)("td",null,f.n),(0,o.createElement)("td",null,f.action?n(f.action==="warn"?"action.warn":"action.block"):"")),I?(0,o.createElement)("tr",{key:`${f.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"},f.at?(0,o.createElement)(x.Tag,{tone:"neutral",className:"pgw-ctx__place",title:f.at.path},n(ct(f.at)),(0,o.createElement)("span",{className:"pgw-ctx__path pgw-mono"},`\xB7 ${Oe(f.at.path)}`)):null,f.before!==void 0||f.after!==void 0?(0,o.createElement)("span",{className:"pgw-ctx__text",title:n("recent.contextHint")},f.before??"",(0,o.createElement)("mark",{className:"pgw-ctx__mark pgw-mono"},f.placeholder),f.after??""):null),F!==""?(0,o.createElement)("div",{className:"pgw-ctx__more"},F):null,B!==""?(0,o.createElement)("div",{className:"pgw-ctx__more"},B):null))):null]}))),t.valuesOmitted?(0,o.createElement)("div",{className:"pgw-meta"},n("recent.omitted",{n:t.valuesOmitted.toLocaleString()})):null,e.viewable&&!a?(0,o.createElement)("div",null,(0,o.createElement)(x.Button,{variant:"outline",size:"sm",onClick:()=>r(!0)},n("view.open"))):null,e.viewable&&a?(0,o.createElement)(Nt,{ctx:e.ctx,t:n,record:t,onClose:()=>r(!1)}):null):null)}function At(e){let{t}=e,[n,a]=(0,o.useState)(!1),[r,s]=(0,o.useState)(!1),[i,l]=(0,o.useState)(!1),d=()=>{a(!1),s(!1)},u=()=>{l(!0),ft(e.ctx).then(h=>{l(!1),d(),e.onDone(h.ok?t("card.resetDone",{n:h.value}):t("card.resetFailed",{message:Y(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:()=>a(!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:r,disabled:i,onAcknowledgedChange:s,onCancel:d,onConfirm:u}))}function It(e){let{t}=e,[n,a]=(0,o.useState)(e.on),[r,s]=(0,o.useState)(!1),[i,l]=(0,o.useState)(!1),[d,u]=(0,o.useState)(!1);(0,o.useEffect)(()=>a(e.on),[e.on]);let h=()=>{s(!1),l(!1)},_=k=>{u(!0),gt(e.ctx,e.session,k).then(y=>{u(!1),h(),y.ok&&a(y.value),e.onDone(y.ok?null:t("session.failed",{message:Y(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:d,onChange:k=>k?_(!0):s(!0)}),(0,o.createElement)("span",{className:"pgw-session__label"},t("session.mask"))),(0,o.createElement)(x.RiskConfirmation,{open:r,title:t("session.offTitle"),description:t("session.offBody"),acknowledgeLabel:t("session.offAck"),cancelLabel:t("card.cancel"),closeLabel:t("card.close"),confirmLabel:t("session.offConfirm"),acknowledged:i,disabled:d,onAcknowledgedChange:l,onCancel:h,onConfirm:()=>_(!1)}))}var O=require("react");function U(e,t,n,a){return(0,O.createElement)("text",{x:e,y:t,textAnchor:"middle",className:n},a)}function Et(e,t){return(0,O.createElement)("marker",{id:e,viewBox:"0 0 10 10",refX:9,refY:5,markerWidth:6,markerHeight:6,orient:"auto-start-reverse"},(0,O.createElement)("path",{d:"M 0 0 L 10 5 L 0 10 z",className:t}))}function Pt(e){let{t}=e,n=(0,O.useId)().replace(/[^a-zA-Z0-9_-]/g,""),a=`pgw-diagram-out-${n}`,r=`pgw-diagram-back-${n}`;return(0,O.createElement)("div",{className:"pgw-diagram"},(0,O.createElement)("svg",{className:"pgw-diagram__svg",viewBox:"0 0 640 200",role:"img","aria-label":t("panel.diagramNote")},(0,O.createElement)("defs",null,Et(a,"pgw-diagram__head-out"),Et(r,"pgw-diagram__head-in")),(0,O.createElement)("rect",{x:8,y:68,width:140,height:64,rx:10,className:"pgw-diagram__box"}),(0,O.createElement)("rect",{x:228,y:52,width:184,height:96,rx:10,className:"pgw-diagram__gateway"}),(0,O.createElement)("rect",{x:492,y:68,width:140,height:64,rx:10,className:"pgw-diagram__vendor"}),U(78,104,"pgw-diagram__title",t("panel.diagramAgent")),U(320,94,"pgw-diagram__title",t("panel.diagramGateway")),U(320,112,"pgw-diagram__sub",t("panel.diagramGatewaySub")),U(562,104,"pgw-diagram__title",t("panel.diagramVendor")),(0,O.createElement)("path",{d:"M 148 84 L 228 84",className:"pgw-diagram__out",markerEnd:`url(#${a})`}),(0,O.createElement)("path",{d:"M 412 84 L 492 84",className:"pgw-diagram__out",markerEnd:`url(#${a})`}),(0,O.createElement)("path",{d:"M 492 116 L 412 116",className:"pgw-diagram__in",markerEnd:`url(#${r})`}),(0,O.createElement)("path",{d:"M 228 116 L 148 116",className:"pgw-diagram__in",markerEnd:`url(#${r})`}),U(188,75,"pgw-diagram__label",t("panel.diagramRequest")),U(452,75,"pgw-diagram__chip",t("panel.diagramPlaceholder")),U(452,129,"pgw-diagram__chip",t("panel.diagramPlaceholder")),U(188,129,"pgw-diagram__label",t("panel.diagramReply"))),(0,O.createElement)("p",{className:"pgw-diagram__note"},t("panel.diagramNote")),(0,O.createElement)("p",{className:"pgw-diagram__hint"},t("panel.empty")))}var pn=15e3,un=200,fn=10,gn=["today","week","month"];function mn(e,t){let[n,a]=(0,p.useState)({status:"loading"}),[r,s]=(0,p.useState)(!1),i=(0,p.useRef)(null),l=(0,p.useCallback)(()=>{i.current?.abort();let d=new AbortController;i.current=d,s(!0),ue(e,un,d.signal,t).then(u=>{d.signal.aborted||(s(!1),a(h=>rt(h,u)))})},[e,t]);return(0,p.useEffect)(()=>{l();let d=setInterval(()=>{(typeof document>"u"||document.visibilityState==="visible")&&l()},pn);return()=>{clearInterval(d),i.current?.abort()}},[l]),[n,l,r]}function he(e){return(0,p.createElement)(hn,{key:e.sessionId??"",...e})}function hn(e){let{t}=e,[n,a,r]=mn(e.ctx,e.sessionId),[s,i]=(0,p.useState)("today"),[l,d]=(0,p.useState)(null),[u,h]=(0,p.useState)(0),[_,k]=(0,p.useState)(null),y=`pgw-card${e.panel?" pgw-card--panel":""}`,m=n.status==="ready"?n.data:void 0,A=!e.panel&&m!==void 0,E=(0,p.createElement)("div",{className:"pgw-head"},(0,p.createElement)("div",{className:"pgw-head__main"},e.panel?null:(0,p.createElement)("h3",{className:"pgw-title"},t("card.title")),e.sessionId&&m&&typeof m.sessionMasking=="boolean"?(0,p.createElement)(It,{ctx:e.ctx,t,session:e.sessionId,on:m.sessionMasking,onDone:N=>{k(N===null?null:{text:N,ok:!1}),a()}}):null,m&&(!e.sessionId||!m.active)?(0,p.createElement)(T.Tag,{tone:m.active?"success":"warning"},t(m.active?"card.on":"card.off")):null,e.sessionId&&m&&m.sessionMasking===void 0?(0,p.createElement)(T.Tag,{tone:"outline"},t("panel.session")):null,m&&!e.panel?(0,p.createElement)("span",{className:"pgw-meta",title:t("card.valuesHint")},t("card.values",{n:m.values})):null,m&&!m.record?(0,p.createElement)("span",{className:"pgw-meta"},t("card.memoryOnly")):null),(0,p.createElement)("div",{className:"pgw-head__actions"},m?(0,p.createElement)(T.SegmentedControl,{id:`pgw-range-${e.sessionId??"all"}`,label:t("card.range"),value:s,options:gn.map(N=>({value:N,label:t(`range.${N}`)})),onChange:i}):null,(0,p.createElement)(T.Button,{variant:"ghost",size:"sm",disabled:r,title:t("card.refresh"),"aria-label":t("card.refresh"),onClick:a},(0,p.createElement)(T.IconRefreshOutlineRegular,{size:14})),A?(0,p.createElement)(At,{ctx:e.ctx,t,onDone:(N,X)=>{k({text:N,ok:X}),d(null),h(0),a()}}):null)),V=_?(0,p.createElement)("div",{className:`pgw-flash${_.ok?"":" pgw-flash--error"}`,role:"status"},_.text):null,$=n.status==="ready"&&n.stale?(0,p.createElement)("div",{className:"pgw-notice pgw-notice--error",role:"status"},(0,p.createElement)(T.IconWarningOutlineRegular,{size:14,className:"pgw-notice__icon"}),(0,p.createElement)("span",null,t("card.stale",{reason:Y(n.stale,t)}))):null,D=e.sessionId&&m?.sessionMasking===!1?(0,p.createElement)("div",{className:"pgw-notice",role:"status"},(0,p.createElement)(T.IconWarningOutlineRegular,{size:14,className:"pgw-notice__icon"}),(0,p.createElement)("span",null,t("session.offNotice"))):null;if(!m){let N=n.status==="error"?`${t("card.unavailable")} ${t("card.reason",{reason:Y(n.failure,t)})}`:t("card.loading");return(0,p.createElement)("section",{className:y},E,(0,p.createElement)("div",{className:"pgw-empty pgw-empty--block"},N))}if(e.sessionId&&m.recent.length===0)return(0,p.createElement)("section",{className:y},E,$,V,D,(0,p.createElement)("div",{className:"pgw-empty pgw-empty--block pgw-empty--diagram"},(0,p.createElement)(Pt,{t})));let f=m,F=f.stats[s],B=new Set(f.vendorView?f.views??[]:[]),I=dt(f.recent,u,fn),H=N=>{h(N),d(null)};return(0,p.createElement)("section",{className:y},E,$,V,D,(0,p.createElement)(Rt,{t,items:Ze(f,F)}),(0,p.createElement)(St,{totals:F,t,...typeof f.restoreLog=="boolean"?{restoreLog:f.restoreLog}:{}}),(0,p.createElement)("div",{className:"pgw-dists"},(0,p.createElement)(me,{t,title:t("dist.kind"),data:F.kinds,others:t("dist.others.kind"),empty:t("dist.empty"),field:"kind"}),(0,p.createElement)(me,{t,title:t("dist.finder"),data:F.finders,others:t("dist.others.finder"),empty:t("dist.empty"),field:"finder"}),(0,p.createElement)(me,{t,title:t("dist.host"),data:F.hosts,others:t("dist.others.host"),empty:t("dist.empty")})),(0,p.createElement)("div",{className:"pgw-section"},(0,p.createElement)("div",{className:"pgw-section__head"},(0,p.createElement)("span",{className:"pgw-section__title"},t("recent.title")),f.recent.length>0?(0,p.createElement)("span",{className:"pgw-meta"},t("recent.count",{n:f.recent.length})):null),f.recent.length===0?(0,p.createElement)("div",{className:"pgw-empty pgw-empty--block"},t("recent.empty")):(0,p.createElement)("div",{className:"pgw-recs"},(0,p.createElement)(Tt,{t}),(0,p.createElement)("ul",{className:"pgw-recs__list","aria-label":t("recent.title")},I.items.map(N=>(0,p.createElement)(Ot,{key:N.key,ctx:e.ctx,r:N,open:l===N.key,toggle:()=>d(l===N.key?null:N.key),t,viewable:B.has(N.key)})))),I.pages>1?(0,p.createElement)("div",{className:"pgw-pager"},(0,p.createElement)(T.Button,{variant:"ghost",size:"sm",disabled:I.page===0,onClick:()=>H(0)},t("page.first")),(0,p.createElement)(T.Button,{variant:"ghost",size:"sm",disabled:I.page===0,"aria-label":t("page.prev"),title:t("page.prev"),onClick:()=>H(I.page-1)},(0,p.createElement)(T.IconChevronLeftOutlineRegular,{size:14})),(0,p.createElement)("span",{className:"pgw-meta pgw-pager__at"},t("page.at",{page:I.page+1,pages:I.pages})),(0,p.createElement)(T.Button,{variant:"ghost",size:"sm",disabled:I.page>=I.pages-1,"aria-label":t("page.next"),title:t("page.next"),onClick:()=>H(I.page+1)},(0,p.createElement)(T.IconChevronRightOutlineRegular,{size:14}))):null))}var wn="dsh-privacy-gateway",ee=fe(void 0);function Lt(e,t){return e.code==="noDisposer"?t("err.noDisposer"):t("err.thrown",{message:e.message})}function Ft(e,t){ee.set(void 0);let n;try{let a=e.slots.inject("conversation.view",()=>e.slots.register({name:"conversation.view",id:wn,order:35,locale:J,label:()=>t("panel.tab")},r=>(0,Mt.createElement)(he,{ctx:e,t,panel:!0,...r?.sessionId?{sessionId:r.sessionId}:{}})));if(typeof a!="function"){ee.set({code:"noDisposer"});return}n=a}catch(a){ee.set({code:"thrown",message:a instanceof Error?a.message:String(a)});return}return()=>{let a=n;n=void 0;try{a?.()}catch{}}}var we=class{waiting=[];current;failed=!1;send;onState;constructor(t,n=()=>{}){this.send=t,this.onState=n}get state(){return{busy:this.current!==void 0||this.waiting.length>0,failed:this.failed}}latest(t,n){for(let a=this.waiting.length-1;a>=0;a--)if(this.waiting[a]?.path===t)return this.waiting[a]?.value;return this.current?.path===t?this.current.value:n}write(t,n){return new Promise(a=>{let r=this.waiting.find(s=>s.path===t);r?(r.value=n,r.done.push(a)):this.waiting.push({path:t,value:n,done:[a]}),this.failed=!1,this.notify(),this.current||this.drain()})}async drain(){let t=!1;for(;this.waiting.length>0;){let n=this.waiting.shift();this.current=n;let a;try{a=await this.send(n.path,n.value,t)}catch{a=!1}this.current=void 0,t=!0;for(let r of n.done)r(a);if(!a){this.failed=!0;for(let r of this.waiting.splice(0))for(let s of r.done)s(!1)}this.notify()}}notify(){this.onState(this.state)}};function yn(){let[,e]=(0,g.useState)(0),t=(0,g.useSyncExternalStore)(Q.subscribe,Q.get),n=(0,g.useMemo)(()=>{try{return t?.describe()}catch{return}},[t]);(0,g.useEffect)(()=>{if(n)return Promise.resolve(n.ensure()).catch(()=>{}),n.subscribe(()=>e(l=>l+1))},[n]);let a=n?.getSnapshot().view,r=(0,g.useMemo)(()=>a?Ae(a.namespaces):void 0,[a]),s=(0,g.useMemo)(()=>{try{return t&&r!==void 0?t.get(r):void 0}catch{return}},[t,r]);(0,g.useEffect)(()=>s?s.subscribe(()=>e(l=>l+1)):void 0,[s]);let i=s?.getSnapshot();return(0,g.useMemo)(()=>{if(!s||!i)return;let l=s.mutate,d=l?(u,h)=>l.call(s,u,h):async u=>{for(let h of u)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:d}},[s,i])}var Kt="dsh-privacy-gateway.config.open",kn=["mask"];function bn(){try{let e=JSON.parse(globalThis.localStorage?.getItem(Kt)??"null");if(Array.isArray(e))return ie.filter(t=>e.includes(t))}catch{}return[...kn]}function vn(e){try{globalThis.localStorage?.setItem(Kt,JSON.stringify(e))}catch{}}var j=e=>e;function Pe(e){let{ctx:t,t:n}=e,a=yn(),r=e.form??a,s=(0,g.useRef)(r);s.current=r;let[i,l]=(0,g.useState)({busy:!1,failed:!1}),[d]=(0,g.useState)(()=>new we((c,v,C)=>{let S=s.current;return S?S.mutate([{op:"set",path:[c],value:v}],C?void 0:S.state.revision):Promise.resolve(!1)},l)),[u,h]=(0,g.useState)(null),[_,k]=(0,g.useState)(!1),y=(0,g.useSyncExternalStore)(ee.subscribe,ee.get),m=(0,g.useId)(),[A,E]=(0,g.useState)(null),[V,$]=(0,g.useState)(!1),[D,f]=(0,g.useState)(0),[F,B]=(0,g.useState)(bn),I=c=>B(v=>{let C=v.includes(c)?v.filter(S=>S!==c):ie.filter(S=>S===c||v.includes(S));return vn(C),C}),H=r?.state,N=H?.status==="ready",X=H?.writable!==!1,se=H?.value??{},z=c=>d.latest(c,se[c]);if((0,g.useEffect)(()=>{let c=new AbortController;return mt(t,c.signal).then(v=>{c.signal.aborted||($(!v.ok),E(v.ok?v.value:[]))}),()=>c.abort()},[t,D]),!r)return(0,g.createElement)("div",{className:"pgw-empty"},n("cfg.unavailable"));let te=N?null:(0,g.createElement)("div",{className:"pgw-cfg__desc",role:"status"},n("cfg.loading")),K=!N||!X,zt=c=>A?.find(v=>v.id.toLowerCase()===c.toLowerCase())?.name??c,ne=(c,v)=>{if(K)return Promise.resolve(!1);let C=Ke(c,z(c.key),v);return C?new Promise(S=>{k(!1),h(G=>(G?.resolve(!1),{f:c,next:v,change:C,resolve:S}))}):d.write(c.key,v)},Le=c=>{let v=u;h(null),k(!1),v&&(c?d.write(v.f.key,v.next).then(v.resolve):v.resolve(!1))},Bt=c=>{let v=n(j(`cfg.f.${c.key}`));switch(c.kind){case"switch":return(0,g.createElement)(je,{label:v,checked:ae(z(c.key),c.default),disabled:K,onChange:C=>{ne(c,C)}});case"choice":{let C=_e(z(c.key),c.choices,c.default);return(0,g.createElement)(Ne,{label:n(j(`cfg.f.${c.key}.${C}`)),labelledBy:`${m}${c.key}`,items:c.choices.map(S=>({id:S,label:n(j(`cfg.f.${c.key}.${S}`))})),selectedId:C,disabled:K,onSelect:S=>{S!==C&&ne(c,S)}})}case"list":return(0,g.createElement)(qe,{t:n,label:v,list:W(z(c.key),c.default),anyCase:c.anyCase,placeholder:n(j(`cfg.f.${c.key}.placeholder`)),disabled:K,onChange:C=>ne(c,C)});case"count":return(0,g.createElement)(Ye,{t:n,value:re(z(c.key),c.min,c.default),min:c.min,label:v,disabled:K,onChange:C=>ne(c,C)});case"providers":return Ht(c)}},Ht=c=>{let v=W(z(c.key),[]),C=yt(A??[],v),S=C.filter(P=>P.excluded).map(P=>P.name),G=He(S,n("cfg.sep")),xe=G.kind==="none"?n("cfg.excludedNone"):G.kind==="some"?G.names:n("cfg.excludedMany",{names:G.names,n:G.n});return(0,g.createElement)(Ne,{label:xe,labelledBy:`${m}${c.key}`,multi:!0,items:C.map(P=>({id:P.id,label:P.registered?P.name:n("cfg.providerAbsent",{name:P.name})})),selectedIds:C.filter(P=>P.excluded).map(P=>P.id),disabled:K,onSelect:P=>{ne(c,kt(W(z(c.key),[]),P))}})},Fe=c=>{if(c.key==="showPanel"&&y)return(0,g.createElement)("div",{className:"pgw-cfg__desc pgw-cfg__desc--error"},n("cfg.sidebarFailed",{reason:Lt(y,n)}));if(c.key==="excludeProviders"&&V)return(0,g.createElement)("div",{className:"pgw-cfg__desc pgw-cfg__desc--error"},n("cfg.providerListUnavailable")," ",(0,g.createElement)(ye.Button,{variant:"outline",size:"sm",onClick:()=>f(v=>v+1)},n("cfg.retry")))},Gt=Object.fromEntries(le.map(c=>[c.key,z(c.key)])),Wt=c=>{let v=le.filter(M=>M.group===c),C=n(j(`cfg.g.${c}`)),S=F.includes(c),G=Ve(c,Gt),xe=v.some(M=>Fe(M)!==void 0),P=N?[...G.map((M,jt)=>(0,g.createElement)("span",{key:jt,className:M.off?"pgw-fold__part pgw-fold__part--off":"pgw-fold__part"},n(j(M.key),M.params))),xe?(0,g.createElement)("span",{key:"problem",className:"pgw-fold__part pgw-fold__part--error"},n("cfg.s.problem")):null]:null;return(0,g.createElement)(We,{key:c,title:C,summary:P,open:S,toggleLabel:n(S?"cfg.collapse":"cfg.expand",{name:C}),onToggle:()=>I(c)},v.map(M=>(0,g.createElement)(Ge,{key:M.key,title:n(j(`cfg.f.${M.key}`)),titleId:`${m}${M.key}`,hint:n(j(`cfg.f.${M.key}.hint`)),note:Fe(M),inline:De(M),half:M.half===!0},Bt(M))))},ve=u?xn(u,n,u.f.key==="excludeProviders"?zt:c=>c):null;return(0,g.createElement)(g.Fragment,null,(0,g.createElement)("section",{className:"pgw-cfg","aria-busy":i.busy||void 0},e.form?null:(0,g.createElement)("h3",{className:"pgw-title"},n("cfg.title")),i.failed?(0,g.createElement)("div",{className:"pgw-notice pgw-notice--error",role:"alert"},n("cfg.failed")):null,te,(0,g.createElement)("div",{className:"pgw-cfg__folds"},ie.map(Wt)),(0,g.createElement)("p",{className:"pgw-cfg__desc pgw-cfg__foot"},n("cfg.applies")," ",n("cfg.others"))),(0,g.createElement)(ye.RiskConfirmation,{open:u!==null,title:ve?.title??"",description:ve?.body??"",acknowledgeLabel:ve?.ack??"",cancelLabel:n("card.cancel"),closeLabel:n("card.close"),confirmLabel:n("cfg.risk.confirm"),acknowledged:_,onAcknowledgedChange:k,onCancel:()=>Le(!1),onConfirm:()=>Le(!0)}))}function xn(e,t,n){let{change:a}=e,r={},s=a.added??a.removed;return s&&(r.names=s.map(n).join(t("cfg.sep"))),a.from!==void 0&&(r.from=a.from),a.to!==void 0&&(r.to=a.to),{title:t(a.risk==="send"?"cfg.risk.send.title":a.risk==="delete"?"cfg.risk.delete.title":"cfg.risk.log.title"),body:t(j(`cfg.r.${e.f.key}`),r),ack:t(a.risk==="send"?"cfg.risk.send.ack":a.risk==="delete"?"cfg.risk.delete.ack":"cfg.risk.log.ack")}}var ke="dsh-privacy-gateway",Dt="dsh-privacy-gateway";var Me="var(--ds-font-family-code,ui-monospace,monospace)",_n=`
|
|
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,11 +12,27 @@ 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:${
|
|
15
|
+
.pgw-mono{font-family:${Me}}
|
|
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)}
|
|
19
19
|
.pgw-empty--block{padding:24px 0;text-align:center}
|
|
20
|
+
.pgw-empty--diagram{display:flex;align-items:center;justify-content:center;min-height:clamp(280px,45vh,520px)}
|
|
21
|
+
.pgw-diagram{--pgw-diagram-accent:#686af5;display:flex;flex-direction:column;align-items:center;gap:10px;padding:8px 0 4px}
|
|
22
|
+
.pgw-diagram__svg{display:block;width:100%;max-width:520px;height:auto}
|
|
23
|
+
.pgw-diagram__box{fill:var(--dsw-alias-bg-layer-2);stroke:var(--dsw-alias-border-l1);stroke-width:1}
|
|
24
|
+
.pgw-diagram__gateway{fill:color-mix(in srgb,var(--pgw-diagram-accent) 10%,transparent);stroke:color-mix(in srgb,var(--pgw-diagram-accent) 55%,transparent);stroke-width:1}
|
|
25
|
+
.pgw-diagram__vendor{fill:color-mix(in srgb,var(--dsw-alias-state-success-primary) 9%,transparent);stroke:color-mix(in srgb,var(--dsw-alias-state-success-primary) 40%,transparent);stroke-width:1}
|
|
26
|
+
.pgw-diagram__title{fill:var(--dsw-alias-label-primary);font-size:12px;font-weight:500}
|
|
27
|
+
.pgw-diagram__sub{fill:color-mix(in srgb,var(--pgw-diagram-accent) 70%,var(--dsw-alias-label-secondary));font-size:10px}
|
|
28
|
+
.pgw-diagram__label{fill:var(--dsw-alias-label-tertiary);font-size:10px}
|
|
29
|
+
.pgw-diagram__chip{fill:var(--dsw-alias-state-warn-primary);font-size:10px;font-weight:600}
|
|
30
|
+
.pgw-diagram__out{fill:none;stroke:var(--pgw-diagram-accent);stroke-width:1.4}
|
|
31
|
+
.pgw-diagram__in{fill:none;stroke:var(--dsw-alias-label-tertiary);stroke-width:1.2}
|
|
32
|
+
.pgw-diagram__head-out{fill:var(--pgw-diagram-accent)}
|
|
33
|
+
.pgw-diagram__head-in{fill:var(--dsw-alias-label-tertiary)}
|
|
34
|
+
.pgw-diagram__note{max-width:520px;margin:0;font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary);text-align:center}
|
|
35
|
+
.pgw-diagram__hint{max-width:520px;margin:0;font-size:12px;line-height:18px;color:var(--dsw-alias-label-tertiary);text-align:center}
|
|
20
36
|
.pgw-flash{font-size:12px;line-height:18px;padding:8px 12px;border-radius:8px;background:color-mix(in srgb,var(--dsw-alias-state-success-primary) 10%,transparent);color:var(--dsw-alias-label-primary)}
|
|
21
37
|
.pgw-flash--error{background:color-mix(in srgb,var(--dsw-alias-state-error-primary) 10%,transparent)}
|
|
22
38
|
.pgw-notices{display:flex;flex-direction:column;gap:6px}
|
|
@@ -39,7 +55,7 @@ var module = { exports: {} }; var exports = module.exports;
|
|
|
39
55
|
.pgw-bar{display:flex;flex-direction:column;gap:4px;font-size:12px}
|
|
40
56
|
.pgw-bar__head{display:flex;justify-content:space-between;gap:8px}
|
|
41
57
|
.pgw-bar__head>*{min-width:0}
|
|
42
|
-
.pgw-bar__label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:${
|
|
58
|
+
.pgw-bar__label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:${Me};color:var(--dsw-alias-label-primary)}
|
|
43
59
|
.pgw-bar__label--hint{cursor:help}
|
|
44
60
|
.pgw-bar__value{flex:none;font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-secondary)}
|
|
45
61
|
.pgw-bar__track{height:4px;border-radius:2px;background:var(--dsw-alias-bg-layer-2);overflow:hidden}
|
|
@@ -63,6 +79,7 @@ var module = { exports: {} }; var exports = module.exports;
|
|
|
63
79
|
.pgw-rec__num{min-width:0;text-align:right;font-variant-numeric:tabular-nums;white-space:nowrap}
|
|
64
80
|
.pgw-rec__dim{color:var(--dsw-alias-label-secondary)}
|
|
65
81
|
.pgw-rec__bad{color:var(--dsw-alias-state-error-primary);font-weight:600}
|
|
82
|
+
.pgw-rec__unknown{color:var(--dsw-alias-state-warn-primary);font-weight:500}
|
|
66
83
|
.pgw-detail{display:flex;flex-direction:column;gap:8px;padding:8px 12px 12px 36px;background:var(--dsw-alias-bg-layer-2);font-size:12px;overflow-x:auto;border-top:.5px solid var(--dsw-alias-border-l1)}
|
|
67
84
|
.pgw-values{border-collapse:collapse;width:100%}
|
|
68
85
|
.pgw-values th{text-align:left;font-weight:500;color:var(--dsw-alias-label-tertiary);padding:4px 12px 4px 0;border-bottom:.5px solid var(--dsw-alias-border-l2);white-space:nowrap}
|
|
@@ -140,9 +157,9 @@ var module = { exports: {} }; var exports = module.exports;
|
|
|
140
157
|
.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
158
|
.pgw-view__table th:first-child,.pgw-view__n{width:44px}
|
|
142
159
|
.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:${
|
|
160
|
+
.pgw-detail .pgw-view__code{font-family:${Me};white-space:pre-wrap;word-break:break-all;padding:2px 8px;vertical-align:top;border-left:1px solid var(--dsw-alias-border-l2)}
|
|
144
161
|
.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
162
|
.pgw-view__mark--agent{background:color-mix(in srgb,var(--dsw-alias-state-warn-primary) 18%,transparent)}
|
|
146
|
-
`,
|
|
163
|
+
`,Vt="dsh-privacy-gateway-styles";function $t(){if(typeof document>"u"||document.getElementById(Vt))return;let e=document.createElement("style");e.id=Vt,e.textContent=_n,document.head.appendChild(e)}var Nn="dsh-privacy-gateway",Cn=["slots","locale","connection"];function Rn(e){$t(),e.effect(()=>e.locale.register(J,xt)??void 0,"dsh-privacy-gateway: dictionaries");let t=e.locale.bind(J);ht(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},l=>l.subject?.kind==="bundle"&&l.subject.pkg?.name===ke?(0,be.createElement)(he,{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:ke,locale:J},l=>l.view==="summary"?t("cfg.title"):(0,be.createElement)(Pe,{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:`${ke}#${Dt}`,locale:J},l=>l.view==="summary"?t("cfg.title"):(0,be.createElement)(Pe,{ctx:e,t,form:l.form})));return typeof i=="function"?i:void 0},"dsh-privacy-gateway: configuration (row page)");let n=!1,a,r=()=>{let i=a;a=void 0,i?.()},s=()=>{n&&!a?a=Ft(e,t):n||r()};e.effect(()=>{let i=wt(e,l=>{n=l,s()});return()=>{i(),n=!1,r()}},"dsh-privacy-gateway: view tab")}module.exports={name:Nn,inject:Cn,apply:Rn};
|
|
147
164
|
return module.exports;
|
|
148
165
|
} });
|
package/lib/index.d.ts
CHANGED
|
@@ -50,6 +50,12 @@ interface PrivacyGatewayConfig {
|
|
|
50
50
|
toolGuard?: ToolGuard;
|
|
51
51
|
/** A secret goes as a made-up key of its own form (same prefix, length, kinds of character) instead of a placeholder, where it can (docs/adr/0015). */
|
|
52
52
|
shape?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Put a reply's placeholders back before the session log is written; off
|
|
55
|
+
* (the default) keeps the values out of the log, and the agent sees
|
|
56
|
+
* placeholders too (docs/adr/0003).
|
|
57
|
+
*/
|
|
58
|
+
restoreLog?: boolean;
|
|
53
59
|
/** Cookie names masked wherever NAME=value is written, beside the built-in list (BDUSS, JSESSIONID, …). */
|
|
54
60
|
cookieNames?: string[];
|
|
55
61
|
/** Cookie names never masked. */
|
|
@@ -114,7 +120,7 @@ interface RequestInfo {
|
|
|
114
120
|
interface Exchange {
|
|
115
121
|
/** The body as it goes. */
|
|
116
122
|
readonly text: string;
|
|
117
|
-
/** Whether the reply can hold a placeholder to put back. */
|
|
123
|
+
/** Whether the reply can hold a placeholder to put back: the log restore switch is on and the table holds values (docs/adr/0003). */
|
|
118
124
|
restoring(): boolean;
|
|
119
125
|
/** Restores a whole JSON (or text) reply body. */
|
|
120
126
|
restoreBody(text: string): string;
|
|
@@ -167,7 +173,8 @@ interface LayerInfo {
|
|
|
167
173
|
/**
|
|
168
174
|
* The gateway: an undici dispatcher chained in front of whatever dispatcher
|
|
169
175
|
* was global before it (docs/adr/0001). A POST whose body is a JSON model
|
|
170
|
-
* request goes on masked, its reply restored
|
|
176
|
+
* request goes on masked, its reply restored while the exchange is restoring
|
|
177
|
+
* (the log restore switch, docs/adr/0003); everything else goes on
|
|
171
178
|
* untouched. An upgrade a model call opens (the Codex WebSocket) is refused
|
|
172
179
|
* (docs/adr/0025); one a plugin opens outside a call — dsh-im-infoflow's
|
|
173
180
|
* inbound, say — is let through unmasked, with one warn per host
|
|
@@ -221,8 +228,9 @@ declare class MaskingDispatcher extends Dispatcher {
|
|
|
221
228
|
* dsh-privacy-gateway cordis plugin entry: chains a masking dispatcher in
|
|
222
229
|
* front of undici's global dispatcher (docs/adr/0001). Secrets in outgoing
|
|
223
230
|
* model requests go as placeholders; the placeholders in the replies come
|
|
224
|
-
* back as the values
|
|
225
|
-
*
|
|
231
|
+
* back as the values while the log restore switch is on (docs/adr/0003) —
|
|
232
|
+
* off by default, so the session log holds no plaintext. Disposal (plugin
|
|
233
|
+
* reload, unload, shutdown) puts the previous dispatcher back.
|
|
226
234
|
*/
|
|
227
235
|
/** The subject of a `session/event`: the plugin reads the session's id and nothing else. */
|
|
228
236
|
interface SessionLike {
|
package/lib/index.js
CHANGED
|
@@ -24,6 +24,7 @@ const TEXT = {
|
|
|
24
24
|
values: (n) => `${n} 个值:`,
|
|
25
25
|
state: (on) => `状态:${on ? "开启" : "已关闭(/privacy on 恢复)"}`,
|
|
26
26
|
covers: (secrets, personal) => `范围:密钥 ${secrets ? "开" : "关"},个人信息 ${personal ? "开" : "关"}`,
|
|
27
|
+
log: (on) => `日志:${on ? "还原(回复里的占位符换回真值,写进会话日志)" : "不还原(回复里的占位符原样进会话日志)"}`,
|
|
27
28
|
table: (n) => `值表:${n} 个值`,
|
|
28
29
|
line: (label, t) => `${label}:记录 ${t.requests} 次请求,${t.masked} 次有脱敏,替换 ${t.n} 处,还原 ${t.restored} 处${t.restoredInTools > 0 ? `(工具参数里 ${t.restoredInTools} 处)` : ""}`,
|
|
29
30
|
today: "今日",
|
|
@@ -54,6 +55,7 @@ const TEXT = {
|
|
|
54
55
|
values: (n) => `${n} value${n === 1 ? "" : "s"}:`,
|
|
55
56
|
state: (on) => `State: ${on ? "on" : "off (/privacy on turns it back on)"}`,
|
|
56
57
|
covers: (secrets, personal) => `Masks: secrets ${secrets ? "on" : "off"}, personal data ${personal ? "on" : "off"}`,
|
|
58
|
+
log: (on) => `Log: ${on ? "restored (a reply’s placeholders become the real values in the session log)" : "not restored (a reply’s placeholders go into the session log as they are)"}`,
|
|
57
59
|
table: (n) => `Value table: ${n} values`,
|
|
58
60
|
line: (label, t) => `${label}: ${t.requests} requests recorded, ${t.masked} masked, ${t.n} places replaced, ${t.restored} restored${t.restoredInTools > 0 ? ` (${t.restoredInTools} in tool arguments)` : ""}`,
|
|
59
61
|
today: "Today",
|
|
@@ -84,7 +86,7 @@ function status(face, lang) {
|
|
|
84
86
|
const s$1 = face.stats();
|
|
85
87
|
const out = [T.state(face.active)];
|
|
86
88
|
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));
|
|
89
|
+
out.push(T.covers(face.secrets, face.personal), T.log(face.restoreLog), 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));
|
|
88
90
|
if (Object.keys(s$1.today.kinds).length > 0) out.push(T.kinds + counts(s$1.today.kinds));
|
|
89
91
|
if (Object.keys(s$1.today.finders).length > 0) out.push(T.finders + counts(s$1.today.finders));
|
|
90
92
|
if (s$1.today.warned > 0 || s$1.today.blocked > 0) out.push(T.actedToday(s$1.today.warned, s$1.today.blocked));
|
|
@@ -198,6 +200,7 @@ const Config = Schema.object({
|
|
|
198
200
|
"block"
|
|
199
201
|
]).default("off").volatile(),
|
|
200
202
|
shape: Schema.boolean().default(false).volatile(),
|
|
203
|
+
restoreLog: Schema.boolean().default(false).volatile(),
|
|
201
204
|
maskKeys: Schema.boolean().default(true).volatile(),
|
|
202
205
|
cookieNames: Schema.array(Schema.string()).default([]),
|
|
203
206
|
cookieKeep: Schema.array(Schema.string()).default([
|
|
@@ -228,6 +231,7 @@ const LIVE_FIELDS = [
|
|
|
228
231
|
"allow",
|
|
229
232
|
"toolGuard",
|
|
230
233
|
"shape",
|
|
234
|
+
"restoreLog",
|
|
231
235
|
"maskKeys",
|
|
232
236
|
"record",
|
|
233
237
|
"keepDays",
|
|
@@ -247,6 +251,7 @@ const defaults = {
|
|
|
247
251
|
actions: {},
|
|
248
252
|
toolGuard: "off",
|
|
249
253
|
shape: false,
|
|
254
|
+
restoreLog: false,
|
|
250
255
|
maskKeys: true,
|
|
251
256
|
cookieNames: [],
|
|
252
257
|
cookieKeep: [
|
|
@@ -301,6 +306,7 @@ function resolveConfig(config = {}) {
|
|
|
301
306
|
actions: actions(c.actions),
|
|
302
307
|
toolGuard: c.toolGuard === "warn" || c.toolGuard === "block" ? c.toolGuard : "off",
|
|
303
308
|
shape: bool(c.shape, defaults.shape),
|
|
309
|
+
restoreLog: bool(c.restoreLog, defaults.restoreLog),
|
|
304
310
|
maskKeys: bool(c.maskKeys, defaults.maskKeys),
|
|
305
311
|
cookieNames: strings(c.cookieNames),
|
|
306
312
|
cookieKeep: strings(c.cookieKeep, defaults.cookieKeep),
|
|
@@ -4450,6 +4456,8 @@ var PrivacyEngine = class {
|
|
|
4450
4456
|
#restorer;
|
|
4451
4457
|
/** Keep the bodies for the vendor view (config vendorView); `reconfigure` changes it. */
|
|
4452
4458
|
#keepViews;
|
|
4459
|
+
/** Put a reply's placeholders back before the session log gets it (config restoreLog, docs/adr/0003); `reconfigure` changes it. */
|
|
4460
|
+
#restoreLog;
|
|
4453
4461
|
records;
|
|
4454
4462
|
#logger;
|
|
4455
4463
|
views;
|
|
@@ -4465,6 +4473,7 @@ var PrivacyEngine = class {
|
|
|
4465
4473
|
this.#masker = this.#maskerFor(config);
|
|
4466
4474
|
this.#restorer = new Restorer(this.#table, config.toolGuard);
|
|
4467
4475
|
this.#keepViews = config.vendorView;
|
|
4476
|
+
this.#restoreLog = config.restoreLog;
|
|
4468
4477
|
this.#logger = options.logger;
|
|
4469
4478
|
this.#names = options.names;
|
|
4470
4479
|
this.#steps = options.steps;
|
|
@@ -4496,13 +4505,16 @@ var PrivacyEngine = class {
|
|
|
4496
4505
|
/**
|
|
4497
4506
|
* The rules from `config` from the next request on (docs/adr/0021): the
|
|
4498
4507
|
* finders and the reply guard are rebuilt, the value table stays, so a reply
|
|
4499
|
-
* to a request already sent is still restored. The
|
|
4500
|
-
*
|
|
4508
|
+
* to a request already sent is still restored. The log restore switch
|
|
4509
|
+
* (docs/adr/0003) is read when a request goes and held for its reply, so a
|
|
4510
|
+
* call in flight runs under the settings it went out with. The masker starts
|
|
4511
|
+
* with an empty memo of what was sent, which was keyed to the old rules.
|
|
4501
4512
|
*/
|
|
4502
4513
|
reconfigure(config) {
|
|
4503
4514
|
this.#masker = this.#maskerFor(config);
|
|
4504
4515
|
this.#restorer = new Restorer(this.#table, config.toolGuard);
|
|
4505
4516
|
this.#keepViews = config.vendorView;
|
|
4517
|
+
this.#restoreLog = config.restoreLog;
|
|
4506
4518
|
if (!config.vendorView) this.views?.clear();
|
|
4507
4519
|
}
|
|
4508
4520
|
/** How many values the table holds. */
|
|
@@ -4577,11 +4589,12 @@ var PrivacyEngine = class {
|
|
|
4577
4589
|
}
|
|
4578
4590
|
const tally = newTally();
|
|
4579
4591
|
const restorer = this.#restorer;
|
|
4592
|
+
const restoreLog = this.#restoreLog;
|
|
4580
4593
|
const sentText = r.text;
|
|
4581
4594
|
let done = false;
|
|
4582
4595
|
return {
|
|
4583
4596
|
text: r.text,
|
|
4584
|
-
restoring: () => this.#table.size > 0,
|
|
4597
|
+
restoring: () => restoreLog && this.#table.size > 0,
|
|
4585
4598
|
restoreBody: (text) => restorer.restoreJSON(text, tally),
|
|
4586
4599
|
streamRestorer: () => restorer.stream(tally),
|
|
4587
4600
|
finish: () => {
|
|
@@ -4982,14 +4995,17 @@ function replyMode(type) {
|
|
|
4982
4995
|
return type.includes("json") ? "whole" : "pass";
|
|
4983
4996
|
}
|
|
4984
4997
|
/**
|
|
4985
|
-
* Passes a model reply on with the placeholders in it put back
|
|
4986
|
-
*
|
|
4987
|
-
*
|
|
4988
|
-
*
|
|
4989
|
-
*
|
|
4990
|
-
*
|
|
4991
|
-
*
|
|
4992
|
-
*
|
|
4998
|
+
* Passes a model reply on: with the placeholders in it put back while the
|
|
4999
|
+
* exchange is restoring, untouched when it is not — the log restore switch is
|
|
5000
|
+
* off then (docs/adr/0003), so the placeholders reach the agent and the
|
|
5001
|
+
* session log as they are. A `text/event-stream` goes line by line as it
|
|
5002
|
+
* arrives, an `application/x-ndjson` reply one line (one JSON document) at a
|
|
5003
|
+
* time, a JSON body whole at its end. Backpressure is the downstream handler's
|
|
5004
|
+
* own, through the same controller. While restoring, the gateway asks for an
|
|
5005
|
+
* unencoded reply (docs/adr/0025); one that comes compressed all the same is
|
|
5006
|
+
* decoded here and goes on unencoded. A coding there is no decoder for goes on
|
|
5007
|
+
* as it is, with a warning: the placeholders reach the agent, the secrets
|
|
5008
|
+
* never left.
|
|
4993
5009
|
*/
|
|
4994
5010
|
var RestoringHandler = class {
|
|
4995
5011
|
#next;
|
|
@@ -5194,7 +5210,8 @@ const RANK = {
|
|
|
5194
5210
|
/**
|
|
5195
5211
|
* The gateway: an undici dispatcher chained in front of whatever dispatcher
|
|
5196
5212
|
* was global before it (docs/adr/0001). A POST whose body is a JSON model
|
|
5197
|
-
* request goes on masked, its reply restored
|
|
5213
|
+
* request goes on masked, its reply restored while the exchange is restoring
|
|
5214
|
+
* (the log restore switch, docs/adr/0003); everything else goes on
|
|
5198
5215
|
* untouched. An upgrade a model call opens (the Codex WebSocket) is refused
|
|
5199
5216
|
* (docs/adr/0025); one a plugin opens outside a call — dsh-im-infoflow's
|
|
5200
5217
|
* inbound, say — is let through unmasked, with one warn per host
|
|
@@ -5433,7 +5450,7 @@ var MaskingDispatcher = class extends Dispatcher {
|
|
|
5433
5450
|
const body = changed ? Buffer.from(exchange.text, "utf8") : raw;
|
|
5434
5451
|
const set = { "content-length": String(body.length) };
|
|
5435
5452
|
if (changed && codings.length > 0) set["content-encoding"] = null;
|
|
5436
|
-
if (exchange !== null) set["accept-encoding"] = "identity";
|
|
5453
|
+
if (exchange !== null && exchange.restoring()) set["accept-encoding"] = "identity";
|
|
5437
5454
|
const headers = editHeaders(opts.headers, set, ["accept-encoding"]);
|
|
5438
5455
|
to = this.downstream();
|
|
5439
5456
|
next = {
|
|
@@ -5819,6 +5836,9 @@ function apply(ctx, config = {}) {
|
|
|
5819
5836
|
get personal() {
|
|
5820
5837
|
return current$1().personal;
|
|
5821
5838
|
},
|
|
5839
|
+
get restoreLog() {
|
|
5840
|
+
return current$1().restoreLog;
|
|
5841
|
+
},
|
|
5822
5842
|
get values() {
|
|
5823
5843
|
return engine.values;
|
|
5824
5844
|
},
|
|
@@ -5851,6 +5871,7 @@ function apply(ctx, config = {}) {
|
|
|
5851
5871
|
stats: records.stats(session),
|
|
5852
5872
|
recent: records.recent(limit, session),
|
|
5853
5873
|
vendorView: c.vendorView,
|
|
5874
|
+
restoreLog: c.restoreLog,
|
|
5854
5875
|
views: c.vendorView ? views.keys() : [],
|
|
5855
5876
|
showPanel: liveBool(config.showPanel, c.showPanel),
|
|
5856
5877
|
excludeProviders: excludedProviders(),
|
package/locale/en.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"meta": {
|
|
3
3
|
"title": "Privacy Gateway",
|
|
4
|
-
"description": "Masks secrets in outgoing model requests
|
|
4
|
+
"description": "Masks secrets in outgoing model requests; replies keep their placeholders in the session log by default, and restoreLog puts them back, for every provider.",
|
|
5
5
|
"detail": "docs/details/DETAIL.en.md"
|
|
6
6
|
}
|
|
7
7
|
}
|
package/locale/zh.json
CHANGED
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-privacy-gateway",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "Process-wide HTTP redaction gateway for DSH: masks secrets in outgoing model requests
|
|
5
|
+
"description": "Process-wide HTTP redaction gateway for DSH: masks secrets in outgoing model requests; replies keep placeholders in the session log by default, and restoreLog writes the real values back before it is written, for every provider.",
|
|
6
6
|
"icon": "./assets/icon.svg",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"author": "xbzbing <xbzbing@gmail.com>",
|