dsh-model-switch 0.4.53 → 0.4.55

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/CHANGELOG.md CHANGED
@@ -1,3 +1,45 @@
1
+ ## v0.4.55
2
+
3
+ 声明兼容 DSH `0.2.1-rc.5`(该版本进入 `dsh.compatibility.dshReleases`,运行时下限仍是 `>=0.2.0-rc.2`,不设上界)。
4
+
5
+ **在 rc.5 上实测通过的(virtual / 零真实额度,lab `D:\dsh-lab` 端口 3082,headless Edge over CDP)**
6
+
7
+ - 设置页渲染,含「模型切换」分组;模型选择器切换(`gpt-6.1-sol` ↔ `MiMo-V2.6-Flash`)。
8
+ - 「记忆蒸馏模型」卡片(0.4.54 恢复)显示 `apigoto · probe-memory` 与新文案。
9
+ - 「审查豁免」卡片:已开启、名单内 58 条,与 `tools` RPC 的 `recommended: 58` 一致。
10
+ - automode 行被适配层识别:`{installed: true, route: "apigoto/mimo-v2.6-flash", added: 53, skipped: 2}`。
11
+ - 「自动审查」预设下写操作**确实被审查**,审查请求走本插件配置的路由:
12
+ `gpt-6.1-sol(tool=write)` → `mimo-v2.6-flash` → `gpt-6.1-sol`(记录器 `probe-ui-rv5.jsonl`)。
13
+
14
+ **静态契约核对**
15
+
16
+ - rc.5 的 `dsh-client-ui-user-questions` 用与本插件**逐条相同**的谓词判定计划审核
17
+ (单问题 / `intent.kind === "plan-review"` / 有 detail / 非多选 / 选项 ≤ 2),宿主也正是用同一
18
+ 辅助函数产出该 kind,所以计划审核卡的数据面在本插件侧无需改动。
19
+
20
+ **如实记录的未验项与异常**
21
+
22
+ - 计划审核卡**已验通**:会话里执行 `/plan`("Plan mode on. Use /plan off to leave.")后,
23
+ 回放 `exit_plan_mode` 会弹出审批卡,卡上出现本插件的 **「去聊天里说」**、拒绝、设置为目标并执行、
24
+ 确认执行;点「去聊天里说」后审批卡消失、回合停止、输入框切回计划模式("描述你的任务以生成计划")。
25
+ 截图 `D:\dsh-artifacts\ui-plan-card.png`。此前三次尝试失败的原因是缺少 `/plan` 这一入口——
26
+ `planMode` 不是预设 isolate 才能进入,命令即可。
27
+ - `allowedCalls` / `skippedReadOnly` 在 rc.5 上保持 0,**不是回归**:这两个计数只统计兜底路径
28
+ (前者仅在审查基础设施抛错、本插件失败开放时 +1,`src/auto-review.ts:286`;后者仅在权限服务询问当前
29
+ 预设且环境工具命中纯读白名单时 +1,`src/auto-review.ts:424`)。正常审查不经过这两条分支,纯读跳过在
30
+ rc.5 上由宿主自身完成,所以计数为 0 是预期结果。
31
+
32
+ ## v0.4.54
33
+
34
+ 记忆蒸馏路由**做通了并重新上线**(此前因未证实而撤卡)。
35
+
36
+ - **根因(lab 实测定位)**:`dsh-prime-memory` 的 `effectiveCfg` 只要 `cfg.llm.provider+model` 非空就视为 pinned,**同时忽略运行时链与 `distillProvider/distillModel` 对**。本插件早期写入的静态 pin 因此一直压过后续所有 live 写入——表现为「卡片改了、实际调用没变」。
37
+ - **修复**:①live 推送被确认成功后,主动删除自己写过的 `llm:` 块(`clearStaticPin`),让 live 对真正生效;②静态 pin 不再抢先写入,改为 **live 尝试耗尽后**的最后手段(`pinAsFallback`,4 次重试后)。
38
+ - **证据(virtual / 零真实额度,记录器 `D:\dsh-artifacts\probe-hot.jsonl`)**:删 pin 后启动不再回写 pin;把本插件的记忆路由改成 `apigoto/gpt-6.1-sol` 重启 → 插件日志 `蒸馏模型路由: apigoto/gpt-6.1-sol`;`rebuild-start` 对 6 条合成 L0 触发真实蒸馏 → 探针记录 `gpt-6.1-sol: 3`、插件日志 `LLM 调用 apigoto/gpt-6.1-sol`。
39
+ - **卡恢复**:`MEMORY_CAPABILITY_UI = true`,「记忆蒸馏模型」卡片与分组行重新上线;文案改为「反复重试仍写不进去时才回落静态路由」。
40
+ - **已知限制(如实记录)**:新的路由要等本插件该行重跑才会被推送(重启,或经我们设置服务的改动);`dsh-prime-memory` 自身 `engines.dsh` 只声明到 `0.2.1-rc.4`,在 rc.5 上宿主会跳过该 bundle,与本插件无关。
41
+ - **新增测试**:`tests/prime-memory-pin.spec.ts` 3 例(写入 → 清除 → 幂等清除 / 无该行 / 文档缺失)。
42
+
1
43
  ## v0.4.53
