@genkaku/dsh-user-plugin 0.1.19 → 0.1.20

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 +63 -27
  2. package/package.json +2 -2
package/lib/client.js CHANGED
@@ -157,47 +157,83 @@ function Page() {
157
157
  }
158
158
  if (status == null) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { padding: 16, ...dim }, children: "Loading worker status\u2026" });
159
159
  const offers = status.offers ?? [];
160
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { padding: 16, maxWidth: 720 }, children: [
160
+ const price = (micro) => {
161
+ const n = Number(micro);
162
+ if (!Number.isFinite(n)) return "\u2014";
163
+ return n === 0 ? "free" : `${(n / 1e6).toFixed(2)} USDC`;
164
+ };
165
+ const eth = (wei) => {
166
+ const n = Number(wei);
167
+ return Number.isFinite(n) ? `${(n / 1e18).toFixed(4)} ETH` : "\u2014";
168
+ };
169
+ const usdc = (micro) => {
170
+ const n = Number(micro);
171
+ return Number.isFinite(n) ? `${(n / 1e6).toFixed(2)} USDC` : "\u2014";
172
+ };
173
+ const short = (addr) => addr == null || addr.length < 12 ? addr ?? "\u2014" : `${addr.slice(0, 6)}\u2026${addr.slice(-4)}`;
174
+ const wallets = new Set(offers.map((o) => o.offer?.workerWallet).filter((w) => typeof w === "string" && w !== ""));
175
+ const workerCount = wallets.size > 0 ? wallets.size : (status.workers ?? []).length;
176
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { padding: 16, maxWidth: 760 }, children: [
177
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: `
178
+ .gk-net-wrap { position: relative; padding-right: 12px; }
179
+ .gk-net-models { max-height: min(380px, 48vh); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; }
180
+ .gk-net-models::-webkit-scrollbar { display: none; }
181
+ .gk-net-rail { position: absolute; top: 2px; bottom: 2px; right: 2px; width: 8px; border-radius: 4px; background: rgba(127,137,153,.16); cursor: pointer; }
182
+ .gk-net-thumb { position: absolute; left: 0; width: 8px; min-height: 16px; border-radius: 4px; background: rgba(127,137,153,.7); }
183
+ .gk-net-rail:hover .gk-net-thumb { background: rgba(127,137,153,.9); }
184
+ .gk-net-row { display: grid; grid-template-columns: minmax(0, 1fr) 92px 116px; gap: 10px; align-items: center; padding: 7px 0; border-top: 0.5px solid rgba(127,137,153,.18); }
185
+ .gk-net-row:first-child { border-top: none; }
186
+ ` }),
161
187
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { style: { margin: 0 }, children: "GenKaKu network" }),
162
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { ...dim, marginTop: 4 }, children: status.role ?? "unknown role" }),
188
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { ...dim, marginTop: 4 }, children: [
189
+ "user \xB7 ",
190
+ status.env ?? "base-sepolia"
191
+ ] }),
163
192
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: box, children: [
164
193
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: row, children: [
165
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: dim, children: "Peer" }),
166
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", { children: status.peerId ?? "\u2014" })
194
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: dim, children: "Wallet" }),
195
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", { title: status.wallet, children: short(status.wallet) })
196
+ ] }),
197
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: row, children: [
198
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: dim, children: "Balance" }),
199
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
200
+ eth(status.balances?.eth),
201
+ " \xB7 ",
202
+ usdc(status.balances?.usdc)
203
+ ] })
167
204
  ] }),
168
205
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: row, children: [
169
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: dim, children: "Sessions served" }),
170
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: status.sessions ?? 0 })
206
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: dim, children: "Payments" }),
207
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: status.settle === true ? "escrow enabled" : "free / dev" })
171
208
  ] }),
172
209
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: row, children: [
173
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: dim, children: "Published on-chain" }),
174
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: status.published === true ? "yes" : "no" })
210
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: dim, children: "Workers discovered" }),
211
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: workerCount })
175
212
  ] }),
