@rajat-rastogi/maestro 0.5.5 → 0.5.6

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.
@@ -1388,6 +1388,18 @@ class AgentPtyAdapter {
1388
1388
  }
1389
1389
  };
1390
1390
  this.ws.on("message", this.messageHandler);
1391
+ this.ws.on("close", () => {
1392
+ console.log(`[AgentPty] ${this.sessionId.slice(0, 8)} WebSocket closed — connection lost`);
1393
+ if (this.dataCallback) {
1394
+ this.dataCallback("\r\n\x1B[1;31m[Maestro] Connection to remote agent lost. Close and recreate the terminal.\x1B[0m\r\n");
1395
+ }
1396
+ if (this.exitCallback) {
1397
+ this.exitCallback(null);
1398
+ }
1399
+ });
1400
+ this.ws.on("error", (err) => {
1401
+ console.log(`[AgentPty] ${this.sessionId.slice(0, 8)} WebSocket error: ${err.message}`);
1402
+ });
1391
1403
  this.ws.send(JSON.stringify({ type: "create", id: this.sessionId, shell: "powershell", cwd, cols, rows }));
1392
1404
  await new Promise((resolve) => {
1393
1405
  const t = setTimeout(resolve, 5e3);
@@ -1412,10 +1424,14 @@ class AgentPtyAdapter {
1412
1424
  this.exitCallback = cb;
1413
1425
  }
1414
1426
  write(data) {
1415
- this.ws?.send(JSON.stringify({ type: "input", id: this.sessionId, data }));
1427
+ if (this.ws?.readyState === WebSocket.OPEN) {
1428
+ this.ws.send(JSON.stringify({ type: "input", id: this.sessionId, data }));
1429
+ }
1416
1430
  }
1417
1431
  resize(cols, rows) {
1418
- this.ws?.send(JSON.stringify({ type: "resize", id: this.sessionId, cols, rows }));
1432
+ if (this.ws?.readyState === WebSocket.OPEN) {
1433
+ this.ws.send(JSON.stringify({ type: "resize", id: this.sessionId, cols, rows }));
1434
+ }
1419
1435
  }
1420
1436
  kill() {
1421
1437
  if (this.ws && this.messageHandler) {
@@ -1868,6 +1884,26 @@ class SessionManager {
1868
1884
  this.push("sessions:stateChanged", ev);
1869
1885
  }
1870
1886
  }
1887
+ const logDir = electron.app.getPath("userData");
1888
+ const logFile = path.join(logDir, "maestro-gui.log");
1889
+ try {
1890
+ if (fs__namespace.existsSync(logFile)) fs__namespace.renameSync(logFile, logFile + ".prev");
1891
+ } catch {
1892
+ }
1893
+ const logStream = fs__namespace.createWriteStream(logFile, { flags: "a" });
1894
+ const origLog = console.log;
1895
+ const origErr = console.error;
1896
+ console.log = (...args) => {
1897
+ const line = `${(/* @__PURE__ */ new Date()).toISOString()} ${args.map(String).join(" ")}`;
1898
+ logStream.write(line + "\n");
1899
+ origLog(...args);
1900
+ };
1901
+ console.error = (...args) => {
1902
+ const line = `${(/* @__PURE__ */ new Date()).toISOString()} ERROR ${args.map(String).join(" ")}`;
1903
+ logStream.write(line + "\n");
1904
+ origErr(...args);
1905
+ };
1906
+ console.log(`[Maestro] Log file: ${logFile}`);
1871
1907
  const startupArgs = process.argv.slice(2);
1872
1908
  let startupPlanFile = null;
1873
1909
  const pfIdx = startupArgs.indexOf("--plan-file");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rajat-rastogi/maestro",
3
- "version": "0.5.5",
3
+ "version": "0.5.6",
4
4
  "description": "Conduct your codebase — autonomous AI coding orchestrator",
5
5
  "type": "module",
6
6
  "main": "dist/main.js",