@ebowwa/terminal 0.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/client.d.ts +15 -0
- package/dist/client.js +45 -0
- package/dist/error.d.ts +8 -0
- package/dist/error.js +12 -0
- package/dist/exec.d.ts +47 -0
- package/dist/exec.js +107 -0
- package/dist/files.d.ts +124 -0
- package/dist/files.js +436 -0
- package/dist/fingerprint.d.ts +67 -0
- package/dist/index.d.ts +17 -0
- package/dist/pool.d.ts +143 -0
- package/dist/pool.js +554 -0
- package/dist/pty.d.ts +59 -0
- package/dist/scp.d.ts +30 -0
- package/dist/scp.js +74 -0
- package/dist/sessions.d.ts +98 -0
- package/dist/tmux-exec.d.ts +50 -0
- package/dist/tmux.d.ts +213 -0
- package/dist/tmux.js +528 -0
- package/dist/types.d.ts +18 -0
- package/dist/types.js +5 -0
- package/ebowwa-terminal-0.2.0.tgz +0 -0
- package/mcp/README.md +181 -0
- package/mcp/package.json +34 -0
- package/mcp/test-fix.sh +273 -0
- package/package.json +118 -0
- package/src/api.ts +752 -0
- package/src/client.ts +55 -0
- package/src/config.ts +489 -0
- package/src/error.ts +13 -0
- package/src/exec.ts +128 -0
- package/src/files.ts +636 -0
- package/src/fingerprint.ts +263 -0
- package/src/index.ts +144 -0
- package/src/manager.ts +319 -0
- package/src/mcp/index.ts +467 -0
- package/src/mcp/stdio.ts +708 -0
- package/src/network-error-detector.ts +121 -0
- package/src/pool.ts +662 -0
- package/src/pty.ts +285 -0
- package/src/scp.ts +109 -0
- package/src/sessions.ts +861 -0
- package/src/tmux-exec.ts +96 -0
- package/src/tmux-local.ts +839 -0
- package/src/tmux-manager.ts +962 -0
- package/src/tmux.ts +711 -0
- package/src/types.ts +19 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Network Error Detection
|
|
3
|
+
* Detects and provides helpful messages for common network issues
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export interface NetworkErrorDetails {
|
|
7
|
+
type: "SERVER_NOT_READY" | "NETWORK_BLOCKED" | "AUTH_FAILED" | "UNKNOWN";
|
|
8
|
+
message: string;
|
|
9
|
+
troubleshooting: string[];
|
|
10
|
+
isLikelyNetworkBlock: boolean;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Analyzes SSH connection error and provides detailed diagnosis
|
|
15
|
+
*/
|
|
16
|
+
export function detectNetworkError(
|
|
17
|
+
error: Error | string,
|
|
18
|
+
host: string,
|
|
19
|
+
serverStatus?: string
|
|
20
|
+
): NetworkErrorDetails {
|
|
21
|
+
const errorMessage = typeof error === "string" ? error : error.message;
|
|
22
|
+
|
|
23
|
+
// Pattern 1: Network blocking (ECONNREFUSED on specific IPs)
|
|
24
|
+
const isConnectionRefused =
|
|
25
|
+
errorMessage.includes("ECONNREFUSED") ||
|
|
26
|
+
errorMessage.includes("Connection refused") ||
|
|
27
|
+
errorMessage.includes("connect ECONNREFUSED");
|
|
28
|
+
|
|
29
|
+
const isHetznerOrDatacenterIP =
|
|
30
|
+
host.startsWith("195.") ||
|
|
31
|
+
host.startsWith("148.") ||
|
|
32
|
+
host.startsWith("116.") ||
|
|
33
|
+
host.startsWith("138.") ||
|
|
34
|
+
host.includes("hetzner") ||
|
|
35
|
+
host.includes("fsn1") ||
|
|
36
|
+
host.includes("nbg1") ||
|
|
37
|
+
host.includes("hel1");
|
|
38
|
+
|
|
39
|
+
const serverIsRunning = serverStatus === "running";
|
|
40
|
+
|
|
41
|
+
// Network blocking pattern:
|
|
42
|
+
// - ECONNREFUSED (not timeout)
|
|
43
|
+
// - Server is running (per API)
|
|
44
|
+
// - Hetzner/datacenter IP
|
|
45
|
+
if (isConnectionRefused && serverIsRunning && isHetznerOrDatacenterIP) {
|
|
46
|
+
return {
|
|
47
|
+
type: "NETWORK_BLOCKED",
|
|
48
|
+
message: "Network appears to be blocking this server",
|
|
49
|
+
troubleshooting: [
|
|
50
|
+
"✓ Server is running and responding to API",
|
|
51
|
+
"✗ Your network is refusing connections to this IP",
|
|
52
|
+
"",
|
|
53
|
+
"⚠️ COMMON CAUSES:",
|
|
54
|
+
"• Corporate/public WiFi blocks datacenter IPs",
|
|
55
|
+
"• ISP firewall filtering VPS providers",
|
|
56
|
+
"• Router content filtering",
|
|
57
|
+
"",
|
|
58
|
+
"🔧 SOLUTIONS:",
|
|
59
|
+
"1. Try a different network (hotspot, home WiFi, VPN)",
|
|
60
|
+
"2. Check router firewall settings",
|
|
61
|
+
"3. Contact ISP about blocking Hetzner IPs",
|
|
62
|
+
"",
|
|
63
|
+
"💡 TEST: Works from other networks? = Network block confirmed",
|
|
64
|
+
],
|
|
65
|
+
isLikelyNetworkBlock: true,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Pattern 2: Server still booting
|
|
70
|
+
if (isConnectionRefused && !serverIsRunning) {
|
|
71
|
+
return {
|
|
72
|
+
type: "SERVER_NOT_READY",
|
|
73
|
+
message: "Server is not ready yet",
|
|
74
|
+
troubleshooting: [
|
|
75
|
+
"Server is still starting up",
|
|
76
|
+
"SSH daemon hasn't started yet",
|
|
77
|
+
"",
|
|
78
|
+
"⏳ Wait 1-2 minutes and try again",
|
|
79
|
+
],
|
|
80
|
+
isLikelyNetworkBlock: false,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Pattern 3: Authentication failure
|
|
85
|
+
if (
|
|
86
|
+
errorMessage.includes("All configured authentication") ||
|
|
87
|
+
errorMessage.includes("Authentication failed")
|
|
88
|
+
) {
|
|
89
|
+
return {
|
|
90
|
+
type: "AUTH_FAILED",
|
|
91
|
+
message: "SSH authentication failed",
|
|
92
|
+
troubleshooting: [
|
|
93
|
+
"SSH key issue or wrong credentials",
|
|
94
|
+
"Check that the SSH key is configured correctly",
|
|
95
|
+
],
|
|
96
|
+
isLikelyNetworkBlock: false,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Default: Unknown error
|
|
101
|
+
return {
|
|
102
|
+
type: "UNKNOWN",
|
|
103
|
+
message: errorMessage,
|
|
104
|
+
troubleshooting: [
|
|
105
|
+
"Check if server is running",
|
|
106
|
+
"Verify network connectivity",
|
|
107
|
+
"Check SSH key configuration",
|
|
108
|
+
],
|
|
109
|
+
isLikelyNetworkBlock: false,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Format network error for WebSocket/UI display
|
|
115
|
+
*/
|
|
116
|
+
export function formatNetworkError(diagnosis: NetworkErrorDetails): string {
|
|
117
|
+
if (diagnosis.isLikelyNetworkBlock) {
|
|
118
|
+
return `⚠️ ${diagnosis.message}\n\n${diagnosis.troubleshooting.join("\n")}`;
|
|
119
|
+
}
|
|
120
|
+
return diagnosis.message;
|
|
121
|
+
}
|