# loktrishal-05/solar-da architecture

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

- Interactive diagram: https://gitdiagram.com/loktrishal-05/solar-da
- Repository: https://github.com/loktrishal-05/solar-da

## Overview

Solarda is a safety-gated precision-agriculture platform. A farmer or operator starts a replayed farm shift in the web console; the agent runtime evaluates triggers and runs specialist assessment, then asks the API’s safety gate to vet proposals before any approved action can be dispatched and audited. Separate product branches provide chat advice, crop-disease diagnosis, irrigation simulation, market outlook, traceability and alerts. The README documents the broad workflow; some domain services and UI integrations are represented at directory level because their implementation was not sampled.

Main entry points: [`services/agents/app/graphs/farm_shift.py`](https://github.com/loktrishal-05/solar-da/blob/main/services/agents/app/graphs/farm_shift.py) (Farm-shift graph), [`weiqou/api/src/agent_routes.ts`](https://github.com/loktrishal-05/solar-da/blob/main/weiqou/api/src/agent_routes.ts) (Agent endpoints), [`weiqou/web/src/App.tsx`](https://github.com/loktrishal-05/solar-da/blob/main/weiqou/web/src/App.tsx) (Product pages), [`services/agents/app/chat.py`](https://github.com/loktrishal-05/solar-da/blob/main/services/agents/app/chat.py) (Farm assistant)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_webapp["Farm console<br/>[AgentConsole.tsx]"]
  node_webpages["Product pages<br/>[App.tsx]"]
end

subgraph group_agents["Agent runtime"]
  node_runner["Replay runner<br/>[runner.py]"]
  node_triggers["Trigger engine<br/>[triggers.py]"]
  node_replay["Replay layer"]
  node_farmshift["Farm-shift graph<br/>[farm_shift.py]"]
  node_sensor["Sensor models<br/>[sensor_models.py]"]
end

subgraph group_decision["Decision services"]
  node_twin["Irrigation crop twin<br/>[twin.py]"]
  node_vision["Disease classifier<br/>[classifier.py]"]
end

subgraph group_operations["Safety and operations"]
  node_engine["Safety engine<br/>[interlocks.ts]"]
  node_api["API routing<br/>[app.ts]"]
  node_agentapi["Agent endpoints<br/>[agent_routes.ts]"]
  node_approvals["Human approvals<br/>[approvals.ts]"]
  node_audit[("Audit and actions<br/>[store.ts]")]
end

subgraph group_advisory["Farmer services"]
  node_chat["Farm assistant<br/>[chat.py]"]
  node_advisor["Advisor graph<br/>[advisor.py]"]
  node_knowledge["Approved knowledge<br/>[knowledge.py]"]
  node_market["Market outlook<br/>[market.py]"]
  node_passport["Harvest passport<br/>[passport.ts]"]
  node_marketplace[("Marketplace listings")]
  node_sms["Alert delivery<br/>[sms.ts]"]
end

node_farmer(("Farmer / operator"))
node_gemini(("Gemini API"))
node_weather(("Open-Meteo"))

node_farmer -->|"starts replay"| node_webapp
node_webapp -->|"controls runs"| node_runner
node_runner -->|"reads scenarios"| node_replay
node_runner -->|"evaluates triggers"| node_triggers
node_runner -->|"starts graph"| node_farmshift
node_sensor -->|"supplies forecasts"| node_farmshift
node_farmshift -->|"requests options"| node_twin
node_farmshift -->|"requests diagnosis"| node_vision
node_farmshift -->|"checks proposals"| node_agentapi
node_agentapi -->|"evaluates safety"| node_engine
node_agentapi -->|"records verdicts"| node_audit
node_farmshift -->|"requests approval"| node_approvals
node_approvals -->|"presents decision"| node_farmer
node_farmshift -->|"dispatches action"| node_agentapi
node_agentapi -->|"records actions"| node_audit
node_farmer -->|"opens features"| node_webpages
node_webpages -->|"asks questions"| node_chat
node_chat -->|"streams responses"| node_gemini
node_chat -->|"uses advisor"| node_advisor
node_advisor -->|"retrieves sources"| node_knowledge
node_chat -->|"reads prices"| node_market
node_chat -->|"gets weather"| node_weather
node_webpages -->|"explores irrigation"| node_twin
node_webpages -->|"requests diagnosis"| node_vision
node_api -->|"mounts routes"| node_agentapi
node_api -->|"mounts routes"| node_approvals
node_api -->|"loads listings"| node_marketplace
node_agentapi -->|"sends alerts"| node_sms
node_webpages -->|"views traceability"| node_passport
node_passport -.->|"supports listings"| node_marketplace

click node_webapp "https://github.com/loktrishal-05/solar-da/blob/main/weiqou/web/src/components/AgentConsole.tsx"
click node_webpages "https://github.com/loktrishal-05/solar-da/blob/main/weiqou/web/src/App.tsx"
click node_runner "https://github.com/loktrishal-05/solar-da/blob/main/services/agents/app/runner.py"
click node_triggers "https://github.com/loktrishal-05/solar-da/blob/main/services/agents/app/triggers.py"
click node_replay "https://github.com/loktrishal-05/solar-da/tree/main/services/agents/app/replay"
click node_farmshift "https://github.com/loktrishal-05/solar-da/blob/main/services/agents/app/graphs/farm_shift.py"
click node_sensor "https://github.com/loktrishal-05/solar-da/blob/main/services/agents/app/sensor_models.py"
click node_twin "https://github.com/loktrishal-05/solar-da/blob/main/services/twin/app/twin.py"
click node_vision "https://github.com/loktrishal-05/solar-da/blob/main/services/vision/app/classifier.py"
click node_engine "https://github.com/loktrishal-05/solar-da/blob/main/packages/engine/src/interlocks.ts"
click node_api "https://github.com/loktrishal-05/solar-da/blob/main/weiqou/api/src/app.ts"
click node_agentapi "https://github.com/loktrishal-05/solar-da/blob/main/weiqou/api/src/agent_routes.ts"
click node_approvals "https://github.com/loktrishal-05/solar-da/blob/main/weiqou/api/src/approvals.ts"
click node_audit "https://github.com/loktrishal-05/solar-da/blob/main/weiqou/api/src/store.ts"
click node_chat "https://github.com/loktrishal-05/solar-da/blob/main/services/agents/app/chat.py"
click node_advisor "https://github.com/loktrishal-05/solar-da/blob/main/services/agents/app/graphs/advisor.py"
click node_knowledge "https://github.com/loktrishal-05/solar-da/blob/main/services/agents/app/knowledge.py"
click node_market "https://github.com/loktrishal-05/solar-da/blob/main/services/agents/app/market.py"
click node_passport "https://github.com/loktrishal-05/solar-da/blob/main/packages/engine/src/passport.ts"
click node_marketplace "https://github.com/loktrishal-05/solar-da/blob/main/weiqou/api/src/marketplace_store.ts"
click node_sms "https://github.com/loktrishal-05/solar-da/blob/main/weiqou/api/src/sms.ts"

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_webapp,node_webpages toneBlue
class node_runner,node_triggers,node_replay,node_farmshift,node_sensor toneAmber
class node_twin,node_vision,node_gemini toneMint
class node_engine,node_api,node_agentapi,node_approvals,node_audit toneRose
class node_chat,node_advisor,node_knowledge,node_market,node_passport,node_marketplace,node_sms,node_farmer,node_weather toneIndigo
```

## Components

### Web experience

- [Farm console](https://github.com/loktrishal-05/solar-da/blob/main/weiqou/web/src/components/AgentConsole.tsx): `weiqou/web/src/components/AgentConsole.tsx`
- [Product pages](https://github.com/loktrishal-05/solar-da/blob/main/weiqou/web/src/App.tsx): `weiqou/web/src/App.tsx`

### Agent runtime

- [Replay runner](https://github.com/loktrishal-05/solar-da/blob/main/services/agents/app/runner.py): `services/agents/app/runner.py`
- [Trigger engine](https://github.com/loktrishal-05/solar-da/blob/main/services/agents/app/triggers.py): `services/agents/app/triggers.py`
- [Replay layer](https://github.com/loktrishal-05/solar-da/tree/main/services/agents/app/replay): `services/agents/app/replay`
- [Farm-shift graph](https://github.com/loktrishal-05/solar-da/blob/main/services/agents/app/graphs/farm_shift.py): `services/agents/app/graphs/farm_shift.py`
- [Sensor models](https://github.com/loktrishal-05/solar-da/blob/main/services/agents/app/sensor_models.py): `services/agents/app/sensor_models.py`

### Decision services

- [Irrigation crop twin](https://github.com/loktrishal-05/solar-da/blob/main/services/twin/app/twin.py): `services/twin/app/twin.py`
- [Disease classifier](https://github.com/loktrishal-05/solar-da/blob/main/services/vision/app/classifier.py): `services/vision/app/classifier.py`

### Safety and operations

- [Safety engine](https://github.com/loktrishal-05/solar-da/blob/main/packages/engine/src/interlocks.ts): `packages/engine/src/interlocks.ts`
- [API routing](https://github.com/loktrishal-05/solar-da/blob/main/weiqou/api/src/app.ts): `weiqou/api/src/app.ts`
- [Agent endpoints](https://github.com/loktrishal-05/solar-da/blob/main/weiqou/api/src/agent_routes.ts): `weiqou/api/src/agent_routes.ts`
- [Human approvals](https://github.com/loktrishal-05/solar-da/blob/main/weiqou/api/src/approvals.ts): `weiqou/api/src/approvals.ts`
- [Audit and actions](https://github.com/loktrishal-05/solar-da/blob/main/weiqou/api/src/store.ts): `weiqou/api/src/store.ts`

### Farmer services

- [Farm assistant](https://github.com/loktrishal-05/solar-da/blob/main/services/agents/app/chat.py): `services/agents/app/chat.py`
- [Advisor graph](https://github.com/loktrishal-05/solar-da/blob/main/services/agents/app/graphs/advisor.py): `services/agents/app/graphs/advisor.py`
- [Approved knowledge](https://github.com/loktrishal-05/solar-da/blob/main/services/agents/app/knowledge.py): `services/agents/app/knowledge.py`
- [Market outlook](https://github.com/loktrishal-05/solar-da/blob/main/services/agents/app/market.py): `services/agents/app/market.py`
- [Harvest passport](https://github.com/loktrishal-05/solar-da/blob/main/packages/engine/src/passport.ts): `packages/engine/src/passport.ts`
- [Marketplace listings](https://github.com/loktrishal-05/solar-da/blob/main/weiqou/api/src/marketplace_store.ts): `weiqou/api/src/marketplace_store.ts`
- [Alert delivery](https://github.com/loktrishal-05/solar-da/blob/main/weiqou/api/src/sms.ts): `weiqou/api/src/sms.ts`

### Other components

- **Farmer / operator**
- **Gemini API**
- **Open-Meteo**

## Connections

- Farmer / operator → Farm console: starts replay (evidence: `README.md`)
- Farm console → Replay runner: controls runs (evidence: `README.md`)
- Replay runner → Replay layer: reads scenarios (evidence: `services/agents/app/runner.py`)
- Replay runner → Trigger engine: evaluates triggers (evidence: `services/agents/app/runner.py`)
- Replay runner → Farm-shift graph: starts graph (evidence: `services/agents/app/runner.py`)
- Sensor models → Farm-shift graph: supplies forecasts (evidence: `README.md`)
- Farm-shift graph → Irrigation crop twin: requests options (evidence: `README.md`)
- Farm-shift graph → Disease classifier: requests diagnosis (evidence: `README.md`)
- Farm-shift graph → Agent endpoints: checks proposals (evidence: `README.md`)
- Agent endpoints → Safety engine: evaluates safety (evidence: `weiqou/api/src/agent_routes.ts`)
- Agent endpoints → Audit and actions: records verdicts (evidence: `weiqou/api/src/agent_routes.ts`)
- Farm-shift graph → Human approvals: requests approval (evidence: `README.md`)
- Human approvals → Farmer / operator: presents decision (evidence: `README.md`)
- Farm-shift graph → Agent endpoints: dispatches action (evidence: `README.md`)
- Agent endpoints → Audit and actions: records actions (evidence: `weiqou/api/src/agent_routes.ts`)
- Farmer / operator → Product pages: opens features (evidence: `weiqou/web/src/App.tsx`)
- Product pages → Farm assistant: asks questions (evidence: `README.md`)
- Farm assistant → Gemini API: streams responses (evidence: `README.md`)
- Farm assistant → Advisor graph: uses advisor (evidence: `services/agents/app/chat.py`)
- Advisor graph → Approved knowledge: retrieves sources (evidence: `services/agents/app/graphs/advisor.py`)
- Farm assistant → Market outlook: reads prices (evidence: `services/agents/app/chat.py`)
- Farm assistant → Open-Meteo: gets weather (evidence: `README.md`)
- Product pages → Irrigation crop twin: explores irrigation (evidence: `README.md`)
- Product pages → Disease classifier: requests diagnosis (evidence: `README.md`)
- API routing → Agent endpoints: mounts routes (evidence: `weiqou/api/src/app.ts`)
- API routing → Human approvals: mounts routes (evidence: `weiqou/api/src/app.ts`)
- API routing → Marketplace listings: loads listings
- Agent endpoints → Alert delivery: sends alerts (evidence: `weiqou/api/src/agent_routes.ts`)
- Product pages → Harvest passport: views traceability (evidence: `README.md`)
- Harvest passport → Marketplace listings: supports listings
