@mofeng2223/dsh-claude-provider 0.5.7 → 0.5.9

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/lib/client.js CHANGED
@@ -993,6 +993,8 @@ window.__ModuleLoader__.load({
993
993
  });
994
994
  /** Latest load wins; an older response never overwrites a newer one. */
995
995
  generation = 0;
996
+ /** Callers follow the current refresh's outcome, including callers whose read was superseded. */
997
+ pendingLoads = /* @__PURE__ */ new Set();
996
998
  /**
997
999
  * @param ctx - the page plugin's context, whose `remote.llm` and
998
1000
  * `remote.credentials` namespaces carry the directory and credential reads.
@@ -1009,11 +1011,28 @@ window.__ModuleLoader__.load({
1009
1011
  * settings answer in parallel, then one batched credential describe over
1010
1012
  * every referenced ref. Provider failure or absence of an initial settings
1011
1013
  * answer keeps the last good rows and surfaces an error; a failed settings
1012
- * refresh reuses the mirror's held view.
1013
- * @returns nothing; the snapshot carries the outcome.
1014
+ * refresh reuses the mirror's held view. Concurrent callers resolve only
1015
+ * after the current refresh publishes its ready or error snapshot.
1016
+ * @returns resolution after the current snapshot is published.
1017
+ * @throws the current read's unexpected rejection; superseded rejections are ignored.
1014
1018
  */
