pinokiod 2.15.47 → 2.15.50

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.
@@ -26,8 +26,7 @@ class HF {
26
26
  delete params.path
27
27
  let chunks = unparse(params)
28
28
  let message = [
29
- `huggingface-cli download ${chunks.join(" ")}`,
30
- (kernel.platform === "win32" ? "dir" : "ls")
29
+ `huggingface-cli download ${chunks.join(" ")}` + (kernel.platform === "win32" ? " && dir" : " ; ls")
31
30
  ]
32
31
  console.log({ message, before: req.params.message })
33
32
  req.params.message = message
@@ -2,10 +2,16 @@ const fs = require('fs')
2
2
  const { rimraf } = require('rimraf')
3
3
  class Playwright {
4
4
  async install(req, ondata) {
5
+ let c
6
+ if (this.kernel.platform === "win32") {
7
+ c = `npm config set prefix ${this.kernel.bin.path("miniconda")}`
8
+ } else {
9
+ c = `npm config set prefix ${this.kernel.bin.path("miniconda/lib")}`
10
+ }
5
11
  await this.kernel.exec({
6
12
  message: [
7
13
  // "npm init -y",
8
- `npm config set prefix ${this.kernel.bin.path("miniconda")}`,
14
+ c
9
15
  ],
10
16
  path: this.kernel.bin.path("playwright"),
11
17
  env: {
package/kernel/shells.js CHANGED
@@ -150,8 +150,6 @@ class Shells {
150
150
  ondata(stream)
151
151
  })
152
152
 
153
- console.log(">>>>>> RESPONSE", response)
154
-
155
153
  /*
156
154
  {
157
155
  method: "shell.run",
@@ -181,7 +179,6 @@ class Shells {
181
179
 
182
180
  // 2. first find the `break: false` handlers and replace the patterns with blank => so they won't be matched in the next step
183
181
  //let line = response.replaceAll(/[\r\n]/g, "")
184
- console.log("checking breakpoints", breakPoints)
185
182
  for(let handler of breakPoints) {
186
183
  if (handler.event) {
187
184
  let matches = /^\/(.+)\/([dgimsuy]*)$/gs.exec(handler.event)
package/kernel/util.js CHANGED
@@ -140,6 +140,16 @@ const parse_env_detail = async (filename) => {
140
140
  */
141
141
  return items
142
142
  }
143
+ const log_path = (fullpath, kernel) => {
144
+ let api_path = `${kernel.homedir}${path.sep}api`
145
+ let rel_path = path.relative(api_path, fullpath)
146
+ console.log({ rel_path })
147
+ let log_root = `${kernel.homedir}${path.sep}logs`
148
+ console.log({ log_root })
149
+ let current_log_path = path.resolve(log_root, "shell/cleaned/api", rel_path)
150
+ console.log({ current_log_path })
151
+ return current_log_path
152
+ }
143
153
  const api_path = (fullpath, kernel) => {
144
154
  let api_path = `${kernel.homedir}${path.sep}api`
145
155
  let rel_path = path.relative(api_path, fullpath)
@@ -196,5 +206,5 @@ const update_env = async (filepath, changes) => {
196
206
  await fs.promises.writeFile(filepath, newval)
197
207
  };
198
208
  module.exports = {
199
- parse_env, api_path, update_env, parse_env_detail, openfs, port_running, du
209
+ parse_env, log_path, api_path, update_env, parse_env_detail, openfs, port_running, du
200
210
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "2.15.47",
3
+ "version": "2.15.50",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/server/index.js CHANGED
@@ -931,6 +931,8 @@ class Server {
931
931
  items: pre_items
932
932
  })
933
933
  } else {
934
+ let logpath = encodeURIComponent(Util.log_path(filepath, this.kernel))
935
+ console.log({ logpath })
934
936
  const result = {
935
937
  prev,
936
938
  error,
@@ -949,6 +951,7 @@ class Server {
949
951
  gitRemote,
950
952
  filename,
951
953
  filepath,
954
+ logpath,
952
955
  encodedFilePath: encodeURIComponent(filepath),
953
956
  schemaPath,
954
957
  uri,
@@ -2363,6 +2366,11 @@ class Server {
2363
2366
  apps
2364
2367
  })
2365
2368
  }))
2369
+ this.app.get("/getlog", ex(async (req, res) => {
2370
+ console.log("query", req.query)
2371
+ let str = await fs.promises.readFile(req.query.logpath, "utf8")
2372
+ res.send(str)
2373
+ }))
2366
2374
  this.app.post("/proxy", ex(async (req, res) => {
2367
2375
  /*
2368
2376
  req.body := {
@@ -89,6 +89,13 @@ td.key {
89
89
  header .runner {
90
90
  padding: 10px 0 0;
91
91
  }
92
+ #del-bin {
93
+ color: royalblue;
94
+ cursor: pointer;
95
+ font-weight: bold;
96
+ padding: 0 5px;
97
+ text-decoration: underline;
98
+ }
92
99
  </style>
93
100
  <script>
94
101
  document.addEventListener("DOMContentLoaded", async () => {
@@ -742,6 +749,40 @@ document.addEventListener("DOMContentLoaded", async () => {
742
749
  document.querySelector("#close-error-screen").addEventListener('click', (e) => {
743
750
  document.querySelector("#error-screen").classList.add("hidden")
744
751
  })
752
+ if (document.querySelector("#del-bin")) {
753
+ document.querySelector("#del-bin").addEventListener("click", async (e) => {
754
+ console.log("del-bin")
755
+ let proceed = confirm("Are you sure you wish to delete the bin folder?")
756
+ if (proceed) {
757
+ document.querySelector(".reset-bin-loading").classList.remove("hidden")
758
+ document.querySelector("#del-bin").classList.add("hidden")
759
+ let res = await fetch("/pinokio/delete", {
760
+ method: "post",
761
+ headers: {
762
+ "Content-Type": "application/json"
763
+ },
764
+ body: JSON.stringify({ type: "bin" })
765
+ }).then((res) => {
766
+ return res.json()
767
+ })
768
+ console.log(res)
769
+ document.querySelector(".reset-bin-loading").classList.add("hidden")
770
+ if (res.error) {
771
+ alert(res.error)
772
+ } else {
773
+ location.href = location.href
774
+ }
775
+ }
776
+ })
777
+ }
778
+ /*
779
+ document.querySelector("#open-log").addEventListener("click", async (e) => {
780
+ let logs = await fetch("/getlog?logpath=<%=logpath%>").then((res) => {
781
+ return res.text()
782
+ })
783
+ console.log(logs)
784
+ })
785
+ */
745
786
  })
746
787
  const reloadMemory = async () => {
747
788
  // let url = "/pinokio/memory?filepath=" + encodeURI("<%-filepath%>")
@@ -795,6 +836,9 @@ const reloadMemory = async () => {
795
836
  </div>
796
837
  <button class='btn' id='open-fs' data-filepath="<%=filepath%>"><i class="fa-solid fa-eye"></i> View File</button>
797
838
  <!--
839
+ <button class='btn' id='open-log' data-logpath="<%=logpath%>"><i class="fa-solid fa-align-left"></i> View Logs</button>
840
+ -->
841
+ <!--
798
842
  <button class='btn' id='source' data-editor-url="<%=editorUrl%>">Navigate</button>
799
843
  -->
800
844
  <div id='save' class='btn disabled'>
@@ -836,6 +880,12 @@ const reloadMemory = async () => {
836
880
  <input type='hidden' name='callback' value="<%=current%>">
837
881
  <button class='btn'>Install</button>
838
882
  </form>
883
+ <div class='item'>
884
+ <div class='d'>Not working? <a id='del-bin'>Try a fresh install</a></div>
885
+ <div class='reset-bin-loading hidden'>
886
+ <i class="fa-solid fa-circle-notch fa-spin"></i> Stand by. Do not close this window..
887
+ </div>
888
+ </div>
839
889
  </div>
840
890
  </div>
841
891
  <% } else { %>
@@ -98,6 +98,13 @@ header {
98
98
  .btn {
99
99
  background: royalblue;
100
100
  }
101
+ #del-bin {
102
+ color: royalblue;
103
+ cursor: pointer;
104
+ font-weight: bold;
105
+ padding: 0 5px;
106
+ text-decoration: underline;
107
+ }
101
108
  </style>
102
109
  <script>
103
110
  document.addEventListener("DOMContentLoaded", async () => {
@@ -711,6 +718,38 @@ document.addEventListener("DOMContentLoaded", async () => {
711
718
  document.querySelector("#close-error-screen").addEventListener('click', (e) => {
712
719
  document.querySelector("#error-screen").classList.add("hidden")
713
720
  })
721
+ if (document.querySelector("#del-bin")) {
722
+ document.querySelector("#del-bin").addEventListener("click", async (e) => {
723
+ console.log("del-bin")
724
+ let proceed = confirm("Are you sure you wish to delete the bin folder?")
725
+ if (proceed) {
726
+ document.querySelector(".reset-bin-loading").classList.remove("hidden")
727
+ document.querySelector("#del-bin").classList.add("hidden")
728
+ let res = await fetch("/pinokio/delete", {
729
+ method: "post",
730
+ headers: {
731
+ "Content-Type": "application/json"
732
+ },
733
+ body: JSON.stringify({ type: "bin" })
734
+ }).then((res) => {
735
+ return res.json()
736
+ })
737
+ console.log(res)
738
+ document.querySelector(".reset-bin-loading").classList.add("hidden")
739
+ if (res.error) {
740
+ alert(res.error)
741
+ } else {
742
+ location.href = location.href
743
+ }
744
+ }
745
+ })
746
+ }
747
+ // document.querySelector("#open-log").addEventListener("click", async (e) => {
748
+ // let logs = await fetch("/getlog?logpath=<%=logpath%>").then((res) => {
749
+ // return res.text()
750
+ // })
751
+ // console.log(logs)
752
+ // })
714
753
  })
715
754
  const reloadMemory = async () => {
716
755
  // let url = "/pinokio/memory?filepath=<%=encodedFilePath%>"
@@ -754,6 +793,9 @@ const reloadMemory = async () => {
754
793
  <span class='stop hidden'><i class="fa-solid fa-stop"></i> Stop</span>
755
794
  </div>
756
795
  <button class='btn' id='open-fs' data-filepath="<%=filepath%>"><i class="fa-solid fa-eye"></i> View File</button>
796
+ <!--
797
+ <button class='btn' id='open-log' data-logpath="<%=logpath%>"><i class="fa-solid fa-align-left"></i> View Logs</button>
798
+ -->
757
799
  </div>
758
800
  <% } %>
759
801
  </header>
@@ -790,6 +832,12 @@ const reloadMemory = async () => {
790
832
  <input type='hidden' name='callback' value="<%=current%>">
791
833
  <button class='btn'>Install</button>
792
834
  </form>
835
+ <div class='item'>
836
+ <div class='d'>Not working? <a id='del-bin'>Try a fresh install</a></div>
837
+ <div class='reset-bin-loading hidden'>
838
+ <i class="fa-solid fa-circle-notch fa-spin"></i> Stand by. Do not close this window..
839
+ </div>
840
+ </div>
793
841
  </div>
794
842
  </div>
795
843
  <% } else { %>