2
44
 
3
45
  「自动审查模型」与「审查超时」两项设置改为**热生效**,不再需要重启 DSH。
package/lib/client.js CHANGED
@@ -1745,7 +1745,7 @@ window.__ModuleLoader__.load({
1745
1745
  const compactionChoices = deriveRouteChoices(groups, compactionDraft);
1746
1746
  const compactionOn = routePairConfigured(compaction.value);
1747
1747
  const titleChoices = deriveRouteChoices(groups, titleDraft);
1748
- deriveRouteChoices(groups, memoryDraft);
1748
+ const memoryChoices = deriveRouteChoices(groups, memoryDraft);
1749
1749
  const titleOn = routePairConfigured(sessionTitle.value);
1750
1750
  const catalogSeed = firstCatalogRoute(groups);
1751
1751
  const synced = [
@@ -2055,7 +2055,7 @@ window.__ModuleLoader__.load({
2055
2055
  const groupCompactionChoices = deriveRouteChoices(groups, groupCompaction);
2056
2056
  const groupAutoReviewChoices = deriveRouteChoices(groups, groupAutoReview);
2057
2057
  const groupTitleChoices = deriveRouteChoices(groups, groupTitle);
2058
- deriveRouteChoices(groups, groupMemory);
2058
+ const groupMemoryChoices = deriveRouteChoices(groups, groupMemory);
2059
2059
  const groupSubagentChoices = deriveRouteChoices(groups, groupSubagent);
2060
2060
  const groupSubMatched = matchCatalogModel(groups.find((group) => group.id === (groupDraft?.subagentProvider ?? ""))?.models ?? [], groupDraft?.subagentModel ?? "");
2061
2061
  const groupSubEfforts = (() => {
@@ -2622,7 +2622,66 @@ window.__ModuleLoader__.load({
2622
2622
  })
2623
2623
  ] })
2624
2624
  }),
2625
- null
2625
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RouteCard, {
2626
+ title: props.t("memory"),
2627
+ summary: memoryDraft === void 0 ? props.t("loading") : routePairConfigured(memoryDraft) ? routeName(groups, memoryDraft) : props.t("memoryFollow"),
2628
+ hint: props.t("memoryHelp"),
2629
+ note: groupNote(props.t, groupPins.memory),
2630
+ icon: "memory",
2631
+ open: open === "memory",
2632
+ onToggle: () => {
2633
+ toggle("memory");
2634
+ },
2635
+ children: memoryDraft === void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
2636
+ className: ModelSwitchSettings_module_css_default.hint,
2637
+ children: props.t("loading")
2638
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
2639
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
2640
+ className: ModelSwitchSettings_module_css_default.hint,
2641
+ children: props.t("memoryRouteHelp")
2642
+ }),
2643
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2644
+ className: ModelSwitchSettings_module_css_default.formGrid,
2645
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
2646
+ label: props.t("provider"),
2647
+ value: memoryDraft.provider ?? "",
2648
+ disabled: busy !== void 0 || !memory.writable,
2649
+ choices: memoryChoices.providers,
2650
+ onChange: (provider) => {
2651
+ const first = groups.find((group) => group.id === provider)?.models[0];
2652
+ setMemoryDraft({
2653
+ provider,
2654
+ ...first === void 0 ? {} : { model: first.id }
2655
+ });
2656
+ }
2657
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
2658
+ label: props.t("model"),
2659
+ value: memoryDraft.model ?? "",
2660
+ disabled: busy !== void 0 || !memory.writable,
2661
+ choices: memoryChoices.models,
2662
+ onChange: (model) => {
2663
+ setMemoryDraft({
2664
+ ...memoryDraft,
2665
+ model
2666
+ });
2667
+ }
2668
+ })]
2669
+ }),
2670
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Actions, {
2671
+ t: props.t,
2672
+ busy: busy === "memory",
2673
+ disabled: busy !== void 0 || !memory.writable,
2674
+ ...message?.route === "memory" ? { message: message.text } : {},
2675
+ onCancel: () => {
2676
+ resetMemory();
2677
+ setMessage(void 0);
2678
+ },
2679
+ onSave: () => {
2680
+ run("memory", () => props.saveCapability("memory", pairOps(memoryDraft)));
2681
+ }
2682
+ })
2683
+ ] })
2684
+ })
2626
2685
  ]
