autoglm-gui 1.4.1__py3-none-any.whl → 1.5.1__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.
- AutoGLM_GUI/__init__.py +11 -0
- AutoGLM_GUI/__main__.py +26 -4
- AutoGLM_GUI/actions/__init__.py +6 -0
- phone_agent/actions/handler_ios.py → AutoGLM_GUI/actions/handler.py +30 -112
- AutoGLM_GUI/actions/types.py +15 -0
- {phone_agent → AutoGLM_GUI}/adb/__init__.py +25 -23
- {phone_agent → AutoGLM_GUI}/adb/connection.py +5 -40
- {phone_agent → AutoGLM_GUI}/adb/device.py +12 -94
- {phone_agent → AutoGLM_GUI}/adb/input.py +6 -47
- AutoGLM_GUI/adb/screenshot.py +11 -0
- {phone_agent/config → AutoGLM_GUI/adb}/timing.py +1 -1
- AutoGLM_GUI/adb_plus/keyboard_installer.py +4 -2
- AutoGLM_GUI/adb_plus/screenshot.py +22 -1
- AutoGLM_GUI/adb_plus/serial.py +38 -20
- AutoGLM_GUI/adb_plus/touch.py +4 -9
- AutoGLM_GUI/agents/__init__.py +43 -12
- AutoGLM_GUI/agents/events.py +19 -0
- AutoGLM_GUI/agents/factory.py +31 -38
- AutoGLM_GUI/agents/glm/__init__.py +7 -0
- AutoGLM_GUI/agents/glm/agent.py +297 -0
- AutoGLM_GUI/agents/glm/message_builder.py +81 -0
- AutoGLM_GUI/agents/glm/parser.py +110 -0
- {phone_agent/config → AutoGLM_GUI/agents/glm}/prompts_en.py +7 -9
- {phone_agent/config → AutoGLM_GUI/agents/glm}/prompts_zh.py +18 -25
- AutoGLM_GUI/agents/mai/__init__.py +28 -0
- AutoGLM_GUI/agents/mai/agent.py +408 -0
- AutoGLM_GUI/agents/mai/parser.py +254 -0
- AutoGLM_GUI/agents/mai/prompts.py +103 -0
- AutoGLM_GUI/agents/mai/traj_memory.py +91 -0
- AutoGLM_GUI/agents/protocols.py +12 -8
- AutoGLM_GUI/agents/stream_runner.py +193 -0
- AutoGLM_GUI/api/__init__.py +40 -21
- AutoGLM_GUI/api/agents.py +181 -239
- AutoGLM_GUI/api/control.py +9 -6
- AutoGLM_GUI/api/devices.py +102 -12
- AutoGLM_GUI/api/history.py +104 -0
- AutoGLM_GUI/api/layered_agent.py +67 -15
- AutoGLM_GUI/api/media.py +64 -1
- AutoGLM_GUI/api/scheduled_tasks.py +98 -0
- AutoGLM_GUI/config.py +81 -0
- AutoGLM_GUI/config_manager.py +68 -51
- AutoGLM_GUI/device_manager.py +248 -29
- AutoGLM_GUI/device_protocol.py +1 -1
- AutoGLM_GUI/devices/adb_device.py +5 -10
- AutoGLM_GUI/devices/mock_device.py +4 -2
- AutoGLM_GUI/devices/remote_device.py +8 -3
- AutoGLM_GUI/history_manager.py +164 -0
- AutoGLM_GUI/model/__init__.py +5 -0
- AutoGLM_GUI/model/message_builder.py +69 -0
- AutoGLM_GUI/model/types.py +24 -0
- AutoGLM_GUI/models/__init__.py +10 -0
- AutoGLM_GUI/models/history.py +140 -0
- AutoGLM_GUI/models/scheduled_task.py +71 -0
- AutoGLM_GUI/parsers/__init__.py +22 -0
- AutoGLM_GUI/parsers/base.py +50 -0
- AutoGLM_GUI/parsers/phone_parser.py +58 -0
- AutoGLM_GUI/phone_agent_manager.py +62 -396
- AutoGLM_GUI/platform_utils.py +26 -0
- AutoGLM_GUI/prompt_config.py +15 -0
- AutoGLM_GUI/prompts/__init__.py +32 -0
- AutoGLM_GUI/scheduler_manager.py +350 -0
- AutoGLM_GUI/schemas.py +246 -72
- AutoGLM_GUI/scrcpy_stream.py +142 -24
- AutoGLM_GUI/socketio_server.py +100 -27
- AutoGLM_GUI/static/assets/{about-_XNhzQZX.js → about-CfwX1Cmc.js} +1 -1
- AutoGLM_GUI/static/assets/alert-dialog-CtGlN2IJ.js +1 -0
- AutoGLM_GUI/static/assets/chat-BYa-foUI.js +129 -0
- AutoGLM_GUI/static/assets/circle-alert-t08bEMPO.js +1 -0
- AutoGLM_GUI/static/assets/dialog-FNwZJFwk.js +45 -0
- AutoGLM_GUI/static/assets/eye-D0UPWCWC.js +1 -0
- AutoGLM_GUI/static/assets/history-CRo95B7i.js +1 -0
- AutoGLM_GUI/static/assets/{index-Cy8TmmHV.js → index-BaLMSqd3.js} +1 -1
- AutoGLM_GUI/static/assets/index-CTHbFvKl.js +11 -0
- AutoGLM_GUI/static/assets/index-CV7jGxGm.css +1 -0
- AutoGLM_GUI/static/assets/label-DJFevVmr.js +1 -0
- AutoGLM_GUI/static/assets/logs-RW09DyYY.js +1 -0
- AutoGLM_GUI/static/assets/popover--JTJrE5v.js +1 -0
- AutoGLM_GUI/static/assets/scheduled-tasks-DTRKsQXF.js +1 -0
- AutoGLM_GUI/static/assets/square-pen-CPK_K680.js +1 -0
- AutoGLM_GUI/static/assets/textarea-PRmVnWq5.js +1 -0
- AutoGLM_GUI/static/assets/workflows-CdcsAoaT.js +1 -0
- AutoGLM_GUI/static/index.html +2 -2
- AutoGLM_GUI/types.py +17 -0
- {autoglm_gui-1.4.1.dist-info → autoglm_gui-1.5.1.dist-info}/METADATA +179 -130
- autoglm_gui-1.5.1.dist-info/RECORD +118 -0
- AutoGLM_GUI/agents/mai_adapter.py +0 -627
- AutoGLM_GUI/api/dual_model.py +0 -317
- AutoGLM_GUI/device_adapter.py +0 -263
- AutoGLM_GUI/dual_model/__init__.py +0 -53
- AutoGLM_GUI/dual_model/decision_model.py +0 -664
- AutoGLM_GUI/dual_model/dual_agent.py +0 -917
- AutoGLM_GUI/dual_model/protocols.py +0 -354
- AutoGLM_GUI/dual_model/vision_model.py +0 -442
- AutoGLM_GUI/mai_ui_adapter/agent_wrapper.py +0 -291
- AutoGLM_GUI/phone_agent_patches.py +0 -147
- AutoGLM_GUI/static/assets/chat-DwJpiAWf.js +0 -126
- AutoGLM_GUI/static/assets/dialog-B3uW4T8V.js +0 -45
- AutoGLM_GUI/static/assets/index-Cpv2gSF1.css +0 -1
- AutoGLM_GUI/static/assets/index-UYYauTly.js +0 -12
- AutoGLM_GUI/static/assets/workflows-Du_de-dt.js +0 -1
- autoglm_gui-1.4.1.dist-info/RECORD +0 -117
- mai_agent/base.py +0 -137
- mai_agent/mai_grounding_agent.py +0 -263
- mai_agent/mai_naivigation_agent.py +0 -526
- mai_agent/prompt.py +0 -148
- mai_agent/unified_memory.py +0 -67
- mai_agent/utils.py +0 -73
- phone_agent/__init__.py +0 -12
- phone_agent/actions/__init__.py +0 -5
- phone_agent/actions/handler.py +0 -400
- phone_agent/adb/screenshot.py +0 -108
- phone_agent/agent.py +0 -253
- phone_agent/agent_ios.py +0 -277
- phone_agent/config/__init__.py +0 -53
- phone_agent/config/apps_harmonyos.py +0 -256
- phone_agent/config/apps_ios.py +0 -339
- phone_agent/config/prompts.py +0 -80
- phone_agent/device_factory.py +0 -166
- phone_agent/hdc/__init__.py +0 -53
- phone_agent/hdc/connection.py +0 -384
- phone_agent/hdc/device.py +0 -269
- phone_agent/hdc/input.py +0 -145
- phone_agent/hdc/screenshot.py +0 -127
- phone_agent/model/__init__.py +0 -5
- phone_agent/model/client.py +0 -290
- phone_agent/xctest/__init__.py +0 -47
- phone_agent/xctest/connection.py +0 -379
- phone_agent/xctest/device.py +0 -472
- phone_agent/xctest/input.py +0 -311
- phone_agent/xctest/screenshot.py +0 -226
- {phone_agent/config → AutoGLM_GUI/adb}/apps.py +0 -0
- {phone_agent/config → AutoGLM_GUI}/i18n.py +0 -0
- {autoglm_gui-1.4.1.dist-info → autoglm_gui-1.5.1.dist-info}/WHEEL +0 -0
- {autoglm_gui-1.4.1.dist-info → autoglm_gui-1.5.1.dist-info}/entry_points.txt +0 -0
- {autoglm_gui-1.4.1.dist-info → autoglm_gui-1.5.1.dist-info}/licenses/LICENSE +0 -0
AutoGLM_GUI/api/__init__.py
CHANGED
|
@@ -13,37 +13,24 @@ from fastapi.responses import FileResponse
|
|
|
13
13
|
from fastapi.staticfiles import StaticFiles
|
|
14
14
|
|
|
15
15
|
from AutoGLM_GUI.adb_plus.qr_pair import qr_pairing_manager
|
|
16
|
-
from AutoGLM_GUI.logger import logger
|
|
17
16
|
from AutoGLM_GUI.version import APP_VERSION
|
|
18
17
|
|
|
19
18
|
from . import (
|
|
20
19
|
agents,
|
|
21
20
|
control,
|
|
22
21
|
devices,
|
|
23
|
-
dual_model,
|
|
24
22
|
health,
|
|
23
|
+
history,
|
|
25
24
|
layered_agent,
|
|
26
25
|
mcp,
|
|
27
26
|
media,
|
|
28
27
|
metrics,
|
|
28
|
+
scheduled_tasks,
|
|
29
29
|
version,
|
|
30
30
|
workflows,
|
|
31
31
|
)
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
# TODO:应该要支持运行时动态切换设备
|
|
35
|
-
def _maybe_inject_remote_device() -> None:
|
|
36
|
-
if remote_base_url := os.getenv("REMOTE_DEVICE_BASE_URL"):
|
|
37
|
-
from AutoGLM_GUI.device_adapter import inject_device_protocol
|
|
38
|
-
from AutoGLM_GUI.devices.remote_device import RemoteDevice
|
|
39
|
-
|
|
40
|
-
def get_remote_device(device_id: str | None):
|
|
41
|
-
return RemoteDevice(device_id or "mock_device_001", remote_base_url)
|
|
42
|
-
|
|
43
|
-
inject_device_protocol(get_remote_device)
|
|
44
|
-
logger.info(f"Remote device mode enabled: connecting to {remote_base_url}")
|
|
45
|
-
|
|
46
|
-
|
|
47
34
|
def _get_cors_origins() -> list[str]:
|
|
48
35
|
cors_origins_str = os.getenv("AUTOGLM_CORS_ORIGINS", "http://localhost:3000")
|
|
49
36
|
if cors_origins_str == "*":
|
|
@@ -58,7 +45,20 @@ def _get_static_dir() -> Path | None:
|
|
|
58
45
|
if bundled_static.exists():
|
|
59
46
|
return bundled_static
|
|
60
47
|
|
|
61
|
-
# Priority 2:
|
|
48
|
+
# Priority 2: Check filesystem directly (for Docker deployments)
|
|
49
|
+
# This handles the case where static files are copied to the package directory
|
|
50
|
+
# but not included in the Python package itself (e.g., Docker builds)
|
|
51
|
+
try:
|
|
52
|
+
from AutoGLM_GUI import __file__ as package_file
|
|
53
|
+
|
|
54
|
+
package_dir = Path(package_file).parent
|
|
55
|
+
filesystem_static = package_dir / "static"
|
|
56
|
+
if filesystem_static.exists() and filesystem_static.is_dir():
|
|
57
|
+
return filesystem_static
|
|
58
|
+
except (ImportError, AttributeError):
|
|
59
|
+
pass
|
|
60
|
+
|
|
61
|
+
# Priority 3: importlib.resources (for installed package)
|
|
62
62
|
try:
|
|
63
63
|
static_dir = files("AutoGLM_GUI").joinpath("static")
|
|
64
64
|
if hasattr(static_dir, "_path"):
|
|
@@ -77,9 +77,6 @@ def _get_static_dir() -> Path | None:
|
|
|
77
77
|
def create_app() -> FastAPI:
|
|
78
78
|
"""Build the FastAPI app with routers and static assets."""
|
|
79
79
|
|
|
80
|
-
# Inject RemoteDevice if REMOTE_DEVICE_BASE_URL is set
|
|
81
|
-
_maybe_inject_remote_device()
|
|
82
|
-
|
|
83
80
|
# Create MCP ASGI app
|
|
84
81
|
mcp_app = mcp.get_mcp_asgi_app()
|
|
85
82
|
|
|
@@ -91,15 +88,20 @@ def create_app() -> FastAPI:
|
|
|
91
88
|
asyncio.create_task(qr_pairing_manager.cleanup_expired_sessions())
|
|
92
89
|
|
|
93
90
|
from AutoGLM_GUI.device_manager import DeviceManager
|
|
91
|
+
from AutoGLM_GUI.scheduler_manager import scheduler_manager
|
|
94
92
|
|
|
95
93
|
device_manager = DeviceManager.get_instance()
|
|
96
94
|
device_manager.start_polling()
|
|
97
95
|
|
|
96
|
+
# Start scheduled task scheduler
|
|
97
|
+
scheduler_manager.start()
|
|
98
|
+
|
|
98
99
|
# Run MCP lifespan
|
|
99
100
|
async with mcp_app.lifespan(app):
|
|
100
101
|
yield
|
|
101
102
|
|
|
102
|
-
# App shutdown
|
|
103
|
+
# App shutdown
|
|
104
|
+
scheduler_manager.shutdown()
|
|
103
105
|
|
|
104
106
|
# Create FastAPI app with combined lifespan
|
|
105
107
|
app = FastAPI(
|
|
@@ -116,14 +118,15 @@ def create_app() -> FastAPI:
|
|
|
116
118
|
|
|
117
119
|
app.include_router(agents.router)
|
|
118
120
|
app.include_router(health.router)
|
|
121
|
+
app.include_router(history.router)
|
|
119
122
|
app.include_router(layered_agent.router)
|
|
120
123
|
app.include_router(devices.router)
|
|
121
124
|
app.include_router(control.router)
|
|
122
125
|
app.include_router(media.router)
|
|
123
126
|
app.include_router(metrics.router)
|
|
127
|
+
app.include_router(scheduled_tasks.router)
|
|
124
128
|
app.include_router(version.router)
|
|
125
129
|
app.include_router(workflows.router)
|
|
126
|
-
app.include_router(dual_model.router)
|
|
127
130
|
|
|
128
131
|
# Mount static files BEFORE MCP to ensure they have priority
|
|
129
132
|
# This is critical: FastAPI processes mounts in order, so static files
|
|
@@ -139,8 +142,23 @@ def create_app() -> FastAPI:
|
|
|
139
142
|
async def serve_spa(full_path: str) -> FileResponse:
|
|
140
143
|
file_path = static_dir / full_path
|
|
141
144
|
if file_path.is_file():
|
|
145
|
+
# Explicitly set media_type for common file types to avoid MIME detection issues
|
|
146
|
+
# This is critical for PyInstaller environments where mimetypes module may fail
|
|
147
|
+
media_type = None
|
|
148
|
+
suffix = file_path.suffix.lower()
|
|
149
|
+
if suffix == ".js":
|
|
150
|
+
media_type = "application/javascript"
|
|
151
|
+
elif suffix == ".css":
|
|
152
|
+
media_type = "text/css"
|
|
153
|
+
elif suffix == ".json":
|
|
154
|
+
media_type = "application/json"
|
|
155
|
+
elif suffix in (".png", ".jpg", ".jpeg", ".gif", ".svg", ".ico"):
|
|
156
|
+
# Let FileResponse auto-detect image types (usually works)
|
|
157
|
+
media_type = None
|
|
158
|
+
|
|
142
159
|
return FileResponse(
|
|
143
160
|
file_path,
|
|
161
|
+
media_type=media_type,
|
|
144
162
|
headers={
|
|
145
163
|
"Cache-Control": "no-cache, no-store, must-revalidate",
|
|
146
164
|
"Pragma": "no-cache",
|
|
@@ -149,6 +167,7 @@ def create_app() -> FastAPI:
|
|
|
149
167
|
)
|
|
150
168
|
return FileResponse(
|
|
151
169
|
static_dir / "index.html",
|
|
170
|
+
media_type="text/html",
|
|
152
171
|
headers={
|
|
153
172
|
"Cache-Control": "no-cache, no-store, must-revalidate",
|
|
154
173
|
"Pragma": "no-cache",
|