autoglm-gui 1.4.0__tar.gz → 1.5.0__tar.gz

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 (175) hide show
  1. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/.gitignore +24 -0
  2. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/AutoGLM_GUI/__init__.py +11 -0
  3. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/AutoGLM_GUI/__main__.py +26 -8
  4. autoglm_gui-1.5.0/AutoGLM_GUI/actions/__init__.py +6 -0
  5. autoglm_gui-1.5.0/AutoGLM_GUI/actions/handler.py +196 -0
  6. autoglm_gui-1.5.0/AutoGLM_GUI/actions/types.py +15 -0
  7. autoglm_gui-1.5.0/AutoGLM_GUI/adb/__init__.py +53 -0
  8. autoglm_gui-1.5.0/AutoGLM_GUI/adb/connection.py +323 -0
  9. autoglm_gui-1.5.0/AutoGLM_GUI/adb/device.py +171 -0
  10. autoglm_gui-1.5.0/AutoGLM_GUI/adb/input.py +67 -0
  11. autoglm_gui-1.5.0/AutoGLM_GUI/adb/screenshot.py +11 -0
  12. autoglm_gui-1.5.0/AutoGLM_GUI/adb/timing.py +167 -0
  13. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/AutoGLM_GUI/adb_plus/keyboard_installer.py +4 -2
  14. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/AutoGLM_GUI/adb_plus/qr_pair.py +8 -8
  15. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/AutoGLM_GUI/adb_plus/screenshot.py +22 -1
  16. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/AutoGLM_GUI/adb_plus/serial.py +38 -20
  17. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/AutoGLM_GUI/adb_plus/touch.py +4 -9
  18. autoglm_gui-1.5.0/AutoGLM_GUI/agents/__init__.py +51 -0
  19. autoglm_gui-1.5.0/AutoGLM_GUI/agents/events.py +19 -0
  20. autoglm_gui-1.5.0/AutoGLM_GUI/agents/factory.py +153 -0
  21. autoglm_gui-1.5.0/AutoGLM_GUI/agents/glm/__init__.py +7 -0
  22. autoglm_gui-1.5.0/AutoGLM_GUI/agents/glm/agent.py +292 -0
  23. autoglm_gui-1.5.0/AutoGLM_GUI/agents/glm/message_builder.py +81 -0
  24. autoglm_gui-1.5.0/AutoGLM_GUI/agents/glm/parser.py +110 -0
  25. autoglm_gui-1.5.0/AutoGLM_GUI/agents/glm/prompts_en.py +77 -0
  26. autoglm_gui-1.5.0/AutoGLM_GUI/agents/glm/prompts_zh.py +75 -0
  27. autoglm_gui-1.5.0/AutoGLM_GUI/agents/mai/__init__.py +28 -0
  28. autoglm_gui-1.5.0/AutoGLM_GUI/agents/mai/agent.py +405 -0
  29. autoglm_gui-1.5.0/AutoGLM_GUI/agents/mai/parser.py +254 -0
  30. autoglm_gui-1.5.0/AutoGLM_GUI/agents/mai/prompts.py +103 -0
  31. autoglm_gui-1.5.0/AutoGLM_GUI/agents/mai/traj_memory.py +91 -0
  32. autoglm_gui-1.5.0/AutoGLM_GUI/agents/protocols.py +27 -0
  33. autoglm_gui-1.5.0/AutoGLM_GUI/agents/stream_runner.py +188 -0
  34. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/AutoGLM_GUI/api/__init__.py +71 -11
  35. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/AutoGLM_GUI/api/agents.py +190 -229
  36. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/AutoGLM_GUI/api/control.py +9 -6
  37. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/AutoGLM_GUI/api/devices.py +112 -28
  38. autoglm_gui-1.5.0/AutoGLM_GUI/api/health.py +13 -0
  39. autoglm_gui-1.5.0/AutoGLM_GUI/api/history.py +78 -0
  40. autoglm_gui-1.5.0/AutoGLM_GUI/api/layered_agent.py +711 -0
  41. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/AutoGLM_GUI/api/mcp.py +11 -10
  42. autoglm_gui-1.5.0/AutoGLM_GUI/api/media.py +112 -0
  43. autoglm_gui-1.5.0/AutoGLM_GUI/api/scheduled_tasks.py +98 -0
  44. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/AutoGLM_GUI/api/version.py +23 -10
  45. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/AutoGLM_GUI/api/workflows.py +2 -1
  46. autoglm_gui-1.5.0/AutoGLM_GUI/config.py +81 -0
  47. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/AutoGLM_GUI/config_manager.py +98 -27
  48. autoglm_gui-1.5.0/AutoGLM_GUI/device_adapter.py +263 -0
  49. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/AutoGLM_GUI/device_manager.py +248 -29
  50. autoglm_gui-1.5.0/AutoGLM_GUI/device_protocol.py +266 -0
  51. autoglm_gui-1.5.0/AutoGLM_GUI/devices/__init__.py +49 -0
  52. autoglm_gui-1.5.0/AutoGLM_GUI/devices/adb_device.py +200 -0
  53. autoglm_gui-1.5.0/AutoGLM_GUI/devices/mock_device.py +185 -0
  54. autoglm_gui-1.5.0/AutoGLM_GUI/devices/remote_device.py +177 -0
  55. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/AutoGLM_GUI/exceptions.py +3 -3
  56. autoglm_gui-1.5.0/AutoGLM_GUI/history_manager.py +164 -0
  57. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/AutoGLM_GUI/metrics.py +13 -20
  58. autoglm_gui-1.5.0/AutoGLM_GUI/model/__init__.py +5 -0
  59. autoglm_gui-1.5.0/AutoGLM_GUI/model/message_builder.py +69 -0
  60. autoglm_gui-1.5.0/AutoGLM_GUI/model/types.py +24 -0
  61. autoglm_gui-1.5.0/AutoGLM_GUI/models/__init__.py +10 -0
  62. autoglm_gui-1.5.0/AutoGLM_GUI/models/history.py +96 -0
  63. autoglm_gui-1.5.0/AutoGLM_GUI/models/scheduled_task.py +71 -0
  64. autoglm_gui-1.5.0/AutoGLM_GUI/parsers/__init__.py +22 -0
  65. autoglm_gui-1.5.0/AutoGLM_GUI/parsers/base.py +50 -0
  66. autoglm_gui-1.5.0/AutoGLM_GUI/parsers/phone_parser.py +58 -0
  67. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/AutoGLM_GUI/phone_agent_manager.py +118 -367
  68. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/AutoGLM_GUI/platform_utils.py +31 -2
  69. autoglm_gui-1.5.0/AutoGLM_GUI/prompt_config.py +15 -0
  70. autoglm_gui-1.5.0/AutoGLM_GUI/prompts/__init__.py +32 -0
  71. autoglm_gui-1.5.0/AutoGLM_GUI/scheduler_manager.py +304 -0
  72. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/AutoGLM_GUI/schemas.py +272 -63
  73. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/AutoGLM_GUI/scrcpy_stream.py +159 -37
  74. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/AutoGLM_GUI/server.py +3 -1
  75. autoglm_gui-1.5.0/AutoGLM_GUI/socketio_server.py +210 -0
  76. autoglm_gui-1.5.0/AutoGLM_GUI/state.py +29 -0
  77. autoglm_gui-1.4.0/AutoGLM_GUI/static/assets/about-DeclntHg.js → autoglm_gui-1.5.0/AutoGLM_GUI/static/assets/about-BQm96DAl.js +1 -1
  78. autoglm_gui-1.5.0/AutoGLM_GUI/static/assets/alert-dialog-B42XxGPR.js +1 -0
  79. autoglm_gui-1.5.0/AutoGLM_GUI/static/assets/chat-C0L2gQYG.js +129 -0
  80. autoglm_gui-1.5.0/AutoGLM_GUI/static/assets/circle-alert-D4rSJh37.js +1 -0
  81. autoglm_gui-1.5.0/AutoGLM_GUI/static/assets/dialog-DZ78cEcj.js +45 -0
  82. autoglm_gui-1.5.0/AutoGLM_GUI/static/assets/history-DFBv7TGc.js +1 -0
  83. autoglm_gui-1.5.0/AutoGLM_GUI/static/assets/index-Bzyv2yQ2.css +1 -0
  84. autoglm_gui-1.4.0/AutoGLM_GUI/static/assets/index-zQ4KKDHt.js → autoglm_gui-1.5.0/AutoGLM_GUI/static/assets/index-CmZSnDqc.js +1 -1
  85. autoglm_gui-1.5.0/AutoGLM_GUI/static/assets/index-CssG-3TH.js +11 -0
  86. autoglm_gui-1.5.0/AutoGLM_GUI/static/assets/label-BCUzE_nm.js +1 -0
  87. autoglm_gui-1.5.0/AutoGLM_GUI/static/assets/logs-eoFxn5of.js +1 -0
  88. autoglm_gui-1.5.0/AutoGLM_GUI/static/assets/popover-DLsuV5Sx.js +1 -0
  89. autoglm_gui-1.5.0/AutoGLM_GUI/static/assets/scheduled-tasks-MyqGJvy_.js +1 -0
  90. autoglm_gui-1.5.0/AutoGLM_GUI/static/assets/square-pen-zGWYrdfj.js +1 -0
  91. autoglm_gui-1.5.0/AutoGLM_GUI/static/assets/textarea-BX6y7uM5.js +1 -0
  92. autoglm_gui-1.5.0/AutoGLM_GUI/static/assets/workflows-CYFs6ssC.js +1 -0
  93. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/AutoGLM_GUI/static/index.html +2 -2
  94. autoglm_gui-1.5.0/AutoGLM_GUI/types.py +142 -0
  95. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/PKG-INFO +178 -92
  96. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/README.md +173 -91
  97. autoglm_gui-1.5.0/mai_agent/base.py +137 -0
  98. autoglm_gui-1.5.0/mai_agent/mai_grounding_agent.py +263 -0
  99. autoglm_gui-1.5.0/mai_agent/mai_naivigation_agent.py +526 -0
  100. autoglm_gui-1.5.0/mai_agent/prompt.py +148 -0
  101. autoglm_gui-1.5.0/mai_agent/unified_memory.py +67 -0
  102. autoglm_gui-1.5.0/mai_agent/utils.py +73 -0
  103. autoglm_gui-1.5.0/phone_agent/config/apps.py +227 -0
  104. autoglm_gui-1.5.0/phone_agent/config/i18n.py +81 -0
  105. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/pyproject.toml +9 -3
  106. autoglm_gui-1.4.0/AutoGLM_GUI/api/dual_model.py +0 -311
  107. autoglm_gui-1.4.0/AutoGLM_GUI/api/layered_agent.py +0 -586
  108. autoglm_gui-1.4.0/AutoGLM_GUI/api/media.py +0 -49
  109. autoglm_gui-1.4.0/AutoGLM_GUI/config.py +0 -23
  110. autoglm_gui-1.4.0/AutoGLM_GUI/dual_model/__init__.py +0 -53
  111. autoglm_gui-1.4.0/AutoGLM_GUI/dual_model/decision_model.py +0 -664
  112. autoglm_gui-1.4.0/AutoGLM_GUI/dual_model/dual_agent.py +0 -917
  113. autoglm_gui-1.4.0/AutoGLM_GUI/dual_model/protocols.py +0 -354
  114. autoglm_gui-1.4.0/AutoGLM_GUI/dual_model/vision_model.py +0 -442
  115. autoglm_gui-1.4.0/AutoGLM_GUI/mai_ui_adapter/agent_wrapper.py +0 -291
  116. autoglm_gui-1.4.0/AutoGLM_GUI/phone_agent_patches.py +0 -146
  117. autoglm_gui-1.4.0/AutoGLM_GUI/socketio_server.py +0 -125
  118. autoglm_gui-1.4.0/AutoGLM_GUI/state.py +0 -49
  119. autoglm_gui-1.4.0/AutoGLM_GUI/static/assets/chat-Iut2yhSw.js +0 -125
  120. autoglm_gui-1.4.0/AutoGLM_GUI/static/assets/dialog-BfdcBs1x.js +0 -45
  121. autoglm_gui-1.4.0/AutoGLM_GUI/static/assets/index-5hCCwHA7.css +0 -1
  122. autoglm_gui-1.4.0/AutoGLM_GUI/static/assets/index-DHF1NZh0.js +0 -12
  123. autoglm_gui-1.4.0/AutoGLM_GUI/static/assets/workflows-xiplap-r.js +0 -1
  124. {autoglm_gui-1.4.0/phone_agent/config → autoglm_gui-1.5.0/AutoGLM_GUI/adb}/apps.py +0 -0
  125. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/AutoGLM_GUI/adb_plus/__init__.py +0 -0
  126. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/AutoGLM_GUI/adb_plus/device.py +0 -0
  127. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/AutoGLM_GUI/adb_plus/ip.py +0 -0
  128. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/AutoGLM_GUI/adb_plus/mdns.py +0 -0
  129. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/AutoGLM_GUI/adb_plus/pair.py +0 -0
  130. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/AutoGLM_GUI/adb_plus/version.py +0 -0
  131. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/AutoGLM_GUI/api/metrics.py +0 -0
  132. {autoglm_gui-1.4.0/phone_agent/config → autoglm_gui-1.5.0/AutoGLM_GUI}/i18n.py +0 -0
  133. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/AutoGLM_GUI/logger.py +0 -0
  134. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/AutoGLM_GUI/prompts.py +0 -0
  135. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/AutoGLM_GUI/scrcpy_protocol.py +0 -0
  136. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/AutoGLM_GUI/static/assets/logo-Cyfm06Ym.png +0 -0
  137. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/AutoGLM_GUI/static/assets/worker-D6BRitjy.js +0 -0
  138. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/AutoGLM_GUI/static/favicon.ico +0 -0
  139. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/AutoGLM_GUI/static/logo-192.png +0 -0
  140. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/AutoGLM_GUI/static/logo-512.png +0 -0
  141. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/AutoGLM_GUI/version.py +0 -0
  142. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/AutoGLM_GUI/workflow_manager.py +0 -0
  143. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/LICENSE +0 -0
  144. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/phone_agent/__init__.py +0 -0
  145. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/phone_agent/actions/__init__.py +0 -0
  146. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/phone_agent/actions/handler.py +0 -0
  147. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/phone_agent/actions/handler_ios.py +0 -0
  148. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/phone_agent/adb/__init__.py +0 -0
  149. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/phone_agent/adb/connection.py +0 -0
  150. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/phone_agent/adb/device.py +0 -0
  151. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/phone_agent/adb/input.py +0 -0
  152. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/phone_agent/adb/screenshot.py +0 -0
  153. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/phone_agent/agent.py +0 -0
  154. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/phone_agent/agent_ios.py +0 -0
  155. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/phone_agent/config/__init__.py +0 -0
  156. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/phone_agent/config/apps_harmonyos.py +0 -0
  157. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/phone_agent/config/apps_ios.py +0 -0
  158. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/phone_agent/config/prompts.py +0 -0
  159. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/phone_agent/config/prompts_en.py +0 -0
  160. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/phone_agent/config/prompts_zh.py +0 -0
  161. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/phone_agent/config/timing.py +0 -0
  162. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/phone_agent/device_factory.py +0 -0
  163. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/phone_agent/hdc/__init__.py +0 -0
  164. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/phone_agent/hdc/connection.py +0 -0
  165. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/phone_agent/hdc/device.py +0 -0
  166. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/phone_agent/hdc/input.py +0 -0
  167. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/phone_agent/hdc/screenshot.py +0 -0
  168. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/phone_agent/model/__init__.py +0 -0
  169. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/phone_agent/model/client.py +0 -0
  170. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/phone_agent/xctest/__init__.py +0 -0
  171. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/phone_agent/xctest/connection.py +0 -0
  172. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/phone_agent/xctest/device.py +0 -0
  173. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/phone_agent/xctest/input.py +0 -0
  174. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/phone_agent/xctest/screenshot.py +0 -0
  175. {autoglm_gui-1.4.0 → autoglm_gui-1.5.0}/scrcpy-server-v3.3.3 +0 -0
