# quvi-ai/sketchup-plugin architecture

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

- Interactive diagram: https://gitdiagram.com/quvi-ai/sketchup-plugin
- Repository: https://github.com/quvi-ai/sketchup-plugin

## Overview

QUVIAI is a SketchUp extension for AI architectural rendering and 3D object generation. The user opens the panel, authenticates, supplies render settings or object-generation input, and receives an opened render or an imported GLB. The graph follows these distinct workflows through the extension coordinator, API client, asynchronous job polling, and SketchUp result handling; authentication, saved preferences, and main-thread dispatch are supporting layers. README capabilities not visible in sampled client methods are retained as documented API capabilities. Edges reflect excerpts or README statements; unsampled wiring is omitted.

Main entry points: [`quviai_sketchup/extension.rb`](https://github.com/quvi-ai/sketchup-plugin/blob/main/quviai_sketchup/extension.rb) (Workflow coordinator), [`quviai_sketchup/client.rb`](https://github.com/quvi-ai/sketchup-plugin/blob/main/quviai_sketchup/client.rb) (API and task client), [`quviai_sketchup/panel.rb`](https://github.com/quvi-ai/sketchup-plugin/blob/main/quviai_sketchup/panel.rb) (Web panel), [`quviai_sketchup/http.rb`](https://github.com/quvi-ai/sketchup-plugin/blob/main/quviai_sketchup/http.rb) (Authenticated HTTP)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Panel and UI"]
  node_entry["Extension entry<br/>[quviai_sketchup.rb]"]
  node_panel["Web panel<br/>[panel.rb]"]
  node_html["Panel interface<br/>[panel.html]"]
end

subgraph group_workflow["Generation workflows"]
  node_coordinator["Workflow coordinator<br/>[extension.rb]"]
  node_models["Task and result models<br/>[models.rb]"]
  node_exceptions["Workflow errors<br/>[exceptions.rb]"]
end

subgraph group_platform["SketchUp integration"]
  node_capture["Viewport and image capture<br/>[capture.rb]"]
  node_store[("Saved session and credits<br/>[store.rb]")]
  node_importer["Render and model results<br/>[importer.rb]"]
  node_dispatch["Main-thread dispatch<br/>[main_thread.rb]"]
end

subgraph group_services["QUVIAI services"]
  node_client["API and task client<br/>[client.rb]"]
  node_poller["Job status polling<br/>[polling.rb]"]
  node_http["Authenticated HTTP<br/>[http.rb]"]
  node_auth["JWT authentication<br/>[auth.rb]"]
end

node_user(("SketchUp user"))
node_api{{"QUVIAI API"}}
node_preferences[("SketchUp preferences")]
node_sketchup["SketchUp model and UI"]

node_user -->|"opens and uses"| node_panel
node_entry -->|"registers extension"| node_coordinator
node_coordinator -->|"opens"| node_panel
node_panel -->|"loads interface"| node_html
node_panel -->|"routes actions"| node_coordinator
node_coordinator -->|"loads and saves"| node_store
node_store -->|"reads and writes"| node_preferences
node_coordinator -->|"authenticates and runs jobs"| node_client
node_coordinator -->|"captures inputs"| node_capture
node_client -->|"submits requests"| node_http
node_client -->|"polls tasks"| node_poller
node_poller -->|"checks status"| node_http
node_http -->|"refreshes credentials"| node_auth
node_auth -->|"refreshes token"| node_api
node_http -->|"sends API requests"| node_api
node_client -->|"logs in and downloads"| node_api
node_capture -->|"provides encoded input"| node_client
node_client -->|"returns generated bytes"| node_coordinator
node_coordinator -->|"hands off results"| node_importer
node_importer -->|"opens or imports"| node_sketchup
node_panel -->|"queues UI updates"| node_dispatch
node_dispatch -->|"runs on main thread"| node_sketchup
node_poller -->|"creates task status"| node_models
node_http -->|"raises API errors"| node_exceptions
node_poller -->|"raises task errors"| node_exceptions

click node_entry "https://github.com/quvi-ai/sketchup-plugin/blob/main/quviai_sketchup.rb"
click node_panel "https://github.com/quvi-ai/sketchup-plugin/blob/main/quviai_sketchup/panel.rb"
click node_html "https://github.com/quvi-ai/sketchup-plugin/blob/main/quviai_sketchup/ui/panel.html"
click node_coordinator "https://github.com/quvi-ai/sketchup-plugin/blob/main/quviai_sketchup/extension.rb"
click node_capture "https://github.com/quvi-ai/sketchup-plugin/blob/main/quviai_sketchup/capture.rb"
click node_client "https://github.com/quvi-ai/sketchup-plugin/blob/main/quviai_sketchup/client.rb"
click node_poller "https://github.com/quvi-ai/sketchup-plugin/blob/main/quviai_sketchup/polling.rb"
click node_http "https://github.com/quvi-ai/sketchup-plugin/blob/main/quviai_sketchup/http.rb"
click node_auth "https://github.com/quvi-ai/sketchup-plugin/blob/main/quviai_sketchup/auth.rb"
click node_store "https://github.com/quvi-ai/sketchup-plugin/blob/main/quviai_sketchup/store.rb"
click node_importer "https://github.com/quvi-ai/sketchup-plugin/blob/main/quviai_sketchup/importer.rb"
click node_dispatch "https://github.com/quvi-ai/sketchup-plugin/blob/main/quviai_sketchup/main_thread.rb"
click node_models "https://github.com/quvi-ai/sketchup-plugin/blob/main/quviai_sketchup/models.rb"
click node_exceptions "https://github.com/quvi-ai/sketchup-plugin/blob/main/quviai_sketchup/exceptions.rb"

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_entry,node_panel,node_html,node_user,node_sketchup toneBlue
class node_coordinator,node_models,node_exceptions,node_preferences toneAmber
class node_capture,node_store,node_importer,node_dispatch,node_api toneMint
class node_client,node_poller,node_http,node_auth toneRose
```

## Components

### Panel and UI

- [Extension entry](https://github.com/quvi-ai/sketchup-plugin/blob/main/quviai_sketchup.rb): `quviai_sketchup.rb`
- [Web panel](https://github.com/quvi-ai/sketchup-plugin/blob/main/quviai_sketchup/panel.rb): `quviai_sketchup/panel.rb`
- [Panel interface](https://github.com/quvi-ai/sketchup-plugin/blob/main/quviai_sketchup/ui/panel.html): `quviai_sketchup/ui/panel.html`

### Generation workflows

- [Workflow coordinator](https://github.com/quvi-ai/sketchup-plugin/blob/main/quviai_sketchup/extension.rb): `quviai_sketchup/extension.rb`
- [Task and result models](https://github.com/quvi-ai/sketchup-plugin/blob/main/quviai_sketchup/models.rb): `quviai_sketchup/models.rb`
- [Workflow errors](https://github.com/quvi-ai/sketchup-plugin/blob/main/quviai_sketchup/exceptions.rb): `quviai_sketchup/exceptions.rb`

### SketchUp integration

- [Viewport and image capture](https://github.com/quvi-ai/sketchup-plugin/blob/main/quviai_sketchup/capture.rb): `quviai_sketchup/capture.rb`
- [Saved session and credits](https://github.com/quvi-ai/sketchup-plugin/blob/main/quviai_sketchup/store.rb): `quviai_sketchup/store.rb`
- [Render and model results](https://github.com/quvi-ai/sketchup-plugin/blob/main/quviai_sketchup/importer.rb): `quviai_sketchup/importer.rb`
- [Main-thread dispatch](https://github.com/quvi-ai/sketchup-plugin/blob/main/quviai_sketchup/main_thread.rb): `quviai_sketchup/main_thread.rb`

### QUVIAI services

- [API and task client](https://github.com/quvi-ai/sketchup-plugin/blob/main/quviai_sketchup/client.rb): `quviai_sketchup/client.rb`
- [Job status polling](https://github.com/quvi-ai/sketchup-plugin/blob/main/quviai_sketchup/polling.rb): `quviai_sketchup/polling.rb`
- [Authenticated HTTP](https://github.com/quvi-ai/sketchup-plugin/blob/main/quviai_sketchup/http.rb): `quviai_sketchup/http.rb`
- [JWT authentication](https://github.com/quvi-ai/sketchup-plugin/blob/main/quviai_sketchup/auth.rb): `quviai_sketchup/auth.rb`

### Other components

- **SketchUp user**
- **QUVIAI API**
- **SketchUp preferences**
- **SketchUp model and UI**

## Connections

- SketchUp user → Web panel: opens and uses (evidence: `README.md`)
- Extension entry → Workflow coordinator: registers extension (evidence: `quviai_sketchup.rb`)
- Workflow coordinator → Web panel: opens (evidence: `quviai_sketchup/extension.rb`)
- Web panel → Panel interface: loads interface (evidence: `quviai_sketchup/panel.rb`)
- Web panel → Workflow coordinator: routes actions (evidence: `quviai_sketchup/panel.rb`)
- Workflow coordinator → Saved session and credits: loads and saves (evidence: `quviai_sketchup/extension.rb`)
- Saved session and credits → SketchUp preferences: reads and writes (evidence: `quviai_sketchup/store.rb`)
- Workflow coordinator → API and task client: authenticates and runs jobs (evidence: `quviai_sketchup/extension.rb`)
- Workflow coordinator → Viewport and image capture: captures inputs (evidence: `quviai_sketchup/extension.rb`)
- API and task client → Authenticated HTTP: submits requests (evidence: `quviai_sketchup/client.rb`)
- API and task client → Job status polling: polls tasks (evidence: `quviai_sketchup/client.rb`)
- Job status polling → Authenticated HTTP: checks status (evidence: `quviai_sketchup/polling.rb`)
- Authenticated HTTP → JWT authentication: refreshes credentials (evidence: `quviai_sketchup/http.rb`)
- JWT authentication → QUVIAI API: refreshes token (evidence: `quviai_sketchup/auth.rb`)
- Authenticated HTTP → QUVIAI API: sends API requests (evidence: `quviai_sketchup/http.rb`)
- API and task client → QUVIAI API: logs in and downloads (evidence: `quviai_sketchup/client.rb`)
- Viewport and image capture → API and task client: provides encoded input
- API and task client → Workflow coordinator: returns generated bytes (evidence: `quviai_sketchup/extension.rb`)
- Workflow coordinator → Render and model results: hands off results
- Render and model results → SketchUp model and UI: opens or imports (evidence: `quviai_sketchup/importer.rb`)
- Web panel → Main-thread dispatch: queues UI updates (evidence: `quviai_sketchup/panel.rb`)
- Main-thread dispatch → SketchUp model and UI: runs on main thread (evidence: `quviai_sketchup/main_thread.rb`)
- Job status polling → Task and result models: creates task status (evidence: `quviai_sketchup/polling.rb`)
- Authenticated HTTP → Workflow errors: raises API errors (evidence: `quviai_sketchup/http.rb`)
- Job status polling → Workflow errors: raises task errors (evidence: `quviai_sketchup/polling.rb`)
