pinokiod 3.82.0 → 3.85.0

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.
@@ -1,6 +1,6 @@
1
1
  class Huggingface {
2
2
  cmd() {
3
- return "huggingface_hub"
3
+ return 'huggingface_hub "hf-xet!=1.1.10"'
4
4
  }
5
5
  async install(req, ondata) {
6
6
  await this.kernel.bin.exec({
package/kernel/peer.js CHANGED
@@ -28,7 +28,7 @@ class PeerDiscovery {
28
28
  for(let host of peer_array) {
29
29
  if (this.host !== host) {
30
30
  let result = await this._refresh(host)
31
- console.log("check peeers", { host, result })
31
+ console.log("check peers", { host, result })
32
32
  if (!result) {
33
33
  console.log("delete host", host)
34
34
  this.peers.delete(host)
@@ -140,7 +140,6 @@ class PeerDiscovery {
140
140
  return res.data
141
141
  }
142
142
  } catch (e) {
143
- // console.log("_refresh error", { host , e })
144
143
  return null
145
144
  }
146
145
  }
@@ -156,10 +155,7 @@ class PeerDiscovery {
156
155
  let res = await axios.post(endpoint, info, {
157
156
  timeout: 2000
158
157
  })
159
- // return res.data
160
158
  } catch (e) {
161
- // console.log("ERROR", e)
162
- // return null
163
159
  }
164
160
  }
165
161
  }
@@ -371,15 +367,21 @@ class PeerDiscovery {
371
367
  let d = Date.now()
372
368
  let router_info = await this.router_info()
373
369
  let installed = await this.installed()
374
- let peers = Object.values(this.info).filter((info) => {
375
- return info.host !== this.host
376
- }).map((info) => {
377
- return {
378
- name: info.name,
379
- host: info.host
380
- }
381
- })
370
+ let peers
371
+ if (this.info) {
372
+ peers = Object.values(this.info).filter((info) => {
373
+ return info.host !== this.host
374
+ }).map((info) => {
375
+ return {
376
+ name: info.name,
377
+ host: info.host
378
+ }
379
+ })
380
+ } else {
381
+ peers = []
382
+ }
382
383
  return {
384
+ active: this.active,
383
385
  version: this.kernel.version,
384
386
  home: this.kernel.homedir,
385
387
  arch: this.kernel.arch,
@@ -30,7 +30,6 @@ class PeerStaticRouter extends Processor {
30
30
  rewrite: /asset/api/test
31
31
  match: test.x.localhost
32
32
  */
33
- // console.log("PEER STATIC ROUTER", rewrite_mapping)
34
33
  let url = new URL("http://" + rewrite_mapping.external_ip)
35
34
  let dial = url.host
36
35
  let rewrite = url.pathname
package/kernel/shell.js CHANGED
@@ -1259,7 +1259,14 @@ ${cleaned}
1259
1259
  return
1260
1260
  }
1261
1261
  this.vt.write(msg, () => {
1262
- let buf = this.vts.serialize()
1262
+ let buf
1263
+ try {
1264
+ buf = this.vts.serialize()
1265
+ } catch (e) {
1266
+ console.log("vts serialize error", e)
1267
+ callback()
1268
+ return
1269
+ }
1263
1270
  let cleaned = this.stripAnsi(buf)
1264
1271
  let response = {
1265
1272
  id: this.id,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "3.82.0",
3
+ "version": "3.85.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/server/index.js CHANGED
@@ -2664,11 +2664,13 @@ class Server {
2664
2664
  }
2665
2665
  getPeers() {
2666
2666
  let list = []
2667
- for(let key in this.kernel.peer.info) {
2668
- // if (key !== this.kernel.peer.host) {
2667
+ if (this.kernel.peer.active) {
2668
+ for(let key in this.kernel.peer.info) {
2669
2669
  let info = this.kernel.peer.info[key]
2670
- list.push(info)
2671
- // }
2670
+ if (info.active) {
2671
+ list.push(info)
2672
+ }
2673
+ }
2672
2674
  }
2673
2675
  return list
2674
2676
  }
@@ -2796,6 +2798,11 @@ class Server {
2796
2798
  } else {
2797
2799
  // For every update, this gets triggered exactly once.
2798
2800
  // 1. first mkdir if it doesn't exist (this step is irrelevant since at this point the home dir will exist)
2801
+
2802
+ let exists = await this.kernel.exists(home)
2803
+ if (!exists) {
2804
+ await fs.promises.mkdir(home, { recursive: true })
2805
+ }
2799
2806
 
2800
2807
  needInitHome = true
2801
2808
  console.log("not up to date. update py.")
@@ -4236,10 +4243,11 @@ class Server {
4236
4243
  return
4237
4244
  }
4238
4245
 
4239
-
4240
4246
  // let list = this.getPeerInfo()
4241
4247
  // console.log("peeerInfo", JSON.stringify(list, null, 2))
4248
+ console.time("check peers")
4242
4249
  await this.kernel.peer.check_peers()
4250
+ console.timeEnd("check peers")
4243
4251
 
4244
4252
 
4245
4253
  let peers = []
@@ -6249,15 +6257,16 @@ class Server {
6249
6257
  if (this.kernel.peer.active) {
6250
6258
  // if network is active, return success only if the router is up for all of its peers (including itself)
6251
6259
  let ready = true
6252
- if (this.kernel.peer.info && Object.keys(this.kernel.peer.info).length > 0) {
6253
- for(let host in this.kernel.peer.info) {
6254
- let info = this.kernel.peer.info[host]
6260
+ if (this.kernel.peer.info) {
6261
+ let info = this.kernel.peer.info[this.kernel.peer.host]
6262
+ if (info) {
6255
6263
  if (info.router && Object.keys(info.router).length > 0) {
6256
6264
  ready = true
6257
6265
  } else {
6258
6266
  ready = false
6259
- break;
6260
6267
  }
6268
+ } else {
6269
+ ready = false
6261
6270
  }
6262
6271
  } else {
6263
6272
  ready = false;
@@ -3,7 +3,7 @@
3
3
  width: 100%;
4
4
  }
5
5
  .url-modal-overlay .url-dropdown {
6
- max-height: 50%;
6
+ max-height: 50vh;
7
7
  }
8
8
  .url-dropdown {
9
9
  position: absolute;
@@ -335,10 +335,22 @@ function initUrlDropdown(config = {}) {
335
335
  const url = this.getAttribute('data-url');
336
336
  const type = this.getAttribute('data-host-type');
337
337
  urlInput.value = url;
338
- urlInput.setAttribute("data-host-type", type)
338
+ urlInput.setAttribute("data-host-type", type);
339
339
  hideDropdown();
340
- // Submit the form
341
- urlInput.closest('form').dispatchEvent(new Event('submit'));
340
+
341
+ // Navigate directly instead of dispatching submit event
342
+ if (type === "local") {
343
+ let redirect_uri = "/container?url=" + url;
344
+ location.href = redirect_uri;
345
+ } else {
346
+ let u = new URL(url);
347
+ if (String(u.port) === "42000") {
348
+ window.open(url, "_blank", 'self');
349
+ } else {
350
+ let redirect_uri = "/container?url=" + url;
351
+ location.href = redirect_uri;
352
+ }
353
+ }
342
354
  });
343
355
  });
344
356
 
@@ -558,10 +570,25 @@ function initUrlDropdown(config = {}) {
558
570
  modalDropdown.querySelectorAll('.url-dropdown-item:not(.non-selectable)').forEach(item => {
559
571
  item.addEventListener('click', function() {
560
572
  const url = this.getAttribute('data-url');
573
+ const type = this.getAttribute('data-host-type');
561
574
  modalInput.value = url;
562
575
  urlInput.value = url;
563
- urlInput.closest('form').dispatchEvent(new Event('submit'));
576
+ urlInput.setAttribute("data-host-type", type);
564
577
  closeMobileModal();
578
+
579
+ // Navigate directly instead of dispatching submit event
580
+ if (type === "local") {
581
+ let redirect_uri = "/container?url=" + url;
582
+ location.href = redirect_uri;
583
+ } else {
584
+ let u = new URL(url);
585
+ if (String(u.port) === "42000") {
586
+ window.open(url, "_blank", 'self');
587
+ } else {
588
+ let redirect_uri = "/container?url=" + url;
589
+ location.href = redirect_uri;
590
+ }
591
+ }
565
592
  });
566
593
  });
567
594
 
@@ -936,6 +936,7 @@ body.dark .troubleshoot {
936
936
  color: rgba(255,255,255,0.5);
937
937
  }
938
938
  .troubleshoot {
939
+ padding-top: 15px;
939
940
  color: rgba(0,0,0,0.5);
940
941
  }
941
942
  .network-name.expanded .btn {
@@ -1126,7 +1127,6 @@ document.addEventListener('DOMContentLoaded', function() {
1126
1127
  </div>
1127
1128
  </div>
1128
1129
  <div class='advanced'>
1129
- <br>
1130
1130
  <!--
1131
1131
  <div id='advanced-label' class='link-label label'>Advanced</div>
1132
1132
  <div id='reset-label' class='btn'>Reset</div>