@@ -5,10 +5,18 @@ build/
5
5
  dist/
6
6
  wheels/
7
7
  *.egg-info
8
+ .pytest_cache/
9
+ .mypy_cache/
10
+ .tox/
11
+ .coverage
12
+ coverage/
8
13
 
9
14
  # Virtual environments
10
15
  .venv
11
16
  .python-version
17
+ .env
18
+ .env.*
19
+ *.env
12
20
 
13
21
  # Built static files (generated by scripts/build.py)
14
22
  AutoGLM_GUI/static/
@@ -17,6 +25,7 @@ AutoGLM_GUI/static/
17
25
  frontend/node_modules/
18
26
  frontend/dist/
19
27
  frontend/package-lock.json
28
+ pnpm-debug.log*
20
29
 
21
30
  # Electron
22
31
  electron/node_modules/
@@ -34,3 +43,18 @@ logs/
34
43
 
35
44
  # macOS
36
45
  .DS_Store
46
+
47
+ # serena
48
+ .serena/
49
+
50
+ # Docs site
51
+ docs/node_modules/
52
+ docs/build/
53
+ docs/.docusaurus/
54
+
55
+ # Vercel
56
+ .vercel/
57
+
58
+ # IDE
59
+ .vscode/
60
+ .idea/
@@ -5,6 +5,9 @@ import sys
5
5
  from functools import wraps
