covebox 0.1.1 → 0.1.3

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.
@@ -118,6 +118,9 @@ async function handleCommand(client, line, rl) {
118
118
  if (sandbox.noVncUrl) {
119
119
  console.log(` NoVNC: ${chalk.blue(sandbox.noVncUrl)}`);
120
120
  }
121
+ if (sandbox.ptyUrl) {
122
+ console.log(` PTY: ${chalk.green(sandbox.ptyUrl)}`);
123
+ }
121
124
  if (sandbox.vncUrl) {
122
125
  console.log(` VNC WS: ${chalk.gray(sandbox.vncUrl)}`);
123
126
  }
@@ -261,8 +264,9 @@ async function handleCommand(client, line, rl) {
261
264
  if (rl) {
262
265
  rl.close();
263
266
  }
264
- // Only remove keypress listener (readline's), not all listeners
265
267
  process.stdin.removeAllListeners("keypress");
268
+ // Small delay for bun's event loop to settle after readline close
269
+ await new Promise((r) => setTimeout(r, 100));
266
270
  try {
267
271
  await runPtySession(sandbox.ptyUrl);
268
272
  }
@@ -81,7 +81,7 @@ export async function runPtySession(ptyUrl) {
81
81
  sendBinary(buf);
82
82
  };
83
83
  try {
84
- ws = new WebSocket(ptyUrl);
84
+ ws = new WebSocket(ptyUrl, { followRedirects: true });
85
85
  ws.on("open", () => {
86
86
  // Create session
87
87
  sendJson(MsgCreateSession, { name: "cli-session" });
@@ -101,7 +101,7 @@ export async function runPtySession(ptyUrl) {
101
101
  const response = JSON.parse(payload.toString());
102
102
  if (response.type === "session_created" && response.session) {
103
103
  // Attach to session
104
- const sessionId = response.session.ID;
104
+ const sessionId = response.session.id;
105
105
  const buf = Buffer.alloc(1 + 36);
106
106
  buf[0] = MsgAttachSession;
107
107
  buf.write(sessionId, 1);
@@ -114,13 +114,13 @@ export async function runPtySession(ptyUrl) {
114
114
  else if (response.type === "window_created" && response.window) {
115
115
  // Create pane
116
116
  sendJson(MsgCreatePane, {
117
- windowId: response.window.ID,
117
+ windowId: response.window.id,
118
118
  rows,
119
119
  cols,
120
120
  });
121
121
  }
122
122
  else if (response.type === "pane_created" && response.pane) {
123
- paneId = response.pane.ID;
123
+ paneId = response.pane.id;
124
124
  // Now we're connected - set up terminal
125
125
  if (process.stdin.isTTY) {
126
126
  process.stdin.setRawMode(true);
@@ -142,6 +142,12 @@ export async function runPtySession(ptyUrl) {
142
142
  };
143
143
  process.stdout.on("resize", resizeHandler);
144
144
  }
145
+ else if (response.type === "pane_closed") {
146
+ // Shell exited - close connection
147
+ cleanup();
148
+ resolve();
149
+ return;
150
+ }
145
151
  }
146
152
  catch {
147
153
  // Ignore JSON parse errors
@@ -163,7 +169,9 @@ export async function runPtySession(ptyUrl) {
163
169
  });
164
170
  ws.on("error", (err) => {
165
171
  cleanup();
166
- reject(err);
172
+ // Extract meaningful error message from WebSocket error
173
+ const message = err.message || err.code || String(err);
174
+ reject(new Error(message));
167
175
  });
168
176
  // Handle signals
169
177
  const handleSignal = () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "covebox",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "CLI for Cove sandboxes - cloud development environments",
5
5
  "type": "module",
6
6
  "bin": {