dsh-any-deepseek 0.0.11 → 0.0.12

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/http.d.ts CHANGED
@@ -98,6 +98,15 @@ export declare function probeChannel(channel: ResolvedChannel, key: string, sess
98
98
  message?: string;
99
99
  responded?: string;
100
100
  }>;
101
+ /**
102
+ * The body's `error` value, when it is actually an error.
103
+ *
104
+ * Returns `undefined` for a missing field AND for an explicit `null` — both mean "no error".
105
+ * A non-null value (object or string) is returned as JSON text for the panel to show.
106
+ * @param text - the raw response body.
107
+ * @returns the error as text, or undefined when the body reports no error.
108
+ */
109
+ export declare function errorFieldValue(text: string): string | undefined;
101
110
  /**
102
111
  * What a successful probe response says the relay called its model.
103
112
  *
package/lib/index.js CHANGED
@@ -1818,7 +1818,7 @@ function probeRequest(channel) {
1818
1818
  body: {
1819
1819
  model: channel.model,
1820
1820
  input: "ping",
1821
- max_output_tokens: 16,
1821
+ max_output_tokens: 256,
1822
1822
  stream: false
1823
1823
  }
1824
1824
  };
@@ -1890,11 +1890,12 @@ async function probeChannel(channel, key, sessionId, signal) {
1890
1890
  code: probeCode(response.status, text),
1891
1891
  message: text.slice(0, 400)
1892
1892
  };
1893
- if (text.includes("\"error\"")) return {
1893
+ const bodyError = errorFieldValue(text);
1894
+ if (bodyError !== void 0) return {
1894
1895
  ok: false,
1895
1896
  ms,
1896
1897
  code: "SERVER",
1897
- message: text.slice(0, 400)
1898
+ message: bodyError.slice(0, 400)
1898
1899
  };
1899
1900
  return {
1900
1901
  ok: true,
@@ -1911,6 +1912,25 @@ async function probeChannel(channel, key, sessionId, signal) {
1911
1912
  }
1912
1913
  }
1913
1914
  /**
1915
+ * The body's `error` value, when it is actually an error.
1916
+ *
1917
+ * Returns `undefined` for a missing field AND for an explicit `null` — both mean "no error".
1918
+ * A non-null value (object or string) is returned as JSON text for the panel to show.
1919
+ * @param text - the raw response body.
1920
+ * @returns the error as text, or undefined when the body reports no error.
1921
+ */
1922
+ function errorFieldValue(text) {
1923
+ let parsed;
1924
+ try {
1925
+ parsed = JSON.parse(text);
1926
+ } catch {
1927
+ return text.includes("\"error\"") ? text : void 0;
1928
+ }
1929
+ const candidate = parsed?.error;
1930
+ if (candidate === void 0 || candidate === null) return void 0;
1931
+ return typeof candidate === "string" ? candidate : JSON.stringify(candidate);
1932
+ }
1933
+ /**
1914
1934
  * What a successful probe response says the relay called its model.
1915
1935
  *
1916
1936
  * Three protocols, three response shapes — the old reader understood only completions
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-any-deepseek",
3
- "version": "0.0.11",
3
+ "version": "0.0.12",
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": {