6
6
  from importlib import metadata
7
7
 
8
+ from AutoGLM_GUI.config import AgentConfig, ModelConfig, StepResult
9
+ from AutoGLM_GUI.logger import logger
10
+
8
11
  # 修复 Windows 编码问题 - 必须在所有其他导入之前
9
12
  if sys.platform == "win32":
10
13
  import codecs
@@ -58,3 +61,11 @@ try:
58
61
  __version__ = metadata.version("autoglm-gui")
59
62
  except metadata.PackageNotFoundError:
60
63
  __version__ = "unknown"
64
+
65
+ __all__ = [
66
+ "__version__",
67
+ "ModelConfig",
68
+ "AgentConfig",
69
+ "StepResult",
70
+ "logger",
71
+ ]
@@ -44,19 +44,25 @@ def find_available_port(
44
44
  )
45
45
 
46
46
 
47
- def open_browser(host: str, port: int, delay: float = 1.5) -> None:
47
+ def open_browser(
48
+ host: str, port: int, use_ssl: bool = False, delay: float = 1.5
49
+ ) -> None:
48
50
  """Open browser after a delay to ensure server is ready.
49
51
 
50
52
  Args:
51
53
  host: Server host
52
54
  port: Server port
55
+ use_ssl: Whether to use HTTPS
53
56
  delay: Delay in seconds before opening browser
54
57
  """