2627
2686
  }),
2628
2687
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
@@ -3059,7 +3118,54 @@ window.__ModuleLoader__.load({
3059
3118
  }
3060
3119
  })]
3061
3120
  }),
3062
- null,
3121
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3122
+ className: ModelSwitchSettings_module_css_default.rowCard,
3123
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3124
+ className: ModelSwitchSettings_module_css_default.rowCopy,
3125
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3126
+ className: ModelSwitchSettings_module_css_default.rowTitle,
3127
+ children: props.t("memory")
3128
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
3129
+ className: ModelSwitchSettings_module_css_default.hint,
3130
+ children: groupMemory === void 0 ? props.t("memoryFollow") : routeName(groups, groupMemory)
3131
+ })]
3132
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(InstantSwitch, {
3133
+ checked: groupMemory !== void 0,
3134
+ disabled: groupControlsDisabled || groupMemory === void 0 && catalogSeed === void 0,
3135
+ label: props.t("memory"),
3136
+ onChange: (value) => {
3137
+ if (value) enableGroupCapability("memory");
3138
+ else disableGroupCapability("memory");
3139
+ }
3140
+ })]
3141
+ }), groupMemory === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3142
+ className: ModelSwitchSettings_module_css_default.formGrid,
3143
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
3144
+ label: props.t("provider"),
3145
+ value: groupMemory.provider,
3146
+ disabled: groupControlsDisabled,
3147
+ choices: groupMemoryChoices.providers,
3148
+ onChange: (provider) => {
3149
+ const first = groups.find((item) => item.id === provider)?.models[0];
3150
+ setGroupDraft((draft) => draft === void 0 ? draft : {
3151
+ ...draft,
3152
+ memoryProvider: provider,
3153
+ memoryModel: first?.id ?? ""
3154
+ });
3155
+ }
3156
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
3157
+ label: props.t("model"),
3158
+ value: groupMemory.model,
3159
+ disabled: groupControlsDisabled,
3160
+ choices: groupMemoryChoices.models,
3161
+ onChange: (model) => {
3162
+ setGroupDraft((draft) => draft === void 0 ? draft : {
3163
+ ...draft,
3164
+ memoryModel: model
3165
+ });
3166
+ }
3167
+ })]
3168
+ })] }),
3063
3169
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3064
3170
  className: ModelSwitchSettings_module_css_default.rowCard,
