pinokiod 3.19.2 → 3.19.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.
@@ -86,6 +86,12 @@ body.dark *::-webkit-scrollbar-thumb {
86
86
  border: 7px solid rgba(255,255,255,0.3);
87
87
  }
88
88
 
89
+ @font-face {
90
+ font-family: 'RobotoMono';
91
+ src: url('./RobotoMono-Regular.ttf') format(truetype);
92
+ font-weight: normal;
93
+ font-style: normal;
94
+ }
89
95
  @font-face {
90
96
  font-family: 'SpaceMono';
91
97
  src: url('./SpaceMono-Regular.ttf') format(truetype);
@@ -115,6 +121,9 @@ body.dark *::-webkit-scrollbar-thumb {
115
121
  .drawer.vertical-collapsed {
116
122
  max-height: 0;
117
123
  }
124
+ .git.selected {
125
+ border-left: 10px solid royalblue;
126
+ }
118
127
  body.dark .dynamic.selected {
119
128
  border-left: 10px solid royalblue;
120
129
  }
@@ -947,8 +956,9 @@ body.columns .containers {
947
956
  .xterm-rows {
948
957
  /*
949
958
  font-family: "SpaceMono", monospace !important;
950
- */
951
959
  font-family: "SourceCode", monospace !important;
960
+ */
961
+ font-family: "RobotoMono", monospace !important;
952
962
  font-weight: 400 !important;
953
963
  font-style: normal !important;
954
964
 
package/server/socket.js CHANGED
@@ -1,8 +1,10 @@
1
1
  const WebSocket = require('ws');
2
+ const path = require('path')
2
3
  const Util = require("../kernel/util")
3
4
  class Socket {
4
5
  constructor(parent) {
5
6
  this.buffer = {}
7
+ this.sessions = {}
6
8
  this.connected = {}
7
9
  this.active_shell = {}
8
10
  this.parent = parent
@@ -168,6 +170,80 @@ class Socket {
168
170
  headers.push('Access-Control-Allow-Origin: *');
169
171
  headers.push('Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept');
170
172
  });
173
+
174
+ this.interval = setInterval(async () => {
175
+ for(let key in this.buffer) {
176
+ let buf = this.buffer[key]
177
+ if (this.old_buffer[key] !== buf) {
178
+
179
+ /*
180
+
181
+ dev
182
+ /Users/x/pinokio/plugin/dev/claude.json?cwd=/Users/x/pinokio/api/audioplay
183
+ /Users/x/pinokio/plugin/dev/gemini.json?cwd=/Users/x/pinokio/api/audioplay
184
+
185
+ api
186
+ /Users/x/pinokio/api/audioplay/start.json
187
+
188
+ shell
189
+ facefusion-pinokio.git_0.0_a56eb7d48c9e96d8a5217d625d83d204
190
+ facefusion-pinokio.git_0.0_a56eb7d48c9e96d8a5217d625d83d204
191
+ audioplay_0.0_a56eb7d48c9e96d8a5217d625d83d204
192
+ */
193
+
194
+ // 1. dev
195
+ if (path.isAbsolute(key)) {
196
+ let p = key.replace(/\?.*$/, '')
197
+ let relative = path.relative(this.parent.kernel.homedir, p)
198
+ if (relative.startsWith("plugin")) {
199
+ // dev
200
+ let m = /\?.*$/.exec(key)
201
+ if (m && m.length > 0) {
202
+ /*
203
+ DEV Changed {
204
+ cwd: '/Users/x/pinokio/api/audioplay',
205
+ relative: 'plugin/dev/claude.json'
206
+ }
207
+ */
208
+ let paramStr = m[0]
209
+ let cwd = new URL("http://localhost" + paramStr).searchParams.get("cwd")
210
+ let session = this.sessions[key]
211
+ let logpath = path.resolve(cwd, "logs/dev", path.parse(relative).base)
212
+ await Util.log(logpath, buf, session)
213
+
214
+ }
215
+ } else if (relative.startsWith("api")) {
216
+ // api
217
+ /*
218
+ API Changed {
219
+ cwd: '/Users/x/pinokio/api/audioplay/start.json',
220
+ filepath: [ 'start.json' ]
221
+ }
222
+ */
223
+ let filepath_chunks = relative.split(path.sep).slice(2)
224
+ let cwd = this.parent.kernel.path(...relative.split(path.sep).slice(0, 2))
225
+ let session = this.sessions[key]
226
+ let logpath = path.resolve(cwd, "logs/api", ...filepath_chunks)
227
+ await Util.log(logpath, buf, session)
228
+ }
229
+ } else {
230
+ // SHELL
231
+ /*
232
+ SHELL Changed { cwd: '/Users/x/pinokio/api/kernel.api.stop', key: 'kernel.api.stop' }
233
+ */
234
+ let cwd = this.parent.kernel.path("api", key.split("_")[0])
235
+ let session = this.sessions[key]
236
+ let logpath = path.resolve(cwd, "logs/shell")
237
+ await Util.log(logpath, buf, session)
238
+
239
+
240
+ }
241
+ } else {
242
+ // console.log(`State hasn't changed: ${key}`)
243
+ }
244
+ }
245
+ this.old_buffer = structuredClone(this.buffer)
246
+ }, 5000)
171
247
  }
172
248
  subscribe(ws, id, buf, sh) {
173
249
 
@@ -215,10 +291,20 @@ class Socket {
215
291
  });
216
292
  }
217
293
 
294
+ if (e.data && e.data.type === "shell.kill") {
295
+ // when shell is killed, reset the buffer
296
+ delete this.buffer[id]
297
+ delete this.sessions[id]
298
+ }
299
+
218
300
  if (!this.buffer[id]) {
219
301
  this.buffer[id] = ""
302
+ if (!this.sessions[id]) {
303
+ this.sessions[id] = "" + Date.now()
304
+ }
220
305
  }
221
- if (e.data && e.data.raw) this.buffer[id] += e.data.raw
306
+ //if (e.data && e.data.raw) this.buffer[id] += e.data.raw
307
+ if (e.data && e.data.buf) this.buffer[id] = e.data.buf
222
308
 
223
309
  if (e.data && e.data.shell_id) {
224
310
  this.active_shell[id] = e.data.shell_id
@@ -256,7 +342,8 @@ class Socket {
256
342
  if (!this.buffer[caller]) {
257
343
  this.buffer[caller] = ""
258
344
  }
259
- if (e.data.raw) this.buffer[caller] += e.data.raw
345
+ //if (e.data.raw) this.buffer[caller] += e.data.raw
346
+ if (e.data.buf) this.buffer[caller] = e.data.buf
260
347
 
261
348
  if (e.data && e.data.shell_id) {
262
349
  this.active_shell[caller] = e.data.shell_id
@@ -637,8 +637,8 @@ body.dark .submenu {
637
637
  }
638
638
  .disk-usage {
639
639
  flex-grow: 1;
640
- text-align: right;
641
640
  font-weight: bold;
641
+ text-align: right;
642
642
  }
643
643
  .disk-usage i {
644
644
  margin-right: 5px;
@@ -669,6 +669,18 @@ body.dark .submenu {
669
669
  body.dark .appcanvas {
670
670
  border-top: 1px solid rgba(255,255,255,0.04);
671
671
  }
672
+ .filler {
673
+ display: none;
674
+ }
675
+
676
+ @media only screen and (max-width: 1000px) {
677
+ .url-bar {
678
+ display: none;
679
+ }
680
+ .filler {
681
+ display: block;
682
+ }
683
+ }
672
684
 
673
685
  @media only screen and (max-width: 480px) {
674
686
  nav .btn2 {
@@ -747,6 +759,7 @@ body.dark .appcanvas {
747
759
  <button class='btn2' id='back'><div><i class="fa-solid fa-chevron-left"></i></div><div>Prev</div></button>
748
760
  <button class='btn2' id='forward'><div><i class="fa-solid fa-chevron-right"></i></div><div>Next</div></button>
749
761
  <button class='btn2' id='refresh-page'><div><i class="fa-solid fa-rotate-right"></i></div><div>Refresh</div></button>
762
+ <div class='flexible filler'></div>
750
763
  <div class='url-bar'>
751
764
  <% if (current_urls.https) { %>
752
765
  <a class='https-url' target="_blank" href="<%=current_urls.https%>"><i class="fa-solid fa-square-arrow-up-right"></i> <%=current_urls.https%></a>
@@ -822,15 +835,13 @@ body.dark .appcanvas {
822
835
  </div>
823
836
  <div class='m n system' data-type="n">
824
837
  <a target="<%=src%>" href="<%=src%>" class='btn header-item frame-link' data-index="0" data-mode="refresh">
825
- <div class='tab'><i class="fa-regular fa-folder-open"></i> Files <div class='disk-usage'></div></div>
838
+ <div class='tab'>
839
+ <i class="fa-regular fa-folder-open"></i> Files <div class='disk-usage'></div>
840
+ </div>
841
+ <div class='loader'>
842
+ <i id='open-folder' data-filepath="<%=path%>" class="fa-solid fa-up-right-from-square"></i>
843
+ </div>
826
844
  </a>
827
- <% if (config.init_required) { %>
828
- <a data-init class='btn header-item frame-link' href="/prototype?type=init&path=<%=path%>" target="/prototype?type=init&path=<%=path%>" data-index="1" data-mode="refresh">
829
- <div class='tab'>
830
- <i class='fa-solid fa-bolt'></i> Initialize
831
- </div>
832
- </a>
833
- <% } %>
834
845
  <% if (profile || feed) { %>
835
846
  <div class='btn header-item frame-link revealer' data-group='.info-group'>
836
847
  <div class='tab'>
@@ -856,6 +867,21 @@ body.dark .appcanvas {
856
867
  <%- include('./partials/dynamic', { dynamic: plugin_menu, }) %>
857
868
  <% } %>
858
869
  </div>
870
+ <% if (type === "browse") { %>
871
+ <div class='nested-menu selected git'>
872
+ <div class='btn header-item frame-link reveal'>
873
+ <div class='tab'><i class="fa-solid fa-cloud"></i> Git</div>
874
+ <div class='loader'><i class="fa-solid fa-angle-down"></i><i class="fa-solid fa-angle-up hidden"></i></div>
875
+ </div>
876
+ <div class='submenu'>
877
+ <% repos.forEach((git, index) => { %>
878
+ <a target="/git/<%=git.gitParentRelPath%>" href="/git/<%=git.gitParentRelPath%>" class='btn header-item frame-link' data-index="<%=index%>" data-mode="refresh">
879
+ <div class='tab'><i class="fa-regular fa-folder-open"></i> <%=git.gitRelPath%></div>
880
+ </a>
881
+ <% }) %>
882
+ </div>
883
+ </div>
884
+ <% } %>
859
885
  <div class='btn header-item frame-link revealer' data-group='.config-group'>
860
886
  <div class='tab'>
861
887
  <i class='fa-solid fa-gear'></i> Settings
@@ -886,6 +912,17 @@ body.dark .appcanvas {
886
912
  <%})%>
887
913
  </div>
888
914
  <div class='flexible'></div>
915
+ <div class='header-top header-item'>
916
+ <div class='app-info'>
917
+ <% if (type === 'run') { %>
918
+ <div class='mode-section'>
919
+ <h3><i class='fa-solid fa-circle-play'></i> Run mode</h3>
920
+ <div class='desc'>Switch to dev mode to make changes to the app.</div>
921
+ <a class='btn' href="<%=home.endsWith("/") ? home : home + "/" %>dev"><i class="fa-solid fa-code"></i> Switch to Dev mode</a>
922
+ </div>
923
+ <% } %>
924
+ </div>
925
+ </div>
889
926
  <!--
890
927
  <div class='tabmenu'>
891
928
  <div id='new-tab' class='btn header-item'><div class='tab'><i class="fa-solid fa-plus"></i> New</div></div>
@@ -174,12 +174,11 @@ body.dark .browser-options-row {
174
174
  <a class='path' href="<%=path.path%>"><%-path.name%></a>
175
175
  <% } %>
176
176
  <% }) %>
177
+ <% if (display.includes("form")) { %>
177
178
  <form class='search'>
178
- <% if (display.includes("form")) { %>
179
- <input type='search' class="flexible" placeholder='Filter downloaded apps'>
180
- <% } else { %>
181
- <% } %>
179
+ <input type='search' class="flexible" placeholder='Filter downloaded apps'>
182
180
  </form>
181
+ <% } %>
183
182
  <% if (ishome) { %>
184
183
  <div class='nav-btns'>
185
184
  <a class='btn2' href="<%=portal%>" target="_blank"><div><i class="fa-solid fa-question"></i></div><div>Help</div></a>
@@ -0,0 +1,149 @@
1
+ <html>
2
+ <head>
3
+ <link href="/css/fontawesome.min.css" rel="stylesheet">
4
+ <link href="/css/solid.min.css" rel="stylesheet">
5
+ <link href="/css/regular.min.css" rel="stylesheet">
6
+ <link href="/css/brands.min.css" rel="stylesheet">
7
+ <link href="/style.css" rel="stylesheet"/>
8
+ <% if (agent === "electron") { %>
9
+ <link href="/electron.css" rel="stylesheet"/>
10
+ <% } %>
11
+ <style>
12
+ .container {
13
+ padding: 20px;
14
+ max-width: 800px;
15
+ box-sizing: border-box;
16
+ }
17
+ nav {
18
+ position: sticky;
19
+ top: 0;
20
+ }
21
+ nav a {
22
+ display: block;
23
+ padding: 10px;
24
+ color: royalblue;
25
+ }
26
+ label {
27
+ display: block;
28
+ padding: 10px;
29
+ }
30
+ nav label {
31
+ display: block;
32
+ padding: 10px;
33
+ }
34
+ main {
35
+ padding: 20px;
36
+ }
37
+ main iframe {
38
+ width: 100%;
39
+ height: 500px;
40
+ }
41
+ main img {
42
+ width: 100%;
43
+ }
44
+ main h2 {
45
+ margin: 0 0 10px;
46
+ }
47
+ pre.l {
48
+ /*
49
+ white-space: pre-wrap;
50
+ font-family: monospace;
51
+ */
52
+ padding: 0 10px;
53
+ border-left: 4px solid transparent;
54
+ }
55
+ .added { background: #e6ffed; border-color: green; }
56
+ .removed { background: #ffeef0; border-color: red; }
57
+
58
+
59
+ .diff-line {
60
+ display: flex;
61
+ white-space: pre-wrap;
62
+ font-family: monospace;
63
+ line-height: 1.4;
64
+ }
65
+
66
+ .lnum {
67
+ width: 3em;
68
+ flex-shrink: 0;
69
+ text-align: right;
70
+ padding-right: 0.5em;
71
+ color: #999;
72
+ }
73
+
74
+ .lnum.old {
75
+ border-right: 1px solid #ccc;
76
+ }
77
+
78
+ .lnum.new {
79
+ border-right: 1px solid #ccc;
80
+ }
81
+
82
+ .code {
83
+ flex: 1;
84
+ padding-left: 0.5em;
85
+ }
86
+ .binary-notice {
87
+ background: #f0f0f0;
88
+ font-family: monospace;
89
+ padding: 0.5em;
90
+ color: #555;
91
+ }
92
+ .diff-block {
93
+ max-height: 300px;
94
+ background: rgba(0, 0, 0, 0.04);
95
+ padding: 0 20px 20px;
96
+ overflow: auto;
97
+ }
98
+ main h3 {
99
+ margin: 0;
100
+ background: rgba(0, 0, 0, 0.04);
101
+ padding: 15px;
102
+ margin-top: 30px;
103
+ font-size: 14px;
104
+ }
105
+
106
+ .add { background: #e6ffed; color: green; }
107
+ .del { background: #ffeef0; color: red; }
108
+ .context { background: #f8f8f8; }
109
+ .btn {
110
+ margin-right: 10px;
111
+ }
112
+ </style>
113
+ </head>
114
+ <body class='<%=theme%>' data-platform="<%=platform%>" data-agent="<%=agent%>">
115
+ <nav>
116
+ <% if (remote) { %>
117
+ <a href="/run/scripts/git/push.json?cwd=<%=encodeURIComponent(dir)%>" class='btn'><i class="fa-brands fa-github"></i> Publish to GitHub</a>
118
+ <a href="<%=remote%>" target="_blank"><%=remote%></a>
119
+ <% } else { %>
120
+ <a href="/run/scripts/git/create.json?cwd=<%=encodeURIComponent(dir)%>" class='btn'><i class="fa-brands fa-github"></i> Create on GitHub</a>
121
+ <% } %>
122
+ <a href="/run/scripts/git/commit.json?cwd=<%=encodeURIComponent(dir)%>" class='btn'><i class="fa-solid fa-floppy-disk"></i> Commit (Save the current version)</a>
123
+ </nav>
124
+ <main>
125
+ <h2>Changed Files</h2>
126
+ <% if (changes && changes.length > 0) { %>
127
+ <% changes.forEach(({ file, status, binary, diff, webpath }) => { %>
128
+ <h3>[<%= status %>] <%= file %></h3>
129
+ <% if (binary) { %>
130
+ <div class="binary-notice">[Binary file <%= status %>]</div>
131
+ <iframe src="<%=webpath%>"></iframe>
132
+ <% } else { %>
133
+ <div class="diff-block">
134
+ <% diff.forEach(({ line, lineOld, lineNew, type }) => { %>
135
+ <div class="diff-line <%= type %>">
136
+ <span class="lnum old"><%= lineOld !== '' ? lineOld : '' %></span>
137
+ <span class="lnum new"><%= lineNew !== '' ? lineNew : '' %></span>
138
+ <span class="code"><%= (type === 'add' ? '+ ' : type === 'del' ? '- ' : ' ') + line %></span>
139
+ </div>
140
+ <% }); %>
141
+ </div>
142
+ <% } %>
143
+ <% }); %>
144
+ <% } else { %>
145
+ <div class='empty'>No changes</div>
146
+ <% } %>
147
+ </main>
148
+ </body>
149
+ </html>
@@ -155,6 +155,9 @@ const createTerm = async (_theme) => {
155
155
  selectionBackground: "red",
156
156
  selectionForeground: "white"
157
157
  })
158
+ <% if (theme !== "dark") { %>
159
+ theme.foreground = "black"
160
+ <% } %>
158
161
  let config = {
159
162
  scrollback: 9999999,
160
163
  fontSize: 14,