55
58
 
56
59
  def _open():
57
60
  time.sleep(delay)
61
+ protocol = "https" if use_ssl else "http"
58
62
  url = (
59
- f"http://127.0.0.1:{port}" if host == "0.0.0.0" else f"http://{host}:{port}"
63
+ f"{protocol}://127.0.0.1:{port}"
64
+ if host == "0.0.0.0"
65
+ else f"{protocol}://{host}:{port}"
60
66
  )
61
67
  try:
62
68
  webbrowser.open(url)
@@ -125,6 +131,16 @@ def main() -> None:
125
131
  action="store_true",
126
132
  help="Disable file logging",
127
133
  )
134
+ parser.add_argument(
135
+ "--ssl-keyfile",
136
+ default=None,
137
+ help="SSL key file path (for HTTPS)",
138
+ )
139
+ parser.add_argument(
140
+ "--ssl-certfile",
141
+ default=None,
142
+ help="SSL certificate file path (for HTTPS)",
143
+ )
128
144
 
129
145
  args = parser.parse_args()
130
146
 
@@ -140,7 +156,6 @@ def main() -> None:
140
156
  import uvicorn
141
157
 
142
158
  from AutoGLM_GUI import server
143
- from AutoGLM_GUI.config import config
144
159
  from AutoGLM_GUI.config_manager import config_manager
