dsh-unlimited-retry 2.3.2 → 2.4.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/README.md CHANGED
@@ -342,9 +342,15 @@ curl -s http://127.0.0.1:3080/unlimited-retry/stats | head -c 400
342
342
  | Requirement | Value |
343
343
  |---|---|
344
344
  | Node.js | **>= 20** |
345
- | DSH | **>= 0.2.0-0 < 0.3.0-0** (`engines.dsh`, enforced by the host's compatibility preflight) |
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 and 0.2.2-alpha.2 |
346
346
  | Ships `dsh-agent-loop` and `dsh-llm-retry` | Yes — the retry listener hangs off that event |
347
347
 
348
+ The session-projection reader adapts to both registration shapes the Host has
349
+ shipped: the disposer returned before 0.2.2, and the callable thenable returned
350
+ from 0.2.2 on, whose `typeof` is `"function"` while it still carries `then`.
351
+ The handle is preferred where it exists, so no deprecated read is performed on a
352
+ runtime that deprecated it.
353
+
348
354
  The `-0` lower bound in `engines.dsh` is deliberate: the host matches with
349
355
  `includePrerelease: true`, and only a boundary carrying a prerelease tag admits a
350
356
  prerelease runtime such as `0.2.1-rc.3`. A plain `>=0.2.0` would silently exclude
package/README.zh.md CHANGED
@@ -262,9 +262,13 @@ curl -s http://127.0.0.1:3080/unlimited-retry/stats | head -c 400
262
262
  | 依赖 | 要求 |
263
263
  |---|---|
264
264
  | Node.js | **>= 20** |
265
- | DSH | **>= 0.2.0-0 < 0.3.0-0**(`package.json` 的 `engines.dsh`,由宿主的兼容性预检强制执行) |
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 上验证 |
266
266
  | 带 `dsh-agent-loop` 与 `dsh-llm-retry` | 是(重试监听器挂在那条事件上) |
267
267
 
268
+ 会话投影读取对宿主先后提供过的两种注册形态都做了适配:0.2.2 之前 `register`
269
+ 返回 disposer,0.2.2 起返回**可调用 thenable**(`typeof` 是 `"function"`,但仍带 `then`)。
270
+ 有句柄时优先用句柄,因此在已弃用旧读取的运行时上不会走那条路。
271
+
268
272
  `engines.dsh` 的 `-0` 下界是刻意的:宿主的预检用 `includePrerelease: true` 匹配,而只有带预发布标签的边界才能放行 `0.2.1-rc.3` 这样的预发布运行时。写成 `>=0.2.0` 会把所有 `-rc` 版本静默排除。
269
273
  - 有 `AbortSignal.any` 就用它,没有则用 controller 方案等价实现。
270
274
  - 1.x 的 `config` 仍可挂载:`retryAllCodes` 被忽略(除非显式排除,否则每个码都会重试),`terminalCodes` 按 `excludeCodes` 读取,两者各打一条替代提示。
Binary file
Binary file
package/icon.svg CHANGED
@@ -1,19 +1,5 @@
1
1
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64" role="img" aria-label="Unlimited Retry">
2
- <defs>
3
- <linearGradient id="ur-ring" x1="10" y1="8" x2="54" y2="56" gradientUnits="userSpaceOnUse">
4
- <stop offset="0" stop-color="#4d8df6"/>
5
- <stop offset="1" stop-color="#7b5cff"/>
6
- </linearGradient>
7
- </defs>
8
- <rect x="2" y="2" width="60" height="60" rx="15" fill="url(#ur-ring)"/>
9
- <g fill="none" stroke="#ffffff" stroke-width="4" stroke-linecap="round" stroke-linejoin="round">
10
- <path d="M18 32a14 14 0 0 1 23.9-9.9"/>
11
- <path d="M46 32a14 14 0 0 1-23.9 9.9"/>
12
- </g>
13
- <g fill="#ffffff">
14
- <path d="M43.6 13.2 44.9 25l-11.6-3.3z"/>
15
- <path d="M20.4 50.8 19.1 39l11.6 3.3z"/>
16
- </g>
17
- <circle cx="32" cy="32" r="5" fill="#ffffff"/>
18
- <circle cx="32" cy="32" r="2" fill="url(#ur-ring)"/>
2
+ <rect width="64" height="64" rx="14" fill="#141517"/>
3
+ <path d="M38.89 20.98A13 13 0 1 1 24.36 21.48" fill="none" stroke="#F5F0E6" stroke-width="7.6" stroke-linecap="butt"/>
4
+ <path d="M31.88 16.02L27.5 27.85L19.27 16.53Z" fill="#F5F0E6" stroke="#F5F0E6" stroke-width="2.2" stroke-linejoin="round"/>
19
5
  </svg>
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.3.2";
43
+ const PLUGIN_VERSION = "2.4.1";
44
44
  const STATS_PATH = "/unlimited-retry/stats";
45
45
  const CONFIG_PATH = "/unlimited-retry/config";
46
46
  const RESET_PATH = "/unlimited-retry/reset";
@@ -780,9 +780,15 @@ export function apply(ctx, config) {
780
780
  const EMPTY_CHAIN = Object.freeze({ attempt: 0, retryId: undefined });
781
781
 
782
782
  let chainsRegistered = false;
783
+ /**
784
+ * A 0.2.2+ registration handle, whose `stateOf(session)` is the supported reader.
785
+ * Absent on runtimes whose `register` returns a disposer; there the service-level
786
+ * `stateOf(session, key)` is the only reader, and it is not yet deprecated.
787
+ */
788
+ let chainHandle;
783
789
  if (cfg.recordSessionEvents && CHAIN_SCHEMA !== undefined) {
784
790
  try {
785
- ctx.sessionProjections.register({
791
+ const registered = ctx.sessionProjections.register({
786
792
  key: CHAIN_KEY,
787
793
  stateVersion: 1,
788
794
  stateSchema: CHAIN_SCHEMA,
@@ -802,6 +808,30 @@ export function apply(ctx, config) {
802
808
  },
803
809
  });
804
810
  chainsRegistered = true;
811
+ // The two runtimes differ only in what `register` returns: a plain disposer
812
+ // before 0.2.2, and from 0.2.2 a *callable thenable* — upstream's own README
813
+ // says `typeof` is "function" and `instanceof Promise` is false. A check for
814
+ // an object misses it and leaves every read on the deprecated service reader,
815
+ // so this test intentionally accepts a function that carries `then`.
816
+ //
817
+ // Deliberately not an async `apply`: upstream's guidance for new plugins is
818
+ // to await registration, but this plugin's routes and mount probe are
819
+ // registered synchronously and its reader is served from a listener that can
820
+ // fire at any time. Definitions install synchronously anyway, and the handle
821
+ // lands on a microtask, so resolving it here keeps `apply` sync without ever
822
+ // reading stale state.
823
+ if (registered !== null && (typeof registered === "object" || typeof registered === "function")
824
+ && typeof registered.then === "function") {
825
+ Promise.resolve(registered).then(
826
+ (handle) => {
827
+ if (handle !== null && typeof handle === "object" && typeof handle.stateOf === "function") chainHandle = handle;
828
+ },
829
+ (error) => {
830
+ chainsRegistered = false;
831
+ log("warn", `session projection registration failed (${String(error)}); retry ladders are bounded and process-local instead`);
832
+ },
833
+ );
834
+ }
805
835
  } catch (error) {
806
836
  log("warn", `session projections unavailable (${String(error)}); retry ladders are bounded and process-local instead`);
807
837
  }
@@ -836,6 +866,11 @@ export function apply(ctx, config) {
836
866
  function chainFor(session) {
837
867
  if (chainsRegistered) {
838
868
  try {
869
+ // Prefer the handle, which is the supported reader from 0.2.2 on; the
870
+ // service reader is deprecated there. The handle resolves on a microtask,
871
+ // so no recorded event can arrive before it is adopted — measured on
872
+ // 0.2.2-alpha.2: zero deprecation warnings across a full ladder.
873
+ if (chainHandle !== undefined) return chainHandle.stateOf(session) ?? EMPTY_CHAIN;
839
874
  return ctx.sessionProjections.stateOf(session, CHAIN_KEY) ?? EMPTY_CHAIN;
840
875
  } catch (error) {
841
876
  // Reading a projection needs a real session (the registry folds its log
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-unlimited-retry",
3
- "version": "2.3.2",
3
+ "version": "2.4.1",
4
4
  "description": "Unbounded model-request retry for the DeepSeek Harness agent loop, with a live Settings panel.",
5
5
  "keywords": [
6
6
  "deepseek",
@@ -39,7 +39,8 @@
39
39
  "README.md",
40
40
  "README.zh.md",
41
41
  "LICENSE",
42
- "assets/icon-180.png"
42
+ "assets/icon-180.png",
43
+ "assets/icon-512.png"
43
44
  ],
44
45
  "engines": {
45
46
  "node": ">=20",