vibora 4.8.0 → 4.8.2

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/server/index.js +19 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vibora",
3
- "version": "4.8.0",
3
+ "version": "4.8.2",
4
4
  "description": "The Vibe Engineer's Cockpit",
5
5
  "license": "PolyForm-Shield-1.0.0",
6
6
  "repository": {
package/server/index.js CHANGED
@@ -20832,12 +20832,24 @@ class TerminalSession {
20832
20832
  this.onExit(1);
20833
20833
  }
20834
20834
  }
20835
- attach() {
20835
+ async attach() {
20836
20836
  if (this.pty)
20837
20837
  return;
20838
20838
  const dtach = getDtachService();
20839
- if (!dtach.hasSession(this.id)) {
20840
- log2.terminal.error("dtach socket not found", { terminalId: this.id });
20839
+ const MAX_ATTEMPTS = 10;
20840
+ const POLL_INTERVAL_MS = 50;
20841
+ let socketFound = false;
20842
+ for (let attempt = 0;attempt < MAX_ATTEMPTS; attempt++) {
20843
+ if (dtach.hasSession(this.id)) {
20844
+ socketFound = true;
20845
+ break;
20846
+ }
20847
+ if (attempt < MAX_ATTEMPTS - 1) {
20848
+ await new Promise((resolve2) => setTimeout(resolve2, POLL_INTERVAL_MS));
20849
+ }
20850
+ }
20851
+ if (!socketFound) {
20852
+ log2.terminal.error("dtach socket not found after polling", { terminalId: this.id });
20841
20853
  this.status = "exited";
20842
20854
  this.exitCode = 1;
20843
20855
  this.updateDb({ status: "exited", exitCode: 1 });
@@ -21058,12 +21070,12 @@ class PTYManager {
21058
21070
  session.start();
21059
21071
  return session.getInfo();
21060
21072
  }
21061
- attach(terminalId) {
21073
+ async attach(terminalId) {
21062
21074
  const session = this.sessions.get(terminalId);
21063
21075
  if (!session)
21064
21076
  return false;
21065
21077
  if (!session.isAttached()) {
21066
- session.attach();
21078
+ await session.attach();
21067
21079
  }
21068
21080
  return true;
21069
21081
  }
@@ -21399,7 +21411,7 @@ var terminalWebSocketHandlers = {
21399
21411
  payload: { theme: theme || "system" }
21400
21412
  });
21401
21413
  },
21402
- onMessage(evt, ws) {
21414
+ async onMessage(evt, ws) {
21403
21415
  const clientData = clients.get(ws);
21404
21416
  if (!clientData)
21405
21417
  return;
@@ -21519,7 +21531,7 @@ var terminalWebSocketHandlers = {
21519
21531
  }
21520
21532
  case "terminal:attach": {
21521
21533
  const terminalId = message.payload.terminalId;
21522
- ptyManager2.attach(terminalId);
21534
+ await ptyManager2.attach(terminalId);
21523
21535
  const buffer = ptyManager2.getBuffer(terminalId);
21524
21536
  log2.ws.info("terminal:attach adding to attachedTerminals", {
21525
21537
  terminalId,