dsh-question-timeout-protection 0.0.0-stage → 0.1.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/COPYRIGHT +10 -0
- package/LICENSE +201 -0
- package/README.md +268 -2
- package/README_en-US.md +269 -0
- package/cordis.patch.yml +4 -0
- package/dist/client.js +2149 -0
- package/dist/index.d.mts +76 -0
- package/dist/index.mjs +1095 -0
- package/package.json +99 -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/README_en-US.md
ADDED
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# dsh-question-timeout-protection
|
|
4
|
+
|
|
5
|
+
[](https://github.com/JularDepick/dsh-question-timeout-protection/releases)
|
|
6
|
+
[](./COPYRIGHT)
|
|
7
|
+
[](./LICENSE)
|
|
8
|
+
|
|
9
|
+
English
|
|
10
|
+
| [简体中文](./README.md)
|
|
11
|
+
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
A plugin for dsh: once ask_user_question times out, the content you entered will remain in the UI or model context.
|
|
15
|
+
|
|
16
|
+
## Why you need it
|
|
17
|
+
|
|
18
|
+
A dsh question blocks by default: once the model asks, it waits, and if you step away the whole conversation sits there. Switch to a timed wait and another problem appears: when the clock runs out, whatever you had already selected and typed is dropped, and the model only learns that it timed out, not what you were about to say.
|
|
19
|
+
|
|
20
|
+
This plugin adds three things: you can see how long is left, you can pause the wait, and the content at the moment of the timeout is not lost.
|
|
21
|
+
|
|
22
|
+
## What you get
|
|
23
|
+
|
|
24
|
+
| Capability | What you will see |
|
|
25
|
+
|:---:|:---:|
|
|
26
|
+
| Countdown | The question card shows the remaining seconds at its top right, ticking down |
|
|
27
|
+
| Warning | In the last seconds the number turns red and blinks |
|
|
28
|
+
| Wait indefinitely | A button next to the countdown; one click removes the deadline until you submit, or the page or session ends |
|
|
29
|
+
| Auto wait indefinitely | A toolbar switch that puts every new question into indefinite wait |
|
|
30
|
+
| Selection fill | A chosen single-choice option fills the square marker in front of it |
|
|
31
|
+
| Timeout draft | The options you selected and the text you typed are kept at the moment of the timeout |
|
|
32
|
+
| Draft review | After a timeout the question row shows a bubble button; click it to read what you had entered |
|
|
33
|
+
| Context injection | When on, the draft returns to the model context with the tool result |
|
|
34
|
+
|
|
35
|
+
## Install
|
|
36
|
+
|
|
37
|
+
### Requirements
|
|
38
|
+
|
|
39
|
+
- dsh within `>=0.2.1-rc.1 <=0.2.2-rc.2`; installation and startup refuse anything outside it
|
|
40
|
+
- Node.js >= 20
|
|
41
|
+
|
|
42
|
+
### Option A: install from npm
|
|
43
|
+
|
|
44
|
+
dsh installs plugins from npm natively:
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
dsh plugin --profile <profile> add dsh-question-timeout-protection
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
The npm latest tag currently points at 0.1.1, which declares dsh support only up to 0.2.2-rc.1, so installation and startup reject it on 0.2.2-rc.2. For this version (0.1.2) use Options B to D below; once latest points at 0.1.2 the command above installs this version directly.
|
|
51
|
+
|
|
52
|
+
### Option B: build from source
|
|
53
|
+
|
|
54
|
+
For using the plugin straight from this repository:
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
pnpm install
|
|
58
|
+
pnpm pack
|
|
59
|
+
dsh plugin --profile <profile> add ./release/<tarball>
|
|
60
|
+
dsh plugin --profile <profile> add <absolute path>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
`pnpm pack` builds first, then moves the tarball into `release/` at the repository root under a name like `dsh-question-timeout-protection-0.1.2.tgz`. Where a sandbox blocks lifecycle scripts, use `pnpm run pack:release` for the same artifact. A path passed to `add` is resolved against your current directory only when it starts with `./` or `../`; otherwise it is treated as a package name and looked up in the registry.
|
|
64
|
+
|
|
65
|
+
### Option C: install from the GitHub source
|
|
66
|
+
|
|
67
|
+
Use `github:JularDepick/dsh-question-timeout-protection#<commit>` as the package name; `prepare` runs the build.
|
|
68
|
+
|
|
69
|
+
pnpm 10 and newer block dependency build scripts by default, so the first `add` fails and prints a package key. Put that key into this profile's `pnpm-workspace.yaml`:
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
allowBuilds:
|
|
73
|
+
dsh-question-timeout-protection: true
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
`allowBuilds` is available from pnpm 10.26; on earlier 10.x put the same package key into an `onlyBuiltDependencies` list.
|
|
77
|
+
|
|
78
|
+
Then run `add` again. Without this step the install lands with no build output and the plugin does not work.
|
|
79
|
+
|
|
80
|
+
### Option D: install from a release tarball
|
|
81
|
+
|
|
82
|
+
Download the tarball for the version you want and install it directly:
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
dsh plugin --profile <profile> add ./release/<tarball>
|
|
86
|
+
dsh plugin --profile <profile> add <absolute path>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
No build is needed and the pnpm build-script policy does not apply.
|
|
90
|
+
|
|
91
|
+
## Quick start
|
|
92
|
+
|
|
93
|
+
1. Install the plugin into your profile with any option above
|
|
94
|
+
2. Restart dsh
|
|
95
|
+
3. Ask the model something so it asks you back; a countdown appears at the card's top right, and you can pause it with "Wait indefinitely" next to it
|
|
96
|
+
|
|
97
|
+
## Usage
|
|
98
|
+
|
|
99
|
+
### Countdown and warning
|
|
100
|
+
|
|
101
|
+
The countdown appears only on a **live question**, and it follows the plugin's own deadline: focusing the input or starting to type does not pause it. During the last seconds the number turns red and blinks. Once the deadline passes, the plugin withdraws its countdown and failure hints and restores the card to the host's own wait state; when the settlement arrives it decides whether to lock and withdraw the card or hand it back.
|
|
102
|
+
|
|
103
|
+
Historical questions and settled answers never show a countdown.
|
|
104
|
+
|
|
105
|
+
### Wait indefinitely
|
|
106
|
+
|
|
107
|
+
The "Wait indefinitely" button sits next to the countdown. Clicking it removes the deadline for this question and freezes the countdown as "Paused" until you submit.
|
|
108
|
+
|
|
109
|
+
The action takes effect only after the server confirms the registration, so a click briefly waits for that reply. If the state channel is unavailable the button does not take effect: the card returns to counting and the countdown slot reads "Cannot wait indefinitely".
|
|
110
|
+
|
|
111
|
+
### Auto wait indefinitely
|
|
112
|
+
|
|
113
|
+
The composer toolbar carries an "Auto wait indefinitely" switch to the left of the model selector. When on, every new question enters indefinite wait automatically, and a question already waiting freezes right away, exactly as if you had clicked "Wait indefinitely" once.
|
|
114
|
+
|
|
115
|
+
The switch state lives in browser storage and survives a refresh. Turning it off affects only later questions: frozen questions stay frozen and end when you submit.
|
|
116
|
+
|
|
117
|
+
The switch appears only while card enhancements and indefinite wait are both on.
|
|
118
|
+
|
|
119
|
+
### Timeout draft and read-only review
|
|
120
|
+
|
|
121
|
+
At the moment of a timeout the plugin keeps the options you selected and the text you typed in memory. That question's tool call row then shows a bubble button; clicking it pops a read-only floating card beside it with your selections and notes per question, offering no way to answer.
|
|
122
|
+
|
|
123
|
+
When the draft is empty, meaning you neither selected nor typed anything, the plugin closes the card on that timeout and no bubble appears.
|
|
124
|
+
|
|
125
|
+
The draft lives only in memory, so a page refresh loses the bubbles and their records.
|
|
126
|
+
|
|
127
|
+
### Context injection
|
|
128
|
+
|
|
129
|
+
This is on by default. While you are answering, the client always reports draft snapshots to the server (it cannot read the plugin configuration); the server decides whether to use them. When on, expiry takes the latest snapshot and returns it to the model context through the tool's pending result, per question, each keeping its own selections and notes; when off, the snapshot stays on the server and is cleared when the call ends.
|
|
130
|
+
|
|
131
|
+
The timeout notice and the draft share that one result, and the model is explicitly told to report the timeout at the end of its reply, plus what it intends to do with the draft when one came back.
|
|
132
|
+
|
|
133
|
+
With this off, the plugin only withdraws the card and hands the model no draft.
|
|
134
|
+
|
|
135
|
+
### Configuration
|
|
136
|
+
|
|
137
|
+
The config page sits at the **top of the plugin detail view**, not inside "Components". Only "Inject into context" can be changed, and a toggle writes immediately without any save or refresh. Keep the draft in the UI and the three fixed features below are listed as fixed rows for reference; the page offers no switches for them.
|
|
138
|
+
|
|
139
|
+
| Option | Values | Default | UI | Description |
|
|
140
|
+
|:---:|:---:|:---:|:---:|:---:|
|
|
141
|
+
| `fallback` | `ui` / `context` / `both` | `both` | One switch | Timeout fallback. The page only offers "Inject into context": checked writes `both`, unchecked writes `ui`. Keeping the draft in the UI is always on, so `context` never appears |
|
|
142
|
+
| `cardEnhancements` | boolean | `true` | Fixed | Decoration only: countdown and warning blink, a background fill on the square marker of the selected single-choice option, the question bubble, and hiding the host's collapse controls and wait text. When off no decoration appears, while the timeout wrap-up still runs: the card that should be withdrawn is still withdrawn and locked, and the draft is still reported per the configuration above |
|
|
143
|
+
| `infiniteWait` | boolean | `true` | Fixed | Provides the "Wait indefinitely" button and the toolbar switch; turning it off removes both |
|
|
144
|
+
| `draftFallback` | boolean | `true` | Fixed | Timeout wrap-up switch. When off the client neither withdraws the card nor reports the draft and hands that question back to the host; the plugin still settles the wait on time |
|
|
145
|
+
| `warningSeconds` | number | 5 | Not exposed | Seconds remaining when the red warning starts, from 1 to 60 |
|
|
146
|
+
| `timeoutSeconds` | number | 120 | Not exposed | Wait seconds used when the model does not pass one explicitly, from 1 to 2147483 |
|
|
147
|
+
|
|
148
|
+
The last two are not exposed in the UI; write them into this plugin's row under `config` in the profile's `cordis.patch.yml`, for example `config: { timeoutSeconds: 300 }` for a 300-second wait. Out-of-range values fail loudly at load time. The three fixed features are switched off the same way, for example `config: { cardEnhancements: false }`; restate every key that row needs rather than only the changed one.
|
|
149
|
+
|
|
150
|
+
## Compatibility
|
|
151
|
+
|
|
152
|
+
| Item | Version |
|
|
153
|
+
|:---:|:---:|
|
|
154
|
+
| dsh | `>=0.2.1-rc.1 <=0.2.2-rc.2` |
|
|
155
|
+
| Node.js | >= 20 |
|
|
156
|
+
|
|
157
|
+
The Node.js requirement of the host dsh itself follows the release notes of the matching version.
|
|
158
|
+
|
|
159
|
+
## FAQ
|
|
160
|
+
|
|
161
|
+
**Will my input be lost when the question times out**
|
|
162
|
+
|
|
163
|
+
Not on this page. At the timeout the plugin keeps your selections and typed text in memory and records them in that question's bubble button, which you can open at any time. A page refresh does erase that record.
|
|
164
|
+
|
|
165
|
+
**Can the model see what I typed**
|
|
166
|
+
|
|
167
|
+
It depends on the "Inject into context" checkbox. When checked the draft reaches the model context with the tool result; when unchecked it stays in the UI only.
|
|
168
|
+
|
|
169
|
+
**Why did the card disappear**
|
|
170
|
+
|
|
171
|
+
Because that question timed out and the plugin took it over. The plugin withdraws and locks the card so it does not leave a dialog you can no longer answer. To review what you had entered, use the bubble button on the question row; when nothing was selected or typed at the timeout no bubble appears.
|
|
172
|
+
|
|
173
|
+
**Why is there no countdown on my screen**
|
|
174
|
+
|
|
175
|
+
Common reasons include: card enhancements are off; that question was a blocking one the model marked with `-1`; or your UI language is neither Chinese nor English. Also, on a page refresh, when the card is already in its editing or waiting state the plugin cannot restore the deadline, so no countdown appears until the card returns to counting.
|
|
176
|
+
|
|
177
|
+
**What happens after I click "Wait indefinitely"**
|
|
178
|
+
|
|
179
|
+
This question no longer has a deadline and the model keeps waiting until you submit, or the page or session ends. If the state channel is unavailable the button does not take effect: the card returns to counting and reads "Cannot wait indefinitely".
|
|
180
|
+
|
|
181
|
+
**The bubble is gone after a refresh**
|
|
182
|
+
|
|
183
|
+
The draft lives in memory only and is never persisted, so a refresh loses the bubbles and records on this page. A still-waiting question is re-evaluated from the host's persisted draft.
|
|
184
|
+
|
|
185
|
+
**Do I need to edit my presets**
|
|
186
|
+
|
|
187
|
+
No. The plugin registers an identically named question tool in each agent scope, shadowing the host's blocking question by scope proximity.
|
|
188
|
+
|
|
189
|
+
**Will it submit answers for me**
|
|
190
|
+
|
|
191
|
+
No. A timeout never selects an option and never submits a draft as a formal answer.
|
|
192
|
+
|
|
193
|
+
## Known limits
|
|
194
|
+
|
|
195
|
+
**Depends on the host UI**
|
|
196
|
+
|
|
197
|
+
Cards and tool rows are located through host class-name suffixes, `data-question-key`, `data-chat-call-id` and `aria-checked`; host controls are recognised by their Chinese or English labels (the Japanese `回答` is identical to the Chinese one, so that entry matches too); when restoring the host entry after settlement the plugin also recognises `查看回答` / `View answers` / `回答を表示`. The toolbar switch prefers the model selector's accessible name, falls back to structural placement inside the composer toolbar, then to a document-wide lookup, and logs one console.warn per reason instead of failing silently. If the host changes those structures or labels the matching enhancement stops working; the recognition labels and selectors live in the source constants file.
|
|
198
|
+
|
|
199
|
+
**Depends on the host question projection**
|
|
200
|
+
|
|
201
|
+
The client relies on the userQuestions projection of the host sessions service to tell whether a question entered the continued state; draft reporting, the timeout wrap-up and the bubble all follow it. If that service is missing or the interface is renamed the plugin logs one console.warn per session: the countdown and card decoration stay, but no draft is reported, the wrap-up does not run and no bubble appears.
|
|
202
|
+
|
|
203
|
+
**Session subscription cap**
|
|
204
|
+
|
|
205
|
+
At most 8 sessions keep a projection subscription at once. Beyond that the least recently seen session degrades to per-second polling and its timeout takeover arrives later; the polling fallback is also capped at 8, and past that the least recently seen session is released, so its timeout fallback may stop working.
|
|
206
|
+
|
|
207
|
+
**No persistence**
|
|
208
|
+
|
|
209
|
+
The draft lives in client memory, so a refresh loses the bubbles and their records. A still-waiting question is re-evaluated from the host's persisted draft and taken over when the takeover conditions hold; settled rows are not restored.
|
|
210
|
+
|
|
211
|
+
**Indefinite wait and draft reporting need the web client**
|
|
212
|
+
|
|
213
|
+
Both share one token-protected channel mounted on the host's own HTTP service, same-origin with the UI. The page fetches the token first and then reports; without the token neither capability works. The channel also requires the request Host to be a loopback address, so a host bound to a non-loopback address or reached through a reverse proxy under a non-loopback name has it rejected. In a deployment without the web client the server still settles the timeout, but the draft never reaches the model context and indefinite wait has no effect.
|
|
214
|
+
|
|
215
|
+
**UI languages**
|
|
216
|
+
|
|
217
|
+
dsh 0.2.2-rc.1 ships eight UI languages while the plugin recognises Chinese and English labels only. Under other locales the countdown, the wait-indefinitely button and the toolbar switch are not rendered, and the plugin's own bubble and config page fall back to English. The Japanese "回答" is identical to Chinese and is hidden, while the Japanese wait text stays visible and contradicts the withdrawn card; in the remaining locales the host answer entry and its wait text mostly stay visible. Under Japanese, a timeout with an empty draft produces no plugin bubble while the host entry is already hidden by its label, so that round offers no entry to reopen. Card dismissal degrades to CSS hiding there and submit buttons stay enabled.
|
|
218
|
+
|
|
219
|
+
**Other**
|
|
220
|
+
|
|
221
|
+
- The plugin times the wait itself: on expiry it settles the timeout and releases the host-side foreground wait, and an answer you actually submitted before that moment still wins
|
|
222
|
+
- With several tabs on the same session the server keeps one draft snapshot per call id, so a later tab overwrites the one reported earlier
|
|
223
|
+
- Only the latest 200 draft records in bubbles are kept, so older bubbles can no longer be opened
|
|
224
|
+
- dsh 0.2.2-rc.1 pre-selects recommended options when a card opens, and the plugin strips those presets by matching the original option labels from the projection; in multiple choice, once you click any option the remaining presets are kept under the host's own submit semantics
|
|
225
|
+
- Skipping every question without any selection or typed text counts as an empty draft, so that timeout closes the card
|
|
226
|
+
- The draft is merged per question from three sources in this order: the host's persisted record, the live value of the question on screen, then the plugin's own snapshot; when the live value is read, selected labels come from the host's screen-reader text, which may drop suffixes such as "(Recommended)"
|
|
227
|
+
- On the macOS desktop app, dsh 0.2.2-rc.2 allows window dragging only inside header rows carrying `data-window-drag`, and the host automatically excludes drag on controls inside a `data-window-drag-controls` container; a custom overlay covering a drag row must declare `data-window-drag-exclude` to stay interactive, and `--dsh-frame-top-clearance` reserves a strip at the top. The plugin's draft panel is attached to the body and declares neither, so near the top of the window it may fall into the reserved strip. The panel holds no clickable controls, so the effect is positional only; the web client is unaffected
|
|
228
|
+
- The timeout notice injected for the model is Chinese-only, so on an English UI the model still receives Chinese text
|
|
229
|
+
- A draft over the 256 KiB per-report limit makes the UI read "Draft too large; not delivered", which does not count towards consecutive failures; after three consecutive failures that question is judged channel-unavailable, the plugin stops taking it over and the card returns to the host and stays answerable
|
|
230
|
+
|
|
231
|
+
## Update and uninstall
|
|
232
|
+
|
|
233
|
+
Remove the old version before installing a new one:
|
|
234
|
+
|
|
235
|
+
```
|
|
236
|
+
dsh plugin --profile <profile> remove dsh-question-timeout-protection
|
|
237
|
+
dsh plugin --profile <profile> add <new package or tarball>
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
To disable without uninstalling, disable the plugin row by id in that profile's `cordis.patch.yml`:
|
|
241
|
+
|
|
242
|
+
```
|
|
243
|
+
- id: question-timeout-protection
|
|
244
|
+
disabled: true
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
## Development
|
|
248
|
+
|
|
249
|
+
```
|
|
250
|
+
pnpm install
|
|
251
|
+
pnpm build
|
|
252
|
+
pnpm typecheck
|
|
253
|
+
pnpm run check:translation
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
`pnpm run check:translation` verifies the three translation files, the config-page dictionary and the visible UI text constants against each other, and checks that a text change also updates the maintenance timestamp.
|
|
257
|
+
|
|
258
|
+
`src/translation/*.ini` mirrors one set of wording and is not read by the UI: visible text comes from `src/constants.ts` and `src/client/i18n.ts`, so a wording change must update those and the three ini files together.
|
|
259
|
+
|
|
260
|
+
## License
|
|
261
|
+
|
|
262
|
+
This project is licensed under the [Apache License 2.0](./LICENSE). The copyright notice is in [COPYRIGHT](./COPYRIGHT).
|
|
263
|
+
|
|
264
|
+
Copyright (c) 2026 JularDepick
|
|
265
|
+
|
|
266
|
+
## Related links
|
|
267
|
+
|
|
268
|
+
- dsh repository: https://github.com/deepseek-ai/deepseek-harness
|
|
269
|
+
- dsh plugin development docs: https://github.com/deepseek-ai/deepseek-harness/tree/master/docs/user/develop
|
package/cordis.patch.yml
ADDED