@genkaku/dsh-user-plugin 0.1.24 → 0.1.26

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.
Files changed (2) hide show
  1. package/lib/client.js +23 -5
  2. package/package.json +3 -3
package/lib/client.js CHANGED
@@ -43,6 +43,18 @@ var import_jsx_runtime = require("react/jsx-runtime");
43
43
  var PANEL_ID = "genkaku-user";
44
44
  var CANDIDATE_PORTS = [47821, 47822, 47823, 47824, 47825, 47826];
45
45
  var originOf = (port) => `http://127.0.0.1:${port}`;
46
+ async function listening(port) {
47
+ try {
48
+ await fetch(`${originOf(port)}/genkaku/status`, {
49
+ mode: "no-cors",
50
+ cache: "no-store",
51
+ signal: AbortSignal.timeout(1500)
52
+ });
53
+ return true;
54
+ } catch {
55
+ return false;
56
+ }
57
+ }
46
58
  var ZH = typeof navigator !== "undefined" && /^zh/i.test(navigator.language);
47
59
  var t = (en, zh) => ZH ? zh : en;
48
60
  var inject = ["slots"];
@@ -148,7 +160,16 @@ function Page() {
148
160
  } catch {
149
161
  }
150
162
  }
151
- setError("no GenKaKu user bridge on 47821\u201347826");
163
+ for (const port of CANDIDATE_PORTS) {
164
+ if (await listening(port)) {
165
+ setError(t(
166
+ `Something answers on 127.0.0.1:${port} but refused this window's origin (403). Update the plugin: dsh plugin add @genkaku/dsh-user-plugin@latest`,
167
+ `127.0.0.1:${port} \u6709\u670D\u52D9\u5728\u8DD1\uFF0C\u4F46\u62D2\u7D55\u4E86\u9019\u500B\u8996\u7A97\u7684\u4F86\u6E90\uFF08403\uFF09\u3002\u8ACB\u66F4\u65B0\u63D2\u4EF6\uFF1Adsh plugin add @genkaku/dsh-user-plugin@latest`
168
+ ));
169
+ return;
170
+ }
171
+ }
172
+ setError(t("No GenKaKu user bridge on 47821\u201347826.", "47821\u201347826 \u4E0A\u627E\u4E0D\u5230 GenKaKu user bridge\u3002"));
152
173
  }, []);
153
174
  (0, import_react.useEffect)(() => {
154
175
  void load();
@@ -289,10 +310,7 @@ function Page() {
289
310
  if (error != null) {
290
311
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { padding: 16 }, children: [
291
312
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { style: { margin: 0 }, children: "GenKaKu network" }),
292
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { style: { ...dim, marginTop: 8 }, children: [
293
- "Worker status unreachable: ",
294
- error
295
- ] }),
313
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { style: { ...dim, marginTop: 8 }, children: error }),
296
314
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { style: { ...dim, fontSize: 12 }, children: "The plugin opens its bridge on the first free port in 47821\u201347826." })
297
315
  ] });
298
316
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@genkaku/dsh-user-plugin",
3
- "version": "0.1.24",
3
+ "version": "0.1.26",
4
4
  "description": "Buy peer-to-peer inference from the GenKaKu network",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -39,8 +39,8 @@
39
39
  },
40
40
  "dependencies": {
41
41
  "@deepseek-ai/dsh-llm": "0.2.2-rc.1",
42
- "@genkaku/dsh-runtime": "0.1.23",
43
- "@genkaku/protocol": "0.1.16"
42
+ "@genkaku/dsh-runtime": "0.1.25",
43
+ "@genkaku/protocol": "0.1.18"
44
44
  },
45
45
  "peerDependencies": {
46
46
  "@deepseek-ai/cordis": "^4.1.0",