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.
Files changed (135) hide show
  1. AutoGLM_GUI/__init__.py +11 -0
  2. AutoGLM_GUI/__main__.py +26 -4
  3. AutoGLM_GUI/actions/__init__.py +6 -0
  4. phone_agent/actions/handler_ios.py → AutoGLM_GUI/actions/handler.py +30 -112
  5. AutoGLM_GUI/actions/types.py +15 -0
  6. {phone_agent → AutoGLM_GUI}/adb/__init__.py +25 -23
  7. {phone_agent → AutoGLM_GUI}/adb/connection.py +5 -40
  8. {phone_agent → AutoGLM_GUI}/adb/device.py +12 -94
  9. {phone_agent → AutoGLM_GUI}/adb/input.py +6 -47
  10. AutoGLM_GUI/adb/screenshot.py +11 -0
  11. {phone_agent/config → AutoGLM_GUI/adb}/timing.py +1 -1
  12. AutoGLM_GUI/adb_plus/keyboard_installer.py +4 -2
  13. AutoGLM_GUI/adb_plus/screenshot.py +22 -1
  14. AutoGLM_GUI/adb_plus/serial.py +38 -20
  15. AutoGLM_GUI/adb_plus/touch.py +4 -9
  16. AutoGLM_GUI/agents/__init__.py +43 -12
  17. AutoGLM_GUI/agents/events.py +19 -0
  18. AutoGLM_GUI/agents/factory.py +31 -38
  19. AutoGLM_GUI/agents/glm/__init__.py +7 -0
  20. AutoGLM_GUI/agents/glm/agent.py +297 -0
  21. AutoGLM_GUI/agents/glm/message_builder.py +81 -0
  22. AutoGLM_GUI/agents/glm/parser.py +110 -0
  23. {phone_agent/config → AutoGLM_GUI/agents/glm}/prompts_en.py +7 -9
  24. {phone_agent/config → AutoGLM_GUI/agents/glm}/prompts_zh.py +18 -25
  25. AutoGLM_GUI/agents/mai/__init__.py +28 -0
  26. AutoGLM_GUI/agents/mai/agent.py +408 -0
  27. AutoGLM_GUI/agents/mai/parser.py +254 -0
  28. AutoGLM_GUI/agents/mai/prompts.py +103 -0
  29. AutoGLM_GUI/agents/mai/traj_memory.py +91 -0
  30. AutoGLM_GUI/agents/protocols.py +12 -8
  31. AutoGLM_GUI/agents/stream_runner.py +193 -0
  32. AutoGLM_GUI/api/__init__.py +40 -21
  33. AutoGLM_GUI/api/agents.py +181 -239
  34. AutoGLM_GUI/api/control.py +9 -6
  35. AutoGLM_GUI/api/devices.py +102 -12
  36. AutoGLM_GUI/api/history.py +104 -0
  37. AutoGLM_GUI/api/layered_agent.py +67 -15
  38. AutoGLM_GUI/api/media.py +64 -1
  39. AutoGLM_GUI/api/scheduled_tasks.py +98 -0
  40. AutoGLM_GUI/config.py +81 -0
  41. AutoGLM_GUI/config_manager.py +68 -51
  42. AutoGLM_GUI/device_manager.py +248 -29
  43. AutoGLM_GUI/device_protocol.py +1 -1
  44. AutoGLM_GUI/devices/adb_device.py +5 -10
  45. AutoGLM_GUI/devices/mock_device.py +4 -2
  46. AutoGLM_GUI/devices/remote_device.py +8 -3
  47. AutoGLM_GUI/history_manager.py +164 -0
  48. AutoGLM_GUI/model/__init__.py +5 -0
  49. AutoGLM_GUI/model/message_builder.py +69 -0
  50. AutoGLM_GUI/model/types.py +24 -0
  51. AutoGLM_GUI/models/__init__.py +10 -0
  52. AutoGLM_GUI/models/history.py +140 -0
  53. AutoGLM_GUI/models/scheduled_task.py +71 -0
  54. AutoGLM_GUI/parsers/__init__.py +22 -0
  55. AutoGLM_GUI/parsers/base.py +50 -0
  56. AutoGLM_GUI/parsers/phone_parser.py +58 -0
  57. AutoGLM_GUI/phone_agent_manager.py +62 -396
  58. AutoGLM_GUI/platform_utils.py +26 -0
  59. AutoGLM_GUI/prompt_config.py +15 -0
  60. AutoGLM_GUI/prompts/__init__.py +32 -0
  61. AutoGLM_GUI/scheduler_manager.py +350 -0
  62. AutoGLM_GUI/schemas.py +246 -72
  63. AutoGLM_GUI/scrcpy_stream.py +142 -24
  64. AutoGLM_GUI/socketio_server.py +100 -27
  65. AutoGLM_GUI/static/assets/{about-_XNhzQZX.js → about-CfwX1Cmc.js} +1 -1
  66. AutoGLM_GUI/static/assets/alert-dialog-CtGlN2IJ.js +1 -0
  67. AutoGLM_GUI/static/assets/chat-BYa-foUI.js +129 -0
  68. AutoGLM_GUI/static/assets/circle-alert-t08bEMPO.js +1 -0
  69. AutoGLM_GUI/static/assets/dialog-FNwZJFwk.js +45 -0
  70. AutoGLM_GUI/static/assets/eye-D0UPWCWC.js +1 -0
  71. AutoGLM_GUI/static/assets/history-CRo95B7i.js +1 -0
  72. AutoGLM_GUI/static/assets/{index-Cy8TmmHV.js → index-BaLMSqd3.js} +1 -1
  73. AutoGLM_GUI/static/assets/index-CTHbFvKl.js +11 -0
  74. AutoGLM_GUI/static/assets/index-CV7jGxGm.css +1 -0
  75. AutoGLM_GUI/static/assets/label-DJFevVmr.js +1 -0
  76. AutoGLM_GUI/static/assets/logs-RW09DyYY.js +1 -0
  77. AutoGLM_GUI/static/assets/popover--JTJrE5v.js +1 -0
  78. AutoGLM_GUI/static/assets/scheduled-tasks-DTRKsQXF.js +1 -0
  79. AutoGLM_GUI/static/assets/square-pen-CPK_K680.js +1 -0
  80. AutoGLM_GUI/static/assets/textarea-PRmVnWq5.js +1 -0
  81. AutoGLM_GUI/static/assets/workflows-CdcsAoaT.js +1 -0
  82. AutoGLM_GUI/static/index.html +2 -2
  83. AutoGLM_GUI/types.py +17 -0
  84. {autoglm_gui-1.4.1.dist-info → autoglm_gui-1.5.1.dist-info}/METADATA +179 -130
  85. autoglm_gui-1.5.1.dist-info/RECORD +118 -0
  86. AutoGLM_GUI/agents/mai_adapter.py +0 -627
  87. AutoGLM_GUI/api/dual_model.py +0 -317
  88. AutoGLM_GUI/device_adapter.py +0 -263
  89. AutoGLM_GUI/dual_model/__init__.py +0 -53
  90. AutoGLM_GUI/dual_model/decision_model.py +0 -664
  91. AutoGLM_GUI/dual_model/dual_agent.py +0 -917
  92. AutoGLM_GUI/dual_model/protocols.py +0 -354
  93. AutoGLM_GUI/dual_model/vision_model.py +0 -442
  94. AutoGLM_GUI/mai_ui_adapter/agent_wrapper.py +0 -291
  95. AutoGLM_GUI/phone_agent_patches.py +0 -147
  96. AutoGLM_GUI/static/assets/chat-DwJpiAWf.js +0 -126
  97. AutoGLM_GUI/static/assets/dialog-B3uW4T8V.js +0 -45
  98. AutoGLM_GUI/static/assets/index-Cpv2gSF1.css +0 -1
  99. AutoGLM_GUI/static/assets/index-UYYauTly.js +0 -12
  100. AutoGLM_GUI/static/assets/workflows-Du_de-dt.js +0 -1
  101. autoglm_gui-1.4.1.dist-info/RECORD +0 -117
  102. mai_agent/base.py +0 -137
  103. mai_agent/mai_grounding_agent.py +0 -263
  104. mai_agent/mai_naivigation_agent.py +0 -526
  105. mai_agent/prompt.py +0 -148
  106. mai_agent/unified_memory.py +0 -67
  107. mai_agent/utils.py +0 -73
  108. phone_agent/__init__.py +0 -12
  109. phone_agent/actions/__init__.py +0 -5
  110. phone_agent/actions/handler.py +0 -400
  111. phone_agent/adb/screenshot.py +0 -108
  112. phone_agent/agent.py +0 -253
  113. phone_agent/agent_ios.py +0 -277
  114. phone_agent/config/__init__.py +0 -53
  115. phone_agent/config/apps_harmonyos.py +0 -256
  116. phone_agent/config/apps_ios.py +0 -339
  117. phone_agent/config/prompts.py +0 -80
  118. phone_agent/device_factory.py +0 -166
  119. phone_agent/hdc/__init__.py +0 -53
  120. phone_agent/hdc/connection.py +0 -384
  121. phone_agent/hdc/device.py +0 -269
  122. phone_agent/hdc/input.py +0 -145
  123. phone_agent/hdc/screenshot.py +0 -127
  124. phone_agent/model/__init__.py +0 -5
  125. phone_agent/model/client.py +0 -290
  126. phone_agent/xctest/__init__.py +0 -47
  127. phone_agent/xctest/connection.py +0 -379
  128. phone_agent/xctest/device.py +0 -472
  129. phone_agent/xctest/input.py +0 -311
  130. phone_agent/xctest/screenshot.py +0 -226
  131. {phone_agent/config → AutoGLM_GUI/adb}/apps.py +0 -0
  132. {phone_agent/config → AutoGLM_GUI}/i18n.py +0 -0
  133. {autoglm_gui-1.4.1.dist-info → autoglm_gui-1.5.1.dist-info}/WHEEL +0 -0
  134. {autoglm_gui-1.4.1.dist-info → autoglm_gui-1.5.1.dist-info}/entry_points.txt +0 -0
  135. {autoglm_gui-1.4.1.dist-info → autoglm_gui-1.5.1.dist-info}/licenses/LICENSE +0 -0
