ta-studio-mcp 1.4.0 → 1.4.1
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/main.py +17 -5
- package/package.json +1 -1
package/main.py
CHANGED
|
@@ -17,10 +17,19 @@ import logging
|
|
|
17
17
|
import os
|
|
18
18
|
import sys
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
# Use try/except to support both execution modes:
|
|
21
|
+
# - `python main.py` (script mode, PYTHONPATH set by cli.js) → absolute imports
|
|
22
|
+
# - `python -m ta_studio_mcp` (module mode) → relative imports
|
|
23
|
+
try:
|
|
24
|
+
from auth import build_auth_headers
|
|
25
|
+
from ws_client import TAWebSocketClient, DEFAULT_SERVER_URL
|
|
26
|
+
from emulator_relay import dispatch_command
|
|
27
|
+
from stream import FrameStreamer
|
|
28
|
+
except ImportError:
|
|
29
|
+
from .auth import build_auth_headers
|
|
30
|
+
from .ws_client import TAWebSocketClient, DEFAULT_SERVER_URL
|
|
31
|
+
from .emulator_relay import dispatch_command
|
|
32
|
+
from .stream import FrameStreamer
|
|
24
33
|
|
|
25
34
|
logging.basicConfig(
|
|
26
35
|
level=logging.INFO,
|
|
@@ -76,7 +85,10 @@ async def main() -> None:
|
|
|
76
85
|
|
|
77
86
|
async def on_connected(_msg: dict) -> None:
|
|
78
87
|
"""Send identity info on connection."""
|
|
79
|
-
|
|
88
|
+
try:
|
|
89
|
+
from emulator_relay import handle_list_devices
|
|
90
|
+
except ImportError:
|
|
91
|
+
from .emulator_relay import handle_list_devices
|
|
80
92
|
devices = await handle_list_devices({})
|
|
81
93
|
await client.send({
|
|
82
94
|
"type": "relay_ready",
|