dsh-question-timeout-protection 0.0.0-stage → 0.1.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/COPYRIGHT +10 -0
- package/LICENSE +201 -0
- package/README.md +263 -2
- package/README_en-US.md +264 -0
- package/cordis.patch.yml +4 -0
- package/dist/client.js +2106 -0
- package/dist/index.d.mts +76 -0
- package/dist/index.mjs +1093 -0
- package/package.json +96 -4
- package/src/translation/.example_zh-CN.ini +43 -0
- package/src/translation/en-US.ini +43 -0
- package/src/translation/zh-CN.ini +43 -0
package/COPYRIGHT
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Copyright (c) 2026 JularDepick
|
|
2
|
+
|
|
3
|
+
This project is made available under the terms of a license.
|
|
4
|
+
The complete license terms are defined in the LICENSE file
|
|
5
|
+
distributed with this source code.
|
|
6
|
+
|
|
7
|
+
For inquiries, please contact:
|
|
8
|
+
JularDepick@gmail.com | 1724834368@qq.com
|
|
9
|
+
|
|
10
|
+
GitHub: https://github.com/JularDepick
|
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,264 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
# dsh-question-timeout-protection
|
|
4
|
+
|
|
5
|
+
[](https://github.com/JularDepick/dsh-question-timeout-protection/releases)
|
|
6
|
+
[](./COPYRIGHT)
|
|
7
|
+
[](./LICENSE)
|
|
8
|
+
|
|
9
|
+
[English](./README_en-US.md)
|
|
10
|
+
| 简体中文
|
|
11
|
+
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
dsh提问超时保护插件: 一旦模型提问超时,将你的回答草稿保留在UI或上下文中,而不是直接丢弃.
|
|
15
|
+
|
|
16
|
+
## 为什么需要它
|
|
17
|
+
|
|
18
|
+
dsh 默认的提问是阻塞式的: 模型问完就一直等, 你离开一会儿, 整个对话就停在那里. 换成限时等待之后又出现另一个问题, 时间一到, 你已经选好, 已经写了一半的内容会被直接丢掉, 模型只知道「超时了」, 不知道你想说什么.
|
|
19
|
+
|
|
20
|
+
这个插件补上三件事: 让你看见还要等多久, 让你能暂停等待, 让超时那一刻的内容不丢.
|
|
21
|
+
|
|
22
|
+
## 它能带来什么
|
|
23
|
+
|
|
24
|
+
| 能力 | 你会看到什么 |
|
|
25
|
+
|:---:|:---:|
|
|
26
|
+
| 倒计时 | 问答卡片右上角显示还剩多少秒, 逐秒递减 |
|
|
27
|
+
| 临期预警 | 最后几秒数字变红闪烁, 提醒你尽快作答 |
|
|
28
|
+
| 无限等待 | 倒计时旁的按钮, 点一下就没有截止时间, 直到你提交或页面与会话结束 |
|
|
29
|
+
| 自动无限等待 | 工具栏上的常开开关, 开启后每条提问都自动进入无限等待 |
|
|
30
|
+
| 选中视觉 | 单选题选中后, 选项前的方形标号填充底色 |
|
|
31
|
+
| 超时草稿 | 超时那一刻的已选选项与已输入内容被保存下来 |
|
|
32
|
+
| 草稿回看 | 超时后提问行出现气泡按钮, 点开只读查看当时写了什么 |
|
|
33
|
+
| 注入上下文 | 开启后草稿随工具结果回到模型上下文, 模型能接着处理 |
|
|
34
|
+
|
|
35
|
+
## 安装
|
|
36
|
+
|
|
37
|
+
### 前置条件
|
|
38
|
+
|
|
39
|
+
- dsh 版本在 `>=0.2.1-rc.1 <=0.2.2-rc.1` 之内, 不满足会被安装与启动阶段拒绝
|
|
40
|
+
- Node.js >= 20
|
|
41
|
+
|
|
42
|
+
### 方式一: 从 npm 安装
|
|
43
|
+
|
|
44
|
+
dsh 原生支持从 npm 安装插件, 但 npm 上的同名包目前只是一个发布占位, 里面没有插件代码, 不能安装: 按下面的命令会装到占位包, dsh 只会打一条警告并跳过该插件, 界面上不会出现任何本插件的功能.
|
|
45
|
+
|
|
46
|
+
真正可用的前提是本项目发布到 npm 且 latest 指向正式版本. 到那时一条命令即可:
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
dsh plugin --profile <profile> add dsh-question-timeout-protection
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
在此之前请用下面的方式二至方式四.
|
|
53
|
+
|
|
54
|
+
### 方式二: 从源码构建后安装
|
|
55
|
+
|
|
56
|
+
适合从这个仓库直接使用:
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
pnpm install
|
|
60
|
+
pnpm pack
|
|
61
|
+
dsh plugin --profile <profile> add <tarball>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
`pnpm pack` 会先构建, 完成后把 tarball 放进打包输出目录, 文件名形如 `dsh-question-timeout-protection-0.1.1.tgz`. 按文件名定位后换成实际路径即可.
|
|
65
|
+
|
|
66
|
+
### 方式三: 直接从 GitHub 源码安装
|
|
67
|
+
|
|
68
|
+
把包名换成 `github:JularDepick/dsh-question-timeout-protection#<提交>`, 由 `prepare` 负责构建.
|
|
69
|
+
|
|
70
|
+
pnpm 10 及以上默认拦截依赖的构建脚本, 因此首次 `add` 会失败并打印一个包键. 把该包键写进这个 profile 的 `pnpm-workspace.yaml` 里:
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
allowBuilds:
|
|
74
|
+
dsh-question-timeout-protection: true
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
然后重新执行 `add`. 跳过这一步装上去没有构建产物, 插件不会工作.
|
|
78
|
+
|
|
79
|
+
### 方式四: 从 Release 的 tarball 安装
|
|
80
|
+
|
|
81
|
+
下载对应版本的 tarball 后直接:
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
dsh plugin --profile <profile> add <tarball>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
这种方式不需要构建, 也不受 pnpm 构建脚本拦截影响.
|
|
88
|
+
|
|
89
|
+
## 快速开始
|
|
90
|
+
|
|
91
|
+
1. 按上面任一方式把插件装进你的 profile
|
|
92
|
+
2. 重启 dsh
|
|
93
|
+
3. 让模型问你一个问题, 卡片右上角会出现倒计时; 想暂停就点旁边的「无限等待」
|
|
94
|
+
|
|
95
|
+
## 使用说明
|
|
96
|
+
|
|
97
|
+
### 倒计时与临期预警
|
|
98
|
+
|
|
99
|
+
倒计时只在**正在进行的提问**上出现, 按插件自己的截止时间走, 你聚焦输入框或开始打字都不会让它暂停. 剩余时间进入警示秒数时数字变红闪烁; 到了截止时间, 插件撤下自己的倒计时与故障提示, 把卡片还原成宿主自己的等待状态, 等结算回执到达后再决定锁定收起还是交还宿主.
|
|
100
|
+
|
|
101
|
+
历史提问与已结算回答的只读卡片上不会出现倒计时.
|
|
102
|
+
|
|
103
|
+
### 无限等待
|
|
104
|
+
|
|
105
|
+
倒计时右侧的「无限等待」按钮, 点击后本次提问不再有截止时间, 倒计时冻结为「已暂停」, 直到你提交才结束.
|
|
106
|
+
|
|
107
|
+
这个动作需要服务端确认登记成功才会生效, 因此点击后要等回执. 如果状态通道不可用, 按钮不会生效, 卡片会回到计时状态并在倒计时位置显示「无法无限等待」.
|
|
108
|
+
|
|
109
|
+
### 自动无限等待
|
|
110
|
+
|
|
111
|
+
工具栏模型选择控件左侧有一个常开开关「问答自动无限等待」. 开启后, 每一条新提问都自动进入无限等待, 正在等待的那条也会立刻冻结, 效果与手动点一次「无限等待」相同.
|
|
112
|
+
|
|
113
|
+
开关状态存在浏览器本地, 刷新后保留. 关闭开关只影响之后的新提问, 已经冻结的提问不会恢复倒计时, 仍由你提交结束.
|
|
114
|
+
|
|
115
|
+
这个开关只在卡片增强与无限等待都开启时出现.
|
|
116
|
+
|
|
117
|
+
### 超时草稿与只读回看
|
|
118
|
+
|
|
119
|
+
超时那一刻, 插件会把你已经选中的选项与已经输入的内容保存到内存. 之后该提问的工具调用行会出现一个气泡按钮, 点开就在气泡旁边弹出只读悬浮卡片, 按题展示当时的已选与补充, 不提供任何作答入口.
|
|
120
|
+
|
|
121
|
+
草稿为空, 也就是你什么都没选也没写时, 这次超时由插件直接关闭卡片, 不产生气泡.
|
|
122
|
+
|
|
123
|
+
草稿只存在内存里, 刷新页面后气泡与记录都会消失.
|
|
124
|
+
|
|
125
|
+
### 注入到上下文
|
|
126
|
+
|
|
127
|
+
这一项默认开启. 开启后, 插件在你作答期间就把草稿快照持续上报给服务端, 工具到期时取用最新一份, 按题随工具的 pending 结果带回模型上下文, 每道题带自己的已选与补充.
|
|
128
|
+
|
|
129
|
+
超时说明与草稿放在同一个结果里, 并明确要求模型在回复末尾告知你这次超时; 如果带回了草稿, 还要说明准备怎么处理它.
|
|
130
|
+
|
|
131
|
+
关闭这一项后, 插件只收起卡片, 不把草稿交给模型.
|
|
132
|
+
|
|
133
|
+
### 配置项
|
|
134
|
+
|
|
135
|
+
配置页在**插件详情页顶部**的插件级配置区块, 不在「包含的组件」里. 其中只有「注入到上下文」一个勾选可以调整, 勾选变化立即写入, 不需要保存或刷新.
|
|
136
|
+
|
|
137
|
+
| 配置项 | 取值 | 默认值 | 界面 | 说明 |
|
|
138
|
+
|:---:|:---:|:---:|:---:|:---:|
|
|
139
|
+
| `fallback` | `ui` / `context` / `both` | `both` | 可改一项 | 超时兜底. 界面只给「注入到上下文」勾选, 勾上写 `both`, 不勾写 `ui`. 界面保留草稿恒定开启, 所以不会出现 `context` |
|
|
140
|
+
| `cardEnhancements` | 布尔 | `true` | 固定特性 | 只管装饰: 倒计时与闪烁, 单选底色, 提问气泡, 隐藏宿主自带的收起控件与等待文案. 关闭后装饰都不出现, 但超时收尾照常: 该收的卡片仍会被收起与锁定, 草稿仍会按配置上报 |
|
|
141
|
+
| `infiniteWait` | 布尔 | `true` | 固定特性 | 提供「无限等待」按钮与工具栏常开开关, 关闭后两者一并移除 |
|
|
142
|
+
| `draftFallback` | 布尔 | `true` | 固定特性 | 超时收尾开关. 关闭后客户端不再收尾卡片也不再上报草稿, 这一轮交还宿主; 提问仍由插件按时结算 |
|
|
143
|
+
| `warningSeconds` | 数字 | 5 | 不暴露 | 进入红字闪烁的剩余秒数, 取值 1 至 60 |
|
|
144
|
+
| `timeoutSeconds` | 数字 | 120 | 不暴露 | 模型没有显式传等待秒数时用的时长, 取值 1 至 2147483 |
|
|
145
|
+
|
|
146
|
+
## 兼容性
|
|
147
|
+
|
|
148
|
+
| 项目 | 版本 |
|
|
149
|
+
|:---:|:---:|
|
|
150
|
+
| dsh | `>=0.2.1-rc.1 <=0.2.2-rc.1` |
|
|
151
|
+
| Node.js | >= 20 |
|
|
152
|
+
|
|
153
|
+
宿主 dsh 自身的 Node.js 要求以对应版本的发行说明为准.
|
|
154
|
+
|
|
155
|
+
## 常见问题
|
|
156
|
+
|
|
157
|
+
**超时后我已经输入的内容会丢吗**
|
|
158
|
+
|
|
159
|
+
不会丢在本页. 插件会在超时那一刻把已选与已输入内容保存到内存, 并记入该提问的气泡按钮, 你可以随时点开只读查看. 但刷新页面后这份记录会消失.
|
|
160
|
+
|
|
161
|
+
**模型能看到我写了什么吗**
|
|
162
|
+
|
|
163
|
+
看你有没有勾选「注入到上下文」. 勾选时草稿随工具结果进入模型上下文; 取消勾选时只留在界面, 模型拿不到.
|
|
164
|
+
|
|
165
|
+
**卡片为什么突然消失了**
|
|
166
|
+
|
|
167
|
+
因为这次提问超时并被插件接管. 插件会收起卡片并锁定, 避免留下一个点也点不动的对话框. 想回看当时的内容, 点提问行的气泡按钮; 超时那一刻没有任何选择与输入时不会产生气泡.
|
|
168
|
+
|
|
169
|
+
**为什么我的界面上没有倒计时**
|
|
170
|
+
|
|
171
|
+
常见原因包括: 卡片增强被关掉; 这次提问是必须回答的阻塞提问, 模型传了 `-1`; 界面语言不是中文或英文. 另外刷新页面时如果卡片已经处于编辑或等待状态, 插件无法还原截止时间, 在卡片回到计时状态之前也不会显示.
|
|
172
|
+
|
|
173
|
+
**点了「无限等待」之后会怎样**
|
|
174
|
+
|
|
175
|
+
本次提问不再有截止时间, 模型会一直等, 直到你提交, 或页面与会话结束. 如果状态通道不可用, 按钮不会生效, 卡片回到计时状态并显示「无法无限等待」.
|
|
176
|
+
|
|
177
|
+
**刷新页面后气泡不见了**
|
|
178
|
+
|
|
179
|
+
草稿只保存在内存里, 不做持久化, 所以刷新后本页记录的气泡与草稿都会丢. 仍在等待的提问会按宿主持久化的草稿重新评估.
|
|
180
|
+
|
|
181
|
+
**需要改我的预设吗**
|
|
182
|
+
|
|
183
|
+
不需要. 插件在每个 agent 作用域注册同名提问工具, 就近遮蔽宿主的阻塞式提问.
|
|
184
|
+
|
|
185
|
+
**会自动替我提交答案吗**
|
|
186
|
+
|
|
187
|
+
不会. 超时不会自动勾选任何选项, 也不会把草稿当成正式回答提交.
|
|
188
|
+
|
|
189
|
+
## 已知限制
|
|
190
|
+
|
|
191
|
+
**依赖宿主界面**
|
|
192
|
+
|
|
193
|
+
卡片与工具行靠宿主的类名后缀, `data-question-key`, `data-chat-call-id`, `aria-checked` 等特征定位, 宿主控件按中英文标签识别; 工具栏开关优先按模型选择控件的无障碍标签定位, 标签不匹配时退回工具栏容器内按结构定位, 再退回全文档查找, 定位失败时按原因各留一条 console.warn 而不是静默消失. 宿主改动这些结构或文案时对应增强会失效, 识别标签与选择器集中在源码的常量文件里.
|
|
194
|
+
|
|
195
|
+
**依赖宿主提问投影**
|
|
196
|
+
|
|
197
|
+
客户端靠宿主 sessions 服务的 userQuestions 投影判断提问是否进入 continued 态, 草稿上报, 超时收尾与气泡都由它驱动. 该服务缺失或接口改名时插件按会话各打一条 console.warn: 倒计时与卡片装饰仍在, 但草稿不上报, 超时收尾不执行, 气泡不出现.
|
|
198
|
+
|
|
199
|
+
**会话订阅上限**
|
|
200
|
+
|
|
201
|
+
同时最多保持 8 个会话的投影订阅, 超出后最久未出现的会话降级为每秒轮询, 该会话的超时接管会延后; 轮询兜底也最多 8 个, 再超出时释放最久未出现的会话, 其超时兜底可能不再生效.
|
|
202
|
+
|
|
203
|
+
**不做持久化**
|
|
204
|
+
|
|
205
|
+
草稿只在客户端内存里, 刷新后气泡与记录都会丢. 仍在等待的提问会按宿主持久化的草稿重新评估并在满足条件时接管; 已结算的行不回显.
|
|
206
|
+
|
|
207
|
+
**「无限等待」与草稿上报需要网页客户端**
|
|
208
|
+
|
|
209
|
+
两者共用一条带令牌的通道, 挂在宿主自己的 HTTP 服务上, 与界面同源. 页面先取令牌再上报, 令牌取不到时两个能力都不生效. 通道还会核对请求的 Host 必须为本机回环地址, 因此宿主绑定到非回环地址或经反向代理以非回环域名访问时通道会被拒绝. 没有网页客户端的部署里服务端仍会按超时结算, 但草稿不会进入模型上下文, 「无限等待」也不生效.
|
|
210
|
+
|
|
211
|
+
**界面语言**
|
|
212
|
+
|
|
213
|
+
宿主 0.2.2-rc.1 起提供 8 种界面语言, 插件只识别中文与英文标签. 其他语言界面下倒计时, 无限等待按钮与工具栏开关不出现, 插件自绘的气泡与配置页文案回退英文. ja 的「回答」与中文同形会被隐藏, 但 ja 的等待文案仍会保留, 与被收起卡片的状态不一致; 其余语言下宿主的「回答」入口与等待文案大多仍然可见. ja 下空草稿超时不会出现插件气泡, 宿主的入口又已按文案隐藏, 因此这一轮没有可点的回看入口. 卡片关闭在这些语言下退化为隐藏类, 提交按钮不锁定.
|
|
214
|
+
|
|
215
|
+
**其他**
|
|
216
|
+
|
|
217
|
+
- 插件自行计时, 到期后由插件按超时结算并释放宿主那边的前台等待; 你在超时那一刻之前真正提交的答案优先采用
|
|
218
|
+
- 多标签页同时打开同一会话时, 服务端按调用标识只保留一份草稿快照, 后上报的标签页会覆盖先到的那份
|
|
219
|
+
- 气泡里的草稿记录只保留最近 200 条, 更早的气泡不再可点开
|
|
220
|
+
- 宿主 0.2.2-rc.1 打开卡片时会预选带推荐标记的选项, 插件按投影里的选项原文剥掉这些预选值; 多选时点过任一选项后, 其余预选项按宿主自己的提交口径一并保留
|
|
221
|
+
- 只是点了「跳过」而没有选择与输入时, 草稿按空处理, 这次超时由插件关闭卡片
|
|
222
|
+
- 草稿按题合并三处来源, 优先级为宿主持久化记录, 当前显示题的实时值, 插件自己的快照; 读实时值时已选标签取的是宿主给读屏用的文案, 其中的「(推荐)」这类后缀可能被省略
|
|
223
|
+
- 注入给模型的超时说明目前只有中文, 英文界面下模型收到的仍是中文说明
|
|
224
|
+
- 草稿超过单次上报上限 256 KiB 时界面显示「草稿过长, 未送达」, 这一条不计入连续失败次数; 连续失败三次后该轮判定通道不可用, 插件不再接管, 卡片交还宿主继续可作答
|
|
225
|
+
|
|
226
|
+
## 更新与卸载
|
|
227
|
+
|
|
228
|
+
升级时先移除旧版本再装新版本:
|
|
229
|
+
|
|
230
|
+
```
|
|
231
|
+
dsh plugin --profile <profile> remove dsh-question-timeout-protection
|
|
232
|
+
dsh plugin --profile <profile> add <新包或 tarball>
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
只想停用而不卸载时, 在该 profile 的 `cordis.patch.yml` 里按行 id 禁用:
|
|
236
|
+
|
|
237
|
+
```
|
|
238
|
+
- id: question-timeout-protection
|
|
239
|
+
disabled: true
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
## 开发
|
|
243
|
+
|
|
244
|
+
```
|
|
245
|
+
pnpm install
|
|
246
|
+
pnpm build
|
|
247
|
+
pnpm typecheck
|
|
248
|
+
pnpm run check:translation
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
`pnpm run check:translation` 会核对三份翻译文件, 配置页字典与界面文案常量是否一致, 以及文案改动是否同步更新了维护时间.
|
|
252
|
+
|
|
253
|
+
`src/translation/*.ini` 是同一套措辞的镜像, 当前界面并不读取它: 界面文案的实际来源是 `src/constants.ts` 与 `src/client/i18n.ts`, 改可见文案要同时改这两处或其中之一与三份 ini.
|
|
254
|
+
|
|
255
|
+
## 许可证
|
|
256
|
+
|
|
257
|
+
本项目采用 [Apache License 2.0](./LICENSE) 授权,版权声明见 [COPYRIGHT](./COPYRIGHT).
|
|
258
|
+
|
|
259
|
+
Copyright (c) 2026 JularDepick
|
|
260
|
+
|
|
261
|
+
## 相关链接
|
|
262
|
+
|
|
263
|
+
- dsh 官方仓库: https://github.com/deepseek-ai/deepseek-harness
|
|
264
|
+
- dsh 插件开发文档: https://github.com/deepseek-ai/deepseek-harness/tree/master/docs/user/develop
|