dsh-unlimited-retry 2.4.1 → 2.5.0
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/README.md +44 -25
- package/README.zh.md +32 -14
- package/client.js +87 -65
- package/index.js +21 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -18,6 +18,10 @@ delay ceiling — until it succeeds or you stop it.
|
|
|
18
18
|
Standard DSH bundle plugin, one-command install. **The same package supports both
|
|
19
19
|
the DSH Web UI and the official desktop client (Electron).**
|
|
20
20
|
|
|
21
|
+

|
|
22
|
+
|
|
23
|
+
<sub>Figures above are sample data. The layout, copy, and controls are the plugin's own.</sub>
|
|
24
|
+
|
|
21
25
|
## Where to install it
|
|
22
26
|
|
|
23
27
|
This repository maintains one product line (`main`). The same package supports
|
|
@@ -25,36 +29,35 @@ both surfaces.
|
|
|
25
29
|
|
|
26
30
|
| Surface | Install |
|
|
27
31
|
|---|---|
|
|
28
|
-
| **DSH Web UI** |
|
|
29
|
-
| **Official desktop client (Electron)** |
|
|
32
|
+
| **DSH Web UI** | Open the **Plugins** page, click **Add plugin**, and enter `dsh-unlimited-retry` — or run `dsh plugin --profile web add dsh-unlimited-retry` in a terminal |
|
|
33
|
+
| **Official desktop client (Electron)** | Open the **Plugins** page, click **Add plugin**, and enter `dsh-unlimited-retry` |
|
|
30
34
|
|
|
31
|
-
###
|
|
35
|
+
### Installing from the UI
|
|
32
36
|
|
|
33
|
-
|
|
34
|
-
design:
|
|
37
|
+
Both surfaces ship the plugin manager, so the shortest path is the same:
|
|
35
38
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
1. Open **Plugins** in the app.
|
|
40
|
+
2. Click **Add plugin**.
|
|
41
|
+
3. Enter `dsh-unlimited-retry` (or `dsh-unlimited-retry@<version>` to pin one).
|
|
42
|
+
4. Confirm, then reopen the app or reload the page if the Settings page does not
|
|
43
|
+
appear immediately.
|
|
39
44
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
with nothing in the console.
|
|
45
|
+
The dialog accepts npm packages, Git repositories, and local directories, so the
|
|
46
|
+
same box also takes `github:xalor888/dsh-unlimited-retry` or a `link:` path.
|
|
43
47
|
|
|
44
|
-
|
|
48
|
+
### Why the desktop must not use `dsh plugin --profile desktop`
|
|
45
49
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
> is already installed first; if it is, report its source and version. Then tell
|
|
49
|
-
> me the result and whether a restart is needed.
|
|
50
|
+
The desktop client reads a profile named `desktop`, which is reserved for the
|
|
51
|
+
Electron application — the CLI refuses to touch it on purpose:
|
|
50
52
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
profile file. Pin a version by asking for `dsh-unlimited-retry@<version>`.
|
|
53
|
+
```
|
|
54
|
+
error: profile "desktop" is managed exclusively by the Electron application
|
|
55
|
+
```
|
|
55
56
|
|
|
56
|
-
|
|
57
|
-
|
|
57
|
+
A `--profile web` install therefore lands in the `web` profile, while the desktop
|
|
58
|
+
window reads `desktop`, so nothing appears. The UI path above is scoped to
|
|
59
|
+
whichever profile the running app actually owns, which is why it is the one to
|
|
60
|
+
use.
|
|
58
61
|
|
|
59
62
|
> Why the desktop works: the desktop profile *is* the Web template (`base` +
|
|
60
63
|
> `web-app`), and Electron loads the local Web UI URL. The `dsh.client` panel is
|
|
@@ -136,6 +139,8 @@ record with no matching `llm/retry-started`, which is exactly what happened.
|
|
|
136
139
|
|
|
137
140
|
### Settings panel
|
|
138
141
|
|
|
142
|
+

