dsh-any-deepseek 0.0.42 → 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
@@ -2087,30 +2087,53 @@ var AnyDeepSeekAdapter = class extends LlmAdapter {
2087
2087
  * The same reasoning extends to `inputModalities`: it describes the model this route serves,
2088
2088
  * so it is reported here unconditionally rather than derived from a channel.
2089
2089
  */
2090
- async listModels(_provider) {
2091
- 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);
2092
2120
  const first = this.deps.channels()[0];
2093
2121
  const label = selected?.label ?? first?.label;
2094
2122
  /**
2095
- * 🔴 One entry per ROUTE, each describing the model THAT ROUTE serves.
2096
- *
2097
- * The catalog is asked per provider (`listModels(provider)`), but the host's wording is
2098
- * "discover models advertised by one registered provider" and the answer is allowed to be
2099
- * advisory. Since each of our routes serves exactly one model, returning all of them here keeps
2100
- * the picker complete even when the host asks once — and returning them ALWAYS, never filtered
2101
- * by which channels happen to exist, is decision 26 (a provider that vanishes when
2102
- * 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.
2103
2126
  *
2104
2127
  * ⚠️ `inputModalities` is per route, not global: Hy4 Flash and DeepSeek V4.1 Flash agree today,
2105
2128
  * but a route-level table is the only shape that stays true if they ever diverge.
2106
2129
  */
2107
- return PROVIDER_ROUTES.map((route) => ({
2108
- provider: route.id,
2130
+ return [{
2131
+ provider,
2109
2132
  id: route.model.id,
2110
2133
  name: route.model.name,
2111
2134
  description: label === void 0 ? "no channel configured yet" : `via ${label}`,
2112
2135
  inputModalities: [...route.caps.input]
2113
- }));
2136
+ }];
2114
2137
  }
2115
2138
  async resolveModel(provider, model, _signal) {
2116
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.42",
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": {