pinokiod 3.147.0 → 3.148.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "3.147.0",
3
+ "version": "3.148.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -35,14 +35,14 @@
35
35
  if (!isLast) {
36
36
  const line = this.buffer + segment
37
37
  this.buffer = ""
38
- this.submit(line)
38
+ this.submit(line, { hadLineBreak: true })
39
39
  } else {
40
40
  this.buffer += segment
41
41
  }
42
42
  }
43
43
  }
44
44
 
45
- submit(line) {
45
+ submit(line, meta = {}) {
46
46
  const win = this.getWindow()
47
47
  if (!win || !win.parent || typeof win.parent.postMessage !== "function") {
48
48
  return
@@ -50,11 +50,13 @@
50
50
  const safeLine = (line || "").replace(/[\x00-\x1F\x7F]/g, "")
51
51
  const preview = safeLine.trim()
52
52
  const truncated = preview.length > this.limit ? `${preview.slice(0, this.limit)}...` : preview
53
+ const hadLineBreak = Boolean(meta && meta.hadLineBreak)
54
+ const meaningful = truncated.length > 0 || hadLineBreak
53
55
  win.parent.postMessage({
54
56
  type: "terminal-input",
55
57
  frame: this.getFrameName(),
56
58
  line: truncated,
57
- hasContent: truncated.length > 0
59
+ hasContent: meaningful
58
60
  }, "*")
59
61
  }
60
62
  }
@@ -272,15 +272,15 @@ document.addEventListener("DOMContentLoaded", async () => {
272
272
  if (!isLast) {
273
273
  const line = this.inputBuffer + segment
274
274
  this.inputBuffer = ""
275
- this.notifyLineSubmitted(line)
275
+ this.notifyLineSubmitted(line, { hadLineBreak: true })
276
276
  } else {
277
277
  this.inputBuffer += segment
278
278
  }
279
279
  }
280
280
  }
281
- notifyLineSubmitted(line) {
281
+ notifyLineSubmitted(line, meta = {}) {
282
282
  if (this.inputTracker) {
283
- this.inputTracker.submit(line)
283
+ this.inputTracker.submit(line, meta)
284
284
  return
285
285
  }
286
286
  if (!window || !window.parent || typeof window.parent.postMessage !== "function") {
@@ -290,11 +290,13 @@ document.addEventListener("DOMContentLoaded", async () => {
290
290
  const preview = safeLine.trim()
291
291
  const limit = 200
292
292
  const truncated = preview.length > limit ? preview.slice(0, limit) + "..." : preview
293
+ const hadLineBreak = Boolean(meta && meta.hadLineBreak)
294
+ const meaningful = truncated.length > 0 || hadLineBreak
293
295
  window.parent.postMessage({
294
296
  type: "terminal-input",
295
297
  frame: window.name || null,
296
298
  line: truncated,
297
- hasContent: truncated.length > 0
299
+ hasContent: meaningful
298
300
  }, "*")
299
301
  }
300
302
  write(text) {