pinokiod 6.0.82 → 6.0.84
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/kernel/shells.js +74 -6
- package/package.json +1 -1
- package/server/views/app.ejs +1 -1
package/kernel/shells.js
CHANGED
|
@@ -251,6 +251,76 @@ class Shells {
|
|
|
251
251
|
const handlerLastMatchEnd = new Map()
|
|
252
252
|
let liveEventBuffer = ""
|
|
253
253
|
let liveEventOffset = 0
|
|
254
|
+
let liveEventAnsiCarry = ""
|
|
255
|
+
|
|
256
|
+
// Keep cross-chunk event matching, but normalize terminal styling away first.
|
|
257
|
+
const findLiveEventCarryIndex = (value = "") => {
|
|
258
|
+
if (!value) {
|
|
259
|
+
return value.length
|
|
260
|
+
}
|
|
261
|
+
const escIndex = value.lastIndexOf("\u001b")
|
|
262
|
+
const csiIndex = value.lastIndexOf("\u009b")
|
|
263
|
+
const start = Math.max(escIndex, csiIndex)
|
|
264
|
+
if (start === -1) {
|
|
265
|
+
return value.length
|
|
266
|
+
}
|
|
267
|
+
if (value[start] === "\u009b") {
|
|
268
|
+
for (let i = start + 1; i < value.length; i++) {
|
|
269
|
+
const code = value.charCodeAt(i)
|
|
270
|
+
if (code >= 0x40 && code <= 0x7e) {
|
|
271
|
+
return value.length
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
return start
|
|
275
|
+
}
|
|
276
|
+
if (start === value.length - 1) {
|
|
277
|
+
return start
|
|
278
|
+
}
|
|
279
|
+
const marker = value[start + 1]
|
|
280
|
+
if (marker === "[") {
|
|
281
|
+
for (let i = start + 2; i < value.length; i++) {
|
|
282
|
+
const code = value.charCodeAt(i)
|
|
283
|
+
if (code >= 0x40 && code <= 0x7e) {
|
|
284
|
+
return value.length
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
return start
|
|
288
|
+
}
|
|
289
|
+
if (marker === "]" || "PX^_".includes(marker)) {
|
|
290
|
+
for (let i = start + 2; i < value.length; i++) {
|
|
291
|
+
const ch = value[i]
|
|
292
|
+
if (ch === "\u0007") {
|
|
293
|
+
return value.length
|
|
294
|
+
}
|
|
295
|
+
if (ch === "\u001b") {
|
|
296
|
+
if (i + 1 >= value.length) {
|
|
297
|
+
return start
|
|
298
|
+
}
|
|
299
|
+
if (value[i + 1] === "\\") {
|
|
300
|
+
return value.length
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
return start
|
|
305
|
+
}
|
|
306
|
+
return value.length
|
|
307
|
+
}
|
|
308
|
+
const normalizeLiveEventChunk = (chunk) => {
|
|
309
|
+
if (typeof chunk !== "string" || chunk.length === 0) {
|
|
310
|
+
return ""
|
|
311
|
+
}
|
|
312
|
+
let combined = liveEventAnsiCarry + chunk
|
|
313
|
+
liveEventAnsiCarry = ""
|
|
314
|
+
const carryIndex = findLiveEventCarryIndex(combined)
|
|
315
|
+
if (carryIndex < combined.length) {
|
|
316
|
+
liveEventAnsiCarry = combined.slice(carryIndex)
|
|
317
|
+
combined = combined.slice(0, carryIndex)
|
|
318
|
+
}
|
|
319
|
+
if (combined.length === 0) {
|
|
320
|
+
return ""
|
|
321
|
+
}
|
|
322
|
+
return sh.stripAnsi(combined).replaceAll(/[\r\n]/g, "")
|
|
323
|
+
}
|
|
254
324
|
|
|
255
325
|
// if error doesn't exist, add default "error:" event
|
|
256
326
|
if (!params.on) {
|
|
@@ -296,12 +366,10 @@ class Shells {
|
|
|
296
366
|
}
|
|
297
367
|
*/
|
|
298
368
|
try {
|
|
299
|
-
const
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
liveEventBuffer = (liveEventBuffer + rawChunk).slice(-300)
|
|
304
|
-
liveEventOffset += rawChunk.length
|
|
369
|
+
const normalizedChunk = normalizeLiveEventChunk(stream.raw)
|
|
370
|
+
if (normalizedChunk.length > 0) {
|
|
371
|
+
liveEventBuffer = (liveEventBuffer + normalizedChunk).slice(-300)
|
|
372
|
+
liveEventOffset += normalizedChunk.length
|
|
305
373
|
}
|
|
306
374
|
const liveEventBufferStart = Math.max(0, liveEventOffset - liveEventBuffer.length)
|
|
307
375
|
if (params.on && Array.isArray(params.on)) {
|
package/package.json
CHANGED
package/server/views/app.ejs
CHANGED
|
@@ -6642,7 +6642,7 @@ const rerenderMenuSection = (container, html) => {
|
|
|
6642
6642
|
*/
|
|
6643
6643
|
|
|
6644
6644
|
if (targetFrame) {
|
|
6645
|
-
|
|
6645
|
+
writeFrameInjectDescriptors(targetFrame, targetInjectDescriptors)
|
|
6646
6646
|
publishBrowserviewInjectTargets([], { sync: true })
|
|
6647
6647
|
targetFrame.classList.remove("hidden")
|
|
6648
6648
|
let mode = target.getAttribute("data-mode")
|