|
|
143
|
+
|
|
139
144
|
- 📊 **Live status**: a pill shows whether the host half answers
|
|
140
145
|
- 🔢 **Counters**: total retries, waits in flight, sessions retrying, last retry, uptime
|
|
141
146
|
- 🪜 **Effective ladder**: what happens on each attempt, with an honest `No limit` instead of a fabricated cap
|
|
@@ -214,8 +219,8 @@ no jitter at all.
|
|
|
214
219
|
dsh plugin --profile web add dsh-unlimited-retry
|
|
215
220
|
```
|
|
216
221
|
|
|
217
|
-
For the official desktop client, use the
|
|
218
|
-
|
|
222
|
+
For the official desktop client, use the in-app **Plugins → Add plugin** dialog
|
|
223
|
+
instead — see [Where to install it](#where-to-install-it). The CLI refuses
|
|
219
224
|
`--profile desktop` by design.
|
|
220
225
|
|
|
221
226
|
### From this repository
|
|
@@ -342,7 +347,7 @@ curl -s http://127.0.0.1:3080/unlimited-retry/stats | head -c 400
|
|
|
342
347
|
| Requirement | Value |
|
|
343
348
|
|---|---|
|
|
344
349
|
| Node.js | **>= 20** |
|
|
345
|
-
| DSH | **>= 0.2.0-0 < 0.3.0-0** (`engines.dsh`, enforced by the host's compatibility preflight). Verified against 0.2.1-rc.3, 0.2.1-rc.5
|
|
350
|
+
| DSH | **>= 0.2.0-0 < 0.3.0-0** (`engines.dsh`, enforced by the host's compatibility preflight). Verified against 0.2.1-rc.3, 0.2.1-rc.5, 0.2.2-alpha.2 and 0.2.2-rc.1 |
|
|
346
351
|
| Ships `dsh-agent-loop` and `dsh-llm-retry` | Yes — the retry listener hangs off that event |
|
|
347
352
|
|
|
348
353
|
The session-projection reader adapts to both registration shapes the Host has
|
|
@@ -359,6 +364,20 @@ every `-rc` build.
|
|
|
359
364
|
- A 1.x `config` still mounts: `retryAllCodes` is ignored and `terminalCodes` is read as `excludeCodes`, each with a one-line warning naming the replacement.
|
|
360
365
|
- The Web panel additionally needs `configEditor` and the `settings.section` slot. Without them the policy still applies; the page is simply absent or read-only.
|
|
361
366
|
|
|
367
|
+
## Changelog
|
|
368
|
+
|
|
369
|
+
### 2.5.0
|
|
370
|
+
|
|
371
|
+
- The ladder's last row printed the plugin's **first** delay beside a label that
|
|
372
|
+
named the ceiling, so it read "every delay capped at 1.0 min — 1.0 s". It now
|
|
373
|
+
shows the ceiling itself.
|
|
374
|
+
- "Sessions retrying" dropped to zero while a wait was still running when two
|
|
375
|
+
failures for one session were waiting at once. The count is now per session
|
|
376
|
+
rather than one flag per session.
|
|
377
|
+
- Install instructions: both surfaces have the plugin manager, so the desktop
|
|
378
|
+
client installs from **Plugins → Add plugin** like any other. The earlier text
|
|
379
|
+
sent you through a chat session for no reason.
|
|
380
|
+
|
|
362
381
|
## Releasing
|
|
363
382
|
|
|
364
383
|
Publishing is tag-driven; nothing publishes from a branch.
|
package/README.zh.md
CHANGED
|
@@ -14,32 +14,40 @@ DeepSeek Harness(DSH)的**无限模型请求重试**插件,附带一个实
|
|
|
14
14
|
|
|
15
15
|
标准 DSH bundle 插件,`dsh plugin` 一键安装。**同一个包同时支持 DSH Web 与官方桌面客户端**(Electron)。
|
|
16
16
|
|
|
17
|
+

|
|
18
|
+
|
|
19
|
+
<sub>图中数字为样例数据;布局、文案与控件均为插件本身。</sub>
|
|
20
|
+
|
|
17
21
|
## 装在哪里
|
|
18
22
|
|
|
19
23
|
本仓库只维护一条产品线(`main`),同一个包同时支持两种界面。
|
|
20
24
|
|
|
21
25
|
| 你要装在哪 | 安装方式 |
|
|
22
26
|
|---|---|
|
|
23
|
-
| **DSH Web 界面** |
|
|
24
|
-
| **官方桌面客户端(Electron)** |
|
|
27
|
+
| **DSH Web 界面** | 打开**插件**页面 → 点「**添加插件**」→ 填 `dsh-unlimited-retry`;或在终端执行 `dsh plugin --profile web add dsh-unlimited-retry` |
|
|
28
|
+
| **官方桌面客户端(Electron)** | 打开**插件**页面 → 点「**添加插件**」→ 填 `dsh-unlimited-retry` |
|
|
25
29
|
|
|
26
|
-
###
|
|
30
|
+
### 从界面安装
|
|
27
31
|
|
|
28
|
-
|
|
32
|
+
两种界面都自带插件管理器,所以最快的路径是一样的:
|
|
29
33
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
34
|
+
1. 在应用里打开**插件**页面。
|
|
35
|
+
2. 点「**添加插件**」。
|
|
36
|
+
3. 填 `dsh-unlimited-retry`(要固定版本就写 `dsh-unlimited-retry@<版本>`)。
|
|
37
|
+
4. 确认;如果设置里没立刻出现这一页,重开应用或刷新页面。
|
|
33
38
|
|
|
34
|
-
|
|
39
|
+
那个输入框接受 npm 包、Git 仓库和本地目录,所以也能填
|
|
40
|
+
`github:xalor888/dsh-unlimited-retry` 或 `link:` 路径。
|
|
35
41
|
|
|
36
|
-
|
|
42
|
+
### 桌面端为什么不能用 `dsh plugin --profile desktop`
|
|
37
43
|
|
|
38
|
-
|
|
44
|
+
桌面端读的是名为 `desktop` 的 profile,它保留给 Electron 应用本身,命令行会**按设计拒绝**:
|
|
39
45
|
|
|
40
|
-
|
|
46
|
+
```
|
|
47
|
+
error: profile "desktop" is managed exclusively by the Electron application
|
|
48
|
+
```
|
|
41
49
|
|
|
42
|
-
|
|
50
|
+
而 `--profile web` 的命令会把插件装进 `web` profile,桌面窗口读的是 `desktop`,自然一个字也看不到。上面那条界面路径的作用域正好是「当前应用真正拥有的那个 profile」,这也是它才是正确做法。
|
|
43
51
|
|
|
44
52
|
> 为什么桌面端也能用:桌面端的 profile 就是 Web 模板(`base` + `web-app`),Electron 加载的是本地 Web UI 的 URL,因此 `dsh.client` 声明的面板在桌面端同样被 `client-modules` 装载。不需要另做一套客户端代码。
|
|
45
53
|
>
|
|
@@ -101,6 +109,8 @@ DSH 自带的 `@deepseek-ai/dsh-llm-retry` 只负责**执行**重试,真正的
|
|
|
101
109
|
|
|
102
110
|
### 设置面板
|
|
103
111
|
|
|
112
|
+

|
|
113
|
+
|
|
104
114
|
- 📊 **实时状态**:小标签显示宿主端是否有响应
|
|
105
115
|
- 🔢 **计数器**:累计重试、等待中的请求、正在重试的会话、最近一次重试、运行时长
|
|
106
116
|
- 🪜 **实际重试顺序**:每次尝试会发生什么;不设上限时如实显示 `No limit`
|
|
@@ -160,7 +170,7 @@ markerFile: null
|
|
|
160
170
|
dsh plugin --profile web add dsh-unlimited-retry
|
|
161
171
|
```
|
|
162
172
|
|
|
163
|
-
|
|
173
|
+
官方桌面客户端请用应用内的「**插件 → 添加插件**」——
|
|
164
174
|
见 [装在哪里](#装在哪里)。命令行按设计拒绝 `--profile desktop`。
|
|
165
175
|
|
|
166
176
|
### 从本仓库
|
|
@@ -262,7 +272,7 @@ curl -s http://127.0.0.1:3080/unlimited-retry/stats | head -c 400
|
|
|
262
272
|
| 依赖 | 要求 |
|
|
263
273
|
|---|---|
|
|
264
274
|
| Node.js | **>= 20** |
|
|
265
|
-
| DSH | **>= 0.2.0-0 < 0.3.0-0**(`package.json` 的 `engines.dsh`,由宿主的兼容性预检强制执行)。已在 0.2.1-rc.3、0.2.1-rc.5、0.2.2-alpha.2 上验证 |
|
|
275
|
+
| DSH | **>= 0.2.0-0 < 0.3.0-0**(`package.json` 的 `engines.dsh`,由宿主的兼容性预检强制执行)。已在 0.2.1-rc.3、0.2.1-rc.5、0.2.2-alpha.2、0.2.2-rc.1 上验证 |
|
|
266
276
|
| 带 `dsh-agent-loop` 与 `dsh-llm-retry` | 是(重试监听器挂在那条事件上) |
|
|
267
277
|
|
|
268
278
|
会话投影读取对宿主先后提供过的两种注册形态都做了适配:0.2.2 之前 `register`
|
|
@@ -274,6 +284,14 @@ curl -s http://127.0.0.1:3080/unlimited-retry/stats | head -c 400
|
|
|
274
284
|
- 1.x 的 `config` 仍可挂载:`retryAllCodes` 被忽略(除非显式排除,否则每个码都会重试),`terminalCodes` 按 `excludeCodes` 读取,两者各打一条替代提示。
|
|
275
285
|
- Web 面板另需 `configEditor` 与 `settings.section` 槽位;缺这些时策略照常生效,页面只是不存在或只读。
|
|
276
286
|
|
|
287
|
+
## 更新记录
|
|
288
|
+
|
|
289
|
+
### 2.5.0
|
|
290
|
+
|
|
291
|
+
- 重试阶梯最后一行把插件的**首个**延迟印在一个标明上限的标签旁边,读起来是「此后每一次延迟均封顶 1.0 分钟 —— 1.0 秒」。现在显示上限本身。
|
|
292
|
+
- 同一会话有两个失败同时在等待时,较短的那个结束后「正在重试的会话」会掉到 0。改为按会话计数,而不是每会话一个布尔标记。
|
|
293
|
+
- 安装说明:两种界面都自带插件管理器,桌面端就是**插件 → 添加插件**。早先那版让你绕道一个对话会话来装,纯属多余。
|
|
294
|
+
|
|
277
295
|
## 发布流程
|
|
278
296
|
|
|
279
297
|
发布由 tag 驱动,任何分支都不会触发发布。
|
package/client.js
CHANGED
|
@@ -59,7 +59,7 @@ window.__ModuleLoader__.load({
|
|
|
59
59
|
ladderHint: "Earlier layers get the first word. This plugin only handles what nobody recovered.",
|
|
60
60
|
ladderProvider: "Provider retry policy",
|
|
61
61
|
ladderPlugin: "This plugin",
|
|
62
|
-
ladderBeyond: "and beyond, every delay capped
|
|
62
|
+
ladderBeyond: "and beyond, every delay capped",
|
|
63
63
|
ladderCap: "up to attempt {n}",
|
|
64
64
|
ladderTerminal: "Terminal",
|
|
65
65
|
ladderTerminalHint: "Excluded codes stop here and fail the turn immediately.",
|
|
@@ -146,7 +146,7 @@ window.__ModuleLoader__.load({
|
|
|
146
146
|
ladderHint: "越靠前的恢复层越先决定,本插件只处理没人接手的失败。",
|
|
147
147
|
ladderProvider: "Provider 重试策略",
|
|
148
148
|
ladderPlugin: "本插件",
|
|
149
|
-
ladderBeyond: "
|
|
149
|
+
ladderBeyond: "此后每一次延迟均封顶",
|
|
150
150
|
ladderCap: "至第 {n} 次",
|
|
151
151
|
ladderTerminal: "终止",
|
|
152
152
|
ladderTerminalHint: "被排除的错误码直接结束该轮,不再重试。",
|
|
@@ -497,40 +497,62 @@ window.__ModuleLoader__.load({
|
|
|
497
497
|
// ---------------------------------------------------------------------
|
|
498
498
|
// Controls
|
|
499
499
|
// ---------------------------------------------------------------------
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
500
|
+
/**
|
|
501
|
+
* A toggle.
|
|
502
|
+
*
|
|
503
|
+
* Two shapes: a standalone one that renders its own label and hint, and an
|
|
504
|
+
* embedded one (`labelId` set) that renders only the control because the
|
|
505
|
+
* surrounding {@link Field} already renders that copy. Rendering it in both
|
|
506
|
+
* places printed the label twice.
|
|
507
|
+
* @param props - state, change handler, and either `label`/`hint` or `labelId`.
|
|
508
|
+
* @returns the toggle element.
|
|
509
|
+
*/
|
|
510
|
+
function Switch({ id, checked, disabled, onChange, label, hint, labelId, describedById }) {
|
|
511
|
+
const ownLabelId = `${id}-label`;
|
|
512
|
+
const ownHintId = `${id}-hint`;
|
|
513
|
+
const embedded = labelId !== undefined;
|
|
514
|
+
const button = React.createElement("button", {
|
|
515
|
+
key: "switch",
|
|
516
|
+
type: "button",
|
|
517
|
+
role: "switch",
|
|
518
|
+
id,
|
|
519
|
+
className: "duSwitch",
|
|
520
|
+
"aria-checked": checked === true,
|
|
521
|
+
"aria-labelledby": embedded ? labelId : ownLabelId,
|
|
522
|
+
"aria-describedby": embedded ? describedById : (hint === undefined ? undefined : ownHintId),
|
|
523
|
+
disabled: disabled === true,
|
|
524
|
+
onClick: () => onChange(checked !== true),
|
|
525
|
+
});
|
|
526
|
+
if (embedded) return button;
|
|
503
527
|
return React.createElement("div", {
|
|
504
528
|
style: { display: "flex", alignItems: "flex-start", gap: 10 },
|
|
505
529
|
}, [
|
|
506
|
-
|
|
507
|
-
key: "switch",
|
|
508
|
-
type: "button",
|
|
509
|
-
role: "switch",
|
|
510
|
-
id,
|
|
511
|
-
className: "duSwitch",
|
|
512
|
-
"aria-checked": checked === true,
|
|
513
|
-
"aria-labelledby": labelId,
|
|
514
|
-
"aria-describedby": hint === undefined ? undefined : hintId,
|
|
515
|
-
disabled: disabled === true,
|
|
516
|
-
onClick: () => onChange(checked !== true),
|
|
517
|
-
}),
|
|
530
|
+
button,
|
|
518
531
|
React.createElement("div", { key: "text", style: { minWidth: 0 } }, [
|
|
519
|
-
React.createElement("div", { key: "l", className: "duFieldLabel", id:
|
|
532
|
+
React.createElement("div", { key: "l", className: "duFieldLabel", id: ownLabelId }, label),
|
|
520
533
|
hint === undefined
|
|
521
534
|
? null
|
|
522
|
-
: React.createElement("div", { key: "h", className: "duFieldHint", id:
|
|
535
|
+
: React.createElement("div", { key: "h", className: "duFieldHint", id: ownHintId }, hint),
|
|
523
536
|
]),
|
|
524
537
|
]);
|
|
525
538
|
}
|
|
526
539
|
|
|
540
|
+
/**
|
|
541
|
+
* One label/control row.
|
|
542
|
+
*
|
|
543
|
+
* The label and hint carry stable ids (`<id>-label`, `<id>-hint`) so a control
|
|
544
|
+
* that renders no text of its own can point at them instead of repeating the
|
|
545
|
+
* copy. Two copies of the same label is what happens when both sides render it.
|
|
546
|
+
* @param props - row id, label, optional hint, and the control.
|
|
547
|
+
* @returns the row element.
|
|
548
|
+
*/
|
|
527
549
|
function Field({ id, label, hint, children }) {
|
|
528
550
|
return React.createElement("div", { className: "duField" }, [
|
|
529
551
|
React.createElement("div", { key: "label" }, [
|
|
530
|
-
React.createElement("label", { key: "l", className: "duFieldLabel", htmlFor: id }, label),
|
|
552
|
+
React.createElement("label", { key: "l", className: "duFieldLabel", id: `${id}-label`, htmlFor: id }, label),
|
|
531
553
|
hint === undefined
|
|
532
554
|
? null
|
|
533
|
-
: React.createElement("div", { key: "h", className: "duFieldHint" }, hint),
|
|
555
|
+
: React.createElement("div", { key: "h", className: "duFieldHint", id: `${id}-hint` }, hint),
|
|
534
556
|
]),
|
|
535
557
|
React.createElement("div", { key: "body", className: "duFieldBody" }, children),
|
|
536
558
|
]);
|
|
@@ -848,7 +870,6 @@ window.__ModuleLoader__.load({
|
|
|
848
870
|
const stats = data.stats ?? {};
|
|
849
871
|
const config = draft ?? serverConfig ?? {};
|
|
850
872
|
const excluded = Array.isArray(config.excludeCodes) ? config.excludeCodes : [];
|
|
851
|
-
const providerRung = data.ladder?.[0] ?? null;
|
|
852
873
|
const maxLabel = fmt.duration(config.maxDelayMs);
|
|
853
874
|
const unlimited = config.maxAttempts === null || config.maxAttempts === undefined;
|
|
854
875
|
|
|
@@ -882,10 +903,11 @@ window.__ModuleLoader__.load({
|
|
|
882
903
|
"data-layer": "plugin",
|
|
883
904
|
}, [
|
|
884
905
|
React.createElement("span", { key: "i", className: "duRungIndex" }, "…"),
|
|
885
|
-
React.createElement("span", { key: "n", className: "duRungName" },
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
906
|
+
React.createElement("span", { key: "n", className: "duRungName" }, t("ladderBeyond")),
|
|
907
|
+
// The ceiling this row is about. It used to read `data.ladder[0].delayMs`,
|
|
908
|
+
// which is the *first* delay of the plugin's own ladder: the row then
|
|
909
|
+
// said "capped at 1.0 min" on the left and "1.0 s" on the right.
|
|
910
|
+
React.createElement("span", { key: "note", className: "duRungNote" }, maxLabel),
|
|
889
911
|
]));
|
|
890
912
|
|
|
891
913
|
const policyCard = React.createElement("div", { key: "policy", className: "duCard" }, [
|
|
@@ -895,19 +917,19 @@ window.__ModuleLoader__.load({
|
|
|
895
917
|
React.createElement("div", { key: "hint", className: "duCardHint" }, t("policyHint")),
|
|
896
918
|
React.createElement("div", { key: "b", className: "duCardBody" },
|
|
897
919
|
React.createElement("div", { className: "duFields" }, [
|
|
898
|
-
React.createElement(
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
920
|
+
React.createElement(Field, {
|
|
921
|
+
key: "enabled",
|
|
922
|
+
id: "du-enabled",
|
|
923
|
+
label: t("enabled"),
|
|
924
|
+
hint: t("enabledHint"),
|
|
925
|
+
}, React.createElement(Switch, {
|
|
926
|
+
id: "du-enabled",
|
|
927
|
+
checked: config.autoRetry === true,
|
|
928
|
+
disabled: !writable || pending,
|
|
929
|
+
onChange: (next) => patch({ autoRetry: next }),
|
|
930
|
+
labelId: "du-enabled-label",
|
|
931
|
+
describedById: "du-enabled-hint",
|
|
932
|
+
})),
|
|
911
933
|
|
|
912
934
|
React.createElement(Field, {
|
|
913
935
|
key: "attempts",
|
|
@@ -1008,33 +1030,33 @@ window.__ModuleLoader__.load({
|
|
|
1008
1030
|
React.createElement("span", { key: "u", className: "duUnit" }, "%"),
|
|
1009
1031
|
]),
|
|
1010
1032
|
|
|
1011
|
-
React.createElement(
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1033
|
+
React.createElement(Field, {
|
|
1034
|
+
key: "without",
|
|
1035
|
+
id: "du-without-policy",
|
|
1036
|
+
label: t("withoutPolicy"),
|
|
1037
|
+
hint: t("withoutPolicyHint"),
|
|
1038
|
+
}, React.createElement(Switch, {
|
|
1039
|
+
id: "du-without-policy",
|
|
1040
|
+
checked: config.retryWithoutProviderPolicy === true,
|
|
1041
|
+
disabled: !writable || pending,
|
|
1042
|
+
onChange: (next) => patch({ retryWithoutProviderPolicy: next }),
|
|
1043
|
+
labelId: "du-without-policy-label",
|
|
1044
|
+
describedById: "du-without-policy-hint",
|
|
1045
|
+
})),
|
|
1024
1046
|
|
|
1025
|
-
React.createElement(
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1047
|
+
React.createElement(Field, {
|
|
1048
|
+
key: "events",
|
|
1049
|
+
id: "du-record-events",
|
|
1050
|
+
label: t("recordEvents"),
|
|
1051
|
+
hint: t("recordEventsHint"),
|
|
1052
|
+
}, React.createElement(Switch, {
|
|
1053
|
+
id: "du-record-events",
|
|
1054
|
+
checked: config.recordSessionEvents === true,
|
|
1055
|
+
disabled: !writable || pending,
|
|
1056
|
+
onChange: (next) => patch({ recordSessionEvents: next }),
|
|
1057
|
+
labelId: "du-record-events-label",
|
|
1058
|
+
describedById: "du-record-events-hint",
|
|
1059
|
+
})),
|
|
1038
1060
|
|
|
1039
1061
|
React.createElement("div", { key: "codes", className: "duField" }, [
|
|
1040
1062
|
React.createElement("div", { key: "l" }, [
|
package/index.js
CHANGED
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
/** Cordis function-plugin name; also the Loader row id used by the patch. */
|
|
41
41
|
export const name = "unlimited-retry";
|
|
42
42
|
|
|
43
|
-
const PLUGIN_VERSION = "2.
|
|
43
|
+
const PLUGIN_VERSION = "2.5.0";
|
|
44
44
|
const STATS_PATH = "/unlimited-retry/stats";
|
|
45
45
|
const CONFIG_PATH = "/unlimited-retry/config";
|
|
46
46
|
const RESET_PATH = "/unlimited-retry/reset";
|
|
@@ -676,8 +676,14 @@ export function apply(ctx, config) {
|
|
|
676
676
|
const lifetime = new AbortController();
|
|
677
677
|
const active = new Set();
|
|
678
678
|
|
|
679
|
-
/**
|
|
680
|
-
|
|
679
|
+
/**
|
|
680
|
+
* Session key -> number of waits in flight for that session.
|
|
681
|
+
*
|
|
682
|
+
* A count, not a Set: two failures for one session can be waiting at the same
|
|
683
|
+
* time, and a Set would drop the session as soon as the shorter wait finished,
|
|
684
|
+
* reporting "0 sessions retrying" while another wait was still running.
|
|
685
|
+
*/
|
|
686
|
+
const activeSessions = new Map();
|
|
681
687
|
const mountedAt = Date.now();
|
|
682
688
|
|
|
683
689
|
function log(level, text) {
|
|
@@ -858,6 +864,16 @@ export function apply(ctx, config) {
|
|
|
858
864
|
});
|
|
859
865
|
}
|
|
860
866
|
|
|
867
|
+
/**
|
|
868
|
+
* Release one in-flight wait for a session.
|
|
869
|
+
* @param key - the session key counted by {@link activeSessions}.
|
|
870
|
+
*/
|
|
871
|
+
function leaveSession(key) {
|
|
872
|
+
const remaining = (activeSessions.get(key) ?? 1) - 1;
|
|
873
|
+
if (remaining <= 0) activeSessions.delete(key);
|
|
874
|
+
else activeSessions.set(key, remaining);
|
|
875
|
+
}
|
|
876
|
+
|
|
861
877
|
/**
|
|
862
878
|
* Read the ladder for one session.
|
|
863
879
|
* @param session - the session that owns the ladder.
|
|
@@ -993,7 +1009,7 @@ export function apply(ctx, config) {
|
|
|
993
1009
|
});
|
|
994
1010
|
|
|
995
1011
|
const sessionKey = session?.id ?? "unidentified-session";
|
|
996
|
-
activeSessions.
|
|
1012
|
+
activeSessions.set(sessionKey, (activeSessions.get(sessionKey) ?? 0) + 1);
|
|
997
1013
|
const at = new Date().toISOString();
|
|
998
1014
|
stats.totalRetries += 1;
|
|
999
1015
|
stats.lastRetryAt = at;
|
|
@@ -1013,7 +1029,7 @@ export function apply(ctx, config) {
|
|
|
1013
1029
|
);
|
|
1014
1030
|
|
|
1015
1031
|
const completed = await cancellableDelay(delayMs, [fused.signal]);
|
|
1016
|
-
|
|
1032
|
+
leaveSession(sessionKey);
|
|
1017
1033
|
fused.release();
|
|
1018
1034
|
if (!completed || fused.signal.aborted) return false;
|
|
1019
1035
|
|