@@ -1 +0,0 @@
1
- import{c as D,u as S,r as t,l as b,j as e,B as r,d as W,a as F,b as T}from"./index-UYYauTly.js";import{P as E,L as f,C as L,a as P,b as z,c as H,T as I,D as q,d as B,e as M,f as _,g as j,I as O,h as R,i as A}from"./dialog-B3uW4T8V.js";const G=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],J=D("square-pen",G);function U(){const s=S(),[m,g]=t.useState([]),[p,x]=t.useState(!0),[k,o]=t.useState(!1),[c,h]=t.useState(null),[l,i]=t.useState({name:"",text:""}),[w,u]=t.useState(!1);t.useEffect(()=>{d()},[]);const d=async()=>{try{x(!0);const a=await b();g(a.workflows)}catch(a){console.error("Failed to load workflows:",a)}finally{x(!1)}},v=()=>{h(null),i({name:"",text:""}),o(!0)},N=a=>{h(a),i({name:a.name,text:a.text}),o(!0)},C=async()=>{try{u(!0),c?await F(c.uuid,l):await T(l),o(!1),d()}catch(a){console.error("Failed to save workflow:",a)}finally{u(!1)}},y=async a=>{if(window.confirm(s.workflows.deleteConfirm))try{await W(a),d()}catch(n){console.error("Failed to delete workflow:",n)}};return e.jsxs("div",{className:"container mx-auto p-6 max-w-7xl",children:[e.jsxs("div",{className:"flex justify-between items-center mb-6",children:[e.jsx("h1",{className:"text-3xl font-bold",children:s.workflows.title}),e.jsxs(r,{onClick:v,children:[e.jsx(E,{className:"w-4 h-4 mr-2"}),s.workflows.createNew]})]}),p?e.jsx("div",{className:"flex justify-center items-center h-64",children:e.jsx(f,{className:"w-8 h-8 animate-spin text-slate-400"})}):m.length===0?e.jsx("div",{className:"text-center py-12",children:e.jsx("p",{className:"text-slate-500 dark:text-slate-400",children:s.workflows.empty})}):e.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:m.map(a=>e.jsxs(L,{className:"hover:shadow-md transition-shadow",children:[e.jsx(P,{children:e.jsx(z,{className:"text-lg",children:a.name})}),e.jsxs(H,{children:[e.jsx("p",{className:"text-sm text-slate-600 dark:text-slate-400 mb-4 line-clamp-3",children:a.text}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(r,{variant:"outline",size:"sm",onClick:()=>N(a),children:[e.jsx(J,{className:"w-3 h-3 mr-1"}),s.common.edit]}),e.jsxs(r,{variant:"destructive",size:"sm",onClick:()=>y(a.uuid),children:[e.jsx(I,{className:"w-3 h-3 mr-1"}),s.common.delete]})]})]})]},a.uuid))}),e.jsx(q,{open:k,onOpenChange:o,children:e.jsxs(B,{className:"sm:max-w-[600px]",children:[e.jsx(M,{children:e.jsx(_,{children:c?s.workflows.edit:s.workflows.create})}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(j,{htmlFor:"name",children:s.workflows.name}),e.jsx(O,{id:"name",value:l.name,onChange:a=>i(n=>({...n,name:a.target.value})),placeholder:s.workflows.namePlaceholder})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(j,{htmlFor:"text",children:s.workflows.text}),e.jsx(R,{id:"text",value:l.text,onChange:a=>i(n=>({...n,text:a.target.value})),placeholder:s.workflows.textPlaceholder,rows:6,className:"resize-none !rounded-lg"})]})]}),e.jsxs(A,{children:[e.jsx(r,{variant:"outline",onClick:()=>o(!1),children:s.common.cancel}),e.jsx(r,{onClick:C,disabled:!l.name.trim()||!l.text.trim()||w,children:w?e.jsxs(e.Fragment,{children:[e.jsx(f,{className:"w-4 h-4 mr-2 animate-spin"}),s.common.loading]}):s.common.save})]})]})})]})}export{U as component};
@@ -1,117 +0,0 @@
1
- AutoGLM_GUI/__init__.py,sha256=ic002QIj6sw9cyhh7e_60DFIb7omtPcF01-L6M4lllM,2176
2
- AutoGLM_GUI/__main__.py,sha256=ygs0rleqyOdDOZBVc7eZoPOjrVmAwKptYjeWOwTtvMc,6251
3
- AutoGLM_GUI/config_manager.py,sha256=Jy10Ka5A-c7Hq94zc3nPUXjV6uqgXW2Dqhip4TG7yz4,23603
4
- AutoGLM_GUI/device_adapter.py,sha256=eA0bOlU-lzJig9cNCZrS0FqApEVbSOg7oke5P1iJ1rA,9011
5
- AutoGLM_GUI/device_manager.py,sha256=dAHP29a63H6GY43f715dOlJdwOz1eWa2XnPf2_SbIiY,26923
6
- AutoGLM_GUI/device_protocol.py,sha256=PyjCckBz8dtU6XUSqLy2epYbIsREoA4xcfOLktYEFNo,6919
7
- AutoGLM_GUI/exceptions.py,sha256=QXTQzxdbEHDUrtaD1G4zuKZydFJO5ymNvuo8ZvVjUdA,3487
8
- AutoGLM_GUI/logger.py,sha256=wLzjbRqsHAsOtI9yB0bcUZFVzgGK6qM8330std6FjVw,2553
9
- AutoGLM_GUI/metrics.py,sha256=L72hzMNzw1eemQLz6Hoth5sRW6OQlI4Np5BIFSFwl1c,8994
10
- AutoGLM_GUI/phone_agent_manager.py,sha256=6ySHfglvMqXv8lLPAKoTE59Mi_8NLWjlAJ63ejQx0Ms,32573
11
- AutoGLM_GUI/phone_agent_patches.py,sha256=xbuD7rBVPyCQ7wMb4MNW-cvSDIdtup7pJT_KvB88foM,4948
12
- AutoGLM_GUI/platform_utils.py,sha256=fAu_3rHYVlIpDxs09eCkJBUI5_qb2_cHu1si6FuuM1U,2448
13
- AutoGLM_GUI/prompts.py,sha256=lC5UktW0KRpWKij6T0GG1OrNKV9gAfM6dUcp_tjX7mo,4814
14
- AutoGLM_GUI/schemas.py,sha256=udgl1SY5c3EbklkSQKrLRu257Wf6w4IFC6S1MmN_mp0,17707
15
- AutoGLM_GUI/scrcpy_protocol.py,sha256=h6AtAGq3zMM30FWM7EYiYKJz7BDikpNCOjcKtFcRx3s,997
16
- AutoGLM_GUI/scrcpy_stream.py,sha256=LScxoEXDQu-Vn3TeG5y0fJ4Z66kMVOUdCkrgYq_tTlc,16913
17
- AutoGLM_GUI/server.py,sha256=Fo2Afl6CFT5B6MBggvR0n_savNxqxW22bFdN51NXRJs,299
18
- AutoGLM_GUI/socketio_server.py,sha256=ekEyyuIR1CwREDhDyGhIu8wxJ9S42Cemrf4fOdRxNKs,3826
19
- AutoGLM_GUI/state.py,sha256=qGnqZKdWFDpegVBLB4KHDbzfAVWc89C0AiCum_R9LSk,912
20
- AutoGLM_GUI/types.py,sha256=LEheZvDfeBrR2Hh_bEwRx3x_8qNDlEV7t8-9ymzzjFE,2532
21
- AutoGLM_GUI/version.py,sha256=z0MPXu-k9UO7RXxVGcAwim2M3yklrRqLwgOq66zSdzo,178
22
- AutoGLM_GUI/workflow_manager.py,sha256=AZ_zrhSeEvtlF1HTNMNS3f4qBwRuX-bzImdZEVZVXV8,5552
23
- AutoGLM_GUI/adb_plus/__init__.py,sha256=YwYYbeMrsKv8BGPcD6dv0PB8-wW93Ik9pMHo02i8QoU,945
24
- AutoGLM_GUI/adb_plus/device.py,sha256=nCMDUd18LPfl5CsJeDjKd9HSt6FFOy2jS1muOSeLO08,1683
25
- AutoGLM_GUI/adb_plus/ip.py,sha256=dt6ffIjiW_jGoEqUKUDi9fRGbWN1W9LxfT8rWIqgS-0,2200
26
- AutoGLM_GUI/adb_plus/keyboard_installer.py,sha256=dsQqLgWd2kkTeljdTTT77mFwJpcM-IJecMcJJEutbHo,13541
27
- AutoGLM_GUI/adb_plus/mdns.py,sha256=AwQ4MQsPKVW1tPjIUpOWvBQGlJxvVrO9eTvxoqsgPUo,5862
28
- AutoGLM_GUI/adb_plus/pair.py,sha256=3UElG0yjylhmZBtPpDER2BNMZs9CwDeavjuQOwOC4sw,1945
29
- AutoGLM_GUI/adb_plus/qr_pair.py,sha256=WHvx76q2xfTnJPXf5y_qI9cNuiBC_KeWwqYpuROdPkw,13571
30
- AutoGLM_GUI/adb_plus/screenshot.py,sha256=pr7BpmUcGZO9rthpDeMRn4D1oAGX9aEEVL3ZnTQzrIo,3211
31
- AutoGLM_GUI/adb_plus/serial.py,sha256=lDbBXTIoOJ5lbFj50K5X7PZnfpKt1vRpFiWVjolfEhQ,3142
32
- AutoGLM_GUI/adb_plus/touch.py,sha256=7cyMon9nOd6zQvZdHK7BHWoRLLWkdK-qWfTuSFfFzJA,2301
33
- AutoGLM_GUI/adb_plus/version.py,sha256=u5u1N40izJceeORN9kFhyz0wq_hZtlwBXaiytfA3px8,2428
34
- AutoGLM_GUI/agents/__init__.py,sha256=-LiMODXhqyXEcsMLOMGgnAhn8xIGokzWE4RyfZVcx_4,430
35
- AutoGLM_GUI/agents/factory.py,sha256=3_hmikWufNBHn-eg1rLAWqe9mPBYpzTBeNDADPOMoIY,4969
36
- AutoGLM_GUI/agents/mai_adapter.py,sha256=rUxw1LtHtKtfhLUDbQdbKWlsDMirNqAwBdpwH7wf2nY,21132
37
- AutoGLM_GUI/agents/protocols.py,sha256=3x3xutUZpF4BFXj0kwp8ZbGA39IIMSU9ymTtDnuoBfs,559
38
- AutoGLM_GUI/api/__init__.py,sha256=GtfuNa-G6SdeWD5_Zj99hvkXiKPYOZ3_YTysrtrGpSk,5420
39
- AutoGLM_GUI/api/agents.py,sha256=GtAwiakLxI3fAOaFmNfYerNw-QsUFmiIVb1INAWrJS8,20661
40
- AutoGLM_GUI/api/control.py,sha256=G-7hfdqTl5fq-UXOwE2CI_HMbfmRH1Vd589t2FTNZyY,3155
41
- AutoGLM_GUI/api/devices.py,sha256=Z_DAPrsPo9DhZSZl29yFGF_ml6obZNQDI-p4Co9oXGI,11088
42
- AutoGLM_GUI/api/dual_model.py,sha256=PYKM9pDcSWpRMwko0aBJ5M8ekkGd9c98YiMoPQ9Jg0k,10648
43
- AutoGLM_GUI/api/health.py,sha256=ZedFUv-IHst_YUyeQ_MpL5JXOKuOhWVlHBVwAY3MM0I,266
44
- AutoGLM_GUI/api/layered_agent.py,sha256=Ts8R5i11woTFHHHUlAOATb5xRVy3TY9MSwfte3iUsSI,26297
45
- AutoGLM_GUI/api/mcp.py,sha256=ppqzBxiS_8tUeJ5P8AszH_4m6q0sNe0oT2SCU_uISks,4625
46
- AutoGLM_GUI/api/media.py,sha256=Ioncwd68CNkYvqmeTJJ3P5I1rjWfw6PM4WPz5Ixx8vI,1631
47
- AutoGLM_GUI/api/metrics.py,sha256=2h5MnUiMTRAshD6nvcarLVoSlOjtlyVAGg-LRXq03vQ,941
48
- AutoGLM_GUI/api/version.py,sha256=DYiSNNykJsxOXO1zvf3w5AcAtQJTs2c-qtA1HRVihx0,6085
49
- AutoGLM_GUI/api/workflows.py,sha256=waYwlm2HxwkcfZwp7Bm2Z2l_bms6UmOy2xJEU9B_t0s,2431
50
- AutoGLM_GUI/devices/__init__.py,sha256=3RHDxS3feJ1jGdWbDKeOHSFUogmexcEr9lpcXWhlnjg,1471
51
- AutoGLM_GUI/devices/adb_device.py,sha256=9xOMQupSdtnr-wxJRcWhzfjisrwUNCrjxoi8LoMuweM,6406
52
- AutoGLM_GUI/devices/mock_device.py,sha256=Fnf9q-tjdqUZ-jKRf2cGbguAWAQhWr3qwVcFC4E4FCo,5700
53
- AutoGLM_GUI/devices/remote_device.py,sha256=x5MDsHwYj5YHR9KBPfjntJA8W8jpKoJwZ4vxslZFYUE,5566
54
- AutoGLM_GUI/dual_model/__init__.py,sha256=EQSMFAZ4NvZZywfnEJtDT9JrBJ4KuKWtGUHX4KcJIyY,1179
55
- AutoGLM_GUI/dual_model/decision_model.py,sha256=4UPTFikplV1GDnKEJNxNTMEXfgB2wjnstYL-yGXaI2g,21925
56
- AutoGLM_GUI/dual_model/dual_agent.py,sha256=HIw6Z5Ae9UH5-JEk9IPI2ry4uodvN-qdUQSIYrU0ecc,31574
57
- AutoGLM_GUI/dual_model/protocols.py,sha256=CZEqXUgsCoBeq7u1Ne43R031BjojGHvsZgvZqVn7Dh0,10534
58
- AutoGLM_GUI/dual_model/vision_model.py,sha256=Vaj-BVWVZpedUbAVr-dl-eXUQ2IHaQpo0P1AIBuTvdg,14440
59
- AutoGLM_GUI/mai_ui_adapter/agent_wrapper.py,sha256=6VZqsPlRHthjf0Q5tJzH7RqNc-zdrRryPnKPCyyJVkY,9322
60
- AutoGLM_GUI/static/favicon.ico,sha256=uB4wrcENiFaF-K4V-FzNp51XLW8GC4-ujpBDHgISfGM,781
61
- AutoGLM_GUI/static/index.html,sha256=8GRBiZjc-NI6PxboyyZ8QmZrGtGIrb2Y41tbWR3w8TE,761
62
- AutoGLM_GUI/static/logo-192.png,sha256=FOXgZxFrN0ZleO0VjlCnvD5cDkd1okJPkwPDZqsflNs,35243
63
- AutoGLM_GUI/static/logo-512.png,sha256=HlwSg09dQ3_Jtb09Ght4l2VK3YNLZlP_941LCdpDkWk,251598
64
- AutoGLM_GUI/static/assets/about-_XNhzQZX.js,sha256=SmhdB_v2cKcfR7bxET7KdyIAIR7-zR2aAAPrQl-OZgo,155
65
- AutoGLM_GUI/static/assets/chat-DwJpiAWf.js,sha256=YWM2KdefYkk3dvykyrhN1_kOt5p9aBPdDh2tL9Txs20,321638
66
- AutoGLM_GUI/static/assets/dialog-B3uW4T8V.js,sha256=ZVyV1aFhZSgX4eNo7QXs1EgPY7zxjnzIY1jLCH491A4,27378
67
- AutoGLM_GUI/static/assets/index-Cpv2gSF1.css,sha256=k7xMpqu3sXEnofUa3E6k2dI76d3lRRlBZbCBZml3Xos,80508
68
- AutoGLM_GUI/static/assets/index-Cy8TmmHV.js,sha256=BOHPeP6BPgHKbLar3Q357uWM_mkYSpHXpZrOsGkXijg,229
69
- AutoGLM_GUI/static/assets/index-UYYauTly.js,sha256=y0cmKh3RwdWH85mKmevbxyr9czFvIYGQLpdODbfOgwY,389521
70
- AutoGLM_GUI/static/assets/logo-Cyfm06Ym.png,sha256=6GRUFH2KNmB4ZmnrmJ1wxpoIYEmOW-__XlmKImyAMKM,4955675
71
- AutoGLM_GUI/static/assets/worker-D6BRitjy.js,sha256=RL1NIRIks9dXdDhXOHK1cCg-OELT0uv9a6u_UEHfQ0Q,173494
72
- AutoGLM_GUI/static/assets/workflows-Du_de-dt.js,sha256=f9FeE4WAt69qNniqvi5i71iU-PbkVxzpoCrTwNYxrys,3459
73
- phone_agent/__init__.py,sha256=7sCmGiY-ePdb6L08MGG6DkOiu8goop6wq-v2SiM62tE,360
74
- phone_agent/agent.py,sha256=1SgHpv70_XbujG1ElYRZbvRO5-d4l7gBgiFRBz_FIH8,8157
75
- phone_agent/agent_ios.py,sha256=R7EBsoHVghEUBtI5TB7M0_btpFcb4NHquMNxktrqrJE,9338
76
- phone_agent/device_factory.py,sha256=x_zsU2SNk4kh_OQafBoAfvH6nmMLCP-koqUUvcjNBhg,5027
77
- phone_agent/actions/__init__.py,sha256=YiAMeBMVhRfmDOf0hQ_1FEBSV5ApcnHPQ05gHjA_weQ,160
78
- phone_agent/actions/handler.py,sha256=QsRWS3RB_CQxdSmoNFNsmSe58j3__D0yDYB52mcmNN8,15640
79
- phone_agent/actions/handler_ios.py,sha256=YmK-QabWqCTHBemNJFGnEqDZO5Zhu05KBEvuyBNYLB8,10223
80
- phone_agent/adb/__init__.py,sha256=w3CBSGRv-cQPME-Q-Bx2tbL_WJkpb9RqmT2olNK9TZw,950
81
- phone_agent/adb/connection.py,sha256=Epmghk079HcDCqOYARIv8u1kb_oit1Y8rxRhBlqr0z0,10344
82
- phone_agent/adb/device.py,sha256=NRZAT9b8wT1wRJzV6176fMYxgmACkwyl0ASoEs3Id8g,6686
83
- phone_agent/adb/input.py,sha256=Yr-5oXcYITkPl8humom7k5eakS3OMVPilj-N0veeCQQ,2857
84
- phone_agent/adb/screenshot.py,sha256=FgPH6WgFBxU7JPgWpaCgQbltcm4LvhIoTmR5X5rm0yM,3161
85
- phone_agent/config/__init__.py,sha256=mtVL2HYW5r5UrGejCsTDefXTnLvpfxrJouvfqc2JaS8,1322
86
- phone_agent/config/apps.py,sha256=D9HcsGzqwJL3g1ZRS4_Iq4WjviijDDEtkBJlV4-TSjE,8774
87
- phone_agent/config/apps_harmonyos.py,sha256=z2QN6O7NPe87ta4EAPs6s4PAC74SPPXlXXz6fTkAXhY,10606
88
- phone_agent/config/apps_ios.py,sha256=CrOEDnPyG7T2qF_lS3SDlXjhbJPwDKI61_yOrggernc,11481
89
- phone_agent/config/i18n.py,sha256=-x8yD5ywyK7xwjoI-pOYqPlSeId_W9KkVjmKayr36m0,2501
90
- phone_agent/config/prompts.py,sha256=0XKS_LrXthPB_bAXUT3ezsyr7UlwJNR2i4FLdEuticQ,8444
91
- phone_agent/config/prompts_en.py,sha256=t8C9YLailtg8kVlFtYvq3t9EdtMGE8HastTfDh5BAUM,2630
92
- phone_agent/config/prompts_zh.py,sha256=oOd5wJz-_P9ZF3F8hIPPrwjXdgv0sIgH7aop94eOTKM,8603
93
- phone_agent/config/timing.py,sha256=bT-5HKGovzY_95wxRGIhmHyrIIPqhWivsXg-0LWc2pM,5793
94
- phone_agent/hdc/__init__.py,sha256=6Olk6ujXQovtzmRLXk5MIqbwffxleSQnoHYvCO4G1Ww,996
95
- phone_agent/hdc/connection.py,sha256=TweQ417wU2M35mgddK_Xt92zn5tZ0K7vtsaQjLn_e1o,11326
96
- phone_agent/hdc/device.py,sha256=-tOXttrO2oGNFWg5dIGDgEEwa_jfesFTzpgTQJqlYik,7598
97
- phone_agent/hdc/input.py,sha256=28TcK1FK1-4qpqbR3_vdjHc-l75en85EGI3rDpPy4rE,4901
98
- phone_agent/hdc/screenshot.py,sha256=sD21nGQidt9_S7nMXDZ3qMl8A2m7Q95nkwJD8vD-9Nc,4099
99
- phone_agent/model/__init__.py,sha256=w6yFkla9VoUvX5vZkTWa7Z5Bg5_lfA9AajrLjZsdL24,149
100
- phone_agent/model/client.py,sha256=vpkWoqJUETd4a9P2fQHJAMdhVDQoALyByb9bpTgDPfY,9707
101
- phone_agent/xctest/__init__.py,sha256=AKIwp6UfoaNdDvDveAp_v5h5UQPxU-PQTefMpfayzj0,881
102
- phone_agent/xctest/connection.py,sha256=m2lT9aNZgknDzItPoA7KOiFaDVOPqx4Imdhl6GcHx20,10833
103
- phone_agent/xctest/device.py,sha256=sOAPMoliMIabcrtsmzuGDKnZXtitqlc0lo8RSjQta7A,13655
104
- phone_agent/xctest/input.py,sha256=aMp1YCRGBtGsRMKhA9rrjxuLkri0_k3n6hisi0EBJ2o,8164
105
- phone_agent/xctest/screenshot.py,sha256=H6dsQGgf38h8dvuSeigiR2Qr8NucPanIgTK8kjlV9hA,6027
106
- mai_agent/base.py,sha256=hYjGQXe_qguYkGq2qVWVO_xzsLzNqayA-dox_usCCM0,4546
107
- mai_agent/mai_grounding_agent.py,sha256=d1X6giinaFVnTtKwh7oFktGZCkDjUySLb22toItykxM,8664
108
- mai_agent/mai_naivigation_agent.py,sha256=7oA_mjxHfUEYEz2-oLdCEIImNQvAK-V4ADIMCqPPM2s,18264
109
- mai_agent/prompt.py,sha256=Zgnj5JmVhCGjgM0sB-q19q0G76OCcNdffLypmwxRdl8,7111
110
- mai_agent/unified_memory.py,sha256=AqEux-0I2WUIQOaY_yCRi-MDuU1BuY6dEWgClQETnEk,2194
111
- mai_agent/utils.py,sha256=oJ50FEOM13-NwPHY4ttQ0tH49GS-w2TEy1_1FMCaxLg,2304
112
- scrcpy-server-v3.3.3,sha256=fnAyO6fyWWSd1KzOl6xP77roECssbZHi575hP9U1S-A,90164
113
- autoglm_gui-1.4.1.dist-info/METADATA,sha256=OCTjbmz6oXyvTATdzv7nuSF87wxvZnD3WHUDJhDKkK0,20387
114
- autoglm_gui-1.4.1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
115
- autoglm_gui-1.4.1.dist-info/entry_points.txt,sha256=sz4rBO_kgrYmOiT0QnhCCv0b9QqBdWyCjugJgY8AEOI,58
116
- autoglm_gui-1.4.1.dist-info/licenses/LICENSE,sha256=0IkSHDewdtmXnmYzTNq4U47EJYjTuhjQNpT0bZKuqWc,11342
117
- autoglm_gui-1.4.1.dist-info/RECORD,,
mai_agent/base.py DELETED
@@ -1,137 +0,0 @@
1
- # Copyright (c) 2025, Alibaba Cloud and its affiliates;
2
- # Licensed under the Apache License, Version 2.0 (the "License");
3
- # you may not use this file except in compliance with the License.
4
- # You may obtain a copy of the License at
5
- #
6
- # http://www.apache.org/licenses/LICENSE-2.0
7
- #
8
- # Unless required by applicable law or agreed to in writing, software
9
- # distributed under the License is distributed on an "AS IS" BASIS,
10
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
- # See the License for the specific language governing permissions and
12
- # limitations under the License.
13
-
14
- """Base agent class for mobile GUI automation agents."""
15
-
16
- from abc import ABC, abstractmethod
17
- from typing import Any, Dict, List, Tuple
18
-
19
- from unified_memory import TrajMemory
20
-
21
-
22
- class BaseAgent(ABC):
23
- """
24
- Abstract base class for all GUI automation agents.
25
-
26
- This class provides common functionality for trajectory management
27
- and defines the interface that all agents must implement.
28
- """
29
-
30
- def __init__(self) -> None:
31
- """Initialize the base agent with empty trajectory memory."""
32
- self.traj_memory = TrajMemory(
33
- task_goal="",
34
- task_id="",
35
- steps=[],
36
- )
37
-
38
- @property
39
- def thoughts(self) -> List[str]:
40
- """Return list of thoughts from trajectory memory."""
41
- return [step.thought if step.thought else "" for step in self.traj_memory.steps]
42
-
43
- @property
44
- def actions(self) -> List[Dict[str, Any]]:
45
- """Return list of actions from trajectory memory."""
46
- return [step.action for step in self.traj_memory.steps]
47
-
48
- @property
49
- def conclusions(self) -> List[str]:
50
- """Return list of conclusions from trajectory memory."""
51
- return [step.conclusion for step in self.traj_memory.steps]
52
-
53
- @property
54
- def observations(self) -> List[Dict[str, Any]]:
55
- """Return list of observations from trajectory memory."""
56
- return [
57
- {
58
- "screenshot": step.screenshot_bytes,
59
- "accessibility_tree": step.accessibility_tree,
60
- }
61
- for step in self.traj_memory.steps
62
- ]
63
-
64
- @property
65
- def history_images(self) -> List[bytes]:
66
- """Return list of screenshot bytes from trajectory memory."""
67
- return [step.screenshot_bytes for step in self.traj_memory.steps]
68
-
69
- @property
70
- def history_responses(self) -> List[str]:
71
- """Return list of predictions from trajectory memory."""
72
- return [step.prediction for step in self.traj_memory.steps]
73
-
74
- @abstractmethod
75
- def predict(
76
- self,
77
- instruction: str,
78
- obs: Dict[str, Any],
79
- **kwargs: Any,
80
- ) -> Tuple[str, Dict[str, Any]]:
81
- """
82
- Predict the next action based on the current observation.
83
-
84
- Args:
85
- instruction: Task instruction/goal.
86
- obs: Current observation containing screenshot and optional accessibility tree.
87
- **kwargs: Additional keyword arguments.
88
-
89
- Returns:
90
- Tuple of (prediction_text, action_dict).
91
- """
92
- pass
93
-
94
- def reset(self) -> None:
95
- """Reset the trajectory memory for a new task."""
96
- self.traj_memory = TrajMemory(
97
- task_goal="",
98
- task_id="",
99
- steps=[],
100
- )
101
-
102
- def load_traj(self, traj_memory: TrajMemory) -> None:
103
- """
104
- Load trajectory from existing TrajMemory object.
105
-
106
- Args:
107
- traj_memory: TrajMemory object containing trajectory data.
108
- """
109
- self.traj_memory = traj_memory
110
-
111
- def save_traj(self) -> Dict[str, Any]:
112
- """
113
- Save current trajectory to a dictionary format.
114
-
115
- Returns:
116
- Dictionary containing the trajectory data that can be serialized.
117
- """
118
- steps_data = []
119
- for step in self.traj_memory.steps:
120
- step_dict = {
121
- "screenshot_bytes": step.screenshot_bytes,
122
- "accessibility_tree": step.accessibility_tree,
123
- "prediction": step.prediction,
124
- "action": step.action,
125
- "conclusion": step.conclusion,
126
- "thought": step.thought,
127
- "step_index": step.step_index,
128
- "agent_type": step.agent_type,
129
- "model_name": step.model_name,
130
- }
131
- steps_data.append(step_dict)
132
-
133
- return {
134
- "task_goal": self.traj_memory.task_goal,
135
- "task_id": self.traj_memory.task_id,
136
- "steps": steps_data,
137
- }
@@ -1,263 +0,0 @@
1
- # Copyright (c) 2025, Alibaba Cloud and its affiliates;
2
- # Licensed under the Apache License, Version 2.0 (the "License");
3
- # you may not use this file except in compliance with the License.
4
- # You may obtain a copy of the License at
5
- #
6
- # http://www.apache.org/licenses/LICENSE-2.0
7
- #
8
- # Unless required by applicable law or agreed to in writing, software
9
- # distributed under the License is distributed on an "AS IS" BASIS,
10
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
- # See the License for the specific language governing permissions and
12
- # limitations under the License.
13
-
14
- """
15
- MAI Grounding Agent - A GUI grounding agent for locating UI elements.
16
-
17
- This module provides the MAIGroundingAgent class that uses vision-language models
18
- to locate UI elements based on natural language instructions.
19
- """
20
-
21
- import json
22
- import re
23
- from io import BytesIO
24
- from typing import Any, Dict, Optional, Tuple, Union
25
-
26
- from openai import OpenAI
27
- from PIL import Image
28
-
29
- from prompt import MAI_MOBILE_SYS_PROMPT_GROUNDING
30
- from utils import pil_to_base64
31
-
32
-
33
- # Constants
34
- SCALE_FACTOR = 999
35
-
36
-
37
- def parse_grounding_response(text: str) -> Dict[str, Any]:
38
- """
39
- Parse model output text containing grounding_think and answer tags.
40
-
41
- Args:
42
- text: Raw model output containing <grounding_think> and <answer> tags.
43
-
44
- Returns:
45
- Dictionary with keys:
46
- - "thinking": The model's reasoning process
47
- - "coordinate": Normalized [x, y] coordinate
48
-
49
- Raises:
50
- ValueError: If parsing fails or JSON is invalid.
51
- """
52
- text = text.strip()
53
-
54
- result: Dict[str, Any] = {
55
- "thinking": None,
56
- "coordinate": None,
57
- }
58
-
59
- # Extract thinking content
60
- think_pattern = r"<grounding_think>(.*?)</grounding_think>"
61
- think_match = re.search(think_pattern, text, re.DOTALL)
62
- if think_match:
63
- result["thinking"] = think_match.group(1).strip()
64
-
65
- # Extract answer content
66
- answer_pattern = r"<answer>(.*?)</answer>"
67
- answer_match = re.search(answer_pattern, text, re.DOTALL)
68
- if answer_match:
69
- answer_text = answer_match.group(1).strip()
70
- try:
71
- answer_json = json.loads(answer_text)
72
- coordinates = answer_json.get("coordinate", [])
73
- if len(coordinates) == 2:
74
- # Normalize coordinates from SCALE_FACTOR range to [0, 1]
75
- point_x = coordinates[0] / SCALE_FACTOR
76
- point_y = coordinates[1] / SCALE_FACTOR
77
- result["coordinate"] = [point_x, point_y]
78
- else:
79
- raise ValueError(
80
- f"Invalid coordinate format: expected 2 values, got {len(coordinates)}"
81
- )
82
- except json.JSONDecodeError as e:
83
- raise ValueError(f"Invalid JSON in answer: {e}")
84
-
85
- return result
86
-
87
-
88
- class MAIGroundingAgent:
89
- """
90
- GUI grounding agent using vision-language models.
91
-
92
- This agent processes a screenshot and natural language instruction to
93
- locate a specific UI element and return its coordinates.
94
-
95
- Attributes:
96
- llm_base_url: Base URL for the LLM API endpoint.
97
- model_name: Name of the model to use for predictions.
98
- runtime_conf: Configuration dictionary for runtime parameters.
99
- """
100
-
101
- def __init__(
102
- self,
103
- llm_base_url: str,
104
- model_name: str,
105
- runtime_conf: Optional[Dict[str, Any]] = None,
106
- ):
107
- """
108
- Initialize the MAIGroundingAgent.
109
-
110
- Args:
111
- llm_base_url: Base URL for the LLM API endpoint.
112
- model_name: Name of the model to use.
113
- runtime_conf: Optional configuration dictionary with keys:
114
- - max_pixels: Maximum pixels for image processing
115
- - min_pixels: Minimum pixels for image processing
116
- - temperature: Sampling temperature (default: 0.0)
117
- - top_k: Top-k sampling parameter (default: -1)
118
- - top_p: Top-p sampling parameter (default: 1.0)
119
- - max_tokens: Maximum tokens in response (default: 2048)
120
- """
121
- # Set default configuration
122
- default_conf = {
123
- "temperature": 0.0,
124
- "top_k": -1,
125
- "top_p": 1.0,
126
- "max_tokens": 2048,
127
- }
128
- self.runtime_conf = {**default_conf, **(runtime_conf or {})}
129
-
130
- self.llm_base_url = llm_base_url
131
- self.model_name = model_name
132
- self.llm = OpenAI(
133
- base_url=self.llm_base_url,
134
- api_key="empty",
135
- )
136
-
137
- # Extract frequently used config values
138
- self.temperature = self.runtime_conf["temperature"]
139
- self.top_k = self.runtime_conf["top_k"]
140
- self.top_p = self.runtime_conf["top_p"]
141
- self.max_tokens = self.runtime_conf["max_tokens"]
142
-
143
- @property
144
- def system_prompt(self) -> str:
145
- """Return the system prompt for grounding tasks."""
146
- return MAI_MOBILE_SYS_PROMPT_GROUNDING
147
-
148
- def _build_messages(
149
- self,
150
- instruction: str,
151
- image: Image.Image,
152
- ) -> list:
153
- """
154
- Build the message list for the LLM API call.
155
-
156
- Args:
157
- instruction: Grounding instruction from user.
158
- image: PIL Image of the screenshot.
159
- magic_prompt: Whether to use the magic prompt format.
160
-
161
- Returns:
162
- List of message dictionaries for the API.
163
- """
164
- encoded_string = pil_to_base64(image)
165
-
166
- messages = [
167
- {
168
- "role": "system",
169
- "content": [
170
- {
171
- "type": "text",
172
- "text": self.system_prompt,
173
- }
174
- ],
175
- }
176
- ]
177
-
178
- messages.append(
179
- {
180
- "role": "user",
181
- "content": [
182
- {
183
- "type": "text",
184
- "text": instruction + "\n",
185
- },
186
- {
187
- "type": "image_url",
188
- "image_url": {"url": f"data:image/png;base64,{encoded_string}"},
189
- },
190
- ],
191
- }
192
- )
193
-
194
- return messages
195
-
196
- def predict(
197
- self,
198
- instruction: str,
199
- image: Union[Image.Image, bytes],
200
- **kwargs: Any,
201
- ) -> Tuple[str, Dict[str, Any]]:
202
- """
203
- Predict the coordinate of the UI element based on the instruction.
204
-
205
- Args:
206
- instruction: Grounding instruction describing the UI element to locate.
207
- image: PIL Image or bytes of the screenshot.
208
- **kwargs: Additional arguments (unused).
209
-
210
- Returns:
211
- Tuple of (prediction_text, result_dict) where:
212
- - prediction_text: Raw model response or error message
213
- - result_dict: Dictionary containing:
214
- - "thinking": Model's reasoning process
215
- - "coordinate": Normalized [x, y] coordinate
216
- """
217
- # Convert bytes to PIL Image if necessary
218
- if isinstance(image, bytes):
219
- image = Image.open(BytesIO(image))
220
-
221
- if image.mode != "RGB":
222
- image = image.convert("RGB")
223
-
224
- # Build messages
225
- messages = self._build_messages(instruction, image)
226
-
227
- # Make API call with retry logic
228
- max_retries = 3
229
- prediction = None
230
- result = None
231
-
232
- for attempt in range(max_retries):
233
- try:
234
- response = self.llm.chat.completions.create(
235
- model=self.model_name,
236
- messages=messages,
237
- max_tokens=self.max_tokens,
238
- temperature=self.temperature,
239
- top_p=self.top_p,
240
- frequency_penalty=0.0,
241
- presence_penalty=0.0,
242
- extra_body={"repetition_penalty": 1.0, "top_k": self.top_k},
243
- seed=42,
244
- )
245
- prediction = response.choices[0].message.content.strip()
246
- print(f"Raw response:\n{prediction}")
247
-
248
- # Parse response
249
- result = parse_grounding_response(prediction)
250
- print(f"Parsed result:\n{result}")
251
- break
252
-
253
- except Exception as e:
254
- print(f"Error on attempt {attempt + 1}: {e}")
255
- prediction = None
256
- result = None
257
-
258
- # Return error if all retries failed
259
- if prediction is None or result is None:
260
- print("Max retry attempts reached, returning error flag.")
261
- return "llm client error", {"thinking": None, "coordinate": None}
262
-
263
- return prediction, result