@genkaku/dsh-worker-plugin 0.1.2 → 0.1.4
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/cordis.patch.yml +5 -0
- package/lib/client.js +129 -0
- package/package.json +20 -6
package/cordis.patch.yml
ADDED
package/lib/client.js
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
window.__ModuleLoader__.load({
|
|
2
|
+
id: "@genkaku/dsh-worker-plugin",
|
|
3
|
+
factory: (require) => {
|
|
4
|
+
var module = { exports: {} };
|
|
5
|
+
var exports = module.exports;
|
|
6
|
+
"use strict";
|
|
7
|
+
var __defProp = Object.defineProperty;
|
|
8
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
9
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
10
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
+
var __export = (target, all) => {
|
|
12
|
+
for (var name in all)
|
|
13
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
14
|
+
};
|
|
15
|
+
var __copyProps = (to, from, except, desc) => {
|
|
16
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
+
for (let key of __getOwnPropNames(from))
|
|
18
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
19
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
|
+
|
|
25
|
+
// src/client/index.tsx
|
|
26
|
+
var index_exports = {};
|
|
27
|
+
__export(index_exports, {
|
|
28
|
+
apply: () => apply,
|
|
29
|
+
inject: () => inject
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(index_exports);
|
|
32
|
+
var import_react = require("react");
|
|
33
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
34
|
+
var PANEL_ID = "genkaku-worker";
|
|
35
|
+
var STATUS_URL = "http://127.0.0.1:47821/genkaku/status";
|
|
36
|
+
var inject = ["slots"];
|
|
37
|
+
function Icon({ size = 16 }) {
|
|
38
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.6", "aria-hidden": "true", children: [
|
|
39
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "7", cy: "17", r: "2.5" }),
|
|
40
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "17", cy: "7", r: "2.5" }),
|
|
41
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "17", cy: "17", r: "2.5" }),
|
|
42
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M9.2 15.6 14.8 8.4M9.5 17h5", strokeLinecap: "round" })
|
|
43
|
+
] });
|
|
44
|
+
}
|
|
45
|
+
var row = { display: "flex", justifyContent: "space-between", gap: 12, padding: "6px 0" };
|
|
46
|
+
var dim = { opacity: 0.6 };
|
|
47
|
+
var box = { border: "1px solid rgba(255,255,255,0.12)", borderRadius: 10, padding: 12, marginTop: 12 };
|
|
48
|
+
function Page() {
|
|
49
|
+
const [status, setStatus] = (0, import_react.useState)(null);
|
|
50
|
+
const [error, setError] = (0, import_react.useState)(null);
|
|
51
|
+
const load = (0, import_react.useCallback)(async () => {
|
|
52
|
+
try {
|
|
53
|
+
const res = await fetch(STATUS_URL);
|
|
54
|
+
if (!res.ok) throw new Error(`status ${res.status}`);
|
|
55
|
+
setStatus(await res.json());
|
|
56
|
+
setError(null);
|
|
57
|
+
} catch (e) {
|
|
58
|
+
setError(e instanceof Error ? e.message : String(e));
|
|
59
|
+
}
|
|
60
|
+
}, []);
|
|
61
|
+
(0, import_react.useEffect)(() => {
|
|
62
|
+
void load();
|
|
63
|
+
const timer = setInterval(() => {
|
|
64
|
+
void load();
|
|
65
|
+
}, 5e3);
|
|
66
|
+
return () => clearInterval(timer);
|
|
67
|
+
}, [load]);
|
|
68
|
+
if (error != null) {
|
|
69
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { padding: 16 }, children: [
|
|
70
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { style: { margin: 0 }, children: "GenKaKu worker" }),
|
|
71
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { style: { ...dim, marginTop: 8 }, children: [
|
|
72
|
+
"Worker status unreachable: ",
|
|
73
|
+
error
|
|
74
|
+
] }),
|
|
75
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { style: { ...dim, fontSize: 12 }, children: "The plugin starts its status server on 127.0.0.1:47821." })
|
|
76
|
+
] });
|
|
77
|
+
}
|
|
78
|
+
if (status == null) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { padding: 16, ...dim }, children: "Loading worker status\u2026" });
|
|
79
|
+
const offers = status.offers ?? [];
|
|
80
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { padding: 16, maxWidth: 720 }, children: [
|
|
81
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { style: { margin: 0 }, children: "GenKaKu worker" }),
|
|
82
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { ...dim, marginTop: 4 }, children: status.role ?? "unknown role" }),
|
|
83
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: box, children: [
|
|
84
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: row, children: [
|
|
85
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: dim, children: "Peer" }),
|
|
86
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", { children: status.peerId ?? "\u2014" })
|
|
87
|
+
] }),
|
|
88
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: row, children: [
|
|
89
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: dim, children: "Sessions served" }),
|
|
90
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: status.sessions ?? 0 })
|
|
91
|
+
] }),
|
|
92
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: row, children: [
|
|
93
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: dim, children: "Published on-chain" }),
|
|
94
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: status.published === true ? "yes" : "no" })
|
|
95
|
+
] }),
|
|
96
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: row, children: [
|
|
97
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: dim, children: "Addresses" }),
|
|
98
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: (status.peerAddrs ?? []).length })
|
|
99
|
+
] })
|
|
100
|
+
] }),
|
|
101
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: box, children: [
|
|
102
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { ...dim, fontSize: 12, textTransform: "uppercase", letterSpacing: 1 }, children: "Offered models" }),
|
|
103
|
+
offers.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { style: { ...dim, marginBottom: 0 }, children: "Nothing offered yet. The worker auto-lists local Ollama models on start." }) : offers.map((offer, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: row, children: [
|
|
104
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: offer.model ?? "\u2014" }),
|
|
105
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { style: dim, children: [
|
|
106
|
+
offer.pricePerHour ?? "?",
|
|
107
|
+
" / hour",
|
|
108
|
+
offer.tier === "chat" ? " \xB7 not for agents" : ""
|
|
109
|
+
] })
|
|
110
|
+
] }, `${offer.model ?? i}`))
|
|
111
|
+
] })
|
|
112
|
+
] });
|
|
113
|
+
}
|
|
114
|
+
function apply(ctx) {
|
|
115
|
+
ctx.effect(() => ctx.slots.inject("main", () => ctx.slots.register({
|
|
116
|
+
name: "main",
|
|
117
|
+
key: PANEL_ID
|
|
118
|
+
}, Page)), "genkaku-worker: panel page");
|
|
119
|
+
ctx.effect(() => ctx.slots.inject("sidebar.panellist", () => ctx.slots.register({
|
|
120
|
+
name: "sidebar.panellist",
|
|
121
|
+
id: PANEL_ID,
|
|
122
|
+
order: 40,
|
|
123
|
+
label: () => "GenKaKu"
|
|
124
|
+
}, Icon)), "genkaku-worker: panel entry");
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return module.exports;
|
|
128
|
+
}
|
|
129
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genkaku/dsh-worker-plugin",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Share this machine's Ollama models on the GenKaKu network",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -11,21 +11,35 @@
|
|
|
11
11
|
"types": "./dist/index.d.ts",
|
|
12
12
|
"default": "./dist/index.js"
|
|
13
13
|
},
|
|
14
|
+
"./client": "./lib/client.js",
|
|
14
15
|
"./package.json": "./package.json"
|
|
15
16
|
},
|
|
16
17
|
"files": [
|
|
17
18
|
"dist/**/*.js",
|
|
18
19
|
"dist/**/*.d.ts",
|
|
19
20
|
"dist/**/*.d.ts.map",
|
|
21
|
+
"lib/client.js",
|
|
20
22
|
"README.md",
|
|
21
|
-
"LICENSE"
|
|
23
|
+
"LICENSE",
|
|
24
|
+
"cordis.patch.yml"
|
|
22
25
|
],
|
|
23
26
|
"dsh": {
|
|
24
|
-
"
|
|
27
|
+
"bundle": {
|
|
28
|
+
"patch": [
|
|
29
|
+
"./cordis.patch.yml"
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
"client": {
|
|
33
|
+
"inject": [
|
|
34
|
+
"@deepseek-ai/dsh-client-ui-slots",
|
|
35
|
+
"@deepseek-ai/dsh-client-ui-layout"
|
|
36
|
+
],
|
|
37
|
+
"platform": "web"
|
|
38
|
+
}
|
|
25
39
|
},
|
|
26
40
|
"dependencies": {
|
|
27
|
-
"@genkaku/
|
|
28
|
-
"@genkaku/
|
|
41
|
+
"@genkaku/dsh-runtime": "0.1.4",
|
|
42
|
+
"@genkaku/protocol": "0.1.4"
|
|
29
43
|
},
|
|
30
44
|
"peerDependencies": {
|
|
31
45
|
"@deepseek-ai/cordis": "^4.1.0"
|
|
@@ -55,7 +69,7 @@
|
|
|
55
69
|
"base"
|
|
56
70
|
],
|
|
57
71
|
"scripts": {
|
|
58
|
-
"build": "tsc -p tsconfig.json",
|
|
72
|
+
"build": "tsc -p tsconfig.json && node ../../scripts/build-client.mjs . @genkaku/dsh-worker-plugin",
|
|
59
73
|
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
60
74
|
}
|
|
61
75
|
}
|