escobar 0.1.72__py3-none-any.whl → 0.1.74__py3-none-any.whl
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.
- escobar/_version.py +1 -1
- escobar/handlers.py +34 -3
- escobar/labextension/package.json +2 -2
- escobar/labextension/schemas/escobar/package.json.orig +1 -1
- escobar/labextension/static/{589.c7f0a2949aa6135031af.js → 589.f8dc01ae6841c48d5bdb.js} +1 -1
- escobar/labextension/static/{remoteEntry.80aa6ea7f9c9223ec4b3.js → remoteEntry.ffdf5783302f3ef7c627.js} +1 -1
- {escobar-0.1.72.data → escobar-0.1.74.data}/data/share/jupyter/labextensions/escobar/package.json +2 -2
- {escobar-0.1.72.data → escobar-0.1.74.data}/data/share/jupyter/labextensions/escobar/schemas/escobar/package.json.orig +1 -1
- escobar-0.1.72.data/data/share/jupyter/labextensions/escobar/static/589.c7f0a2949aa6135031af.js → escobar-0.1.74.data/data/share/jupyter/labextensions/escobar/static/589.f8dc01ae6841c48d5bdb.js +1 -1
- escobar-0.1.72.data/data/share/jupyter/labextensions/escobar/static/remoteEntry.80aa6ea7f9c9223ec4b3.js → escobar-0.1.74.data/data/share/jupyter/labextensions/escobar/static/remoteEntry.ffdf5783302f3ef7c627.js +1 -1
- {escobar-0.1.72.dist-info → escobar-0.1.74.dist-info}/METADATA +1 -1
- {escobar-0.1.72.dist-info → escobar-0.1.74.dist-info}/RECORD +27 -27
- {escobar-0.1.72.data → escobar-0.1.74.data}/data/share/jupyter/labextensions/escobar/install.json +0 -0
- {escobar-0.1.72.data → escobar-0.1.74.data}/data/share/jupyter/labextensions/escobar/schemas/escobar/plugin.json +0 -0
- {escobar-0.1.72.data → escobar-0.1.74.data}/data/share/jupyter/labextensions/escobar/static/304.bf7e91be734e5b36cdc9.js +0 -0
- {escobar-0.1.72.data → escobar-0.1.74.data}/data/share/jupyter/labextensions/escobar/static/346.8a1e61ca6789b6fddfa7.js +0 -0
- {escobar-0.1.72.data → escobar-0.1.74.data}/data/share/jupyter/labextensions/escobar/static/379.40dd59dc19d4a6b42d25.js +0 -0
- {escobar-0.1.72.data → escobar-0.1.74.data}/data/share/jupyter/labextensions/escobar/static/57.17e53b4b9a954f39c4d8.js +0 -0
- {escobar-0.1.72.data → escobar-0.1.74.data}/data/share/jupyter/labextensions/escobar/static/648.a7d314faeacc762d891d.js +0 -0
- {escobar-0.1.72.data → escobar-0.1.74.data}/data/share/jupyter/labextensions/escobar/static/666.3bc65aac3a3be183ee19.js +0 -0
- {escobar-0.1.72.data → escobar-0.1.74.data}/data/share/jupyter/labextensions/escobar/static/874.c539726f31a1baa0267e.js +0 -0
- {escobar-0.1.72.data → escobar-0.1.74.data}/data/share/jupyter/labextensions/escobar/static/986.cbcf9d7c1cd8d06be435.js +0 -0
- {escobar-0.1.72.data → escobar-0.1.74.data}/data/share/jupyter/labextensions/escobar/static/style.js +0 -0
- {escobar-0.1.72.data → escobar-0.1.74.data}/data/share/jupyter/labextensions/escobar/static/third-party-licenses.json +0 -0
- {escobar-0.1.72.dist-info → escobar-0.1.74.dist-info}/WHEEL +0 -0
- {escobar-0.1.72.dist-info → escobar-0.1.74.dist-info}/entry_points.txt +0 -0
- {escobar-0.1.72.dist-info → escobar-0.1.74.dist-info}/licenses/LICENSE +0 -0
escobar/_version.py
CHANGED
escobar/handlers.py
CHANGED
@@ -6,6 +6,7 @@ import websockets
|
|
6
6
|
import ssl
|
7
7
|
import logging
|
8
8
|
import time
|
9
|
+
from urllib.parse import urlparse, urlunparse
|
9
10
|
from jupyter_server.base.handlers import JupyterHandler
|
10
11
|
from jupyter_server.utils import url_path_join
|
11
12
|
import tornado
|
@@ -153,6 +154,32 @@ class WebSocketProxyHandler(tornado.websocket.WebSocketHandler):
|
|
153
154
|
WebSocket proxy handler that forwards connections from /ws to target server
|
154
155
|
"""
|
155
156
|
|
157
|
+
def _resolve_target_url_for_docker(self, url):
|
158
|
+
"""
|
159
|
+
Resolve target URL for Docker environment.
|
160
|
+
Replace localhost/127.0.0.1 with Docker host IP when running in container.
|
161
|
+
"""
|
162
|
+
if not os.path.exists('/.dockerenv'):
|
163
|
+
print(f"[ESCOBAR-WS] Not in Docker container, using original URL: {url}")
|
164
|
+
return url # Not in Docker, return original URL
|
165
|
+
|
166
|
+
# Parse the URL to extract components
|
167
|
+
parsed = urlparse(url)
|
168
|
+
|
169
|
+
# Check if hostname is localhost or 127.0.0.1
|
170
|
+
if parsed.hostname in ['localhost', '127.0.0.1']:
|
171
|
+
# Replace with Docker host IP
|
172
|
+
new_netloc = parsed.netloc.replace(parsed.hostname, '172.17.0.1')
|
173
|
+
new_parsed = parsed._replace(netloc=new_netloc)
|
174
|
+
new_url = urlunparse(new_parsed)
|
175
|
+
|
176
|
+
print(f"[ESCOBAR-WS] Docker hostname resolution: {url} → {new_url}")
|
177
|
+
return new_url
|
178
|
+
else:
|
179
|
+
print(f"[ESCOBAR-WS] Docker container detected, but hostname '{parsed.hostname}' is not localhost/127.0.0.1, keeping original: {url}")
|
180
|
+
|
181
|
+
return url
|
182
|
+
|
156
183
|
def __init__(self, *args, **kwargs):
|
157
184
|
print(f"[ESCOBAR-WS] WebSocketProxyHandler.__init__ called")
|
158
185
|
super().__init__(*args, **kwargs)
|
@@ -167,8 +194,12 @@ class WebSocketProxyHandler(tornado.websocket.WebSocketHandler):
|
|
167
194
|
print(f"[ESCOBAR-WS] Could not get hostname")
|
168
195
|
|
169
196
|
# Read target URL from environment variable
|
170
|
-
|
171
|
-
print(f"[ESCOBAR-WS]
|
197
|
+
raw_target_url = os.getenv('WEBSOCKET_PROXY_TARGET', 'ws://localhost:8777/ws')
|
198
|
+
print(f"[ESCOBAR-WS] Raw target URL from environment: {raw_target_url}")
|
199
|
+
|
200
|
+
# Apply Docker hostname resolution
|
201
|
+
self.target_url = self._resolve_target_url_for_docker(raw_target_url)
|
202
|
+
print(f"[ESCOBAR-WS] Resolved target URL: {self.target_url}")
|
172
203
|
|
173
204
|
# Debug all WebSocket-related environment variables
|
174
205
|
websocket_env_vars = [(k, v) for k, v in os.environ.items() if 'WEBSOCKET' in k.upper()]
|
@@ -255,7 +286,7 @@ class WebSocketProxyHandler(tornado.websocket.WebSocketHandler):
|
|
255
286
|
print(f"[ESCOBAR-WS] === END CONNECTION FAILED ===")
|
256
287
|
|
257
288
|
logging.error(f"Failed to connect to target websocket {self.target_url}: {str(e)}")
|
258
|
-
self.close(code=1011, reason="Failed to connect to target server")
|
289
|
+
self.close(code=1011, reason=f"Failed to connect to target server: {self.target_url}")
|
259
290
|
|
260
291
|
async def on_message(self, message):
|
261
292
|
"""Called when a message is received from the client"""
|
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "escobar",
|
3
|
-
"version": "0.1.
|
3
|
+
"version": "0.1.74",
|
4
4
|
"description": "AI CHAT EXTENSION",
|
5
5
|
"keywords": [
|
6
6
|
"jupyter",
|
@@ -123,7 +123,7 @@
|
|
123
123
|
"outputDir": "escobar/labextension",
|
124
124
|
"schemaDir": "schema",
|
125
125
|
"_build": {
|
126
|
-
"load": "static/remoteEntry.
|
126
|
+
"load": "static/remoteEntry.ffdf5783302f3ef7c627.js",
|
127
127
|
"extension": "./extension",
|
128
128
|
"style": "./style"
|
129
129
|
}
|