pinokiod 3.19.63 → 3.19.65
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/package.json +1 -1
- package/server/socket.js +76 -71
package/package.json
CHANGED
package/server/socket.js
CHANGED
|
@@ -176,74 +176,7 @@ class Socket {
|
|
|
176
176
|
for(let key in this.buffer) {
|
|
177
177
|
let buf = this.buffer[key]
|
|
178
178
|
if (this.old_buffer[key] !== buf) {
|
|
179
|
-
|
|
180
|
-
/*
|
|
181
|
-
|
|
182
|
-
dev
|
|
183
|
-
/Users/x/pinokio/plugin/dev/claude.json?cwd=/Users/x/pinokio/api/audioplay
|
|
184
|
-
/Users/x/pinokio/plugin/dev/gemini.json?cwd=/Users/x/pinokio/api/audioplay
|
|
185
|
-
|
|
186
|
-
api
|
|
187
|
-
/Users/x/pinokio/api/audioplay/start.json
|
|
188
|
-
|
|
189
|
-
shell
|
|
190
|
-
facefusion-pinokio.git_0.0_a56eb7d48c9e96d8a5217d625d83d204
|
|
191
|
-
facefusion-pinokio.git_0.0_a56eb7d48c9e96d8a5217d625d83d204
|
|
192
|
-
audioplay_0.0_a56eb7d48c9e96d8a5217d625d83d204
|
|
193
|
-
*/
|
|
194
|
-
|
|
195
|
-
// 1. dev
|
|
196
|
-
if (path.isAbsolute(key)) {
|
|
197
|
-
let p = key.replace(/\?.*$/, '')
|
|
198
|
-
let relative = path.relative(this.parent.kernel.homedir, p)
|
|
199
|
-
if (relative.startsWith("plugin")) {
|
|
200
|
-
// dev
|
|
201
|
-
let m = /\?.*$/.exec(key)
|
|
202
|
-
if (m && m.length > 0) {
|
|
203
|
-
/*
|
|
204
|
-
DEV Changed {
|
|
205
|
-
cwd: '/Users/x/pinokio/api/audioplay',
|
|
206
|
-
relative: 'plugin/dev/claude.json'
|
|
207
|
-
}
|
|
208
|
-
*/
|
|
209
|
-
let paramStr = m[0]
|
|
210
|
-
let cwd = new URL("http://localhost" + paramStr).searchParams.get("cwd")
|
|
211
|
-
let session = this.sessions[key]
|
|
212
|
-
let logpath = path.resolve(cwd, "logs/dev", path.parse(relative).base)
|
|
213
|
-
await Util.log(logpath, buf, session)
|
|
214
|
-
|
|
215
|
-
}
|
|
216
|
-
} else if (relative.startsWith("api")) {
|
|
217
|
-
// api
|
|
218
|
-
/*
|
|
219
|
-
API Changed {
|
|
220
|
-
cwd: '/Users/x/pinokio/api/audioplay/start.json',
|
|
221
|
-
filepath: [ 'start.json' ]
|
|
222
|
-
}
|
|
223
|
-
*/
|
|
224
|
-
let filepath_chunks = relative.split(path.sep).slice(2)
|
|
225
|
-
let cwd = this.parent.kernel.path(...relative.split(path.sep).slice(0, 2))
|
|
226
|
-
let session = this.sessions[key]
|
|
227
|
-
let logpath = path.resolve(cwd, "logs/api", ...filepath_chunks)
|
|
228
|
-
await Util.log(logpath, buf, session)
|
|
229
|
-
}
|
|
230
|
-
} else {
|
|
231
|
-
// Only log SHELL
|
|
232
|
-
/*
|
|
233
|
-
SHELL Changed { cwd: '/Users/x/pinokio/api/kernel.api.stop', key: 'kernel.api.stop' }
|
|
234
|
-
*/
|
|
235
|
-
if (key.startsWith("kernel.")) {
|
|
236
|
-
// do not log since these are not shell operations
|
|
237
|
-
// need to refactor later to make this logic cleaner
|
|
238
|
-
} else {
|
|
239
|
-
let cwd = this.parent.kernel.path("api", key.split("_")[0])
|
|
240
|
-
let session = this.sessions[key]
|
|
241
|
-
let logpath = path.resolve(cwd, "logs/shell")
|
|
242
|
-
await Util.log(logpath, buf, session)
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
}
|
|
179
|
+
this.log_buffer(key, buf)
|
|
247
180
|
} else {
|
|
248
181
|
// console.log(`State hasn't changed: ${key}`)
|
|
249
182
|
}
|
|
@@ -298,9 +231,11 @@ class Socket {
|
|
|
298
231
|
}
|
|
299
232
|
|
|
300
233
|
if (e.data && e.data.type === "shell.kill") {
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
234
|
+
this.log_buffer(id, this.buffer[id]).then(() => {
|
|
235
|
+
// when shell is killed, reset the buffer
|
|
236
|
+
delete this.buffer[id]
|
|
237
|
+
delete this.sessions[id]
|
|
238
|
+
})
|
|
304
239
|
}
|
|
305
240
|
|
|
306
241
|
if (!this.buffer[id]) {
|
|
@@ -356,5 +291,75 @@ class Socket {
|
|
|
356
291
|
}
|
|
357
292
|
}
|
|
358
293
|
}
|
|
294
|
+
async log_buffer(key, buf) {
|
|
295
|
+
|
|
296
|
+
/*
|
|
297
|
+
|
|
298
|
+
dev
|
|
299
|
+
/Users/x/pinokio/plugin/dev/claude.json?cwd=/Users/x/pinokio/api/audioplay
|
|
300
|
+
/Users/x/pinokio/plugin/dev/gemini.json?cwd=/Users/x/pinokio/api/audioplay
|
|
301
|
+
|
|
302
|
+
api
|
|
303
|
+
/Users/x/pinokio/api/audioplay/start.json
|
|
304
|
+
|
|
305
|
+
shell
|
|
306
|
+
facefusion-pinokio.git_0.0_a56eb7d48c9e96d8a5217d625d83d204
|
|
307
|
+
facefusion-pinokio.git_0.0_a56eb7d48c9e96d8a5217d625d83d204
|
|
308
|
+
audioplay_0.0_a56eb7d48c9e96d8a5217d625d83d204
|
|
309
|
+
*/
|
|
310
|
+
|
|
311
|
+
// 1. dev
|
|
312
|
+
if (path.isAbsolute(key)) {
|
|
313
|
+
let p = key.replace(/\?.*$/, '')
|
|
314
|
+
let relative = path.relative(this.parent.kernel.homedir, p)
|
|
315
|
+
if (relative.startsWith("plugin")) {
|
|
316
|
+
// dev
|
|
317
|
+
let m = /\?.*$/.exec(key)
|
|
318
|
+
if (m && m.length > 0) {
|
|
319
|
+
/*
|
|
320
|
+
DEV Changed {
|
|
321
|
+
cwd: '/Users/x/pinokio/api/audioplay',
|
|
322
|
+
relative: 'plugin/dev/claude.json'
|
|
323
|
+
}
|
|
324
|
+
*/
|
|
325
|
+
let paramStr = m[0]
|
|
326
|
+
let cwd = new URL("http://localhost" + paramStr).searchParams.get("cwd")
|
|
327
|
+
let session = this.sessions[key]
|
|
328
|
+
let logpath = path.resolve(cwd, "logs/dev", path.parse(relative).base)
|
|
329
|
+
await Util.log(logpath, buf, session)
|
|
330
|
+
|
|
331
|
+
}
|
|
332
|
+
} else if (relative.startsWith("api")) {
|
|
333
|
+
// api
|
|
334
|
+
/*
|
|
335
|
+
API Changed {
|
|
336
|
+
cwd: '/Users/x/pinokio/api/audioplay/start.json',
|
|
337
|
+
filepath: [ 'start.json' ]
|
|
338
|
+
}
|
|
339
|
+
*/
|
|
340
|
+
let filepath_chunks = relative.split(path.sep).slice(2)
|
|
341
|
+
let cwd = this.parent.kernel.path(...relative.split(path.sep).slice(0, 2))
|
|
342
|
+
let session = this.sessions[key]
|
|
343
|
+
let logpath = path.resolve(cwd, "logs/api", ...filepath_chunks)
|
|
344
|
+
await Util.log(logpath, buf, session)
|
|
345
|
+
}
|
|
346
|
+
} else {
|
|
347
|
+
// Only log SHELL
|
|
348
|
+
/*
|
|
349
|
+
SHELL Changed { cwd: '/Users/x/pinokio/api/kernel.api.stop', key: 'kernel.api.stop' }
|
|
350
|
+
*/
|
|
351
|
+
if (key.startsWith("kernel.")) {
|
|
352
|
+
// do not log since these are not shell operations
|
|
353
|
+
// need to refactor later to make this logic cleaner
|
|
354
|
+
} else {
|
|
355
|
+
let cwd = this.parent.kernel.path("api", key.split("_")[0])
|
|
356
|
+
let session = this.sessions[key]
|
|
357
|
+
let logpath = path.resolve(cwd, "logs/shell")
|
|
358
|
+
await Util.log(logpath, buf, session)
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
}
|
|
363
|
+
}
|
|
359
364
|
}
|
|
360
365
|
module.exports = Socket
|