dsh-llm-fallbacks 0.1.2 → 0.1.4
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 +5 -5
- package/README.zh-CN.md +5 -5
- package/dist/client/fallbacks-store.d.ts +9 -3
- package/dist/client/index.js +399 -463
- package/dist/client/locales.d.ts +14 -8
- package/dist/config.d.ts +18 -24
- package/dist/index.d.ts +2 -1
- package/dist/index.js +8 -4
- package/dist/schema.d.ts +26 -0
- package/package.json +2 -1
- package/scripts/build-client.ts +0 -5
package/README.md
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|

|
|
7
7
|

|
|
8
8
|

|
|
9
|
+
[](https://dshfind.com/zh/plugins/omdsh-dev/dsh-llm-fallbacks?ref=badge)
|
|
9
10
|
|
|
10
11
|
Automatic provider/model fallback chains for dsh (DeepSeek Harness): when an agent's LLM requests keep failing — retries exhausted, auth errors, quota exceeded, rate limiting (429) — the plugin switches provider/model along the fallback chain for the current role, and the current step/turn continues on the target model: tasks are not interrupted by model problems.
|
|
11
12
|
|
|
@@ -18,7 +19,7 @@ dsh plugin --profile web add dsh-llm-fallbacks # pin a version with @<version>
|
|
|
18
19
|
## Features
|
|
19
20
|
|
|
20
21
|
- **Automatic fallback for root and subagents**: any agent switches down the chain to the next available provider/model on model failure — no manual model switching.
|
|
21
|
-
- **Two-block config**: block 1 `rootChain` — the root agent's single fallback chain (empty = root does not fall back); block 2 declared roles — `roles.list` role entities (id/
|
|
22
|
+
- **Two-block config**: block 1 `rootChain` — the root agent's single fallback chain (empty = root does not fall back); block 2 declared roles — `roles.list` role entities (id/persona/chain/fallback) that `roles.rules` reference by id (or the built-in `inherit`); no rule match → `inherit` → `rootChain`.
|
|
22
23
|
- **Entry syntax**: chain entries are `provider/model` (exact switch) or `provider/*` (keep the failed model id, switch provider only) — the old chain-key namespace (provider/model keys, role-name keys) is gone.
|
|
23
24
|
- **Cooldown and revert**: models that were switched away from / failed are not re-selected during the cooldown period; `revertPolicy: cooldown-expiry` automatically returns to the primary model when the cooldown expires, while `never` does not return within the session.
|
|
24
25
|
- **Visible behavior**: every switch appends a persisted session event `fallbacks/switch` (from/to/role/reason), alongside info-level logs (candidate attempt order and skip reasons) and the read-only status block on the Settings → 插件配置 → Fallbacks card — no silent model switching.
|
|
@@ -35,7 +36,7 @@ dsh plugin --profile web add dsh-llm-fallbacks # pin a version with @<version>
|
|
|
35
36
|
|
|
36
37
|
A registry install fetches the **built package** (`dist/`) — nothing is built on the target machine. The plugin is **mount-only**: it never modifies the dsh source tree, and no patch / postinstall step exists — dsh upgrades never require re-patching. Versioning follows npm dist-tags (`latest` by default); pin an exact version with `dsh plugin --profile web add dsh-llm-fallbacks@<version>`.
|
|
37
38
|
|
|
38
|
-
> **Release status**: published as `dsh-llm-fallbacks@0.1.
|
|
39
|
+
> **Release status**: published as `dsh-llm-fallbacks@0.1.3` (latest). The first publish used a one-time `NODE_AUTH_TOKEN` bootstrap secret; Trusted Publishing is configured afterwards for tokenless releases.
|
|
39
40
|
|
|
40
41
|
### Registry package (npm / pnpm)
|
|
41
42
|
|
|
@@ -85,8 +86,7 @@ fallbacks:
|
|
|
85
86
|
roles: # block 2: declare roles first, then let rules reference them
|
|
86
87
|
list:
|
|
87
88
|
- id: reviewer # role entity: unique id (/^[a-z0-9-]{1,32}$/); "inherit" is reserved
|
|
88
|
-
|
|
89
|
-
description: Code-review subagents
|
|
89
|
+
persona: Code-review subagents
|
|
90
90
|
chain:
|
|
91
91
|
- openai/gpt-4o-mini
|
|
92
92
|
fallback: inherit-root # default: role chain, then append rootChain
|
|
@@ -95,7 +95,7 @@ fallbacks:
|
|
|
95
95
|
role: reviewer
|
|
96
96
|
```
|
|
97
97
|
|
|
98
|
-
Roles are declared entities: `roles.list` holds role cards (id/
|
|
98
|
+
Roles are declared entities: `roles.list` holds role cards (id/persona + chain/fallback), and `roles.rules` match origin/provider/model in order to a declared role id or the built-in `inherit` (first match wins) — **no rule match → `inherit` → `rootChain`**. A declared role is only ever hit when a rule references it. A role without a chain is meaningless — the settings card blocks saving it and the host warns at startup; give every declared role a chain, or point its rules at the built-in `inherit`. (A hand-written YAML role with a missing/empty chain is not fatal: with `fallback: inherit-root` (the default) an empty chain still falls back to `rootChain`; with `fallback: none` an empty chain leaves no candidates and the request passes through untouched — either way it is only a startup warn.) The legacy chain-key namespace and role-default field are gone (migration table: [docs/configuration.md](docs/configuration.md)).
|
|
99
99
|
|
|
100
100
|
Save and restart the web session for the changes to take effect. The feature switch `fallbacks.enabled` **defaults to off (`false`)** — the plugin only engages once it is turned on; `triggerCodes` defaults to `AUTH` / `QUOTA` / `RATE_LIMIT`; and with **no `rootChain`/role chains configured the behavior is identical to not having the plugin installed**. More examples (role entities, fallback strategies, rules referencing `inherit`) → [docs/configuration.md](docs/configuration.md).
|
|
101
101
|
|
package/README.zh-CN.md
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|

|
|
7
7
|

|
|
8
8
|

|
|
9
|
+
[](https://dshfind.com/zh/plugins/omdsh-dev/dsh-llm-fallbacks?ref=badge)
|
|
9
10
|
|
|
10
11
|
dsh(DeepSeek Harness)的自动模型降级插件:当 root agent 或 subagent 的模型请求持续失败(重试耗尽、权限、配额超限、限流 429)时,按角色/模型 fallback 链自动切换 provider/model,当前 step/turn 在目标模型上继续完成——任务不因模型问题中断。
|
|
11
12
|
|
|
@@ -18,7 +19,7 @@ dsh plugin --profile web add dsh-llm-fallbacks # 钉版本:加 @<version>
|
|
|
18
19
|
## 能力一览
|
|
19
20
|
|
|
20
21
|
- **root / subagent 自动降级**:任意 agent 在模型故障下按链切换到下一个可用 provider/model,无需手动换模型。
|
|
21
|
-
- **两块制配置**:块 1 `rootChain`——root 主代理唯一降级链(空 = root 不降级);块 2 声明式角色——`roles.list` 角色实体(id/
|
|
22
|
+
- **两块制配置**:块 1 `rootChain`——root 主代理唯一降级链(空 = root 不降级);块 2 声明式角色——`roles.list` 角色实体(id/persona/chain/fallback)供 `roles.rules` 按 id 引用(或内置 `inherit`);未命中规则 → `inherit` → `rootChain`。
|
|
22
23
|
- **条目语法**:链条目为 `provider/model`(精确切换)或 `provider/*`(保留失败模型 id 仅换 provider)——旧链键命名空间(provider/model 键、角色名键)已删除。
|
|
23
24
|
- **冷却与回主**:被切离/失败的模型在冷却期内不再入选;`revertPolicy: cooldown-expiry` 冷却到期后自动回主模型,`never` 会话内不回。
|
|
24
25
|
- **行为可见**:每次切换追加持久化会话事件 `fallbacks/switch`(from/to/role/reason),配合 info 级日志(候选尝试顺序与跳过原因)与设置 → 插件配置 → Fallbacks 卡片上的只读状态块,无静默换模型。
|
|
@@ -35,7 +36,7 @@ dsh plugin --profile web add dsh-llm-fallbacks # 钉版本:加 @<version>
|
|
|
35
36
|
|
|
36
37
|
registry 安装拉取的是**已构建产物**(`dist/`),目标机无需构建。插件为**纯挂载**:对 dsh 源码树零修改,无任何补丁 / postinstall 步骤——dsh 升级无需重打。版本跟随 npm dist-tag(默认 `latest`);钉精确版本:`dsh plugin --profile web add dsh-llm-fallbacks@<version>`。
|
|
37
38
|
|
|
38
|
-
> **发布状态**:已发布 `dsh-llm-fallbacks@0.1.
|
|
39
|
+
> **发布状态**:已发布 `dsh-llm-fallbacks@0.1.3`(latest)。首次发布用一次性 `NODE_AUTH_TOKEN` bootstrap;Trusted Publishing 后续配置为无 token 发布。
|
|
39
40
|
|
|
40
41
|
### registry 包安装(npm / pnpm)
|
|
41
42
|
|
|
@@ -83,8 +84,7 @@ fallbacks:
|
|
|
83
84
|
roles: # 块 2:先声明角色,再让规则引用
|
|
84
85
|
list:
|
|
85
86
|
- id: reviewer # 角色实体:id 唯一(/^[a-z0-9-]{1,32}$/);inherit 为保留字
|
|
86
|
-
|
|
87
|
-
description: 代码审查子代理
|
|
87
|
+
persona: 代码审查子代理
|
|
88
88
|
chain:
|
|
89
89
|
- openai/gpt-4o-mini
|
|
90
90
|
fallback: inherit-root # 默认:角色链后追加 rootChain
|
|
@@ -93,7 +93,7 @@ fallbacks:
|
|
|
93
93
|
role: reviewer
|
|
94
94
|
```
|
|
95
95
|
|
|
96
|
-
角色是声明式实体:`roles.list` 存放角色卡(id/
|
|
96
|
+
角色是声明式实体:`roles.list` 存放角色卡(id/persona + chain/fallback),`roles.rules` 按 origin/provider/model 顺序匹配到**已声明角色 id 或内置 `inherit`**(首个命中即停)——**未命中 → `inherit` → `rootChain`**。只声明不写规则的角色永不命中。角色无 chain 无意义——设置卡拦截保存、启动时告警;请为每个声明角色配置 chain,或让规则直接引用内置 `inherit`。(手写 YAML 角色链缺省/为空不致命:`fallback: inherit-root`(默认)时空链仍按防御语义回退 `rootChain`;`fallback: none` 时空链无候选 → no-op 透传;两种情况都仅启动告警。)旧链键命名空间与角色兜底字段已删除(迁移表见 [docs/configuration.md](docs/configuration.md))。
|
|
97
97
|
|
|
98
98
|
保存并重启 web 会话后生效。功能级开关 `fallbacks.enabled` **默认关闭(`false`)**——打开开关后插件才会介入;`triggerCodes` 默认覆盖 `AUTH` / `QUOTA` / `RATE_LIMIT`;**未配置任何 `rootChain`/角色链时行为与未安装插件完全一致**。更多示例(角色实体、fallback 策略、引用 `inherit` 的规则)见 [docs/configuration.md](docs/configuration.md)。
|
|
99
99
|
|
|
@@ -210,8 +210,7 @@ export declare function rowsToRootChain(rows: readonly RootChainRow[]): string[]
|
|
|
210
210
|
*/
|
|
211
211
|
export interface RoleRow {
|
|
212
212
|
id: string;
|
|
213
|
-
|
|
214
|
-
description: string;
|
|
213
|
+
persona: string;
|
|
215
214
|
selectors: ChainSelectorRow[];
|
|
216
215
|
fallback: FallbackStrategy;
|
|
217
216
|
}
|
|
@@ -263,7 +262,14 @@ export declare class FallbacksSettingsController {
|
|
|
263
262
|
private readonly rpc;
|
|
264
263
|
/** Snapshot consumed by the section through `useSyncExternalStore`. */
|
|
265
264
|
readonly store: SnapshotStore<FallbacksSettingsState>;
|
|
266
|
-
|
|
265
|
+
/** Read guard: a newer load() supersedes an older one's publish. */
|
|
266
|
+
private readGeneration;
|
|
267
|
+
/**
|
|
268
|
+
* Write guard: save()/resetToDefaults() completions ALWAYS publish unless
|
|
269
|
+
* dispose() invalidated them — an overlapping read must never discard a
|
|
270
|
+
* successful write's accept() (audit F1).
|
|
271
|
+
*/
|
|
272
|
+
private writeGeneration;
|
|
267
273
|
private catalogGeneration;
|
|
268
274
|
private switchesGeneration;
|
|
269
275
|
/** Every settings namespace from the last describe, keyed by ns — the configured-provider join's other input. */
|