1015
- async load() {
1019
+ load() {
1020
+ const pending = Promise.withResolvers();
1021
+ this.pendingLoads.add(pending);
1016
1022
  const generation = ++this.generation;
1023
+ this.read(generation).then(() => {
1024
+ this.settleLoads(generation, (load) => {
1025
+ load.resolve();
1026
+ });
1027
+ }, (error) => {
1028
+ this.settleLoads(generation, (load) => {
1029
+ load.reject(error);
1030
+ });
1031
+ });
1032
+ return pending.promise;
1033
+ }
1034
+ /** Publish one joined answer; stale answers leave the current refresh in charge. */
1035
+ async read(generation) {
1017
1036
  this.store.update((s) => {
1018
1037
  s.status = "loading";
1019
1038
  s.error = null;
@@ -1023,17 +1042,18 @@ window.__ModuleLoader__.load({
1023
1042
  this.ctx.remote.llm.listConfigurableProviders(),
1024
1043
  this.describeFace.ensure()
1025
1044
  ]);
1045
+ if (generation !== this.generation) return;
1026
1046
  if (!registered.ok) {
1027
- this.failLoad(generation, registered.error.message);
1047
+ this.failLoad(registered.error.message);
1028
1048
  return;
1029
1049
  }
1030
1050
  if (!declared.ok) {
1031
- this.failLoad(generation, declared.error.message);
1051
+ this.failLoad(declared.error.message);
1032
1052
  return;
1033
1053
  }
1034
1054
  const mirrored = this.describeFace.getSnapshot();
1035
1055
  if (mirrored.view === void 0) {
1036
- this.failLoad(generation, mirrored.error ?? "settings are unavailable in this browser");
1056
+ this.failLoad(mirrored.error ?? "settings are unavailable in this browser");
1037
1057
  return;
1038
1058
  }
1039
1059
  const providers = joinProviderDirectory(registered.value, declared.value);
@@ -1081,9 +1101,15 @@ window.__ModuleLoader__.load({
1081
1101
  s.namespaces = namespaces;
1082
1102
  });
1083
1103
  }
1084
- /** Publish one load's failure text, unless a newer load already took over. */
1085
- failLoad(generation, message) {
1104
+ /** Settle callers only while this read still owns the current refresh. */
1105
+ settleLoads(generation, settle) {
1086
1106
  if (generation !== this.generation) return;
1107
+ const pending = [...this.pendingLoads];
1108
+ this.pendingLoads.clear();
1109
+ for (const load of pending) settle(load);
1110
+ }
1111
+ /** Publish the current joined read's failure text. */
1112
+ failLoad(message) {
1087
1113
  this.store.update((s) => {
1088
1114
  s.status = "error";
1089
1115
  s.error = message;
@@ -1978,6 +2004,7 @@ window.__ModuleLoader__.load({
1978
2004
  const CLAUDE_KNOWN_MODELS = Object.freeze({
1979
2005
  "claude-fable-5-1": Object.freeze({ contextWindow: 1000000, maxTokens: 128000, preset: "five" }),
1980
2006
  "claude-fable-5": Object.freeze({ contextWindow: 1000000, maxTokens: 128000, preset: "five" }),
2007
+ "claude-haiku-5-5": Object.freeze({ contextWindow: 1000000, maxTokens: 128000, preset: "five" }),
1981
2008
  "claude-haiku-4-5-20251001": Object.freeze({ contextWindow: 200000, maxTokens: 64000, preset: "toggle" }),
1982
2009
  "claude-haiku-4-5": Object.freeze({ contextWindow: 200000, maxTokens: 64000, preset: "toggle" }),
1983
2010
  "claude-opus-4-6": Object.freeze({ contextWindow: 1000000, maxTokens: 128000, preset: "four" }),
@@ -2134,6 +2161,10 @@ window.__ModuleLoader__.load({
2134
2161
  }
2135
2162
  } : row)
2136
2163
  };
2164
+ /** A new or failed surface waits for a current snapshot; background refreshes preserve its drafts. */
2165
+ const [hasReadySnapshot, setHasReadySnapshot] = (0, react.useState)(state.status === "ready");
2166
+ if (state.status === "ready" && !hasReadySnapshot) setHasReadySnapshot(true);
2167
+ if (state.status === "error" && hasReadySnapshot) setHasReadySnapshot(false);
2137
2168
  const [editing, setEditing] = (0, react.useState)(void 0);
2138
2169
  const [addOpen, setAddOpen] = (0, react.useState)(false);
2139
2170
  const [addMode, setAddMode] = (0, react.useState)("catalog");
@@ -2223,6 +2254,16 @@ window.__ModuleLoader__.load({
2223
2254
  })]
2224
2255
  });
2225
2256
  }
2257
+ if (!hasReadySnapshot && state.status !== "ready") return (0, react_jsx_runtime.jsxs)("div", {
2258
+ className: ModelsSection_module_css_default["section"],
2259
+ children: [(0, react_jsx_runtime.jsx)("h2", {
2260
+ className: ModelsSection_module_css_default["title"],
2261
+ children: t("title")
2262
+ }), (0, react_jsx_runtime.jsx)("p", {
2263
+ className: ModelsSection_module_css_default["intro"],
2264
+ children: t("intro")
2265
+ })]
2266
+ });
2226
2267
  const savedRow = savedTarget === void 0 ? void 0 : state.rows.find((row) => row.entry.provider === savedTarget.provider);
2227
2268
  const savedIdentity = savedRow === void 0 ? savedTarget : {
2228
2269
  provider: savedRow.entry.provider,
@@ -2361,7 +2402,9 @@ window.__ModuleLoader__.load({
2361
2402
  type: "button",
2362
2403
  className: ModelsSection_module_css_default["secondaryButton"],
2363
2404
  "aria-label": providerCopy(t("editProvider"), target),
2405
+ disabled: !open && state.status !== "ready",
2364
2406
  onClick: () => {
2407
+ if (!open && controller.store.getSnapshot().status !== "ready") return;
2365
2408
  setSavedTarget(void 0);
2366
2409
  setAddOpen(false);
2367
2410
  setEditing(open ? void 0 : target);
@@ -2371,8 +2414,9 @@ window.__ModuleLoader__.load({
2371
2414
  type: "button",
2372
2415
  className: ModelsSection_module_css_default["dangerButton"],
2373
2416
  "aria-label": providerCopy(t("removeProvider"), target),
2374
- disabled: !state.writable,
2417
+ disabled: !state.writable || state.status !== "ready",
2375
2418
  onClick: () => {
2419
+ if (controller.store.getSnapshot().status !== "ready") return;
2376
2420
  setSavedTarget(void 0);
2377
2421
  setDeleteFailure(void 0);
2378
2422
  setDeleteTarget(target);
@@ -2546,8 +2590,9 @@ window.__ModuleLoader__.load({
2546
2590
  children: (0, react_jsx_runtime.jsxs)("button", {
2547
2591
  type: "button",
2548
2592
  className: ModelsSection_module_css_default["addButton"],
2549
- disabled: !state.writable || !catalogEnabled && !customEnabled,
2593
+ disabled: !state.writable || state.status !== "ready" || !catalogEnabled && !customEnabled,
2550
2594
  onClick: () => {
2595
+ if (controller.store.getSnapshot().status !== "ready") return;
2551
2596
  const first = addable[0];
2552
2597
  const initial = catalogEnabled ? "catalog" : "custom";
2553
2598
  setSavedTarget(void 0);
@@ -3129,7 +3174,7 @@ window.__ModuleLoader__.load({
3129
3174
  claudeTypeIntro: "This provider type saves native RC8 adaptive-thinking compatibility, model reasoning mappings, Claude model discovery, and recorded capacities.",
3130
3175
  adaptiveClaudeEnabled: "Choose a thinking mode for each model; new models default to five levels.",
3131
3176
  adaptiveClaudeHelpLabel: "Thinking mode help",
3132
- adaptiveClaudeHelp: "Five (low / medium / high / xhigh / max): Fable 5.1, Fable 5, Opus 5, Opus 4.8, Opus 4.7, Sonnet 5\nFour (low / medium / high / max): Opus 4.6, Sonnet 4.6\nOn / Off: Haiku 4.5",
3177
+ adaptiveClaudeHelp: "Five (low / medium / high / xhigh / max): Haiku 5.5, Fable 5.1, Fable 5, Opus 5, Opus 4.8, Opus 4.7, Sonnet 5\nFour (low / medium / high / max): Opus 4.6, Sonnet 4.6\nOn / Off: Haiku 4.5",
3133
3178
  adaptiveClaudeTag: "Claude configured",
3134
3179
  thinkingPreset: "Thinking mode",
3135
3180
  thinkingPresetToggle: "On / Off",
@@ -3258,7 +3303,7 @@ window.__ModuleLoader__.load({
3258
3303
  claudeTypeIntro: "此提供方类型会写入 RC8 原生自适应思考兼容配置、模型思考映射、Claude 模型发现和已记录容量。",
3259
3304
  adaptiveClaudeEnabled: "每个模型可单独选择思考模式,新增模型默认使用五档。",
3260
3305
  adaptiveClaudeHelpLabel: "思考模式说明",
3261
- adaptiveClaudeHelp: "五档(低 / 中 / 高 / 超高 / 最大):Fable 5.1、Fable 5、Opus 5、Opus 4.8、Opus 4.7、Sonnet 5\n四档(低 / 中 / 高 / 最大):Opus 4.6、Sonnet 4.6\n开启 / 关闭:Haiku 4.5",
3306
+ adaptiveClaudeHelp: "五档(低 / 中 / 高 / 超高 / 最大):Haiku 5.5、Fable 5.1、Fable 5、Opus 5、Opus 4.8、Opus 4.7、Sonnet 5\n四档(低 / 中 / 高 / 最大):Opus 4.6、Sonnet 4.6\n开启 / 关闭:Haiku 4.5",
3262
3307
  adaptiveClaudeTag: "Claude 已适配",
3263
3308
  thinkingPreset: "思考模式",
3264
3309
  thinkingPresetToggle: "开启 / 关闭",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mofeng2223/dsh-claude-provider",
3
- "version": "0.5.7",
4
- "description": "Custom Claude provider support for DeepSeek Harness 0.2.1-alpha.1",
3
+ "version": "0.5.9",
4
+ "description": "Custom Claude provider support for DeepSeek Harness 0.2.1-alpha.2",
5
5
  "author": "mofeng2223",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -62,6 +62,6 @@
62
62
  }
63
63
  },
64
64
  "devDependencies": {
65
- "@deepseek-ai/dsh-client-ui-settings-models": "0.2.1-alpha.1"
65
+ "@deepseek-ai/dsh-client-ui-settings-models": "0.2.1-alpha.2"
66
66
  }
67
67
  }
package/src/index.js CHANGED
@@ -20,6 +20,7 @@ const MAX_DISCOVERY_PAGES = 100
20
20
  export const CLAUDE_KNOWN_MODELS = Object.freeze({
21
21
  'claude-fable-5-1': Object.freeze({ contextWindow: 1000000, maxTokens: 128000, preset: 'five' }),
22
22
  'claude-fable-5': Object.freeze({ contextWindow: 1000000, maxTokens: 128000, preset: 'five' }),
23
+ 'claude-haiku-5-5': Object.freeze({ contextWindow: 1000000, maxTokens: 128000, preset: 'five' }),
23
24
  'claude-haiku-4-5-20251001': Object.freeze({ contextWindow: 200000, maxTokens: 64000, preset: 'toggle' }),
24
25
  'claude-haiku-4-5': Object.freeze({ contextWindow: 200000, maxTokens: 64000, preset: 'toggle' }),
25
26
  'claude-opus-4-6': Object.freeze({ contextWindow: 1000000, maxTokens: 128000, preset: 'four' }),