176
213
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: row, children: [
177
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: dim, children: "Addresses" }),
178
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: (status.peerAddrs ?? []).length })
214
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: dim, children: "Models offered" }),
215
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: offers.length })
179
216
  ] })
180
217
  ] }),
181
218
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: box, children: [
182
219
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { ...dim, fontSize: 12, textTransform: "uppercase", letterSpacing: 1 }, children: "Models on the network" }),
183
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: `
184
- .gk-net-wrap { position: relative; padding-right: 12px; }
185
- .gk-net-models { max-height: min(360px, 45vh); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; }
186
- .gk-net-models::-webkit-scrollbar { display: none; }
187
- .gk-net-rail { position: absolute; top: 2px; bottom: 2px; right: 2px; width: 8px; border-radius: 4px; background: rgba(127,137,153,.16); cursor: pointer; }
188
- .gk-net-thumb { position: absolute; left: 0; width: 8px; min-height: 16px; border-radius: 4px; background: rgba(127,137,153,.7); }
189
- .gk-net-rail:hover .gk-net-thumb { background: rgba(127,137,153,.9); }
190
- ` }),
191
220
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "gk-net-wrap", children: [
192
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "gk-net-models", ref: models.attach, onScroll: models.update, children: 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: [
193
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: offer.model ?? "\u2014" }),
194
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { style: dim, children: [
195
- offer.pricePerHour ?? "?",
196
- " / hour",
197
- offer.tier === "chat" ? " \xB7 not for agents" : "",
198
- offer.addr != null && status.transports?.[offer.addr] === "relay" ? " \xB7 via seed VM" : offer.addr != null && status.transports?.[offer.addr] === "direct" ? " \xB7 direct" : ""
199
- ] })
200
- ] }, `${offer.model ?? i}`)) }),
221
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "gk-net-models", ref: models.attach, onScroll: models.update, children: offers.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { style: { ...dim, marginBottom: 0 }, children: "Nothing offered yet. A worker lists its local Ollama models on start." }) : offers.map((entry, i) => {
222
+ const offer = entry.offer ?? {};
223
+ const transport = entry.addr == null ? null : status.transports?.[entry.addr];
224
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "gk-net-row", children: [
225
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { style: { minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: [
226
+ offer.model ?? "model name missing",
227
+ offer.tier === "chat" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: { ...dim, fontSize: 11, marginLeft: 8 }, children: "not for agents" }) : offer.tier != null ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: { ...dim, fontSize: 11, marginLeft: 8 }, children: offer.tier }) : null
228
+ ] }),
229
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: { ...dim, textAlign: "right", fontSize: 12 }, children: offer.workerName ?? "\u2014" }),
230
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { style: { textAlign: "right", fontSize: 12 }, children: [
231
+ price(offer.pricePerHour),
232
+ " ",
233
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: dim, children: transport === "relay" ? "\xB7 via seed VM" : transport === "direct" ? "\xB7 direct" : "" })
234
+ ] })
235
+ ] }, `${entry.addr ?? ""}:${offer.model ?? i}`);
236
+ }) }),
201
237
  models.thumb != null && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "gk-net-rail", "aria-hidden": "true", onPointerDown: (e) => models.jump(e), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "gk-net-thumb", style: { top: `${models.thumb.top}%`, height: `${models.thumb.height}%` } }) })
202
238
  ] })
203
239
  ] })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@genkaku/dsh-user-plugin",
3
- "version": "0.1.19",
3
+ "version": "0.1.20",
4
4
  "description": "Buy peer-to-peer inference from the GenKaKu network",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "dependencies": {
41
41
  "@deepseek-ai/dsh-llm": "0.2.2-rc.1",
42
- "@genkaku/dsh-runtime": "0.1.19",
42
+ "@genkaku/dsh-runtime": "0.1.20",
43
43
  "@genkaku/protocol": "0.1.13"
44
44
  },
45
45
  "peerDependencies": {