leakshield 0.3.0 → 0.3.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/LICENSE +202 -21
- package/NOTICE +2 -0
- package/README.md +4 -4
- package/README.zh-TW.md +4 -4
- package/dist/opencode-transparent-http.js +45 -8
- package/package.json +5 -3
package/LICENSE
CHANGED
|
@@ -1,21 +1,202 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/NOTICE
ADDED
package/README.md
CHANGED
|
@@ -26,10 +26,10 @@ MCP server mode has been removed. It depended on the model voluntarily calling a
|
|
|
26
26
|
|
|
27
27
|
**Experimental, `0.x`.** Published to npm as `leakshield`: run `npx leakshield --help` to see the commands, or build locally (`npm ci && npm run build`) and point OpenCode at the `dist` directory. Without arguments or input, the CLI waits on stdin.
|
|
28
28
|
|
|
29
|
-
- Transparent mode has been verified on OpenCode v2.0.28 with local loopback providers, and once against a real OpenAI model. It is **not** a guarantee that nothing sensitive reaches a model: the recommended hook-first setup is reported as `PARTIAL` by `--doctor`, and content added after the plugin's hooks or sent by permitted tools (curl, remote MCP) is outside its coverage.
|
|
29
|
+
- Transparent mode has been verified on OpenCode v2.0.28 with local loopback providers, and once against a real OpenAI model. The 0.3.0 tool restoration was rechecked on OpenCode v2.2.5 with a loopback provider, the OpenChamber render tool and `rtk` ([record](docs/evidence/2026-11-06-opencode-2.2.5-tool-restoration.md)). It is **not** a guarantee that nothing sensitive reaches a model: the recommended hook-first setup is reported as `PARTIAL` by `--doctor`, and content added after the plugin's hooks or sent by permitted tools (curl, remote MCP) is outside its coverage.
|
|
30
30
|
- Not yet verified: OS-keychain custody on Windows and Linux (macOS verified 2026-10-20), a real Anthropic provider, long histories on other providers, long-running use ([#26](https://github.com/jwcrystal/leakshield/issues/26)).
|
|
31
31
|
- Defaults may still change during `0.x`; see the [changelog](CHANGELOG.md).
|
|
32
|
-
- Verification records: [docs/evidence](docs/evidence/README.md). Report vulnerabilities privately: [SECURITY.md](SECURITY.md). License: [
|
|
32
|
+
- Verification records: [docs/evidence](docs/evidence/README.md). Report vulnerabilities privately: [SECURITY.md](SECURITY.md). License: [Apache-2.0](LICENSE).
|
|
33
33
|
|
|
34
34
|
---
|
|
35
35
|
|
|
@@ -282,7 +282,7 @@ See [Wire protection](docs/plugin/wire-protection.md) for both levels.
|
|
|
282
282
|
|
|
283
283
|
#### Detailed guides
|
|
284
284
|
|
|
285
|
-
- [Transparent mode](docs/plugin/transparent-mode.md): placeholders, supported protocols,
|
|
285
|
+
- [Transparent mode](docs/plugin/transparent-mode.md): placeholders, supported protocols, tool argument restoration (per field, `code`/`script` fields, Code Mode, `curl`, `rtk`), restart limitation
|
|
286
286
|
- [Wire protection](docs/plugin/wire-protection.md): hook-only and final wire levels, AI SDK providers, refusals, reply-side recovery
|
|
287
287
|
- [Native WebSocket](docs/plugin/websocket.md): experimental Responses-family support and its limits
|
|
288
288
|
- [Mapping persistence](docs/plugin/persistence.md): opt-in encrypted storage, key custody, erasure
|
|
@@ -345,7 +345,7 @@ Doctor is an install-level check that runs outside the host — it cannot see in
|
|
|
345
345
|
|
|
346
346
|
### What this protects — and what it does not
|
|
347
347
|
|
|
348
|
-
LeakShield protects model-conversation content: prompts, replayed history, tool outputs, and (in transparent mode) provider-bound request bodies whose shape it can parse. It is **not** a tool-egress firewall: a permitted local tool can still transmit originals over the network via `curl`, a remote MCP server, or any other channel. Controlling tool destinations requires a separate permission layer outside this plugin.
|
|
348
|
+
LeakShield protects model-conversation content: prompts, replayed history, tool outputs, and (in transparent mode) provider-bound request bodies whose shape it can parse. It is **not** a tool-egress firewall: a permitted local tool can still transmit originals over the network via `curl`, a remote MCP server, or any other channel. Controlling tool destinations requires a separate permission layer outside this plugin. Since 0.3.0, `curl` and `http` may also hold a placeholder inside an argument, so a tool can call an API with the protected value; the original then leaves the machine by design.
|
|
349
349
|
|
|
350
350
|
Detection also has known gaps: street/postal addresses, dates, IPv6, and generic assignments outside the keyword list or below the 8-character minimum pass through undetected. Credit card and IBAN numbers are detected only when the checksum validates; IP detection covers public IPv4 only; URL detection exists but is opt-in — see [Detection Coverage](#detection-coverage).
|
|
351
351
|
|
package/README.zh-TW.md
CHANGED
|
@@ -26,10 +26,10 @@ MCP Server 模式已移除。它依賴模型在已收到相關 context 後自行
|
|
|
26
26
|
|
|
27
27
|
**實驗性,`0.x` 版本。** 已發佈到 npm(`leakshield`):可用 `npx leakshield --help` 查看指令,或在本機建置(`npm ci && npm run build`)再讓 OpenCode 指向 `dist` 目錄。沒有參數也沒有輸入時,CLI 會等待 stdin。
|
|
28
28
|
|
|
29
|
-
- Transparent 模式已在 OpenCode v2.0.28 搭配本機替身 provider 驗證,並用真實 OpenAI
|
|
29
|
+
- Transparent 模式已在 OpenCode v2.0.28 搭配本機替身 provider 驗證,並用真實 OpenAI 模型驗證過一次。0.3.0 的工具還原另在 OpenCode v2.2.5 用本機替身 provider、OpenChamber 的 render 工具與 `rtk` 重新驗證([紀錄](docs/evidence/2026-11-06-opencode-2.2.5-tool-restoration.md))。它**不保證**敏感內容絕不會送到模型:建議的 hook-first 設定在 `--doctor` 顯示為 `PARTIAL`,hook 之後才加入的內容,以及被允許的工具外送(curl、遠端 MCP),都不在保護範圍內。
|
|
30
30
|
- 尚未驗證:Windows 與 Linux 的 OS keychain 持久化(macOS 已於 2026-10-20 驗證)、真實 Anthropic provider、其他 provider 的長對話、長時間使用([#26](https://github.com/jwcrystal/leakshield/issues/26))。
|
|
31
31
|
- `0.x` 期間預設值仍可能調整,變更見 [CHANGELOG](CHANGELOG.md)。
|
|
32
|
-
- 驗證紀錄:[docs/evidence](docs/evidence/README.md)。漏洞請私下回報:[SECURITY.md](SECURITY.md)。授權:[
|
|
32
|
+
- 驗證紀錄:[docs/evidence](docs/evidence/README.md)。漏洞請私下回報:[SECURITY.md](SECURITY.md)。授權:[Apache-2.0](LICENSE)。
|
|
33
33
|
|
|
34
34
|
---
|
|
35
35
|
|
|
@@ -278,7 +278,7 @@ LeakShield 只支援 OpenCode v2:v2 載入套件的 `id` + `setup(ctx)` 定義
|
|
|
278
278
|
|
|
279
279
|
#### 詳細說明
|
|
280
280
|
|
|
281
|
-
- [Transparent 模式](docs/plugin/transparent-mode.zh-TW.md):
|
|
281
|
+
- [Transparent 模式](docs/plugin/transparent-mode.zh-TW.md): 佔位符、支援的協定、工具參數還原(依欄位判斷、`code`/`script` 欄位、Code Mode、`curl`、`rtk`)、重啟限制
|
|
282
282
|
- [Wire 保護](docs/plugin/wire-protection.zh-TW.md): hook-only 與 final wire 兩種層級、AI SDK provider、拒絕、回覆端復原
|
|
283
283
|
- [Native WebSocket](docs/plugin/websocket.zh-TW.md): 實驗性的 Responses-family 支援與限制
|
|
284
284
|
- [映射持久化](docs/plugin/persistence.zh-TW.md): 選擇性開啟的加密儲存、金鑰保管、清除
|
|
@@ -341,7 +341,7 @@ Doctor 是在 host 之外執行的安裝層檢查,看不到執行中的 sessio
|
|
|
341
341
|
|
|
342
342
|
### 保護範圍與不保護的部分
|
|
343
343
|
|
|
344
|
-
LeakShield 保護送往模型的對話內容:prompt、重播的歷史、工具輸出,以及(transparent 模式下)可解析其結構的 provider 請求 body。它**不是**工具對外連線的防火牆:被允許的本機工具仍可透過 `curl`、遠端 MCP server 或任何其他管道把原文傳出去。要管控工具的目的地,需要此 plugin
|
|
344
|
+
LeakShield 保護送往模型的對話內容:prompt、重播的歷史、工具輸出,以及(transparent 模式下)可解析其結構的 provider 請求 body。它**不是**工具對外連線的防火牆:被允許的本機工具仍可透過 `curl`、遠端 MCP server 或任何其他管道把原文傳出去。要管控工具的目的地,需要此 plugin 之外的權限層。從 0.3.0 起,`curl` 與 `http` 的參數內也可以放 placeholder,讓工具帶著受保護的值呼叫 API;這時原文會依設計離開本機。
|
|
345
345
|
|
|
346
346
|
偵測也有已知缺口:街道/郵遞地址、日期、IPv6,以及關鍵字清單之外或短於 8 字元的一般賦值都不會被偵測。信用卡與 IBAN 只有在檢查碼驗證通過時才會命中;IP 偵測只涵蓋公開 IPv4(超過四段的點分數字會整段回報,避免內嵌位址漏遮;`2026.10.21.14.32.59` 這類點分日期也會回報);URL 偵測存在但需手動開啟,見[偵測範圍](#偵測範圍)。
|
|
347
347
|
|
|
@@ -419,7 +419,9 @@ function withOpaqueReasoningContent(body, fn) {
|
|
|
419
419
|
return fn(body);
|
|
420
420
|
const originals = [];
|
|
421
421
|
for (const item of input) {
|
|
422
|
-
if (isRecord(item) &&
|
|
422
|
+
if (isRecord(item) &&
|
|
423
|
+
(item.type === "reasoning" || item.type === "compaction") &&
|
|
424
|
+
typeof item.encrypted_content === "string") {
|
|
423
425
|
originals.push(item.encrypted_content);
|
|
424
426
|
item.encrypted_content = `${OPAQUE_REASONING_SENTINEL}_${originals.length - 1}`;
|
|
425
427
|
}
|
|
@@ -947,10 +949,11 @@ export async function remaskAnthropicMessagesRequest(service, sessionID, request
|
|
|
947
949
|
/**
|
|
948
950
|
* Validates an OpenAI Responses request body: `instructions` string, `input`
|
|
949
951
|
* (string or item array: message | function_call | function_call_output |
|
|
950
|
-
*
|
|
951
|
-
*
|
|
952
|
-
*
|
|
953
|
-
*
|
|
952
|
+
* custom_tool_call | custom_tool_call_output | reasoning | compaction |
|
|
953
|
+
* configuration_update), flat `tools` ({type:"function", name, parameters}).
|
|
954
|
+
* Reasoning and compaction items pass with their encrypted payload opaque
|
|
955
|
+
* (unscanned, verbatim); reasoning summary/content text is masked; item
|
|
956
|
+
* references and unknown types refuse.
|
|
954
957
|
*/
|
|
955
958
|
function validateResponsesContentParts(content, allowAttachments) {
|
|
956
959
|
if (content === undefined || content === null || typeof content === "string")
|
|
@@ -1010,7 +1013,13 @@ function validateResponsesInputItem(item, allowAttachments) {
|
|
|
1010
1013
|
throw new Error(refusal("responses-function-call-shape"));
|
|
1011
1014
|
}
|
|
1012
1015
|
return;
|
|
1016
|
+
case "custom_tool_call":
|
|
1017
|
+
if (typeof item.name !== "string" || typeof item.input !== "string") {
|
|
1018
|
+
throw new Error(refusal("responses-custom-tool-call-shape"));
|
|
1019
|
+
}
|
|
1020
|
+
return;
|
|
1013
1021
|
case "function_call_output":
|
|
1022
|
+
case "custom_tool_call_output":
|
|
1014
1023
|
if (typeof item.output !== "string") {
|
|
1015
1024
|
if (!Array.isArray(item.output))
|
|
1016
1025
|
throw new Error(refusal("responses-function-output"));
|
|
@@ -1032,6 +1041,19 @@ function validateResponsesInputItem(item, allowAttachments) {
|
|
|
1032
1041
|
validateResponsesReasoningParts(item.content);
|
|
1033
1042
|
return;
|
|
1034
1043
|
}
|
|
1044
|
+
case "compaction":
|
|
1045
|
+
// Same opacity argument as reasoning.encrypted_content: a provider
|
|
1046
|
+
// checkpoint of already-masked history, replayed to the same provider.
|
|
1047
|
+
if (typeof item.encrypted_content !== "string" ||
|
|
1048
|
+
(item.id !== undefined && item.id !== null && typeof item.id !== "string")) {
|
|
1049
|
+
throw new Error(refusal("responses-compaction-shape"));
|
|
1050
|
+
}
|
|
1051
|
+
return;
|
|
1052
|
+
case "configuration_update":
|
|
1053
|
+
if (!isRecord(item.reasoning) || typeof item.reasoning.effort !== "string") {
|
|
1054
|
+
throw new Error(refusal("responses-configuration-update-shape"));
|
|
1055
|
+
}
|
|
1056
|
+
return;
|
|
1035
1057
|
default:
|
|
1036
1058
|
// item_reference / unknown: cannot verify or place.
|
|
1037
1059
|
throw new Error(refusal("responses-item-type"));
|
|
@@ -1077,10 +1099,14 @@ function collectResponsesStructuralStrings(body) {
|
|
|
1077
1099
|
pushString(out, item.type);
|
|
1078
1100
|
pushString(out, item.role);
|
|
1079
1101
|
pushString(out, item.call_id);
|
|
1080
|
-
if (item.type === "function_call")
|
|
1102
|
+
if (item.type === "function_call" || item.type === "custom_tool_call")
|
|
1081
1103
|
pushString(out, item.name);
|
|
1082
|
-
if (item.type === "
|
|
1104
|
+
if (item.type === "function_call")
|
|
1105
|
+
pushString(out, item.namespace);
|
|
1106
|
+
if (item.type === "reasoning" || item.type === "compaction")
|
|
1083
1107
|
pushString(out, item.id);
|
|
1108
|
+
if (item.type === "configuration_update" && isRecord(item.reasoning))
|
|
1109
|
+
pushString(out, item.reasoning.effort);
|
|
1084
1110
|
}
|
|
1085
1111
|
}
|
|
1086
1112
|
if (Array.isArray(body.tools)) {
|
|
@@ -1962,7 +1988,10 @@ function restoreResponsesItemText(service, sessionID, item, fields) {
|
|
|
1962
1988
|
if (item.type === "function_call" && typeof item.arguments === "string") {
|
|
1963
1989
|
allowResponsesField(fields, item, "arguments");
|
|
1964
1990
|
}
|
|
1965
|
-
if (item.type === "
|
|
1991
|
+
if (item.type === "custom_tool_call" && typeof item.input === "string") {
|
|
1992
|
+
allowResponsesField(fields, item, "input");
|
|
1993
|
+
}
|
|
1994
|
+
if ((item.type === "function_call_output" || item.type === "custom_tool_call_output") && typeof item.output === "string") {
|
|
1966
1995
|
allowResponsesField(fields, item, "output");
|
|
1967
1996
|
}
|
|
1968
1997
|
let changed = false;
|
|
@@ -2017,6 +2046,9 @@ export function restoreResponsesEventDisplay(service, sessionID, chunk) {
|
|
|
2017
2046
|
else if (type === "response.function_call_arguments.delta" || type === "response.function_call_arguments.done") {
|
|
2018
2047
|
allowResponsesField(fields, chunk, type.endsWith(".delta") ? "delta" : "arguments");
|
|
2019
2048
|
}
|
|
2049
|
+
else if (type === "response.custom_tool_call_input.delta" || type === "response.custom_tool_call_input.done") {
|
|
2050
|
+
allowResponsesField(fields, chunk, type.endsWith(".delta") ? "delta" : "input");
|
|
2051
|
+
}
|
|
2020
2052
|
else if (type === "response.output_item.added" || type === "response.output_item.done") {
|
|
2021
2053
|
if (isRecord(chunk.item))
|
|
2022
2054
|
restoreResponsesItemText(service, sessionID, chunk.item, fields);
|
|
@@ -2273,6 +2305,11 @@ export function createResponsesSseRestoreStream(service, sessionID, body) {
|
|
|
2273
2305
|
if (typeof chunk[field] === "string")
|
|
2274
2306
|
allowResponsesField(fields, chunk, field);
|
|
2275
2307
|
}
|
|
2308
|
+
else if (eventType === "response.custom_tool_call_input.delta" || eventType === "response.custom_tool_call_input.done") {
|
|
2309
|
+
const field = eventType.endsWith(".delta") ? "delta" : "input";
|
|
2310
|
+
if (typeof chunk[field] === "string")
|
|
2311
|
+
allowResponsesField(fields, chunk, field);
|
|
2312
|
+
}
|
|
2276
2313
|
// P1 (2026-10-06b): an unplaceable placeholder is degradation — WARN
|
|
2277
2314
|
// and emit literally; mapping loss never refuses response delivery.
|
|
2278
2315
|
if (responsesStrayTokenIn(chunk, fields)) {
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "leakshield",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "OpenCode plugin, CLI, and web scanner for sensitive content before sending it to AI",
|
|
5
|
-
"license": "
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"author": "Jared Wang",
|
|
6
7
|
"repository": {
|
|
7
8
|
"type": "git",
|
|
8
9
|
"url": "git+https://github.com/jwcrystal/leakshield.git"
|
|
@@ -28,7 +29,8 @@
|
|
|
28
29
|
"./package.json": "./package.json"
|
|
29
30
|
},
|
|
30
31
|
"files": [
|
|
31
|
-
"dist"
|
|
32
|
+
"dist",
|
|
33
|
+
"NOTICE"
|
|
32
34
|
],
|
|
33
35
|
"engines": {
|
|
34
36
|
"node": ">=20"
|