Components inside the Clarity binary and their relationships. All nodes verified from source.
graph LR
%% ─── Clarity Binary ──────────────────────────────────────────────────────
subgraph BINARY["Clarity Binary (Tauri + Warp)"]
TAURI["Tauri Shell\n(main.rs)"]
WARP["Warp HTTPS Server\n(:3030 TLS)"]
subgraph STORAGE_SUB["Storage Subsystem"]
SE["Storage Engine\n(storage.rs)"]
QE["Query Engine\n(query.rs)"]
WB["Write Buffer\n(100k queue · 20ms flush)"]
AGG["Aggregator\n(aggregator.rs · 14+ ops)"]
end
subgraph MGMT["Management"]
MON["Monitor Agent\n(alarm rules + events)"]
BKP["Backup Scheduler\n(SQLite + timeseries)"]
PM["Process Manager\n(supervisor.rs)"]
end
subgraph DATA_APIS["Data APIs"]
SQLITE_API["SQLite API\n(dynamic CRUD routes)"]
INGEST["Ingest API\n(processing_api/ingest.rs)"]
EMS_API["EMS API\n(processing_api/ems.rs)"]
ELOG["Elog API\n(processing_api/elog.rs)"]
end
subgraph PROXIES["Proxy Routes"]
PY_PROXY["Python Proxy\n(python_proxy.rs)"]
ADK_PROXY["Google ADK Proxy\n(google_adk.rs)"]
end
subgraph CONNECTORS["Connectors"]
PI_CONN["PI Connector\n(webpi_meta_connector.rs\nwebpi_live_data_connector.rs\nwebpi_historic_data_connector.rs)"]
MQTT_SVC["MQTT Client\n(mqtt_services/client.rs)"]
MQTT_WS["MQTT WS Bridge\n(mqtt_ws_proxy.rs)"]
end
AUTH["Auth\n(Argon2 + JWT HS256)"]
end
%% ─── External Processes ───────────────────────────────────────────────────
subgraph EXTERNAL["External Processes"]
PY_SVCS["Python Services\n(FastAPI / Flask\nper service_manager config)"]
ADK_BIN["papa_agent_app\n(:8000 HTTPS · localhost)"]
ML_MAP["ML Mapping API\n(:8200 · localhost)\n⚠ TODO-VERIFY port"]
MQTT_BROKER["Mosquitto MQTT Broker\n(:1883 · 127.0.0.1\nWindows only as service)"]
end
%% ─── Storage on Disk ─────────────────────────────────────────────────────
subgraph DISK["Storage (on disk)"]
BIN_FILES[".bin day files\n(mmap · one per collection/day)"]
SQLITE_FILE["pulse-db.sqlite\n(WAL mode)"]
BACKUP_DIR["backup/\n(tar.gz archives)"]
end
%% ─── Connections ──────────────────────────────────────────────────────────
TAURI --> WARP
WARP --> AUTH
WARP --> SE
WARP --> QE
WARP --> WB
WARP --> MON
WARP --> BKP
WARP --> PM
WARP --> SQLITE_API
WARP --> INGEST
WARP --> EMS_API
WARP --> ELOG
WARP --> PY_PROXY
WARP --> ADK_PROXY
WARP --> PI_CONN
WARP --> MQTT_WS
PY_PROXY --> PY_SVCS
PM --> PY_SVCS
ADK_PROXY --> ADK_BIN
PI_CONN --> ML_MAP
MQTT_SVC --> MQTT_BROKER
MQTT_WS --> MQTT_BROKER
SE --> BIN_FILES
WB --> BIN_FILES
QE --> BIN_FILES
BKP --> BIN_FILES
BKP --> BACKUP_DIR
SQLITE_API --> SQLITE_FILE
AUTH --> SQLITE_FILE
MON --> SQLITE_FILE
BKP --> SQLITE_FILE
Key source references:
- Warp server startup:
clarity:backend/src-tauri/src/main.rs:3155-3374
- ADK proxy routes:
clarity:backend/src-tauri/src/api/google_adk.rs:102-114
- Python proxy:
clarity:backend/src-tauri/src/api/python_proxy.rs
- PI connector routes:
clarity:backend/src-tauri/src/connectors/webpi/webpi_meta_connector.rs:1600-1630
- MQTT WS bridge:
clarity:backend/src-tauri/src/mqtt_ws_proxy.rs
- ML mapping API at port 8200:
clarity:backend/src-tauri/src/connectors/webpi/webpi_meta_connector.rs:1312 — port is a runtime deployment config; verify before documenting as fixed.
The PI onboarding flow is the primary asset configuration workflow. All steps are verified against clarity:backend/src-tauri/src/connectors/webpi/webpi_meta_connector.rs.
sequenceDiagram
participant UI as Browser UI
participant BE as Rust Backend<br/>(Warp :3030)
participant PI as OSI PI Web API<br/>(customer HTTPS)
participant ML as ML Mapping API<br/>(:8200 TODO-VERIFY)
Note over UI,PI: Step 1 — Discover asset servers
UI->>BE: POST /pi/list_asset_servers<br/>{api_url, username, password}
BE->>PI: GET /assetservers
PI-->>BE: {Items: [{Name, WebId}, ...]}
BE-->>UI: {serverName: {web_id, element_count}}
Note over UI,PI: Step 2 — List databases for a server
UI->>BE: POST /pi/list_databases<br/>{api_url, username, password, web_id}
BE->>PI: GET /assetservers/{webId}/assetdatabases
PI-->>BE: {Items: [{Name, WebId}, ...]}
BE-->>UI: {dbName: {web_id, element_count}}
Note over UI,PI: Step 3 — Browse element tree
UI->>BE: POST /pi/list_children<br/>{web_id, is_database}
BE->>PI: GET /elements/{webId}/elements<br/>(or /assetdatabases/{webId}/elements)
PI-->>BE: child elements with counts
BE-->>UI: {elementName: {web_id, element_count, attribute_count}}
Note over UI,BE,PI: Step 4 — Onboard a unit (streaming NDJSON)
UI->>BE: POST /pi/onboard_unit<br/>{api_url, username, password,<br/>web_id, connectionId}
BE->>PI: GET /elements/{webId} (root element)
BE->>PI: GET /elements/{webId}/attributes (recursive walk)
BE->>PI: GET /attributes/{attrWebId} (attribute detail)
BE->>PI: GET /points/{pointWebId} (PI point info)
Note over BE: Writes files to pi_onboarding/:
Note over BE: {connId}_meta.json (element tree)
Note over BE: {connId}_tagmap.ndjson (one tag per line)
Note over BE: {connId}_progress.json (status)
BE-->>UI: NDJSON stream<br/>{"status":"started"}<br/>{"status":"tag","tag":{...}}<br/>...<br/>{"status":"completed","total_tags":N}
Note over UI,BE: Step 5 — Poll onboarding progress
UI->>BE: GET /pi/{connectionId}_progress.json<br/>(or via progress endpoint)
BE-->>UI: {"status":"done","tags_found":N,...}
Note over UI,BE,ML: Step 6 — Map tags via ML service
UI->>BE: POST /pi/map_tags<br/>{connectionId, ...}
BE->>ML: POST https://localhost:8200/map/tags<br/>(tag list from tagmap.ndjson)
Note over ML: ⚠ Port 8200 is a deployment config value.<br/>Verify before treating as fixed.
ML-->>BE: NDJSON stream of mapped tags
BE-->>UI: NDJSON stream (forwarded)
Onboarding output files (written to {app_data}/pi_onboarding/):
| File |
Content |
{connId}_meta.json |
Full element tree with attributes (PiElementNode JSON array) |
{connId}_tagmap.ndjson |
One tag per line: AttributeWebId, TagName, DataTagId, units, descriptor |
{connId}_progress.json |
Status: running / done / error; elements_processed, tags_found |
{connId}_connectionid |
Hierarchy skeleton (root→target path, attributes stripped from children) |
Source: clarity:backend/src-tauri/src/connectors/webpi/webpi_meta_connector.rs:529-831
Last updated: 2026-05-23 — verified from clarity source code