145
160
  from AutoGLM_GUI.logger import configure_logger
146
161
 
@@ -170,12 +185,12 @@ def main() -> None:
170
185
  # 5. 同步到环境变量(reload 模式需要)
171
186
  config_manager.sync_to_env()
172
187
 
173
- # 6. 刷新旧的 config 对象(保持现有代码兼容)
174
- config.refresh_from_env()
175
-
176
188
  # 获取配置来源
177
189
  config_source = config_manager.get_config_source()
178
190
 
191
+ # Determine if SSL is enabled
192
+ use_ssl = args.ssl_keyfile is not None and args.ssl_certfile is not None
193
+
179
194
  # Display startup banner
180
195
  print()
181
196
  print("=" * 50)
@@ -183,7 +198,8 @@ def main() -> None:
183
198
  print("=" * 50)
184
199
  print(f" Version: {__version__}")
185
200
  print()
186
- print(f" Server: http://{args.host}:{args.port}")
201
+ protocol = "https" if use_ssl else "http"
202
+ print(f" Server: {protocol}://{args.host}:{args.port}")
187
203
  print()
188
204
  print(" Model Configuration:")
189
205
  print(f" Source: {config_source.value}")
@@ -206,13 +222,15 @@ def main() -> None:
206
222
 
207
223
  # Open browser automatically unless disabled
