# zombieyang/sd-ppp architecture

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

- Interactive diagram: https://gitdiagram.com/zombieyang/sd-ppp
- Repository: https://github.com/zombieyang/sd-ppp

## Overview

SD-PPP is a Photoshop AI plugin paired with a ComfyUI extension and Python server integration. The main workflow is to select Photoshop content, expose it to a ComfyUI workflow, edit or run that workflow, then return generated content to Photoshop. The graph also preserves documented model/API integrations and the ComfyUI workflow editor. Some UI and integration details are represented at directory level because their source was not sampled; relationships without direct evidence are omitted.

Main entry points: [`typescripts/modules/comfy/src/socket/WorkflowCallee.mts`](https://github.com/zombieyang/sd-ppp/blob/main/typescripts/modules/comfy/src/socket/WorkflowCallee.mts) (Workflow handler), [`sdppp_python/sdppp.py`](https://github.com/zombieyang/sd-ppp/blob/main/sdppp_python/sdppp.py) (Python server), [`sdppp_python/comfy/nodes.py`](https://github.com/zombieyang/sd-ppp/blob/main/sdppp_python/comfy/nodes.py) (Comfy custom nodes), [`typescripts/src/common/socket/Socket.mts`](https://github.com/zombieyang/sd-ppp/blob/main/typescripts/src/common/socket/Socket.mts) (Socket transport)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_photoshop["Photoshop plugin"]
  node_psui["Photoshop panel"]
  node_psworkflow["Workflow editor"]
end

subgraph group_comfy["ComfyUI workflow"]
  node_comfyui["ComfyUI interface"]
  node_comfypopup["Popup controller<br/>[sdpppPopup.mts]"]
  node_workflow["Workflow handler<br/>[WorkflowCallee.mts]"]
  node_form["Graph form converter<br/>[graph-to-form.mts]"]
  node_nodes["Comfy custom nodes<br/>[nodes.py]"]
  node_legacy["Legacy nodes<br/>[nodes_legacy.py]"]
end

subgraph group_backend["Python integration"]
  node_pyserver["Python server<br/>[sdppp.py]"]
  node_http["Image endpoints<br/>[apis.py]"]
  node_psprotocol["Photoshop protocol<br/>[photoshop.py]"]
  node_instances["Client instances<br/>[instances.py]"]
  node_imagecache[("Image cache<br/>[store.py]")]
end

subgraph group_shared["Shared transport and state"]
  node_pscaller["Photoshop caller"]
  node_pscallee["Photoshop callee"]
  node_comfysocket["Comfy socket<br/>[ComfySocket.mts]"]
  node_socket["Socket transport<br/>[Socket.mts]"]
  node_models["Comfy state map"]
  node_page["Workflow state<br/>[page.mts]"]
  node_psstore["Photoshop state<br/>[photoshop.mts]"]
end

node_user(("Photoshop user"))
node_comfy(("ComfyUI runtime"))
node_apis{{"Model/API providers"}}

node_user -.->|"uses"| node_psui
node_user -.->|"edits workflows"| node_comfyui
node_psui -.->|"edits"| node_psworkflow
node_comfy -.->|"hosts"| node_comfypopup
node_comfypopup -.->|"dispatches"| node_workflow
node_workflow -->|"converts widgets"| node_form
node_workflow -->|"updates state"| node_page
node_comfysocket -->|"mixes in"| node_workflow
node_comfysocket -->|"extends transport"| node_socket
node_models -->|"creates"| node_page
node_models -->|"creates"| node_psstore
node_pyserver -->|"registers endpoints"| node_http
node_pyserver -->|"loads nodes"| node_nodes
node_pyserver -->|"uses"| node_instances
node_legacy -->|"reuses"| node_nodes
node_nodes -->|"requests Photoshop actions"| node_psprotocol
node_http -.->|"reads and writes"| node_imagecache
node_psprotocol -->|"selects client"| node_instances
node_pscaller -.->|"uses transport"| node_socket
node_pscallee -.->|"uses transport"| node_socket
node_apis -.->|"provides models"| node_comfy

click node_psui "https://github.com/zombieyang/sd-ppp/tree/main/typescripts/modules/photoshop/src/tsx"
click node_psworkflow "https://github.com/zombieyang/sd-ppp/blob/main/typescripts/modules/photoshop/src/tsx/WorkflowEditWrap.tsx"
click node_pscaller "https://github.com/zombieyang/sd-ppp/blob/main/typescripts/src/socket/PhotoshopCaller.mts"
click node_pscallee "https://github.com/zombieyang/sd-ppp/blob/main/typescripts/src/socket/PhotoshopCalleeInterface.mts"
click node_comfyui "https://github.com/zombieyang/sd-ppp/tree/main/typescripts/modules/comfy/src/popup/tsx"
click node_comfypopup "https://github.com/zombieyang/sd-ppp/blob/main/typescripts/modules/comfy/src/popup/sdpppPopup.mts"
click node_workflow "https://github.com/zombieyang/sd-ppp/blob/main/typescripts/modules/comfy/src/socket/WorkflowCallee.mts"
click node_form "https://github.com/zombieyang/sd-ppp/blob/main/typescripts/modules/comfy/src/graph-to-form.mts"
click node_nodes "https://github.com/zombieyang/sd-ppp/blob/main/sdppp_python/comfy/nodes.py"
click node_legacy "https://github.com/zombieyang/sd-ppp/blob/main/sdppp_python/comfy/nodes_legacy.py"
click node_pyserver "https://github.com/zombieyang/sd-ppp/blob/main/sdppp_python/sdppp.py"
click node_http "https://github.com/zombieyang/sd-ppp/blob/main/sdppp_python/apis.py"
click node_psprotocol "https://github.com/zombieyang/sd-ppp/blob/main/sdppp_python/protocols/photoshop.py"
click node_instances "https://github.com/zombieyang/sd-ppp/blob/main/sdppp_python/instances.py"
click node_imagecache "https://github.com/zombieyang/sd-ppp/blob/main/sdppp_python/store/store.py"
click node_comfysocket "https://github.com/zombieyang/sd-ppp/blob/main/typescripts/modules/comfy/src/socket/ComfySocket.mts"
click node_socket "https://github.com/zombieyang/sd-ppp/blob/main/typescripts/src/common/socket/Socket.mts"
click node_models "https://github.com/zombieyang/sd-ppp/blob/main/typescripts/modules/comfy/photoshopModels.mts"
click node_page "https://github.com/zombieyang/sd-ppp/blob/main/typescripts/src/store/page.mts"
click node_psstore "https://github.com/zombieyang/sd-ppp/blob/main/typescripts/src/store/photoshop.mts"

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_psui,node_psworkflow,node_user,node_comfy toneBlue
class node_comfyui,node_comfypopup,node_workflow,node_form,node_nodes,node_legacy toneAmber
class node_pyserver,node_http,node_psprotocol,node_instances,node_imagecache,node_apis toneMint
class node_pscaller,node_pscallee,node_comfysocket,node_socket,node_models,node_page,node_psstore toneRose
```

## Components

### Photoshop plugin

- [Photoshop panel](https://github.com/zombieyang/sd-ppp/tree/main/typescripts/modules/photoshop/src/tsx): `typescripts/modules/photoshop/src/tsx`
- [Workflow editor](https://github.com/zombieyang/sd-ppp/blob/main/typescripts/modules/photoshop/src/tsx/WorkflowEditWrap.tsx): `typescripts/modules/photoshop/src/tsx/WorkflowEditWrap.tsx`

### ComfyUI workflow

- [ComfyUI interface](https://github.com/zombieyang/sd-ppp/tree/main/typescripts/modules/comfy/src/popup/tsx): `typescripts/modules/comfy/src/popup/tsx`
- [Popup controller](https://github.com/zombieyang/sd-ppp/blob/main/typescripts/modules/comfy/src/popup/sdpppPopup.mts): `typescripts/modules/comfy/src/popup/sdpppPopup.mts`
- [Workflow handler](https://github.com/zombieyang/sd-ppp/blob/main/typescripts/modules/comfy/src/socket/WorkflowCallee.mts): `typescripts/modules/comfy/src/socket/WorkflowCallee.mts`
- [Graph form converter](https://github.com/zombieyang/sd-ppp/blob/main/typescripts/modules/comfy/src/graph-to-form.mts): `typescripts/modules/comfy/src/graph-to-form.mts`
- [Comfy custom nodes](https://github.com/zombieyang/sd-ppp/blob/main/sdppp_python/comfy/nodes.py): `sdppp_python/comfy/nodes.py`
- [Legacy nodes](https://github.com/zombieyang/sd-ppp/blob/main/sdppp_python/comfy/nodes_legacy.py): `sdppp_python/comfy/nodes_legacy.py`

### Python integration

- [Python server](https://github.com/zombieyang/sd-ppp/blob/main/sdppp_python/sdppp.py): `sdppp_python/sdppp.py`
- [Image endpoints](https://github.com/zombieyang/sd-ppp/blob/main/sdppp_python/apis.py): `sdppp_python/apis.py`
- [Photoshop protocol](https://github.com/zombieyang/sd-ppp/blob/main/sdppp_python/protocols/photoshop.py): `sdppp_python/protocols/photoshop.py`
- [Client instances](https://github.com/zombieyang/sd-ppp/blob/main/sdppp_python/instances.py): `sdppp_python/instances.py`
- [Image cache](https://github.com/zombieyang/sd-ppp/blob/main/sdppp_python/store/store.py): `sdppp_python/store/store.py`

### Shared transport and state

- [Photoshop caller](https://github.com/zombieyang/sd-ppp/blob/main/typescripts/src/socket/PhotoshopCaller.mts): `typescripts/src/socket/PhotoshopCaller.mts`
- [Photoshop callee](https://github.com/zombieyang/sd-ppp/blob/main/typescripts/src/socket/PhotoshopCalleeInterface.mts): `typescripts/src/socket/PhotoshopCalleeInterface.mts`
- [Comfy socket](https://github.com/zombieyang/sd-ppp/blob/main/typescripts/modules/comfy/src/socket/ComfySocket.mts): `typescripts/modules/comfy/src/socket/ComfySocket.mts`
- [Socket transport](https://github.com/zombieyang/sd-ppp/blob/main/typescripts/src/common/socket/Socket.mts): `typescripts/src/common/socket/Socket.mts`
- [Comfy state map](https://github.com/zombieyang/sd-ppp/blob/main/typescripts/modules/comfy/photoshopModels.mts): `typescripts/modules/comfy/photoshopModels.mts`
- [Workflow state](https://github.com/zombieyang/sd-ppp/blob/main/typescripts/src/store/page.mts): `typescripts/src/store/page.mts`
- [Photoshop state](https://github.com/zombieyang/sd-ppp/blob/main/typescripts/src/store/photoshop.mts): `typescripts/src/store/photoshop.mts`

### Other components

- **Photoshop user**
- **ComfyUI runtime**
- **Model/API providers**

## Connections

- Photoshop user → Photoshop panel: uses
- Photoshop user → ComfyUI interface: edits workflows
- Photoshop panel → Workflow editor: edits
- ComfyUI runtime → Popup controller: hosts
- Popup controller → Workflow handler: dispatches
- Workflow handler → Graph form converter: converts widgets (evidence: `typescripts/modules/comfy/src/socket/WorkflowCallee.mts`)
- Workflow handler → Workflow state: updates state (evidence: `typescripts/modules/comfy/src/socket/WorkflowCallee.mts`)
- Comfy socket → Workflow handler: mixes in (evidence: `typescripts/modules/comfy/src/socket/ComfySocket.mts`)
- Comfy socket → Socket transport: extends transport (evidence: `typescripts/modules/comfy/src/socket/ComfySocket.mts`)
- Comfy state map → Workflow state: creates (evidence: `typescripts/modules/comfy/photoshopModels.mts`)
- Comfy state map → Photoshop state: creates (evidence: `typescripts/modules/comfy/photoshopModels.mts`)
- Python server → Image endpoints: registers endpoints (evidence: `sdppp_python/sdppp.py`)
- Python server → Comfy custom nodes: loads nodes (evidence: `sdppp_python/sdppp.py`)
- Python server → Client instances: uses (evidence: `sdppp_python/sdppp.py`)
- Legacy nodes → Comfy custom nodes: reuses (evidence: `sdppp_python/comfy/nodes_legacy.py`)
- Comfy custom nodes → Photoshop protocol: requests Photoshop actions (evidence: `sdppp_python/comfy/nodes.py`)
- Image endpoints → Image cache: reads and writes
- Photoshop protocol → Client instances: selects client (evidence: `sdppp_python/protocols/photoshop.py`)
- Photoshop caller → Socket transport: uses transport
- Photoshop callee → Socket transport: uses transport
- Model/API providers → ComfyUI runtime: provides models