3065
3171
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
@@ -3202,7 +3308,7 @@ window.__ModuleLoader__.load({
3202
3308
  titleRouteHelp: "命名请求固定使用这里的 Provider/模型(不带推理强度);关闭时跟随会话模型。保存后立即对下一次命名生效,不会中断正在进行的命名,会话日志记录的也是实际使用的模型。",
3203
3309
  memory: "记忆蒸馏模型",
3204
3310
  memoryFollow: "跟随记忆插件默认",
3205
- memoryHelp: "为 dsh-prime-memory 的记忆蒸馏指定路由;两个字段都留空时跟随该插件自己的默认模型。保存后立即生效(写入该插件自己的 live 设置,运行中的实例会读到);它拒收时才回落到静态路由,下次启动生效。",
3311
+ memoryHelp: "为 dsh-prime-memory 的记忆蒸馏指定路由;两个字段都留空时跟随该插件自己的默认模型。保存后立即生效(写入该插件自己的 live 设置,运行中的实例会读到);只有反复重试仍写不进去时才回落到静态路由(下次启动生效)。",
3206
3312
  memoryRouteHelp: "按部署默认供应商的配置组解析;该供应商没有组时使用这里填写的平面默认。优先写该行的 live 设置(立即生效),不可用时写静态路由(llm.provider/llm.model),启动时生效。",
3207
3313
  providerGroups: "供应商配置组",
3208
3314
  providerGroupsCard: "按供应商预设路由",
@@ -3299,7 +3405,7 @@ window.__ModuleLoader__.load({
3299
3405
  titleRouteHelp: "Naming requests use exactly this provider/model (no reasoning effort); when off they follow the session model. A saved change applies to the very next title, never interrupts a running one, and the session log records the route actually used.",
3300
3406
  memory: "Memory distillation model",
3301
3407
  memoryFollow: "Follows the memory plugin default",
3302
- memoryHelp: "Pin the distillation route for dsh-prime-memory. Both fields empty keeps that plugin on its own default model. Saved changes apply immediately through that plugin’s own live settings; only when it refuses the write does the static route fall back to the next start.",
3408
+ memoryHelp: "Pin the distillation route for dsh-prime-memory. Both fields empty keeps that plugin on its own default model. Saved changes apply immediately through that plugin’s own live settings; only after the live attempts keep failing does the static route fall back to the next start.",
3303
3409
  memoryRouteHelp: "Resolved from the deployment default provider group; without a group the flat pair here applies. The live settings are preferred (immediate); the static route (llm.provider/llm.model) is the fallback that applies at start.",
3304
3410
  providerGroups: "Provider groups",
3305
3411
  providerGroupsCard: "Per-provider route presets",
@@ -140,6 +140,41 @@ const primeMemoryCompatStatus = { installed: false };
140
140
  * @param model - route model to pin.
141
141
  * @returns whether the document changed.
142
142
  */
143
+ /**
144
+ * Remove this plugin's own static pin from the memory row.
145
+ *
146
+ * `effectiveCfg` (dsh-prime-memory `pipeline/runner.js`) treats a non-empty
147
+ * `cfg.llm.provider + cfg.llm.model` pair as "pinned" and then ignores *both* the runtime
148
+ * chain and the legacy `distillProvider`/`distillModel` pair. A pin written earlier — for a
149
+ * host whose live RPC was not ready yet — is therefore not harmless: it keeps winning over
150
+ * every later live push, which is exactly the "the card changed, the calls did not" report.
151
+ * Once a live push is confirmed, the pin has to go.
152
+ *
153
+ * @param documentPath - the profile patch document that holds the memory row.
154
+ * @returns what happened, so the caller can log it without guessing.
155
+ */
156
+ async function clearStaticPin(documentPath) {
157
+ const { readFile, writeFile } = await import("node:fs/promises");
158
+ let text;
159
+ try {
160
+ text = await readFile(documentPath, "utf8");
161
+ } catch {
162
+ return "missing";
163
+ }
164
+ const rows = text.split(/(?=^- id: )/m);
165
+ const index = rows.findIndex((row) => /^- id: dsh-memory\r?\n/.test(row));
166
+ if (index < 0) return "missing";
167
+ const row = rows[index];
168
+ const trimmed = row.replace(/^ {4}llm:\r?\n(?: {6}.*\r?\n)*/m, "");
169
+ if (trimmed === row) return "absent";
170
+ rows[index] = trimmed;
171
+ try {
172
+ await writeFile(documentPath, rows.join(""), "utf8");
173
+ } catch {
174
+ return "missing";
175
+ }
176
+ return "cleared";
177
+ }
143
178
  async function writeStaticPin(documentPath, provider, model) {
144
179
  const { readFile, writeFile } = await import("node:fs/promises");
145
180
  let text;
@@ -359,6 +394,8 @@ function formsOf(ctx) {
359
394
  return;
360
395
  }
361
396
  }
397
+ /** Live attempts to spend before falling back to the static pin. */
398
+ const PIN_AFTER_ATTEMPTS = 4;
362
399
  /**
363
400
  * Install the adapter for the whole profile.
364
401
  *
@@ -400,6 +437,31 @@ function installPrimeMemoryCompat(ctx, loader, routeOf) {
400
437
  timers.push(timer);
401
438
  };
402
439
  /**
440
+ * Last resort for a host whose live seams never accept the route.
441
+ *
442
+ * Writing the static pin disables every live form (`pinned` in `effectiveCfg`), so it must
443
+ * not happen while the live attempts still have a chance: a pin written on a slow start is
444
+ * what kept overriding later pushes. It therefore waits for the retry budget to run out.
445
+ *
446
+ * @param forms - the settings service describing the memory row.
447
+ * @param provider - route provider to pin.
448
+ * @param model - route model to pin.
449
+ * @param wanted - `provider/model`, for the log line.
450
+ */
451
+ const pinAsFallback = async (forms, provider, model, wanted) => {
452
+ if (attempt < PIN_AFTER_ATTEMPTS) {
453
+ scheduleRetry();
454
+ return;
455
+ }
456
+ const documentPath = forms.documentPath;
457
+ if (typeof documentPath !== "string" || documentPath === "") return;
458
+ try {
459
+ if (await writeStaticPin(documentPath, provider, model) === "written") ctx.logger.info(`model-switch: pinned the dsh-prime-memory distillation route to ${wanted} after ${attempt} live attempts (applies from the next start)`);
460
+ } catch (cause) {
461
+ ctx.logger.warn(`model-switch: could not pin the dsh-prime-memory route (${String(cause)})`);
462
+ }
463
+ };
464
+ /**
403
465
  * Write our route into the section the plugin itself reads, then read it back.
404
466
  *
405
467
  * The plugin builds that section inside its own `apply` (`settings.register`), so
@@ -442,16 +504,18 @@ function installPrimeMemoryCompat(ctx, loader, routeOf) {
442
504
  primeMemoryCompatStatus.route = wanted;
443
505
  delete primeMemoryCompatStatus.routeSkipped;
444
506
  }
445
- if (pushed === "pushed") return;
446
- const documentPath = forms.documentPath;
447
- if (typeof documentPath === "string" && documentPath !== "") try {
448
- if (await writeStaticPin(documentPath, provider, model) === "written") ctx.logger.info(`model-switch: pinned the dsh-prime-memory distillation route to ${wanted} (applies from the next start)`);
449
- } catch (cause) {
450
- ctx.logger.warn(`model-switch: could not pin the dsh-prime-memory route (${String(cause)})`);
507
+ if (pushed === "pushed") {
508
+ const pinnedDocument = forms.documentPath;
509
+ if (typeof pinnedDocument === "string" && pinnedDocument !== "") try {
510
+ if (await clearStaticPin(pinnedDocument) === "cleared") ctx.logger.info("model-switch: removed the stale dsh-prime-memory static pin; the live route decides now");
511
+ } catch (cause) {
512
+ ctx.logger.warn(`model-switch: could not clear the dsh-prime-memory static pin (${String(cause)})`);
513
+ }
514
+ return;
451
515
  }
452
516
  const section = sectionOf(forms);
453
517
  if (section === void 0 || asRecord(section.value) === void 0) {
454
- scheduleRetry();
518
+ await pinAsFallback(forms, provider, model, wanted);
455
519
  return;
456
520
  }
457
521
  const current = chainOf(section.value);
@@ -465,10 +529,10 @@ function installPrimeMemoryCompat(ctx, loader, routeOf) {
465
529
  provider,
466
530
  model
467
531
  }, current);
468
- pending = forms.update(MEMORY_ENTRY_ID, distillChainPatch(chain), section.revision).then(() => {
532
+ pending = forms.update(MEMORY_ENTRY_ID, distillChainPatch(chain), section.revision).then(async () => {
469
533
  const applied = chainOf(sectionOf(forms)?.value);
470
534
  if ((applied.length > 0 ? `${text(applied[0]?.provider)}/${text(applied[0]?.model)}` : "") !== wanted) {
471
- scheduleRetry();
535
+ await pinAsFallback(forms, provider, model, wanted);
472
536
  return;
473
537
  }
474
538
  adoptedRoute = wanted;
@@ -476,10 +540,10 @@ function installPrimeMemoryCompat(ctx, loader, routeOf) {
476
540
  primeMemoryCompatStatus.installed = true;
477
541
  primeMemoryCompatStatus.route = wanted;
478
542
  delete primeMemoryCompatStatus.routeSkipped;
479
- }).catch((cause) => {
543
+ }).catch(async (cause) => {
480
544
  primeMemoryCompatStatus.routeSkipped = "no-route";
481
545
  ctx.logger.warn(`model-switch: could not write the dsh-prime-memory distillation route (${String(cause)})`);
482
- scheduleRetry();
546
+ await pinAsFallback(forms, provider, model, wanted);
483
547
  }).finally(() => {
484
548
  pending = void 0;
485
549
  });
@@ -532,4 +596,4 @@ function apply(ctx) {
532
596
  }, "model-switch: keep the dsh-prime-memory route aligned with the settings");
533
597
  }
534
598
  //#endregion
535
- export { apply, chainOf, inject, installPrimeMemoryCompat, memoryLiveMatchesRoute, name, planPrimeMemoryRoute, primeMemoryCompatStatus, pushMemoryRoute };
599
+ export { apply, chainOf, clearStaticPin, inject, installPrimeMemoryCompat, memoryLiveMatchesRoute, name, planPrimeMemoryRoute, primeMemoryCompatStatus, pushMemoryRoute, writeStaticPin };
@@ -44,7 +44,7 @@ export declare const zh: {
44
44
  readonly titleRouteHelp: "命名请求固定使用这里的 Provider/模型(不带推理强度);关闭时跟随会话模型。保存后立即对下一次命名生效,不会中断正在进行的命名,会话日志记录的也是实际使用的模型。";
45
45
  readonly memory: "记忆蒸馏模型";
46
46
  readonly memoryFollow: "跟随记忆插件默认";
47
- readonly memoryHelp: "为 dsh-prime-memory 的记忆蒸馏指定路由;两个字段都留空时跟随该插件自己的默认模型。保存后立即生效(写入该插件自己的 live 设置,运行中的实例会读到);它拒收时才回落到静态路由,下次启动生效。";
47
+ readonly memoryHelp: "为 dsh-prime-memory 的记忆蒸馏指定路由;两个字段都留空时跟随该插件自己的默认模型。保存后立即生效(写入该插件自己的 live 设置,运行中的实例会读到);只有反复重试仍写不进去时才回落到静态路由(下次启动生效)。";
48
48
  readonly memoryRouteHelp: "按部署默认供应商的配置组解析;该供应商没有组时使用这里填写的平面默认。优先写该行的 live 设置(立即生效),不可用时写静态路由(llm.provider/llm.model),启动时生效。";
49
49
  readonly providerGroups: "供应商配置组";
50
50
  readonly providerGroupsCard: "按供应商预设路由";
@@ -43,6 +43,33 @@ export interface PrimeMemoryCompatStatus {
43
43
  }
44
44
  /** The state the settings page reads. */
45
45
  export declare const primeMemoryCompatStatus: PrimeMemoryCompatStatus;
46
+ /**
47
+ * Write the memory row's static route into the profile patch itself.
48
+ *
49
+ * `settings.update` only accepts the entry's *live* schema fields, so the static
50
+ * `llm` pin never survives that call. The pin is what `resolveModelRoute` returns
51
+ * first, and it is the only key every distillation layer honours — so it has to be
52
+ * written where the next start reads it: the row config in the profile document.
53
+ * @param documentPath - the profile patch file.
54
+ * @param provider - route provider to pin.
55
+ * @param model - route model to pin.
56
+ * @returns whether the document changed.
57
+ */
58
+ /**
59
+ * Remove this plugin's own static pin from the memory row.
60
+ *
61
+ * `effectiveCfg` (dsh-prime-memory `pipeline/runner.js`) treats a non-empty
62
+ * `cfg.llm.provider + cfg.llm.model` pair as "pinned" and then ignores *both* the runtime
63
+ * chain and the legacy `distillProvider`/`distillModel` pair. A pin written earlier — for a
64
+ * host whose live RPC was not ready yet — is therefore not harmless: it keeps winning over
65
+ * every later live push, which is exactly the "the card changed, the calls did not" report.
66
+ * Once a live push is confirmed, the pin has to go.
67
+ *
68
+ * @param documentPath - the profile patch document that holds the memory row.
69
+ * @returns what happened, so the caller can log it without guessing.
70
+ */
71
+ export declare function clearStaticPin(documentPath: string): Promise<'cleared' | 'absent' | 'missing'>;
72
+ export declare function writeStaticPin(documentPath: string, provider: string, model: string): Promise<'written' | 'unchanged' | 'missing'>;
46
73
  /**
47
74
  * The distillation chain a settings section currently carries.
48
75
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-model-switch",
3
- "version": "0.4.53",
3
+ "version": "0.4.55",
4
4
  "description": "Explicit model routing plus composer/Plan picker for DeepSeek Harness",
5
5
  "repository": {
6
6
  "type": "git",
@@ -121,7 +121,8 @@
121
121
  "0.1.7-rc.2": "compatible",
122
122
  "0.2.0-rc.2": "compatible",
123
123
  "0.2.1-rc.2": "compatible",
124
- "0.2.1-rc.3": "compatible"
124
+ "0.2.1-rc.3": "compatible",
125
+ "0.2.1-rc.5": "compatible"
125
126
  }
126
127
  }
127
128
  },