# weixinzq/aola_auto_tool architecture

> Architecture diagram of the GitHub repository weixinzq/aola_auto_tool, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/weixinzq/aola_auto_tool
- Repository: https://github.com/weixinzq/aola_auto_tool

## Overview

This is a persistent Python game-account and task-management backend, operated through a CLI or Vue frontend using a shared HTTP API. The main workflow configures accounts and egress, logs in and establishes game sessions, then runs submitted message batches or scripts in background workers while exposing task state and logs. The runtime also includes game-protocol transport, message dispatch, battle automation, OCR and pet/item capabilities. Edges are limited to README statements and relationships listed or shown in supplied excerpts; unsampled subsystem internals are represented at their known directory paths.

Main entry points: [`src/service/application.py`](https://github.com/weixinzq/aola_auto_tool/blob/main/src/service/application.py) (Application runtime), [`src/messaging/dispatcher.py`](https://github.com/weixinzq/aola_auto_tool/blob/main/src/messaging/dispatcher.py) (Message dispatcher), [`src/network/socket_client.py`](https://github.com/weixinzq/aola_auto_tool/blob/main/src/network/socket_client.py) (Game socket), [`frontend/src/App.vue`](https://github.com/weixinzq/aola_auto_tool/blob/main/frontend/src/App.vue) (Vue console)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["Interfaces and service"]
  node_web["Vue console<br/>[App.vue]"]
  node_composer_ui["Task composer<br/>[TaskComposer.vue]"]
  node_http["HTTP API<br/>[http.py]"]
  node_cli["CLI<br/>[cli.py]"]
  node_app["Application runtime<br/>[application.py]"]
  node_store[("Persistent store<br/>[store.py]")]
  node_events["Event hub<br/>[events.py]"]
end

subgraph group_operations["Accounts and egress"]
  node_accounts["Account lifecycle<br/>[manager.py]"]
  node_login["Login and zones<br/>[login.py]"]
  node_session["Game session<br/>[session.py]"]
  node_egress["Egress groups<br/>[egress.py]"]
  node_mihomo["Mihomo proxy<br/>[mihomo.py]"]
end

subgraph group_tasks["Task execution"]
  node_tasks_service["Task service<br/>[tasks.py]"]
  node_workers["Worker pool<br/>[workers.py]"]
  node_worker_host["Worker host<br/>[worker_host.py]"]
  node_composer["Script composer<br/>[composer.py]"]
  node_loader["Script loader<br/>[loader.py]"]
end

subgraph group_game["Game runtime"]
  node_dispatcher["Message dispatcher<br/>[dispatcher.py]"]
  node_parser["Message parser<br/>[parser.py]"]
  node_battle["Battle control<br/>[control.py]"]
  node_game_context["Message context<br/>[context.py]"]
end

subgraph group_wire["Protocol and network"]
  node_socket["Game socket<br/>[socket_client.py]"]
  node_protocol["Protocol codecs"]
  node_proxy["Proxy transport<br/>[proxy.py]"]
end

node_user(("Operator"))
node_game_server(("Game servers"))
node_login_service(("Login service"))

node_user -->|"operates"| node_web
node_user -->|"operates"| node_cli
node_web -->|"renders"| node_composer_ui
node_composer_ui -.->|"submits via"| node_web
node_web -->|"calls API"| node_http
node_cli -->|"shares API"| node_http
node_http -->|"delegates"| node_app
node_app -->|"configures"| node_store
node_app -->|"binds"| node_events
node_app -->|"creates"| node_accounts
node_app -->|"creates"| node_egress
node_app -->|"creates"| node_workers
node_app -.->|"creates"| node_tasks_service
node_accounts -->|"opens"| node_session
node_session -->|"authenticates"| node_login
node_login -.->|"logs in"| node_login_service
node_session -->|"initializes"| node_game_context
node_egress -->|"manages"| node_mihomo
node_tasks_service -->|"dispatches"| node_workers
node_workers -->|"starts"| node_worker_host
node_worker_host -->|"connects"| node_accounts
node_tasks_service -->|"executes"| node_composer
node_composer -->|"loads scripts"| node_loader
node_composer -->|"runs messages"| node_dispatcher
node_dispatcher -.->|"parses messages"| node_parser
node_dispatcher -->|"controls battle"| node_battle
node_dispatcher -->|"uses session"| node_game_context
node_game_context -->|"receives from"| node_socket
node_socket -->|"encodes packets"| node_protocol
node_socket -->|"opens proxy socket"| node_proxy
node_socket -.->|"communicates"| node_game_server

click node_web "https://github.com/weixinzq/aola_auto_tool/blob/main/frontend/src/App.vue"
click node_composer_ui "https://github.com/weixinzq/aola_auto_tool/blob/main/frontend/src/components/TaskComposer.vue"
click node_http "https://github.com/weixinzq/aola_auto_tool/blob/main/src/interfaces/http.py"
click node_cli "https://github.com/weixinzq/aola_auto_tool/blob/main/src/interfaces/cli.py"
click node_app "https://github.com/weixinzq/aola_auto_tool/blob/main/src/service/application.py"
click node_store "https://github.com/weixinzq/aola_auto_tool/blob/main/src/service/store.py"
click node_events "https://github.com/weixinzq/aola_auto_tool/blob/main/src/service/events.py"
click node_accounts "https://github.com/weixinzq/aola_auto_tool/blob/main/src/accounts/manager.py"
click node_login "https://github.com/weixinzq/aola_auto_tool/blob/main/src/accounts/login.py"
click node_session "https://github.com/weixinzq/aola_auto_tool/blob/main/src/accounts/session.py"
click node_egress "https://github.com/weixinzq/aola_auto_tool/blob/main/src/service/egress.py"
click node_mihomo "https://github.com/weixinzq/aola_auto_tool/blob/main/src/service/mihomo.py"
click node_tasks_service "https://github.com/weixinzq/aola_auto_tool/blob/main/src/service/tasks.py"
click node_workers "https://github.com/weixinzq/aola_auto_tool/blob/main/src/service/workers.py"
click node_worker_host "https://github.com/weixinzq/aola_auto_tool/blob/main/src/service/worker_host.py"
click node_composer "https://github.com/weixinzq/aola_auto_tool/blob/main/src/scripting/composer.py"
click node_loader "https://github.com/weixinzq/aola_auto_tool/blob/main/src/scripting/loader.py"
click node_dispatcher "https://github.com/weixinzq/aola_auto_tool/blob/main/src/messaging/dispatcher.py"
click node_parser "https://github.com/weixinzq/aola_auto_tool/blob/main/src/messaging/parser.py"
click node_battle "https://github.com/weixinzq/aola_auto_tool/blob/main/src/game/battle/control.py"
click node_game_context "https://github.com/weixinzq/aola_auto_tool/blob/main/src/network/context.py"
click node_socket "https://github.com/weixinzq/aola_auto_tool/blob/main/src/network/socket_client.py"
click node_protocol "https://github.com/weixinzq/aola_auto_tool/tree/main/src/protocol"
click node_proxy "https://github.com/weixinzq/aola_auto_tool/blob/main/src/network/proxy.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_web,node_composer_ui,node_http,node_cli,node_app,node_store,node_events toneBlue
class node_accounts,node_login,node_session,node_egress,node_mihomo toneAmber
class node_tasks_service,node_workers,node_worker_host,node_composer,node_loader,node_game_server toneMint
class node_dispatcher,node_parser,node_battle,node_game_context toneRose
class node_socket,node_protocol,node_proxy,node_user,node_login_service toneIndigo
```

## Components

### Interfaces and service

- [Vue console](https://github.com/weixinzq/aola_auto_tool/blob/main/frontend/src/App.vue): `frontend/src/App.vue`
- [Task composer](https://github.com/weixinzq/aola_auto_tool/blob/main/frontend/src/components/TaskComposer.vue): `frontend/src/components/TaskComposer.vue`
- [HTTP API](https://github.com/weixinzq/aola_auto_tool/blob/main/src/interfaces/http.py): `src/interfaces/http.py`
- [CLI](https://github.com/weixinzq/aola_auto_tool/blob/main/src/interfaces/cli.py): `src/interfaces/cli.py`
- [Application runtime](https://github.com/weixinzq/aola_auto_tool/blob/main/src/service/application.py): `src/service/application.py`
- [Persistent store](https://github.com/weixinzq/aola_auto_tool/blob/main/src/service/store.py): `src/service/store.py`
- [Event hub](https://github.com/weixinzq/aola_auto_tool/blob/main/src/service/events.py): `src/service/events.py`

### Accounts and egress

- [Account lifecycle](https://github.com/weixinzq/aola_auto_tool/blob/main/src/accounts/manager.py): `src/accounts/manager.py`
- [Login and zones](https://github.com/weixinzq/aola_auto_tool/blob/main/src/accounts/login.py): `src/accounts/login.py`
- [Game session](https://github.com/weixinzq/aola_auto_tool/blob/main/src/accounts/session.py): `src/accounts/session.py`
- [Egress groups](https://github.com/weixinzq/aola_auto_tool/blob/main/src/service/egress.py): `src/service/egress.py`
- [Mihomo proxy](https://github.com/weixinzq/aola_auto_tool/blob/main/src/service/mihomo.py): `src/service/mihomo.py`

### Task execution

- [Task service](https://github.com/weixinzq/aola_auto_tool/blob/main/src/service/tasks.py): `src/service/tasks.py`
- [Worker pool](https://github.com/weixinzq/aola_auto_tool/blob/main/src/service/workers.py): `src/service/workers.py`
- [Worker host](https://github.com/weixinzq/aola_auto_tool/blob/main/src/service/worker_host.py): `src/service/worker_host.py`
- [Script composer](https://github.com/weixinzq/aola_auto_tool/blob/main/src/scripting/composer.py): `src/scripting/composer.py`
- [Script loader](https://github.com/weixinzq/aola_auto_tool/blob/main/src/scripting/loader.py): `src/scripting/loader.py`

### Game runtime

- [Message dispatcher](https://github.com/weixinzq/aola_auto_tool/blob/main/src/messaging/dispatcher.py): `src/messaging/dispatcher.py`
- [Message parser](https://github.com/weixinzq/aola_auto_tool/blob/main/src/messaging/parser.py): `src/messaging/parser.py`
- [Battle control](https://github.com/weixinzq/aola_auto_tool/blob/main/src/game/battle/control.py): `src/game/battle/control.py`
- [Message context](https://github.com/weixinzq/aola_auto_tool/blob/main/src/network/context.py): `src/network/context.py`

### Protocol and network

- [Game socket](https://github.com/weixinzq/aola_auto_tool/blob/main/src/network/socket_client.py): `src/network/socket_client.py`
- [Protocol codecs](https://github.com/weixinzq/aola_auto_tool/tree/main/src/protocol): `src/protocol`
- [Proxy transport](https://github.com/weixinzq/aola_auto_tool/blob/main/src/network/proxy.py): `src/network/proxy.py`

### Other components

- **Operator**
- **Game servers**
- **Login service**

## Connections

- Operator → Vue console: operates
- Operator → CLI: operates
- Vue console → Task composer: renders (evidence: `frontend/src/App.vue`)
- Task composer → Vue console: submits via (evidence: `frontend/src/App.vue`)
- Vue console → HTTP API: calls API
- CLI → HTTP API: shares API (evidence: `src/interfaces/cli.py`)
- HTTP API → Application runtime: delegates (evidence: `src/interfaces/http.py`)
- Application runtime → Persistent store: configures (evidence: `src/service/application.py`)
- Application runtime → Event hub: binds (evidence: `src/service/application.py`)
- Application runtime → Account lifecycle: creates (evidence: `src/service/application.py`)
- Application runtime → Egress groups: creates (evidence: `src/service/application.py`)
- Application runtime → Worker pool: creates (evidence: `src/service/application.py`)
- Application runtime → Task service: creates (evidence: `src/service/application.py`)
- Account lifecycle → Game session: opens (evidence: `src/accounts/manager.py`)
- Game session → Login and zones: authenticates (evidence: `src/accounts/session.py`)
- Login and zones → Login service: logs in
- Game session → Message context: initializes (evidence: `src/accounts/session.py`)
- Egress groups → Mihomo proxy: manages (evidence: `src/service/application.py`)
- Task service → Worker pool: dispatches (evidence: `src/service/tasks.py`)
- Worker pool → Worker host: starts (evidence: `src/service/workers.py`)
- Worker host → Account lifecycle: connects (evidence: `src/service/worker_host.py`)
- Task service → Script composer: executes (evidence: `src/service/tasks.py`)
- Script composer → Script loader: loads scripts (evidence: `src/scripting/composer.py`)
- Script composer → Message dispatcher: runs messages (evidence: `src/scripting/composer.py`)
- Message dispatcher → Message parser: parses messages (evidence: `src/messaging/dispatcher.py`)
- Message dispatcher → Battle control: controls battle (evidence: `src/messaging/dispatcher.py`)
- Message dispatcher → Message context: uses session (evidence: `src/messaging/dispatcher.py`)
- Message context → Game socket: receives from (evidence: `src/network/context.py`)
- Game socket → Protocol codecs: encodes packets (evidence: `src/network/socket_client.py`)
- Game socket → Proxy transport: opens proxy socket (evidence: `src/network/socket_client.py`)
- Game socket → Game servers: communicates
