nstantpage-agent 0.3.1 → 0.3.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.
- package/dist/commands/start.js +20 -4
- package/dist/devServer.js +1 -1
- package/dist/tunnel.d.ts +5 -0
- package/dist/tunnel.js +10 -1
- package/package.json +1 -1
package/dist/commands/start.js
CHANGED
|
@@ -226,15 +226,31 @@ export async function startCommand(directory, options) {
|
|
|
226
226
|
else {
|
|
227
227
|
console.log(chalk.gray(' Dev server skipped (--no-dev)'));
|
|
228
228
|
}
|
|
229
|
-
// Connect tunnel to gateway
|
|
229
|
+
// Connect tunnel to gateway (non-fatal — dev server keeps running even if tunnel fails)
|
|
230
230
|
console.log(chalk.gray(' Connecting to gateway...'));
|
|
231
|
-
|
|
232
|
-
|
|
231
|
+
let tunnelConnected = false;
|
|
232
|
+
try {
|
|
233
|
+
await tunnel.connect();
|
|
234
|
+
tunnelConnected = true;
|
|
235
|
+
console.log(chalk.green(` ✓ Tunnel connected\n`));
|
|
236
|
+
}
|
|
237
|
+
catch (err) {
|
|
238
|
+
console.log(chalk.yellow(` ⚠ Tunnel connection failed: ${err.message || 'connection refused'}`));
|
|
239
|
+
console.log(chalk.gray(' Local dev server is still running. Tunnel will retry in background.'));
|
|
240
|
+
console.log(chalk.gray(` Is the gateway running at ${options.gateway}?\n`));
|
|
241
|
+
// Start background reconnection
|
|
242
|
+
tunnel.startBackgroundReconnect();
|
|
243
|
+
}
|
|
233
244
|
// Display status
|
|
234
245
|
console.log(chalk.blue.bold(` ┌──────────────────────────────────────────────┐`));
|
|
235
246
|
console.log(chalk.blue.bold(` │ Your project is live! │`));
|
|
236
247
|
console.log(chalk.blue.bold(` ├──────────────────────────────────────────────┤`));
|
|
237
|
-
|
|
248
|
+
if (tunnelConnected) {
|
|
249
|
+
console.log(chalk.white(` │ Cloud: https://${projectId}.webprev.live`));
|
|
250
|
+
}
|
|
251
|
+
else {
|
|
252
|
+
console.log(chalk.yellow(` │ Cloud: ⏳ waiting for tunnel...`));
|
|
253
|
+
}
|
|
238
254
|
console.log(chalk.white(` │ Local: http://localhost:${devPort}`));
|
|
239
255
|
console.log(chalk.white(` │ Files: ${projectDir}`));
|
|
240
256
|
console.log(chalk.blue.bold(` └──────────────────────────────────────────────┘\n`));
|
package/dist/devServer.js
CHANGED
|
@@ -54,7 +54,7 @@ export class DevServer {
|
|
|
54
54
|
this.startedAt = Date.now();
|
|
55
55
|
// Start backend if present
|
|
56
56
|
if (hasBackend) {
|
|
57
|
-
const backendPort = port +
|
|
57
|
+
const backendPort = port + 1001; // 3000 → 4001 (avoids gateway port 4000)
|
|
58
58
|
const backendEntry = fs.existsSync(path.join(projectDir, 'server', 'index.ts'))
|
|
59
59
|
? 'server/index.ts'
|
|
60
60
|
: 'server/index.js';
|
package/dist/tunnel.d.ts
CHANGED
|
@@ -42,6 +42,11 @@ export declare class TunnelClient {
|
|
|
42
42
|
uptime: number;
|
|
43
43
|
};
|
|
44
44
|
connect(): Promise<void>;
|
|
45
|
+
/**
|
|
46
|
+
* Start reconnecting in the background (non-blocking).
|
|
47
|
+
* Used when initial connect() fails so the dev server can keep running.
|
|
48
|
+
*/
|
|
49
|
+
startBackgroundReconnect(): void;
|
|
45
50
|
disconnect(): void;
|
|
46
51
|
/**
|
|
47
52
|
* Push an error update to the gateway (for WebSocket error notifications).
|
package/dist/tunnel.js
CHANGED
|
@@ -58,7 +58,7 @@ export class TunnelClient {
|
|
|
58
58
|
// Send enhanced agent info with capabilities
|
|
59
59
|
this.send({
|
|
60
60
|
type: 'agent-info',
|
|
61
|
-
version: '0.2
|
|
61
|
+
version: '0.3.2',
|
|
62
62
|
hostname: os.hostname(),
|
|
63
63
|
platform: `${os.platform()} ${os.arch()}`,
|
|
64
64
|
capabilities: [
|
|
@@ -103,6 +103,15 @@ export class TunnelClient {
|
|
|
103
103
|
});
|
|
104
104
|
});
|
|
105
105
|
}
|
|
106
|
+
/**
|
|
107
|
+
* Start reconnecting in the background (non-blocking).
|
|
108
|
+
* Used when initial connect() fails so the dev server can keep running.
|
|
109
|
+
*/
|
|
110
|
+
startBackgroundReconnect() {
|
|
111
|
+
this.shouldReconnect = true;
|
|
112
|
+
this.reconnectAttempts = 0;
|
|
113
|
+
this.scheduleReconnect();
|
|
114
|
+
}
|
|
106
115
|
disconnect() {
|
|
107
116
|
this.shouldReconnect = false;
|
|
108
117
|
this.cleanup();
|
package/package.json
CHANGED