escobar 0.1.73__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.
Files changed (27) hide show
  1. escobar/_version.py +1 -1
  2. escobar/handlers.py +33 -2
  3. escobar/labextension/package.json +2 -2
  4. escobar/labextension/schemas/escobar/package.json.orig +1 -1
  5. escobar/labextension/static/{589.d1cb43ef7438dbdd0369.js → 589.f8dc01ae6841c48d5bdb.js} +1 -1
  6. escobar/labextension/static/{remoteEntry.c7b59f5a7472168cb072.js → remoteEntry.ffdf5783302f3ef7c627.js} +1 -1
  7. {escobar-0.1.73.data → escobar-0.1.74.data}/data/share/jupyter/labextensions/escobar/package.json +2 -2
  8. {escobar-0.1.73.data → escobar-0.1.74.data}/data/share/jupyter/labextensions/escobar/schemas/escobar/package.json.orig +1 -1
  9. escobar-0.1.73.data/data/share/jupyter/labextensions/escobar/static/589.d1cb43ef7438dbdd0369.js → escobar-0.1.74.data/data/share/jupyter/labextensions/escobar/static/589.f8dc01ae6841c48d5bdb.js +1 -1
  10. escobar-0.1.73.data/data/share/jupyter/labextensions/escobar/static/remoteEntry.c7b59f5a7472168cb072.js → escobar-0.1.74.data/data/share/jupyter/labextensions/escobar/static/remoteEntry.ffdf5783302f3ef7c627.js +1 -1
  11. {escobar-0.1.73.dist-info → escobar-0.1.74.dist-info}/METADATA +1 -1
  12. {escobar-0.1.73.dist-info → escobar-0.1.74.dist-info}/RECORD +27 -27
  13. {escobar-0.1.73.data → escobar-0.1.74.data}/data/share/jupyter/labextensions/escobar/install.json +0 -0
  14. {escobar-0.1.73.data → escobar-0.1.74.data}/data/share/jupyter/labextensions/escobar/schemas/escobar/plugin.json +0 -0
  15. {escobar-0.1.73.data → escobar-0.1.74.data}/data/share/jupyter/labextensions/escobar/static/304.bf7e91be734e5b36cdc9.js +0 -0
  16. {escobar-0.1.73.data → escobar-0.1.74.data}/data/share/jupyter/labextensions/escobar/static/346.8a1e61ca6789b6fddfa7.js +0 -0
  17. {escobar-0.1.73.data → escobar-0.1.74.data}/data/share/jupyter/labextensions/escobar/static/379.40dd59dc19d4a6b42d25.js +0 -0
  18. {escobar-0.1.73.data → escobar-0.1.74.data}/data/share/jupyter/labextensions/escobar/static/57.17e53b4b9a954f39c4d8.js +0 -0
  19. {escobar-0.1.73.data → escobar-0.1.74.data}/data/share/jupyter/labextensions/escobar/static/648.a7d314faeacc762d891d.js +0 -0
  20. {escobar-0.1.73.data → escobar-0.1.74.data}/data/share/jupyter/labextensions/escobar/static/666.3bc65aac3a3be183ee19.js +0 -0
  21. {escobar-0.1.73.data → escobar-0.1.74.data}/data/share/jupyter/labextensions/escobar/static/874.c539726f31a1baa0267e.js +0 -0
  22. {escobar-0.1.73.data → escobar-0.1.74.data}/data/share/jupyter/labextensions/escobar/static/986.cbcf9d7c1cd8d06be435.js +0 -0
  23. {escobar-0.1.73.data → escobar-0.1.74.data}/data/share/jupyter/labextensions/escobar/static/style.js +0 -0
  24. {escobar-0.1.73.data → escobar-0.1.74.data}/data/share/jupyter/labextensions/escobar/static/third-party-licenses.json +0 -0
  25. {escobar-0.1.73.dist-info → escobar-0.1.74.dist-info}/WHEEL +0 -0
  26. {escobar-0.1.73.dist-info → escobar-0.1.74.dist-info}/entry_points.txt +0 -0
  27. {escobar-0.1.73.dist-info → escobar-0.1.74.dist-info}/licenses/LICENSE +0 -0
escobar/_version.py CHANGED
@@ -1,4 +1,4 @@
1
1
  # This file is auto-generated by Hatchling. As such, do not:
2
2
  # - modify
3
3
  # - track in version control e.g. be sure to add to .gitignore
4
- __version__ = VERSION = '0.1.73'
4
+ __version__ = VERSION = '0.1.74'
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
- self.target_url = os.getenv('WEBSOCKET_PROXY_TARGET', 'ws://localhost:8777/ws')
171
- print(f"[ESCOBAR-WS] Target URL will be: {self.target_url}")
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()]
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "escobar",
3
- "version": "0.1.73",
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.c7b59f5a7472168cb072.js",
126
+ "load": "static/remoteEntry.ffdf5783302f3ef7c627.js",
127
127
  "extension": "./extension",
128
128
  "style": "./style"
129
129
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "escobar",
3
- "version": "0.1.73",
3
+ "version": "0.1.74",
4
4
  "description": "AI CHAT EXTENSION",
5
5
  "keywords": [
6
6
  "jupyter",