vibora 1.0.10 → 1.2.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/dist/index.html CHANGED
@@ -6,7 +6,7 @@
6
6
  <link rel="icon" type="image/png" sizes="512x512" href="/vibora-icon.png" />
7
7
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
8
8
  <title>Vibora</title>
9
- <script type="module" crossorigin src="/assets/index-DJxCuTf-.js"></script>
9
+ <script type="module" crossorigin src="/assets/index-qBnZOT-E.js"></script>
10
10
  <link rel="stylesheet" crossorigin href="/assets/index-DCMXlbkM.css">
11
11
  </head>
12
12
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vibora",
3
- "version": "1.0.10",
3
+ "version": "1.2.0",
4
4
  "description": "The Vibe Engineer's Cockpit",
5
5
  "license": "PolyForm-Shield-1.0.0",
6
6
  "repository": {
package/server/index.js CHANGED
@@ -599,7 +599,7 @@ var require_printer = __commonJS((exports) => {
599
599
  leave: printDocASTReducer
600
600
  });
601
601
  }
602
- var MAX_LINE_LENGTH2 = 80;
602
+ var MAX_LINE_LENGTH = 80;
603
603
  var printDocASTReducer = {
604
604
  Name: function Name(node) {
605
605
  return node.value;
@@ -633,7 +633,7 @@ var require_printer = __commonJS((exports) => {
633
633
  var { alias, name, arguments: args, directives, selectionSet } = _ref3;
634
634
  var prefix = wrap("", alias, ": ") + name;
635
635
  var argsLine = prefix + wrap("(", join6(args, ", "), ")");
636
- if (argsLine.length > MAX_LINE_LENGTH2) {
636
+ if (argsLine.length > MAX_LINE_LENGTH) {
637
637
  argsLine = prefix + wrap(`(
638
638
  `, indent(join6(args, `
639
639
  `)), `
@@ -13602,8 +13602,7 @@ function getDtachService() {
13602
13602
  // server/terminal/buffer-manager.ts
13603
13603
  import { existsSync as existsSync4, mkdirSync as mkdirSync3, readFileSync as readFileSync3, writeFileSync as writeFileSync2, unlinkSync } from "fs";
13604
13604
  import * as path4 from "path";
13605
- var MAX_BUFFER_LINES = 1e4;
13606
- var MAX_LINE_LENGTH = 2000;
13605
+ var MAX_BUFFER_BYTES = 1e6;
13607
13606
  function getBuffersDir() {
13608
13607
  const dir = path4.join(getViboraDir(), "buffers");
13609
13608
  if (!existsSync4(dir)) {
@@ -13613,47 +13612,43 @@ function getBuffersDir() {
13613
13612
  }
13614
13613
 
13615
13614
  class BufferManager {
13616
- lines = [];
13617
- partialLine = "";
13615
+ chunks = [];
13616
+ totalBytes = 0;
13618
13617
  terminalId = null;
13619
13618
  setTerminalId(id) {
13620
13619
  this.terminalId = id;
13621
13620
  }
13622
13621
  append(data) {
13623
- const combined = this.partialLine + data;
13624
- const parts = combined.split(`
13625
- `);
13626
- this.partialLine = parts.pop() || "";
13627
- for (const line of parts) {
13628
- const truncated = line.length > MAX_LINE_LENGTH ? line.slice(0, MAX_LINE_LENGTH) + "..." : line;
13629
- this.lines.push(truncated);
13630
- }
13631
- if (this.lines.length > MAX_BUFFER_LINES) {
13632
- this.lines = this.lines.slice(-MAX_BUFFER_LINES);
13622
+ this.chunks.push({ data, timestamp: Date.now() });
13623
+ this.totalBytes += data.length;
13624
+ while (this.totalBytes > MAX_BUFFER_BYTES && this.chunks.length > 1) {
13625
+ const removed = this.chunks.shift();
13626
+ this.totalBytes -= removed.data.length;
13633
13627
  }
13634
13628
  }
13635
13629
  getContents() {
13636
- const content = this.lines.join(`
13637
- `);
13638
- if (this.partialLine) {
13639
- return content + `
13640
- ` + this.partialLine;
13641
- }
13642
- return content;
13630
+ return this.chunks.map((c) => c.data).join("");
13643
13631
  }
13644
13632
  clear() {
13645
- this.lines = [];
13646
- this.partialLine = "";
13633
+ this.chunks = [];
13634
+ this.totalBytes = 0;
13647
13635
  }
13648
13636
  getLineCount() {
13649
- return this.lines.length + (this.partialLine ? 1 : 0);
13637
+ const content = this.getContents();
13638
+ return content.split(`
13639
+ `).length;
13650
13640
  }
13651
13641
  saveToDisk() {
13652
13642
  if (!this.terminalId)
13653
13643
  return;
13654
13644
  const filePath = path4.join(getBuffersDir(), `${this.terminalId}.buf`);
13655
13645
  try {
13656
- writeFileSync2(filePath, this.getContents(), "utf-8");
13646
+ const content = this.getContents();
13647
+ const fileData = {
13648
+ version: 2,
13649
+ content: Buffer.from(content).toString("base64")
13650
+ };
13651
+ writeFileSync2(filePath, JSON.stringify(fileData), "utf-8");
13657
13652
  } catch (err) {
13658
13653
  console.error(`[BufferManager] Failed to save buffer for ${this.terminalId}:`, err);
13659
13654
  }
@@ -13664,11 +13659,21 @@ class BufferManager {
13664
13659
  const filePath = path4.join(getBuffersDir(), `${this.terminalId}.buf`);
13665
13660
  try {
13666
13661
  if (existsSync4(filePath)) {
13667
- const content = readFileSync3(filePath, "utf-8");
13668
- this.lines = content.split(`
13669
- `);
13670
- this.partialLine = "";
13671
- console.log(`[BufferManager] Loaded ${this.lines.length} lines for ${this.terminalId}`);
13662
+ const raw2 = readFileSync3(filePath, "utf-8");
13663
+ let content;
13664
+ try {
13665
+ const parsed = JSON.parse(raw2);
13666
+ if (parsed.version === 2 && typeof parsed.content === "string") {
13667
+ content = Buffer.from(parsed.content, "base64").toString();
13668
+ } else {
13669
+ content = raw2;
13670
+ }
13671
+ } catch {
13672
+ content = raw2;
13673
+ }
13674
+ this.chunks = [{ data: content, timestamp: Date.now() }];
13675
+ this.totalBytes = content.length;
13676
+ console.log(`[BufferManager] Loaded ${this.totalBytes} bytes for ${this.terminalId}`);
13672
13677
  } else {
13673
13678
  console.log(`[BufferManager] No buffer file for ${this.terminalId}`);
13674
13679
  }
@@ -13838,6 +13843,10 @@ class TerminalSession {
13838
13843
  getBuffer() {
13839
13844
  return this.buffer.getContents();
13840
13845
  }
13846
+ clearBuffer() {
13847
+ this.buffer.clear();
13848
+ this.buffer.saveToDisk();
13849
+ }
13841
13850
  getInfo() {
13842
13851
  return {
13843
13852
  id: this.id,
@@ -14011,6 +14020,14 @@ class PTYManager {
14011
14020
  }
14012
14021
  return session.getBuffer();
14013
14022
  }
14023
+ clearBuffer(terminalId) {
14024
+ const session = this.sessions.get(terminalId);
14025
+ if (!session) {
14026
+ return false;
14027
+ }
14028
+ session.clearBuffer();
14029
+ return true;
14030
+ }
14014
14031
  getInfo(terminalId) {
14015
14032
  const session = this.sessions.get(terminalId);
14016
14033
  if (!session) {
@@ -14308,6 +14325,17 @@ var terminalWebSocketHandlers = {
14308
14325
  }
14309
14326
  break;
14310
14327
  }
14328
+ case "terminal:clearBuffer": {
14329
+ const { terminalId } = message.payload;
14330
+ const success = ptyManager2.clearBuffer(terminalId);
14331
+ if (success) {
14332
+ broadcastToTerminal(terminalId, {
14333
+ type: "terminal:bufferCleared",
14334
+ payload: { terminalId }
14335
+ });
14336
+ }
14337
+ break;
14338
+ }
14311
14339
  case "tab:create": {
14312
14340
  const { name, position } = message.payload;
14313
14341
  const tab = tabManager2.create({ name, position });