# luki-pop/duckaiwraper architecture

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

- Interactive diagram: https://gitdiagram.com/luki-pop/duckaiwraper
- Repository: https://github.com/luki-pop/duckaiwraper

## Overview

DuckAIWrapper is a desktop shell around duck.ai, with an embedded browser and session-management panel. The main workflow is to open duck.ai, manage sessions and notes, and use the panel’s summarise action to submit notes through the browser and save the result. Settings and autostart are supporting capabilities. The repository also contains a separate HTTP DuckAI client, but the main-window excerpt says it is no longer used. Edges reflect shown calls or documented behavior; unsampled wiring is omitted.

Main entry points: [`main_window.py`](https://github.com/luki-pop/duckaiwraper/blob/main/main_window.py) (Main Window), [`duckai/history.py`](https://github.com/luki-pop/duckaiwraper/blob/main/duckai/history.py) (History Database), [`preferences.py`](https://github.com/luki-pop/duckaiwraper/blob/main/preferences.py) (Preferences Dialog), [`settings.py`](https://github.com/luki-pop/duckaiwraper/blob/main/settings.py) (Settings)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop UI"]
  node_window["Main Window<br/>[main_window.py]"]
  node_browser["Embedded Browser<br/>[main_window.py]"]
end

subgraph group_sessions["Sessions and History"]
  node_panel["Session Panel<br/>[main_window.py]"]
  node_history["History Database<br/>[history.py]"]
  node_sqlite[("SQLite Store")]
end

subgraph group_preferences["Preferences"]
  node_preferences_dialog["Preferences Dialog<br/>[preferences.py]"]
  node_settings["Settings<br/>[settings.py]"]
  node_settings_file["Settings File"]
  node_autostart["Autostart<br/>[autostart.py]"]
end

subgraph group_client["HTTP Client"]
  node_api_client["DuckAI Client<br/>[client.py]"]
end

node_user(("User"))
node_duckai_site(("duck.ai"))
node_api(("DuckAI API"))

node_user -->|"uses"| node_window
node_window -->|"loads settings"| node_settings
node_window -->|"creates database"| node_history
node_window -->|"hosts"| node_browser
node_window -->|"constructs"| node_panel
node_window -->|"checks status"| node_autostart
node_window -.->|"opens"| node_preferences_dialog
node_browser -->|"loads page"| node_duckai_site
node_panel -->|"manages sessions"| node_history
node_panel -->|"submits summary"| node_browser
node_panel -->|"polls response"| node_browser
node_history -->|"reads and writes"| node_sqlite
node_preferences_dialog -->|"saves settings"| node_settings
node_preferences_dialog -->|"sets autostart"| node_autostart
node_settings -->|"reads and writes"| node_settings_file
node_api_client -->|"loads and stores turns"| node_history
node_api_client -->|"posts chat"| node_api

click node_window "https://github.com/luki-pop/duckaiwraper/blob/main/main_window.py"
click node_browser "https://github.com/luki-pop/duckaiwraper/blob/main/main_window.py"
click node_panel "https://github.com/luki-pop/duckaiwraper/blob/main/main_window.py"
click node_history "https://github.com/luki-pop/duckaiwraper/blob/main/duckai/history.py"
click node_preferences_dialog "https://github.com/luki-pop/duckaiwraper/blob/main/preferences.py"
click node_settings "https://github.com/luki-pop/duckaiwraper/blob/main/settings.py"
click node_autostart "https://github.com/luki-pop/duckaiwraper/blob/main/autostart.py"
click node_api_client "https://github.com/luki-pop/duckaiwraper/blob/main/duckai/client.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_window,node_browser,node_user toneBlue
class node_panel,node_history,node_sqlite toneAmber
class node_preferences_dialog,node_settings,node_settings_file,node_autostart,node_api toneMint
class node_api_client toneRose
class node_duckai_site toneIndigo
```

## Components

### Desktop UI

- [Main Window](https://github.com/luki-pop/duckaiwraper/blob/main/main_window.py): `main_window.py`
- [Embedded Browser](https://github.com/luki-pop/duckaiwraper/blob/main/main_window.py): `main_window.py`

### Sessions and History

- [Session Panel](https://github.com/luki-pop/duckaiwraper/blob/main/main_window.py): `main_window.py`
- [History Database](https://github.com/luki-pop/duckaiwraper/blob/main/duckai/history.py): `duckai/history.py`
- **SQLite Store**

### Preferences

- [Preferences Dialog](https://github.com/luki-pop/duckaiwraper/blob/main/preferences.py): `preferences.py`
- [Settings](https://github.com/luki-pop/duckaiwraper/blob/main/settings.py): `settings.py`
- **Settings File**
- [Autostart](https://github.com/luki-pop/duckaiwraper/blob/main/autostart.py): `autostart.py`

### HTTP Client

- [DuckAI Client](https://github.com/luki-pop/duckaiwraper/blob/main/duckai/client.py): `duckai/client.py`

### Other components

- **User**
- **duck.ai**
- **DuckAI API**

## Connections

- User → Main Window: uses
- Main Window → Settings: loads settings (evidence: `main_window.py`)
- Main Window → History Database: creates database (evidence: `main_window.py`)
- Main Window → Embedded Browser: hosts (evidence: `main_window.py`)
- Main Window → Session Panel: constructs (evidence: `main_window.py`)
- Main Window → Autostart: checks status (evidence: `main_window.py`)
- Main Window → Preferences Dialog: opens (evidence: `main_window.py`)
- Embedded Browser → duck.ai: loads page (evidence: `main_window.py`)
- Session Panel → History Database: manages sessions (evidence: `main_window.py`)
- Session Panel → Embedded Browser: submits summary (evidence: `main_window.py`)
- Session Panel → Embedded Browser: polls response (evidence: `main_window.py`)
- History Database → SQLite Store: reads and writes (evidence: `duckai/history.py`)
- Preferences Dialog → Settings: saves settings (evidence: `preferences.py`)
- Preferences Dialog → Autostart: sets autostart (evidence: `preferences.py`)
- Settings → Settings File: reads and writes (evidence: `settings.py`)
- DuckAI Client → History Database: loads and stores turns (evidence: `duckai/client.py`)
- DuckAI Client → DuckAI API: posts chat (evidence: `duckai/client.py`)
