@xrn1997/dsh-session-delete 0.5.0 → 0.6.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 +201 -201
- package/README.md +165 -141
- package/cordis.patch.yml +7 -3
- package/icon.svg +18 -18
- package/lib/client.js +749 -430
- package/lib/index.js +850 -484
- package/lib/types/api/attachment-orphans.d.ts +9 -3
- package/lib/types/api/attachment.d.ts +17 -7
- package/lib/types/api/connection-route.d.ts +23 -0
- package/lib/types/api/dispatch.d.ts +24 -17
- package/lib/types/api/route-table.d.ts +25 -9
- package/lib/types/client/api-base.d.ts +19 -0
- package/lib/types/client/batch-bar.d.ts +1 -1
- package/lib/types/client/batch-pick.d.ts +19 -0
- package/lib/types/client/batch-select.d.ts +7 -5
- package/lib/types/client/context-menu-actions.d.ts +47 -0
- package/lib/types/client/copy.d.ts +8 -0
- package/lib/types/client/delete-confirm.d.ts +2 -2
- package/lib/types/client/host-rows.d.ts +27 -32
- package/lib/types/client/index.d.ts +2 -0
- package/lib/types/client/main-view.d.ts +2 -1
- package/lib/types/client/maintenance-settings.d.ts +3 -1
- package/lib/types/client/pending-open.d.ts +17 -0
- package/lib/types/client/remote.d.ts +22 -19
- package/lib/types/client/store.d.ts +1 -7
- package/lib/types/client/trash-nav.d.ts +5 -1
- package/lib/types/client/trash-view.d.ts +3 -0
- package/lib/types/client/ui/MenuItemButton.d.ts +1 -1
- package/lib/types/client/ui/Toast.d.ts +4 -1
- package/lib/types/client/use-trash-panel-controller.d.ts +1 -1
- package/lib/types/config.d.ts +45 -0
- package/lib/types/deps.d.ts +8 -3
- package/lib/types/domain/closure.d.ts +3 -0
- package/lib/types/index.d.ts +18 -16
- package/lib/types/ports/attachments-port.d.ts +40 -0
- package/lib/types/ports/fs-port.d.ts +10 -0
- package/lib/types/ports/host-port.d.ts +4 -2
- package/lib/types/shared/wire.d.ts +18 -5
- package/lib/types/trash/attachments.d.ts +17 -2
- package/lib/types/verbs/errors.d.ts +3 -1
- package/lib/types/verbs/orphan-subagents.d.ts +3 -2
- package/lib/types/verbs/permanent-removal.d.ts +10 -5
- package/locale/en.json +6 -6
- package/locale/zh.json +6 -6
- package/package.json +122 -117
- package/lib/types/api/request-trust.d.ts +0 -45
- package/lib/types/ports/connection-port.d.ts +0 -33
package/package.json
CHANGED
|
@@ -1,117 +1,122 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@xrn1997/dsh-session-delete",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "在 DeepSeek Harness 里删除会话:删除=移入回收站(可恢复),另设显式彻底删除",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"packageManager": "pnpm@11.25.0",
|
|
7
|
-
"main": "lib/index.js",
|
|
8
|
-
"types": "lib/types/index.d.ts",
|
|
9
|
-
"exports": {
|
|
10
|
-
".": {
|
|
11
|
-
"types": "./lib/types/index.d.ts",
|
|
12
|
-
"default": "./lib/index.js"
|
|
13
|
-
},
|
|
14
|
-
"./client": {
|
|
15
|
-
"types": "./lib/types/client/index.d.ts",
|
|
16
|
-
"default": "./lib/client.js"
|
|
17
|
-
},
|
|
18
|
-
"./locale/*.json": "./locale/*.json",
|
|
19
|
-
"./package.json": "./package.json"
|
|
20
|
-
},
|
|
21
|
-
"icon": "./icon.svg",
|
|
22
|
-
"files": [
|
|
23
|
-
"lib/index.js",
|
|
24
|
-
"lib/client.js",
|
|
25
|
-
"lib/types/**/*.d.ts",
|
|
26
|
-
"locale",
|
|
27
|
-
"icon.svg",
|
|
28
|
-
"cordis.patch.yml",
|
|
29
|
-
"README.md",
|
|
30
|
-
"LICENSE"
|
|
31
|
-
],
|
|
32
|
-
"engines": {
|
|
33
|
-
"node": ">=24",
|
|
34
|
-
"dsh": ">=0.1.7-rc.2 <0.3.0-0"
|
|
35
|
-
},
|
|
36
|
-
"scripts": {
|
|
37
|
-
"build": "tsdown && tsc -p tsconfig.build.json",
|
|
38
|
-
"typecheck": "tsc --noEmit",
|
|
39
|
-
"lint": "eslint .",
|
|
40
|
-
"test": "vitest run",
|
|
41
|
-
"test:watch": "vitest",
|
|
42
|
-
"pack:dry": "npm pack --dry-run --ignore-scripts",
|
|
43
|
-
"prepack": "npm run build",
|
|
44
|
-
"gates": "pnpm typecheck && pnpm lint && pnpm test && pnpm build && pnpm run pack:dry"
|
|
45
|
-
},
|
|
46
|
-
"peerDependencies": {
|
|
47
|
-
"@deepseek-ai/cordis": "^4.0.4",
|
|
48
|
-
"react": "^18.3.1"
|
|
49
|
-
},
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
"@
|
|
57
|
-
"@
|
|
58
|
-
"@
|
|
59
|
-
"@
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
"
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
"
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
"
|
|
86
|
-
"
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
"
|
|
106
|
-
"
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
"
|
|
113
|
-
|
|
114
|
-
"
|
|
115
|
-
"
|
|
116
|
-
|
|
117
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@xrn1997/dsh-session-delete",
|
|
3
|
+
"version": "0.6.1",
|
|
4
|
+
"description": "在 DeepSeek Harness 里删除会话:删除=移入回收站(可恢复),另设显式彻底删除",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"packageManager": "pnpm@11.25.0",
|
|
7
|
+
"main": "lib/index.js",
|
|
8
|
+
"types": "lib/types/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./lib/types/index.d.ts",
|
|
12
|
+
"default": "./lib/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./client": {
|
|
15
|
+
"types": "./lib/types/client/index.d.ts",
|
|
16
|
+
"default": "./lib/client.js"
|
|
17
|
+
},
|
|
18
|
+
"./locale/*.json": "./locale/*.json",
|
|
19
|
+
"./package.json": "./package.json"
|
|
20
|
+
},
|
|
21
|
+
"icon": "./icon.svg",
|
|
22
|
+
"files": [
|
|
23
|
+
"lib/index.js",
|
|
24
|
+
"lib/client.js",
|
|
25
|
+
"lib/types/**/*.d.ts",
|
|
26
|
+
"locale",
|
|
27
|
+
"icon.svg",
|
|
28
|
+
"cordis.patch.yml",
|
|
29
|
+
"README.md",
|
|
30
|
+
"LICENSE"
|
|
31
|
+
],
|
|
32
|
+
"engines": {
|
|
33
|
+
"node": ">=24",
|
|
34
|
+
"dsh": ">=0.1.7-rc.2 <0.3.0-0"
|
|
35
|
+
},
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build": "tsdown && tsc -p tsconfig.build.json",
|
|
38
|
+
"typecheck": "tsc --noEmit",
|
|
39
|
+
"lint": "eslint .",
|
|
40
|
+
"test": "vitest run",
|
|
41
|
+
"test:watch": "vitest",
|
|
42
|
+
"pack:dry": "npm pack --dry-run --ignore-scripts",
|
|
43
|
+
"prepack": "npm run build",
|
|
44
|
+
"gates": "pnpm typecheck && pnpm lint && pnpm test && pnpm build && pnpm run pack:dry"
|
|
45
|
+
},
|
|
46
|
+
"peerDependencies": {
|
|
47
|
+
"@deepseek-ai/cordis": "^4.0.4",
|
|
48
|
+
"react": "^18.3.1"
|
|
49
|
+
},
|
|
50
|
+
"peerDependenciesMeta": {
|
|
51
|
+
"react": {
|
|
52
|
+
"optional": true
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"@deepseek-ai/cordis": "^4.0.4",
|
|
57
|
+
"@eslint/js": "^10.0.1",
|
|
58
|
+
"@testing-library/dom": "^10.4.2",
|
|
59
|
+
"@testing-library/jest-dom": "^6.10.0",
|
|
60
|
+
"@testing-library/react": "^16.3.3",
|
|
61
|
+
"@types/node": "24.19.0",
|
|
62
|
+
"@types/react": "18.3.31",
|
|
63
|
+
"@types/react-dom": "18.3.5",
|
|
64
|
+
"@types/semver": "^7.8.0",
|
|
65
|
+
"eslint": "^10.14.0",
|
|
66
|
+
"eslint-plugin-react-hooks": "^7.1.1",
|
|
67
|
+
"globals": "^17.13.0",
|
|
68
|
+
"jsdom": "^26.1.0",
|
|
69
|
+
"react": "^18.3.1",
|
|
70
|
+
"react-dom": "18.3.1",
|
|
71
|
+
"react-markdown": "^10.1.0",
|
|
72
|
+
"remark-gfm": "^4.0.1",
|
|
73
|
+
"semver": "^7.8.5",
|
|
74
|
+
"tsdown": "0.23.0",
|
|
75
|
+
"typescript": "5.9.3",
|
|
76
|
+
"typescript-eslint": "^8.72.1",
|
|
77
|
+
"vitest": "3.2.7"
|
|
78
|
+
},
|
|
79
|
+
"dsh": {
|
|
80
|
+
"bundle": {
|
|
81
|
+
"patch": "./cordis.patch.yml"
|
|
82
|
+
},
|
|
83
|
+
"client": {
|
|
84
|
+
"inject": [
|
|
85
|
+
"@deepseek-ai/dsh-client-locale",
|
|
86
|
+
"@deepseek-ai/dsh-client-ui-context-menu"
|
|
87
|
+
],
|
|
88
|
+
"platform": "web"
|
|
89
|
+
},
|
|
90
|
+
"compatibility": {
|
|
91
|
+
"dshReleases": {
|
|
92
|
+
"0.2.0-rc.2": "compatible",
|
|
93
|
+
"0.2.1-rc.1": "compatible",
|
|
94
|
+
"0.2.1-rc.2": "compatible",
|
|
95
|
+
"0.2.1-rc.3": "compatible",
|
|
96
|
+
"0.2.1-rc.5": "compatible",
|
|
97
|
+
"0.2.2-rc.1": "compatible"
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
"publishConfig": {
|
|
102
|
+
"access": "public"
|
|
103
|
+
},
|
|
104
|
+
"repository": {
|
|
105
|
+
"type": "git",
|
|
106
|
+
"url": "git+https://github.com/xrn1997/dsh-session-delete.git"
|
|
107
|
+
},
|
|
108
|
+
"homepage": "https://github.com/xrn1997/dsh-session-delete#readme",
|
|
109
|
+
"bugs": {
|
|
110
|
+
"url": "https://github.com/xrn1997/dsh-session-delete/issues"
|
|
111
|
+
},
|
|
112
|
+
"keywords": [
|
|
113
|
+
"dsh",
|
|
114
|
+
"deepseek-harness",
|
|
115
|
+
"plugin",
|
|
116
|
+
"session",
|
|
117
|
+
"trash",
|
|
118
|
+
"delete"
|
|
119
|
+
],
|
|
120
|
+
"author": "xrn1997",
|
|
121
|
+
"license": "Apache-2.0"
|
|
122
|
+
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 请求栅栏:判一条打到 `/dsh-session-delete-api` 的请求归不归本插件办。
|
|
3
|
-
*
|
|
4
|
-
* 两件事分开:**归属**(Host / Origin / Referer 是不是本次部署自己的)与**身份**(远程客户端是不是
|
|
5
|
-
* 宿主的已认证 Web 客户端)。绑定策略归宿主 webserver 配置——它只接受具体接口 IP 字面量、拒绝
|
|
6
|
-
* wildcard——所以「谁能到达」不是本插件能替它决定的事;栅栏本身只防 browser confused deputy,
|
|
7
|
-
* 身份留给宿主(见 ②)。口径与宿主 `/api` 的 `isTrustedApiRequest`(asar
|
|
8
|
-
* `dsh-client-connection/lib/index.js`)对齐,差别只有一条:本模块多查 Referer,因为
|
|
9
|
-
* `GET /attachment` 是二进制段(见末段)。
|
|
10
|
-
*
|
|
11
|
-
* 两条放行支,外加一条缺席规则:
|
|
12
|
-
* ① 头栅栏全过 ∧ 源地址回环 ∧ Host 属于本次部署(回环名 / 监听 bind 字面量)——本机工具与转发落在
|
|
13
|
-
* 回环的桌面壳;
|
|
14
|
-
* ② 宿主 `connection` 服务的 `requestRejection` 放行——远程浏览器。它自带宿主的 Host 白名单
|
|
15
|
-
* (含部署声明的 `trustedHosts`)与「已认证 live peer」,身份就是那次 `dsh web` 打印的 URL 换来的
|
|
16
|
-
* 签名 cookie,不在本插件里复刻;
|
|
17
|
-
* ③ 身份层缺席(`src/ports/connection-port.ts` 报 `absent`,宿主无 `connection` 服务或成员改名)
|
|
18
|
-
* ⇒ 远程一律拒(fail-closed:退回「只有本机」,LAN 上表现为 403 而不是静默放行)。
|
|
19
|
-
*
|
|
20
|
-
* **DNS rebinding 由 Host 归属判据挡**:`Origin === Host` 只证两者同名,不证这个名字属于本部署;
|
|
21
|
-
* 回环 socket 也不构成豁免(重绑到 `127.0.0.1` 的攻击正是回环源地址)。对浏览器来说 Host 是重绑伪造
|
|
22
|
-
* 不了的那个头——它按连接目标填,而 `Origin` 是页面自己的名字——所以归属判定先于任何本机 / 远程
|
|
23
|
-
* 分支,别在它前面加 fast-path。
|
|
24
|
-
*
|
|
25
|
-
* 末段:`GET /attachment` 的响应不是 opaque 的「读不出内容」——页面若已知某个 `sha256:…` 内容哈希,
|
|
26
|
-
* 就能把它当 `<img src>` 跨源渲染出来。那条请求不带 Origin,靠 Referer 判同源挡;宿主 `/api` 没有
|
|
27
|
-
* 二进制段,所以它的栅栏不需要这一条。
|
|
28
|
-
*/
|
|
29
|
-
import type { IncomingMessage } from 'node:http';
|
|
30
|
-
import type { ConnectionPort } from '../ports/connection-port.js';
|
|
31
|
-
export type RequestTrustVerdict = 'allowed' | 'untrusted' | 'unauthenticated';
|
|
32
|
-
export interface RequestTrustFacts {
|
|
33
|
-
/** 监听器绑定的那个具体接口 IP 字面量;老代次没有这个 getter 时为 `undefined`(bind 支退化,仍 fail-closed)。 */
|
|
34
|
-
readonly bindHost: string | undefined;
|
|
35
|
-
/** 宿主的 Web 身份面;端口每次请求惰性解析服务,缺席由它报 `absent`。 */
|
|
36
|
-
readonly connection: ConnectionPort;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* 这条请求归不归本插件办。`untrusted` = 归属不对(跨源 / 重绑 / 头不成形);`unauthenticated` =
|
|
40
|
-
* 归属对但远程客户端没带宿主身份(原文会提示用 `dsh web` 打印的 URL 打开)。
|
|
41
|
-
*
|
|
42
|
-
* 远程支的两个失败裁决由端口翻译宿主的区分(401 = 缺身份、403 = 归属不对)。身份层缺席(端口报
|
|
43
|
-
* `absent`)一律按归属不对处理:那时没有可换的身份,不能让原文提示用户去补一个不存在的东西。
|
|
44
|
-
*/
|
|
45
|
-
export declare function judgeRequest(req: IncomingMessage, facts: RequestTrustFacts): RequestTrustVerdict;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 宿主 `connection` 服务(`dsh-client-connection` 的 `HostConnectionService`,`super(ctx, "connection")`)
|
|
3
|
-
* 的窄镜像:`requestRejection(request)` 一次做宿主 `/api` 的那两道——Host/Origin 栅栏与「已认证 live peer」。
|
|
4
|
-
*
|
|
5
|
-
* **每次请求惰性解析服务**,不在激活时取一次:插件与 `client-connection` 的激活顺序没有承诺,取早了
|
|
6
|
-
* 会让远程支永远缺席(LAN 上全 403 且难排查)。`ctx.get` 是同步查表,代价可以忽略。
|
|
7
|
-
*
|
|
8
|
-
* **状态码在这里翻成裁决**(401 = 归属对、缺身份;403 = 归属不对;其余按归属不对处理),
|
|
9
|
-
* 调用方拿到的就是自己的词表,不需要知道宿主用哪个码表达哪件事。成员名与返回值按 asar
|
|
10
|
-
* `dsh-client-connection/lib/index.js` 原文读实。
|
|
11
|
-
*/
|
|
12
|
-
import type { IncomingMessage } from 'node:http';
|
|
13
|
-
import type { Context } from '@deepseek-ai/cordis';
|
|
14
|
-
export type ConnectionVerdict = {
|
|
15
|
-
readonly kind: 'allowed';
|
|
16
|
-
}
|
|
17
|
-
/** 组成里没有这个服务(无 web 组成 / 老代次)——调用方 fail-closed。 */
|
|
18
|
-
| {
|
|
19
|
-
readonly kind: 'absent';
|
|
20
|
-
}
|
|
21
|
-
/** 宿主认可归属,但这条请求没带已认证身份。 */
|
|
22
|
-
| {
|
|
23
|
-
readonly kind: 'unauthenticated';
|
|
24
|
-
}
|
|
25
|
-
/** 宿主不认可归属(Host/Origin 栅栏不过,或它给出的其余状态码)。 */
|
|
26
|
-
| {
|
|
27
|
-
readonly kind: 'untrusted';
|
|
28
|
-
};
|
|
29
|
-
export interface ConnectionPort {
|
|
30
|
-
verdictFor(req: IncomingMessage): ConnectionVerdict;
|
|
31
|
-
}
|
|
32
|
-
/** 成员抛错按「归属不对」拒绝(fail-closed)。 */
|
|
33
|
-
export declare function createConnectionPort(ctx: Context): ConnectionPort;
|