@genkaku/dsh-user-plugin 0.1.10 → 0.1.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/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -3
- package/lib/client.js +20 -10
- package/package.json +6 -3
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAKH,oEAAoE;AACpE,eAAO,MAAM,QAAQ,YAAY,CAAA;AAEjC,eAAO,MAAQ,IAAI,UAAE,MAAM,qBAAE,MAAM;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAKH,oEAAoE;AACpE,eAAO,MAAM,QAAQ,YAAY,CAAA;AAEjC,eAAO,MAAQ,IAAI,UAAE,MAAM,qBAAE,MAAM;;;;;;;;;aAuCgrN,CAAC;oBAAqD,CAAC;YAA6C,CAAC;mBAAoD,CAAC;sBAAuD,CAAC;qBAAsD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;aAAy6D,CAAC;oBAAqD,CAAC;YAA6C,CAAC;mBAAoD,CAAC;sBAAuD,CAAC;qBAAsD,CAAC;;;;;;;;;;;;;;;;eAvCzmS,KAAK,8GAsCxC,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -23,13 +23,26 @@ export const { name, inject, Config, apply } = defineGenkakuPlugin({
|
|
|
23
23
|
const log = ctx.logger('genkaku-user');
|
|
24
24
|
const baseUrl = () => `http://127.0.0.1:${config.port.get()}/v1`;
|
|
25
25
|
const adapter = new GenkakuAdapter({ baseUrl, log: line => log.info(line) });
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
// Installing the worker plugin next to this one makes the harness reload
|
|
27
|
+
// plugins; a second register for the same provider throws and took the
|
|
28
|
+
// whole web boot down. Reuse the adapter that is already there instead.
|
|
29
|
+
const guard = (label, register) => {
|
|
30
|
+
try {
|
|
31
|
+
const dispose = register();
|
|
32
|
+
return typeof dispose === 'function' ? dispose : () => { };
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
log.warn('%s: already registered (%s) — reusing the existing one', label, error instanceof Error ? error.message : String(error));
|
|
36
|
+
return () => { };
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
ctx.effect(() => guard('llm adapter', () => ctx.llm.registerAdapter([PROVIDER], adapter)), 'genkaku-user: llm adapter');
|
|
40
|
+
ctx.effect(() => guard('provider route', () => ctx.llm.registerConfigurableProviders([{
|
|
28
41
|
provider: PROVIDER,
|
|
29
42
|
displayName: 'GenKaKu Network',
|
|
30
43
|
settingsNs: 'genkaku-user',
|
|
31
44
|
settingsPath: [],
|
|
32
|
-
}]), 'genkaku-user: provider route');
|
|
45
|
+
}])), 'genkaku-user: provider route');
|
|
33
46
|
},
|
|
34
47
|
});
|
|
35
48
|
//# sourceMappingURL=index.js.map
|
package/lib/client.js
CHANGED
|
@@ -37,7 +37,8 @@ var genkaku_mark_default = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAK4AAA
|
|
|
37
37
|
// src/client/index.tsx
|
|
38
38
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
39
39
|
var PANEL_ID = "genkaku-user";
|
|
40
|
-
var
|
|
40
|
+
var CANDIDATE_PORTS = [47821, 47822, 47823, 47824, 47825, 47826];
|
|
41
|
+
var originOf = (port) => `http://127.0.0.1:${port}`;
|
|
41
42
|
var inject = ["slots"];
|
|
42
43
|
function Icon({ size = 16 }) {
|
|
43
44
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { style: { display: "inline-flex", width: size, height: size }, "aria-hidden": "true", children: [
|
|
@@ -89,14 +90,22 @@ function Page() {
|
|
|
89
90
|
const [status, setStatus] = (0, import_react.useState)(null);
|
|
90
91
|
const [error, setError] = (0, import_react.useState)(null);
|
|
91
92
|
const load = (0, import_react.useCallback)(async () => {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
93
|
+
for (const port of CANDIDATE_PORTS) {
|
|
94
|
+
try {
|
|
95
|
+
const res = await fetch(`${originOf(port)}/genkaku/status`, {
|
|
96
|
+
cache: "no-store",
|
|
97
|
+
signal: AbortSignal.timeout(2500)
|
|
98
|
+
});
|
|
99
|
+
if (!res.ok) continue;
|
|
100
|
+
const doc = await res.json();
|
|
101
|
+
if (doc.role !== "user") continue;
|
|
102
|
+
setStatus(doc);
|
|
103
|
+
setError(null);
|
|
104
|
+
return;
|
|
105
|
+
} catch {
|
|
106
|
+
}
|
|
99
107
|
}
|
|
108
|
+
setError("no GenKaKu user bridge on 47821\u201347826");
|
|
100
109
|
}, []);
|
|
101
110
|
(0, import_react.useEffect)(() => {
|
|
102
111
|
void load();
|
|
@@ -112,7 +121,7 @@ function Page() {
|
|
|
112
121
|
"Worker status unreachable: ",
|
|
113
122
|
error
|
|
114
123
|
] }),
|
|
115
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { style: { ...dim, fontSize: 12 }, children: "The plugin
|
|
124
|
+
/* @__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." })
|
|
116
125
|
] });
|
|
117
126
|
}
|
|
118
127
|
if (status == null) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { padding: 16, ...dim }, children: "Loading worker status\u2026" });
|
|
@@ -145,7 +154,8 @@ function Page() {
|
|
|
145
154
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { style: dim, children: [
|
|
146
155
|
offer.pricePerHour ?? "?",
|
|
147
156
|
" / hour",
|
|
148
|
-
offer.tier === "chat" ? " \xB7 not for agents" : ""
|
|
157
|
+
offer.tier === "chat" ? " \xB7 not for agents" : "",
|
|
158
|
+
offer.addr != null && status.transports?.[offer.addr] === "relay" ? " \xB7 via seed VM" : offer.addr != null && status.transports?.[offer.addr] === "direct" ? " \xB7 direct" : ""
|
|
149
159
|
] })
|
|
150
160
|
] }, `${offer.model ?? i}`))
|
|
151
161
|
] })
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genkaku/dsh-user-plugin",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.12",
|
|
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.
|
|
43
|
-
"@genkaku/protocol": "0.1.
|
|
42
|
+
"@genkaku/dsh-runtime": "0.1.15",
|
|
43
|
+
"@genkaku/protocol": "0.1.11"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"@deepseek-ai/cordis": "^4.1.0",
|
|
@@ -70,6 +70,9 @@
|
|
|
70
70
|
"usdc",
|
|
71
71
|
"base"
|
|
72
72
|
],
|
|
73
|
+
"engines": {
|
|
74
|
+
"node": ">=22"
|
|
75
|
+
},
|
|
73
76
|
"scripts": {
|
|
74
77
|
"build": "tsc -p tsconfig.json && node ../../scripts/build-client.mjs . @genkaku/dsh-user-plugin",
|
|
75
78
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|