@deepseek-ai/dsh-client-connection 0.0.1-rc.3 → 0.1.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +17 -24
- package/README.i18n.yaml +2 -2
- package/README.md +1 -1
- package/README.zh.md +1 -1
- package/lib/client.js +4 -0
- package/lib/index.js +2 -2
- package/lib/types/api-request-trust.d.ts +2 -2
- package/package.json +15 -15
package/LICENSE
CHANGED
|
@@ -1,28 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2026
|
|
3
|
+
Copyright (c) 2026 DeepSeek
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
7
11
|
|
|
8
|
-
|
|
9
|
-
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
10
14
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
20
|
-
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
21
|
-
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
22
|
-
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
23
|
-
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
24
|
-
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
25
|
-
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
26
|
-
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
27
|
-
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
28
|
-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.i18n.yaml
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
3
3
|
# after editing either side, bring the other along and re-record with:
|
|
4
4
|
# pnpm run verify-translation-pairing --write packages/client/connection/README.md
|
|
5
|
-
README.md:
|
|
6
|
-
README.zh.md:
|
|
5
|
+
README.md: f0a707cc5f3a962c7852f7323c727d0a39a57b10
|
|
6
|
+
README.zh.md: b529eebf9af93e36b6b92c19964678b7f5a04ea1
|
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ Wire consumer layer: the client plugin's apply mounts `ctx.connection` (shared a
|
|
|
6
6
|
|
|
7
7
|
## /api browser-trust fence
|
|
8
8
|
|
|
9
|
-
The node half guards every entry under `/api` before bridging or upgrading (`src/api-request-trust.ts`). Every request — browser-marked or not — must present a `Host` that is a loopback authority or matches a `trustedHosts` entry: exact on `host:port` entries, any port on port-less entries, both sides compared through WHATWG normalization (DNS-rebinding defense). There is deliberately no shortcut for unmarked HTTP requests: over plain HTTP a browser attaches neither `Origin` nor Fetch-Metadata to image and navigation reads, so an unmarked request may still be a rebound browser read with a readable response, and Host is the one header rebinding cannot forge; a browser WebSocket handshake carries `Origin` and passes the same comparison. Non-browser clients pass the same fence via loopback,
|
|
9
|
+
The node half guards every entry under `/api` before bridging or upgrading (`src/api-request-trust.ts`). Every request — browser-marked or not — must present a `Host` that is a loopback authority or matches a `trustedHosts` entry: exact on `host:port` entries, any port on port-less entries, both sides compared through WHATWG normalization (DNS-rebinding defense). There is deliberately no shortcut for unmarked HTTP requests: over plain HTTP a browser attaches neither `Origin` nor Fetch-Metadata to image and navigation reads, so an unmarked request may still be a rebound browser read with a readable response, and Host is the one header rebinding cannot forge; a browser WebSocket handshake carries `Origin` and passes the same comparison. Non-browser clients pass the same fence via loopback, deployment-derived LAN IP literals, or a declared authority. When markers are present, an attached `Origin` must equal the Host authority, and an explicit `sec-fetch-site: cross-site` marker is refused. A `trustedHosts` entry that is not a bare, canonical `host[:port]` authority — one WHATWG parsing reads back exactly as written — fails the plugin load loudly: parsing would otherwise quietly authorize the hostname inside `harness.internal/path`, or broaden a dangling-colon or zero-padded port to an any-port grant. HTTP failures answer plain 403 before any RPC dispatch; upgrade failures reject the handshake before any event stream starts. Non-loopback compositions must trust their serving authorities explicitly: the Web runtime derives LAN IP literals from an all-interfaces server config, while `trustedHosts` in cordis.yml and the CLI's `--trusted-host` flag declare named authorities. `dsh web --host 0.0.0.0` is intentionally unsupported until remote access has an authentication layer. The fence is a reachability policy, not authentication; the Web carrier provides no authentication layer. Decision record: [the api browser-trust boundary Agent Note](../../../.agents/notes/implemented/architecture/2026-07-28-api-browser-trust-boundary.md).
|
|
10
10
|
|
|
11
11
|
## `/api` WebSocket downlinks
|
|
12
12
|
|
package/README.zh.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
## /api 浏览器信任栅栏
|
|
8
8
|
|
|
9
|
-
node 半侧在桥接或 upgrade 前守卫 `/api` 下的每个入口(`src/api-request-trust.ts`)。每个请求——无论是否带浏览器标记——`Host` 都必须是回环地址权威,或与某个 `trustedHosts` 条目匹配:带端口的 `host:port` 条目精确匹配,不带端口的条目匹配任意端口,两侧均经 WHATWG 归一化后比较(DNS rebinding 防御)。刻意不为无浏览器标记的 HTTP 请求开捷径:明文 HTTP 下浏览器的图片与导航读取既不带 `Origin` 也不带 Fetch-Metadata,因此无标记请求仍可能是被重绑页面发起的、响应可被读走的读取,而 Host 是重绑唯一伪造不了的请求头;WebSocket 浏览器握手会带 `Origin`
|
|
9
|
+
node 半侧在桥接或 upgrade 前守卫 `/api` 下的每个入口(`src/api-request-trust.ts`)。每个请求——无论是否带浏览器标记——`Host` 都必须是回环地址权威,或与某个 `trustedHosts` 条目匹配:带端口的 `host:port` 条目精确匹配,不带端口的条目匹配任意端口,两侧均经 WHATWG 归一化后比较(DNS rebinding 防御)。刻意不为无浏览器标记的 HTTP 请求开捷径:明文 HTTP 下浏览器的图片与导航读取既不带 `Origin` 也不带 Fetch-Metadata,因此无标记请求仍可能是被重绑页面发起的、响应可被读走的读取,而 Host 是重绑唯一伪造不了的请求头;WebSocket 浏览器握手会带 `Origin` 并通过同一道比较。非浏览器客户端经由回环地址、部署推导的 LAN IP 字面量或已声明的权威通过同一道栅栏。当标记存在时,如附带 `Origin`,则它必须与 Host 权威完全一致;显式的 `sec-fetch-site: cross-site` 标记一律拒绝。不是纯的、规范形 `host[:port]` 权威的 `trustedHosts` 条目——即 WHATWG 解析读回后与原文不完全一致的——会让插件加载明确报错:否则解析会悄悄授权 `harness.internal/path` 这类笔误里的 hostname,或把悬空冒号、补零端口放大成任意端口授权。HTTP 失败在任何 RPC 分发之前以纯 403 应答,upgrade 失败在启动任何事件流前拒绝握手。非回环组合必须显式信任其服务权威:Web 运行时从全接口服务器配置推导 LAN IP 字面量,cordis.yml 中的 `trustedHosts` 与 CLI(命令行界面)的 `--trusted-host` flag 则声明具名权威。`dsh web --host 0.0.0.0` 在远程访问具备认证层之前有意不受支持。这道栅栏是可达性策略,而不是认证;Web 载体不提供认证层。决策记录:[api 浏览器信任边界 Agent Note](../../../.agents/notes/implemented/architecture/2026-07-28-api-browser-trust-boundary.md)。
|
|
10
10
|
|
|
11
11
|
## `/api` WebSocket 下行
|
|
12
12
|
|
package/lib/client.js
CHANGED
|
@@ -5356,6 +5356,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5356
5356
|
asOfSeq: number().int().min(-1),
|
|
5357
5357
|
values: record(string(), unknown())
|
|
5358
5358
|
});
|
|
5359
|
+
object({
|
|
5360
|
+
blank: boolean(),
|
|
5361
|
+
lastPromptAt: number().nullable()
|
|
5362
|
+
});
|
|
5359
5363
|
object({
|
|
5360
5364
|
maxImageBytes: number().int().positive(),
|
|
5361
5365
|
maxImagesPerMessage: number().int().positive(),
|
package/lib/index.js
CHANGED
|
@@ -113,8 +113,8 @@ function isLoopbackHostname(hostname) {
|
|
|
113
113
|
* nor Fetch-Metadata to reads (images and navigations — those
|
|
114
114
|
* headers go only to trustworthy destinations), so an unmarked request may
|
|
115
115
|
* still be a rebound browser read and Host is the one header rebinding cannot
|
|
116
|
-
* forge. Non-browser and remote clients pass the same fence via loopback,
|
|
117
|
-
*
|
|
116
|
+
* forge. Non-browser and remote clients pass the same fence via loopback,
|
|
117
|
+
* deployment-derived LAN IP literals, or a declared `trustedHosts` authority.
|
|
118
118
|
* Network reachability and authentication stay out of scope: binding policy
|
|
119
119
|
* belongs to the webserver config, and this fence is not an auth layer.
|
|
120
120
|
*/
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* nor Fetch-Metadata to reads (images and navigations — those
|
|
8
8
|
* headers go only to trustworthy destinations), so an unmarked request may
|
|
9
9
|
* still be a rebound browser read and Host is the one header rebinding cannot
|
|
10
|
-
* forge. Non-browser and remote clients pass the same fence via loopback,
|
|
11
|
-
*
|
|
10
|
+
* forge. Non-browser and remote clients pass the same fence via loopback,
|
|
11
|
+
* deployment-derived LAN IP literals, or a declared `trustedHosts` authority.
|
|
12
12
|
* Network reachability and authentication stay out of scope: binding policy
|
|
13
13
|
* belongs to the webserver config, and this fence is not an auth layer.
|
|
14
14
|
*/
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepseek-ai/dsh-client-connection",
|
|
3
3
|
"description": "Wire consumer layer: HTTP-up/WebSocket-down client, ConnectionController dual streams with reconnect, and fixture api",
|
|
4
|
-
"version": "0.0
|
|
4
|
+
"version": "0.1.0-rc.2",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "restricted"
|
|
7
7
|
},
|
|
@@ -36,16 +36,16 @@
|
|
|
36
36
|
"immediately": true
|
|
37
37
|
}
|
|
38
38
|
},
|
|
39
|
-
"license": "
|
|
39
|
+
"license": "MIT",
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"ws": "^8.21.0",
|
|
42
|
-
"@deepseek-ai/dsh-attachment": "^0.0
|
|
43
|
-
"@deepseek-ai/dsh-host-apiproxy": "^0.0
|
|
44
|
-
"@deepseek-ai/dsh-
|
|
45
|
-
"@deepseek-ai/dsh-
|
|
46
|
-
"@deepseek-ai/
|
|
47
|
-
"@deepseek-ai/dsh-tools": "^0.0
|
|
48
|
-
"@deepseek-ai/
|
|
42
|
+
"@deepseek-ai/dsh-attachment": "^0.1.0-rc.2",
|
|
43
|
+
"@deepseek-ai/dsh-host-apiproxy": "^0.1.0-rc.2",
|
|
44
|
+
"@deepseek-ai/dsh-llm": "^0.1.0-rc.2",
|
|
45
|
+
"@deepseek-ai/dsh-session": "^0.1.0-rc.2",
|
|
46
|
+
"@deepseek-ai/schemastery": "^3.18.1",
|
|
47
|
+
"@deepseek-ai/dsh-tools": "^0.1.0-rc.2",
|
|
48
|
+
"@deepseek-ai/dsh-commands": "^0.1.0-rc.2"
|
|
49
49
|
},
|
|
50
50
|
"files": [
|
|
51
51
|
"lib/index.js",
|
|
@@ -54,14 +54,14 @@
|
|
|
54
54
|
"lib/types/**/*.d.ts"
|
|
55
55
|
],
|
|
56
56
|
"peerDependencies": {
|
|
57
|
-
"@deepseek-ai/dsh-
|
|
58
|
-
"@deepseek-ai/dsh-
|
|
59
|
-
"@deepseek-ai/cordis": "^4.0.1
|
|
57
|
+
"@deepseek-ai/dsh-invariants": "^0.1.0-rc.2",
|
|
58
|
+
"@deepseek-ai/dsh-host-webserver": "^0.1.0-rc.2",
|
|
59
|
+
"@deepseek-ai/cordis": "^4.0.1"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@types/ws": "^8.18.1",
|
|
63
|
-
"@deepseek-ai/dsh-host-webserver": "^0.0
|
|
64
|
-
"@deepseek-ai/dsh-invariants": "^0.0
|
|
65
|
-
"@deepseek-ai/cordis": "^4.0.1
|
|
63
|
+
"@deepseek-ai/dsh-host-webserver": "^0.1.0-rc.2",
|
|
64
|
+
"@deepseek-ai/dsh-invariants": "^0.1.0-rc.2",
|
|
65
|
+
"@deepseek-ai/cordis": "^4.0.1"
|
|
66
66
|
}
|
|
67
67
|
}
|