208
224
  if not args.no_browser:
209
- open_browser(args.host, args.port)
225
+ open_browser(args.host, args.port, use_ssl=use_ssl)
210
226
 
211
227
  uvicorn.run(
212
228
  server.app if not args.reload else "AutoGLM_GUI.server:app",
213
229
  host=args.host,
214
230
  port=args.port,
215
231
  reload=args.reload,
232
+ ssl_keyfile=args.ssl_keyfile,
233
+ ssl_certfile=args.ssl_certfile,
216
234
  )
217
235
 
218
236
 
@@ -0,0 +1,6 @@
1
+ """Action system for executing phone operations."""
2
+
3
+ from .handler import ActionHandler
4
+ from .types import ActionResult
5
+
6
+ __all__ = ["ActionHandler", "ActionResult"]
@@ -0,0 +1,196 @@
1
+ """Action handler for executing phone operations."""
2
+
3
+ import time
4
+ from typing import Any, Callable
5
+
6
+ from AutoGLM_GUI.device_protocol import DeviceProtocol
7
+
8
+ from .types import ActionResult
9
+
10
+
11
+ class ActionHandler:
12
+ def __init__(
13
+ self,
14
+ device: DeviceProtocol,
15
+ confirmation_callback: Callable[[str], bool] | None = None,
16
+ takeover_callback: Callable[[str], None] | None = None,
17
+ ):
18
+ self.device = device
19
+ self.confirmation_callback = confirmation_callback or self._default_confirmation
20
+ self.takeover_callback = takeover_callback or self._default_takeover
21
+
22
+ def execute(
23
+ self, action: dict[str, Any], screen_width: int, screen_height: int
24
+ ) -> ActionResult:
25
+ action_type = action.get("_metadata")
26
+
27
+ if action_type == "finish":
28
+ return ActionResult(
29
+ success=True, should_finish=True, message=action.get("message")
30
+ )
31
+
32
+ if action_type != "do":
33
+ return ActionResult(
34
+ success=False,
35
+ should_finish=True,
36
+ message=f"Unknown action type: {action_type}",
37
+ )
38
+
39
+ action_name = action.get("action")
40
+ if not isinstance(action_name, str) or not action_name:
41
+ return ActionResult(
42
+ success=False,
43
+ should_finish=False,
44
+ message=f"Unknown action: {action_name}",
45
+ )
46
+
47
+ handler_method = self._get_handler(action_name)
48
+
49
+ if handler_method is None:
50
+ return ActionResult(
51
+ success=False,
52
+ should_finish=False,
53
+ message=f"Unknown action: {action_name}",
54
+ )
55
+
56
+ try:
57
+ return handler_method(action, screen_width, screen_height)
58
+ except Exception as e:
59
+ return ActionResult(
60
+ success=False, should_finish=False, message=f"Action failed: {e}"
61
+ )
62
+
63
+ def _get_handler(self, action_name: str) -> Callable | None:
64
+ handlers = {
65
+ "Launch": self._handle_launch,
66
+ "Tap": self._handle_tap,
67
+ "Type": self._handle_type,
68
+ "Type_Name": self._handle_type,
69
+ "Swipe": self._handle_swipe,
70
+ "Back": self._handle_back,
71
+ "Home": self._handle_home,
72
+ "Double Tap": self._handle_double_tap,
73
+ "Long Press": self._handle_long_press,
74
+ "Wait": self._handle_wait,
75
+ "Take_over": self._handle_takeover,
76
+ "Note": self._handle_note,
77
+ }
78
+ return handlers.get(action_name)
79
+
80
+ def _convert_relative_to_absolute(
81
+ self, element: list[int], screen_width: int, screen_height: int
82
+ ) -> tuple[int, int]:
83
+ x = int(element[0] / 1000 * screen_width)
84
+ y = int(element[1] / 1000 * screen_height)
85
+ return x, y
86
+
87
+ def _handle_launch(self, action: dict, width: int, height: int) -> ActionResult:
88
+ app_name = action.get("app")
89
+ if not app_name:
90
+ return ActionResult(False, False, "No app name specified")
91
+
92
+ success = self.device.launch_app(app_name)
93
+ if success:
94
+ return ActionResult(True, False)
95
+ return ActionResult(False, False, f"App not found: {app_name}")
96
+
97
+ def _handle_tap(self, action: dict, width: int, height: int) -> ActionResult:
98
+ element = action.get("element")
99
+ if not element:
100
+ return ActionResult(False, False, "No element coordinates")
101
+
102
+ x, y = self._convert_relative_to_absolute(element, width, height)
103
+
104
+ if "message" in action:
105
+ if not self.confirmation_callback(action["message"]):
106
+ return ActionResult(
107
+ success=False,
108
+ should_finish=True,
109
+ message="User cancelled sensitive operation",
110
+ )
111
+
112
+ self.device.tap(x, y)
113
+ return ActionResult(True, False)
114
+
115
+ def _handle_type(self, action: dict, width: int, height: int) -> ActionResult:
116
+ text = action.get("text", "")
117
+
118
+ original_ime = self.device.detect_and_set_adb_keyboard()
119
+ time.sleep(0.5)
120
+
121
+ self.device.clear_text()
122
+ time.sleep(0.3)
123
+
124
+ self.device.type_text(text)
125
+ time.sleep(0.5)
126
+
127
+ self.device.restore_keyboard(original_ime)
128
+ time.sleep(0.3)
129
+
130
+ return ActionResult(True, False)
131
+
132
+ def _handle_swipe(self, action: dict, width: int, height: int) -> ActionResult:
133
+ start = action.get("start")
134
+ end = action.get("end")
135
+
136
+ if not start or not end:
137
+ return ActionResult(False, False, "Missing swipe coordinates")
138
+
139
+ start_x, start_y = self._convert_relative_to_absolute(start, width, height)
140
+ end_x, end_y = self._convert_relative_to_absolute(end, width, height)
141
+
142
+ self.device.swipe(start_x, start_y, end_x, end_y)
143
+ return ActionResult(True, False)
144
+
145
+ def _handle_back(self, action: dict, width: int, height: int) -> ActionResult:
146
+ self.device.back()
147
+ return ActionResult(True, False)
148
+
149
+ def _handle_home(self, action: dict, width: int, height: int) -> ActionResult:
150
+ self.device.home()
151
+ return ActionResult(True, False)
152
+
153
+ def _handle_double_tap(self, action: dict, width: int, height: int) -> ActionResult:
154
+ element = action.get("element")
155
+ if not element:
156
+ return ActionResult(False, False, "No element coordinates")
157
+
158
+ x, y = self._convert_relative_to_absolute(element, width, height)
159
+ self.device.double_tap(x, y)
160
+ return ActionResult(True, False)
161
+
162
+ def _handle_long_press(self, action: dict, width: int, height: int) -> ActionResult:
163
+ element = action.get("element")
164
+ if not element:
165
+ return ActionResult(False, False, "No element coordinates")
166
+
167
+ x, y = self._convert_relative_to_absolute(element, width, height)
168
+ self.device.long_press(x, y)
169
+ return ActionResult(True, False)
170
+
171
+ def _handle_wait(self, action: dict, width: int, height: int) -> ActionResult:
172
+ duration_str = action.get("duration", "1 seconds")
173
+ try:
174
+ duration = float(duration_str.replace("seconds", "").strip())
175
+ except ValueError:
176
+ duration = 1.0
177
+
178
+ time.sleep(duration)
179
+ return ActionResult(True, False)
180
+
181
+ def _handle_takeover(self, action: dict, width: int, height: int) -> ActionResult:
182
+ message = action.get("message", "User intervention required")
183
+ self.takeover_callback(message)
184
+ return ActionResult(True, False)
185
+
186
+ def _handle_note(self, action: dict, width: int, height: int) -> ActionResult:
187
+ return ActionResult(True, False)
188
+
189
+ @staticmethod
190
+ def _default_confirmation(message: str) -> bool:
191
+ response = input(f"\n⚠️ Confirm action: {message} (y/n): ")
192
+ return response.lower() in ("y", "yes")
193
+
194
+ @staticmethod
195
+ def _default_takeover(message: str) -> None:
196
+ input(f"\n🤚 {message}. Press Enter to continue...")
@@ -0,0 +1,15 @@
1
+ """Type definitions for actions."""
2
+
3
+ from dataclasses import dataclass
4
+ from typing import Any
5
+
6
+
7
+ @dataclass
8
+ class ActionResult:
9
+ success: bool
10
+ should_finish: bool
11
+ message: str | None = None
12
+ requires_confirmation: bool = False
13
+
14
+
15
+ Action = dict[str, Any]
@@ -0,0 +1,53 @@
1
+ from AutoGLM_GUI.adb.apps import APP_PACKAGES, get_app_name, get_package_name
2
+ from AutoGLM_GUI.adb.connection import (
3
+ ADBConnection,
4
+ ConnectionType,
5
+ DeviceInfo,
6
+ list_devices,
7
+ quick_connect,
8
+ )
9
+ from AutoGLM_GUI.adb.device import (
10
+ back,
11
+ double_tap,
12
+ get_current_app,
13
+ home,
14
+ launch_app,
15
+ long_press,
16
+ swipe,
17
+ tap,
18
+ )
19
+ from AutoGLM_GUI.adb.input import (
20
+ clear_text,
21
+ detect_and_set_adb_keyboard,
22
+ restore_keyboard,
23
+ type_text,
24
+ )
25
+ from AutoGLM_GUI.adb.screenshot import Screenshot, get_screenshot
26
+ from AutoGLM_GUI.adb.timing import TIMING_CONFIG, TimingConfig
27
+
28
+ __all__ = [
29
+ "ADBConnection",
30
+ "ConnectionType",
31
+ "DeviceInfo",
32
+ "list_devices",
33
+ "quick_connect",
34
+ "TIMING_CONFIG",
35
+ "TimingConfig",
36
+ "APP_PACKAGES",
37
+ "get_package_name",
38
+ "get_app_name",
39
+ "tap",
40
+ "double_tap",
41
+ "long_press",
42
+ "swipe",
43
+ "back",
44
+ "home",
45
+ "launch_app",
46
+ "get_current_app",
47
+ "type_text",
48
+ "clear_text",
49
+ "detect_and_set_adb_keyboard",
50
+ "restore_keyboard",
51
+ "Screenshot",
52
+ "get_screenshot",
53
+ ]