dsh-any-deepseek 0.0.41 → 0.0.43

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/adapter.d.ts CHANGED
@@ -380,7 +380,7 @@ export declare class AnyDeepSeekAdapter extends LlmAdapter {
380
380
  * The same reasoning extends to `inputModalities`: it describes the model this route serves,
381
381
  * so it is reported here unconditionally rather than derived from a channel.
382
382
  */
383
- listModels(_provider: string): Promise<LlmModelInfo[]>;
383
+ listModels(provider: string): Promise<LlmModelInfo[]>;
384
384
  resolveModel(provider: string, model: string, _signal?: AbortSignal): Promise<LlmResolvedModelInfo>;
385
385
  /**
386
386
  * Bind the model metadata and the dispatch to one channel generation.
package/lib/index.js CHANGED
@@ -2043,9 +2043,17 @@ var AnyDeepSeekAdapter = class extends LlmAdapter {
2043
2043
  this.deps = deps;
2044
2044
  }
2045
2045
  providerInfo(provider) {
2046
+ /**
2047
+ * 🔴 The name comes from the ROUTE, not from this plugin's first route.
2048
+ *
2049
+ * Returning `PROVIDER_NAME` unconditionally was correct while there was one route. With two,
2050
+ * it would label `any-hy` as "Any DeepSeek" in every provider selector — the user would pick
2051
+ * Hy4 Flash and see DeepSeek's name on it. Falls back to the plugin name for an id we do not
2052
+ * recognise (an old saved selection), so the answer is never blank.
2053
+ */
2046
2054
  return {
2047
2055
  id: provider,
2048
- name: PROVIDER_NAME
2056
+ name: providerRoute(provider)?.name ?? "Any DeepSeek"
2049
2057
  };
2050
2058
  }
2051
2059
  /**
@@ -2079,30 +2087,53 @@ var AnyDeepSeekAdapter = class extends LlmAdapter {
2079
2087
  * The same reasoning extends to `inputModalities`: it describes the model this route serves,
2080
2088
  * so it is reported here unconditionally rather than derived from a channel.
2081
2089
  */
2082
- async listModels(_provider) {
2083
- const selected = this.selected();
2090
+ async listModels(provider) {
2091
+ const route = providerRoute(provider);
2092
+ /**
2093
+ * 🔴 **Return ONLY the requested route's model, and echo the requested provider id.**
2094
+ *
2095
+ * This was got wrong in `0.0.42` and took both routes offline — the model picker showed
2096
+ * 「加载失败:adapter returned invalid or duplicate model metadata」 for `any-deepseek` AND
2097
+ * `any-hy`, which meant the container's default model had no catalog at all.
2098
+ *
2099
+ * The host's rule, read off the source rather than guessed this time
2100
+ * (`dsh-llm/lib/index.js:2090`):
2101
+ *
2102
+ * ```js
2103
+ * if (typeof model.provider !== 'string' || model.provider !== provider || … || seen.has(model.id))
2104
+ * throw new LlmError(`adapter returned invalid or duplicate model metadata …`, 'INVALID_CATALOG')
2105
+ * ```
2106
+ *
2107
+ * ⇒ Two constraints, both violated by "return every route and let the caller sort it out":
2108
+ * 1. `model.provider` must EQUAL the provider being asked about. Returning `any-hy`'s entry
2109
+ * from an `any-deepseek` call is an immediate `INVALID_CATALOG`.
2110
+ * 2. `model.id` must be unique within one response.
2111
+ *
2112
+ * The lesson is the same one this file keeps re-learning: **"the answer is advisory" is a
2113
+ * statement about routing, not about validation.** A catalog is still shape-checked.
2114
+ *
2115
+ * An id we do not recognise yields `[]` rather than throwing: the host only asks about routes
2116
+ * we registered, and an empty catalog is the honest answer for one we no longer serve.
2117
+ */
2118
+ if (route === void 0) return [];
2119
+ const selected = this.selectedFor(provider);
2084
2120
  const first = this.deps.channels()[0];
2085
2121
  const label = selected?.label ?? first?.label;
2086
2122
  /**
2087
- * 🔴 One entry per ROUTE, each describing the model THAT ROUTE serves.
2088
- *
2089
- * The catalog is asked per provider (`listModels(provider)`), but the host's wording is
2090
- * "discover models advertised by one registered provider" and the answer is allowed to be
2091
- * advisory. Since each of our routes serves exactly one model, returning all of them here keeps
2092
- * the picker complete even when the host asks once — and returning them ALWAYS, never filtered
2093
- * by which channels happen to exist, is decision 26 (a provider that vanishes when
2094
- * unconfigured looks exactly like one that is not installed).
2123
+ * ⚠️ Returning the entry ALWAYS, never filtered by whether a usable channel exists, is
2124
+ * decision 26: a provider that vanishes when unconfigured looks exactly like one that is not
2125
+ * installed, and that is precisely when the user is trying to set it up.
2095
2126
  *
2096
2127
  * ⚠️ `inputModalities` is per route, not global: Hy4 Flash and DeepSeek V4.1 Flash agree today,
2097
2128
  * but a route-level table is the only shape that stays true if they ever diverge.
2098
2129
  */
2099
- return PROVIDER_ROUTES.map((route) => ({
2100
- provider: route.id,
2130
+ return [{
2131
+ provider,
2101
2132
  id: route.model.id,
2102
2133
  name: route.model.name,
2103
2134
  description: label === void 0 ? "no channel configured yet" : `via ${label}`,
2104
2135
  inputModalities: [...route.caps.input]
2105
- }));
2136
+ }];
2106
2137
  }
2107
2138
  async resolveModel(provider, model, _signal) {
2108
2139
  const channel = this.selectedFor(provider);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-any-deepseek",
3
- "version": "0.0.41",
3
+ "version": "0.0.43",
4
4
  "description": "One DeepSeek V4.1 Flash provider for DeepSeek Harness: paste a key per channel, switch channels manually, token usage booked per real upstream.",
5
5
  "license": "MIT",
6
6
  "repository": {