# vark-debug/rocxps architecture

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

- Interactive diagram: https://gitdiagram.com/vark-debug/rocxps
- Repository: https://github.com/vark-debug/rocxps

## Overview

This is a Photoshop UXP plugin for AI-assisted selection redraw, removal, and canvas expansion. The main workflow is: select an area in Photoshop, capture an image and mask, submit a prompt through the task pipeline and provider dispatcher, then place the generated result back on the canvas. The graph also preserves queue persistence and controls, settings and templates, provider integrations, Siliconed cross-machine computation, and the documented expansion and upscale capabilities. Edges cite README workflow statements or source-index references; unsampled implementation details are not inferred.

Main entry points: [`src/providers/index.ts`](https://github.com/vark-debug/rocxps/blob/main/src/providers/index.ts) (Provider dispatch), [`src/task/pipeline.ts`](https://github.com/vark-debug/rocxps/blob/main/src/task/pipeline.ts) (Generation pipeline), [`src/components/RedrawPanel.tsx`](https://github.com/vark-debug/rocxps/blob/main/src/components/RedrawPanel.tsx) (Redraw panel), [`src/main.tsx`](https://github.com/vark-debug/rocxps/blob/main/src/main.tsx) (Panel entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Plugin interface"]
  node_main["Panel entry<br/>[main.tsx]"]
  node_redraw_ui["Redraw panel<br/>[RedrawPanel.tsx]"]
  node_selection_ui["Selection panel<br/>[SelectionPanel.tsx]"]
  node_settings_ui["Settings panel<br/>[SettingsPanel.tsx]"]
end

subgraph group_tasks["Task execution"]
  node_pipeline["Generation pipeline<br/>[pipeline.ts]"]
  node_queue["Task queue<br/>[queue.ts]"]
  node_queue_runner["Queue runner<br/>[queueRunner.ts]"]
  node_queue_store[("Queue persistence<br/>[queueStore.ts]")]
  node_scheduler["Queue scheduler<br/>[scheduler.ts]"]
end

subgraph group_photoshop["Photoshop imaging"]
  node_capture["Selection capture<br/>[capture.ts]"]
  node_expand_capture["Canvas expansion capture<br/>[expandCapture.ts]"]
  node_size_planning["Size planning<br/>[presetFit.ts]"]
  node_place_back["Result placement<br/>[placeBack.ts]"]
end

subgraph group_providers["Generation providers"]
  node_provider_catalog["Model catalog<br/>[catalog.ts]"]
  node_provider_dispatch["Provider dispatch<br/>[index.ts]"]
  node_ark["Ark service<br/>[client.ts]"]
  node_runninghub["RunningHub<br/>[runninghub.ts]"]
  node_siliconed["Siliconed provider<br/>[siliconed.ts]"]
  node_iopaint["IOPaint provider<br/>[iopaint.ts]"]
  node_custom_http["Custom HTTP provider<br/>[custom.ts]"]
  node_comfyui["ComfyUI provider<br/>[comfyui.ts]"]
end

subgraph group_configuration["Settings and compute"]
  node_settings_store[("Settings storage<br/>[store.ts]")]
  node_templates["Prompt templates<br/>[templates.ts]"]
  node_siliconed_target["Compute target planning<br/>[siliconedTarget.ts]"]
  node_silicontrol["Siliconed control<br/>[silicontrol.ts]"]
  node_upscale["Upscale planning<br/>[upscalePlan.ts]"]
end

node_user(("Plugin user"))
node_photoshop_host["Photoshop host"]

node_user -->|"opens plugin"| node_main
node_main -->|"renders"| node_redraw_ui
node_main -->|"renders"| node_selection_ui
node_main -->|"renders"| node_settings_ui
node_user -->|"submits prompt"| node_redraw_ui
node_user -->|"selects area"| node_photoshop_host
node_redraw_ui -->|"starts generation"| node_pipeline
node_selection_ui -->|"captures selection"| node_capture
node_pipeline -->|"loads settings"| node_settings_store
node_pipeline -->|"resolves model"| node_provider_catalog
node_pipeline -->|"captures selection"| node_capture
node_pipeline -->|"requests generation"| node_provider_dispatch
node_pipeline -->|"places result"| node_place_back
node_redraw_ui -->|"manages jobs"| node_queue
node_queue -->|"persists state"| node_queue_store
node_queue -.->|"schedules jobs"| node_scheduler
node_scheduler -.->|"runs jobs"| node_queue_runner
node_queue_runner -->|"requests generation"| node_provider_dispatch
node_queue_runner -->|"places result"| node_place_back
node_queue_runner -.->|"stores job data"| node_queue_store
node_capture -->|"reads image and mask"| node_photoshop_host
node_capture -->|"plans dimensions"| node_size_planning
node_expand_capture -->|"reads expanded canvas"| node_photoshop_host
node_place_back -->|"writes generated result"| node_photoshop_host
node_provider_dispatch -->|"selects model"| node_provider_catalog
node_provider_dispatch -->|"dispatches request"| node_ark
node_provider_dispatch -->|"dispatches request"| node_runninghub
node_provider_dispatch -->|"dispatches request"| node_siliconed
node_provider_dispatch -->|"dispatches request"| node_iopaint
node_provider_dispatch -->|"dispatches request"| node_custom_http
node_provider_dispatch -->|"dispatches request"| node_comfyui
node_siliconed -->|"invokes control"| node_silicontrol
node_siliconed -->|"checks target"| node_siliconed_target
node_silicontrol -->|"builds upscale args"| node_upscale
node_settings_ui -->|"configures settings"| node_settings_store
node_settings_ui -->|"edits templates"| node_templates
node_pipeline -->|"applies override"| node_templates
node_settings_store -->|"normalizes templates"| node_templates
node_settings_store -->|"normalizes target"| node_siliconed_target
node_settings_ui -.->|"configures expansion"| node_expand_capture
node_redraw_ui -.->|"exposes upscale workflow"| node_upscale

click node_main "https://github.com/vark-debug/rocxps/blob/main/src/main.tsx"
click node_redraw_ui "https://github.com/vark-debug/rocxps/blob/main/src/components/RedrawPanel.tsx"
click node_selection_ui "https://github.com/vark-debug/rocxps/blob/main/src/components/SelectionPanel.tsx"
click node_settings_ui "https://github.com/vark-debug/rocxps/blob/main/src/components/SettingsPanel.tsx"
click node_pipeline "https://github.com/vark-debug/rocxps/blob/main/src/task/pipeline.ts"
click node_queue "https://github.com/vark-debug/rocxps/blob/main/src/task/queue.ts"
click node_queue_runner "https://github.com/vark-debug/rocxps/blob/main/src/task/queueRunner.ts"
click node_queue_store "https://github.com/vark-debug/rocxps/blob/main/src/task/queueStore.ts"
click node_scheduler "https://github.com/vark-debug/rocxps/blob/main/src/task/scheduler.ts"
click node_capture "https://github.com/vark-debug/rocxps/blob/main/src/ps/capture.ts"
click node_expand_capture "https://github.com/vark-debug/rocxps/blob/main/src/ps/expandCapture.ts"
click node_size_planning "https://github.com/vark-debug/rocxps/blob/main/src/ps/presetFit.ts"
click node_place_back "https://github.com/vark-debug/rocxps/blob/main/src/ps/placeBack.ts"
click node_provider_catalog "https://github.com/vark-debug/rocxps/blob/main/src/providers/catalog.ts"
click node_provider_dispatch "https://github.com/vark-debug/rocxps/blob/main/src/providers/index.ts"
click node_ark "https://github.com/vark-debug/rocxps/blob/main/src/ark/client.ts"
click node_runninghub "https://github.com/vark-debug/rocxps/blob/main/src/providers/runninghub.ts"
click node_siliconed "https://github.com/vark-debug/rocxps/blob/main/src/providers/siliconed.ts"
click node_iopaint "https://github.com/vark-debug/rocxps/blob/main/src/providers/iopaint.ts"
click node_custom_http "https://github.com/vark-debug/rocxps/blob/main/src/providers/custom.ts"
click node_comfyui "https://github.com/vark-debug/rocxps/blob/main/src/providers/comfyui.ts"
click node_settings_store "https://github.com/vark-debug/rocxps/blob/main/src/settings/store.ts"
click node_templates "https://github.com/vark-debug/rocxps/blob/main/src/settings/templates.ts"
click node_siliconed_target "https://github.com/vark-debug/rocxps/blob/main/src/providers/siliconedTarget.ts"
click node_silicontrol "https://github.com/vark-debug/rocxps/blob/main/src/core/silicontrol.ts"
click node_upscale "https://github.com/vark-debug/rocxps/blob/main/src/core/upscalePlan.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_main,node_redraw_ui,node_selection_ui,node_settings_ui,node_user toneBlue
class node_pipeline,node_queue,node_queue_runner,node_queue_store,node_scheduler toneAmber
class node_capture,node_expand_capture,node_size_planning,node_place_back toneMint
class node_provider_catalog,node_provider_dispatch,node_ark,node_runninghub,node_siliconed,node_iopaint,node_custom_http,node_comfyui toneRose
class node_settings_store,node_templates,node_siliconed_target,node_silicontrol,node_upscale,node_photoshop_host toneIndigo
```

## Components

### Plugin interface

- [Panel entry](https://github.com/vark-debug/rocxps/blob/main/src/main.tsx): `src/main.tsx`
- [Redraw panel](https://github.com/vark-debug/rocxps/blob/main/src/components/RedrawPanel.tsx): `src/components/RedrawPanel.tsx`
- [Selection panel](https://github.com/vark-debug/rocxps/blob/main/src/components/SelectionPanel.tsx): `src/components/SelectionPanel.tsx`
- [Settings panel](https://github.com/vark-debug/rocxps/blob/main/src/components/SettingsPanel.tsx): `src/components/SettingsPanel.tsx`

### Task execution

- [Generation pipeline](https://github.com/vark-debug/rocxps/blob/main/src/task/pipeline.ts): `src/task/pipeline.ts`
- [Task queue](https://github.com/vark-debug/rocxps/blob/main/src/task/queue.ts): `src/task/queue.ts`
- [Queue runner](https://github.com/vark-debug/rocxps/blob/main/src/task/queueRunner.ts): `src/task/queueRunner.ts`
- [Queue persistence](https://github.com/vark-debug/rocxps/blob/main/src/task/queueStore.ts): `src/task/queueStore.ts`
- [Queue scheduler](https://github.com/vark-debug/rocxps/blob/main/src/task/scheduler.ts): `src/task/scheduler.ts`

### Photoshop imaging

- [Selection capture](https://github.com/vark-debug/rocxps/blob/main/src/ps/capture.ts): `src/ps/capture.ts`
- [Canvas expansion capture](https://github.com/vark-debug/rocxps/blob/main/src/ps/expandCapture.ts): `src/ps/expandCapture.ts`
- [Size planning](https://github.com/vark-debug/rocxps/blob/main/src/ps/presetFit.ts): `src/ps/presetFit.ts`
- [Result placement](https://github.com/vark-debug/rocxps/blob/main/src/ps/placeBack.ts): `src/ps/placeBack.ts`

### Generation providers

- [Model catalog](https://github.com/vark-debug/rocxps/blob/main/src/providers/catalog.ts): `src/providers/catalog.ts`
- [Provider dispatch](https://github.com/vark-debug/rocxps/blob/main/src/providers/index.ts): `src/providers/index.ts`
- [Ark service](https://github.com/vark-debug/rocxps/blob/main/src/ark/client.ts): `src/ark/client.ts`
- [RunningHub](https://github.com/vark-debug/rocxps/blob/main/src/providers/runninghub.ts): `src/providers/runninghub.ts`
- [Siliconed provider](https://github.com/vark-debug/rocxps/blob/main/src/providers/siliconed.ts): `src/providers/siliconed.ts`
- [IOPaint provider](https://github.com/vark-debug/rocxps/blob/main/src/providers/iopaint.ts): `src/providers/iopaint.ts`
- [Custom HTTP provider](https://github.com/vark-debug/rocxps/blob/main/src/providers/custom.ts): `src/providers/custom.ts`
- [ComfyUI provider](https://github.com/vark-debug/rocxps/blob/main/src/providers/comfyui.ts): `src/providers/comfyui.ts`

### Settings and compute

- [Settings storage](https://github.com/vark-debug/rocxps/blob/main/src/settings/store.ts): `src/settings/store.ts`
- [Prompt templates](https://github.com/vark-debug/rocxps/blob/main/src/settings/templates.ts): `src/settings/templates.ts`
- [Compute target planning](https://github.com/vark-debug/rocxps/blob/main/src/providers/siliconedTarget.ts): `src/providers/siliconedTarget.ts`
- [Siliconed control](https://github.com/vark-debug/rocxps/blob/main/src/core/silicontrol.ts): `src/core/silicontrol.ts`
- [Upscale planning](https://github.com/vark-debug/rocxps/blob/main/src/core/upscalePlan.ts): `src/core/upscalePlan.ts`

### Other components

- **Plugin user**
- **Photoshop host**

## Connections

- Plugin user → Panel entry: opens plugin (evidence: `README.md`)
- Panel entry → Redraw panel: renders (evidence: `src/main.tsx`)
- Panel entry → Selection panel: renders (evidence: `src/main.tsx`)
- Panel entry → Settings panel: renders (evidence: `src/main.tsx`)
- Plugin user → Redraw panel: submits prompt (evidence: `README.md`)
- Plugin user → Photoshop host: selects area (evidence: `README.md`)
- Redraw panel → Generation pipeline: starts generation (evidence: `src/components/RedrawPanel.tsx`)
- Selection panel → Selection capture: captures selection (evidence: `src/components/SelectionPanel.tsx`)
- Generation pipeline → Settings storage: loads settings (evidence: `src/task/pipeline.ts`)
- Generation pipeline → Model catalog: resolves model (evidence: `src/task/pipeline.ts`)
- Generation pipeline → Selection capture: captures selection (evidence: `src/task/pipeline.ts`)
- Generation pipeline → Provider dispatch: requests generation (evidence: `src/task/pipeline.ts`)
- Generation pipeline → Result placement: places result (evidence: `src/task/pipeline.ts`)
- Redraw panel → Task queue: manages jobs (evidence: `README.md`)
- Task queue → Queue persistence: persists state (evidence: `README.md`)
- Task queue → Queue scheduler: schedules jobs
- Queue scheduler → Queue runner: runs jobs (evidence: `src/task/queueRunner.ts`)
- Queue runner → Provider dispatch: requests generation (evidence: `src/task/queueRunner.ts`)
- Queue runner → Result placement: places result (evidence: `src/task/queueRunner.ts`)
- Queue runner → Queue persistence: stores job data (evidence: `src/task/queueRunner.ts`)
- Selection capture → Photoshop host: reads image and mask (evidence: `src/ps/capture.ts`)
- Selection capture → Size planning: plans dimensions (evidence: `src/ps/capture.ts`)
- Canvas expansion capture → Photoshop host: reads expanded canvas (evidence: `src/ps/expandCapture.ts`)
- Result placement → Photoshop host: writes generated result (evidence: `src/ps/placeBack.ts`)
- Provider dispatch → Model catalog: selects model (evidence: `src/providers/index.ts`)
- Provider dispatch → Ark service: dispatches request (evidence: `src/providers/index.ts`)
- Provider dispatch → RunningHub: dispatches request (evidence: `src/providers/index.ts`)
- Provider dispatch → Siliconed provider: dispatches request (evidence: `src/providers/index.ts`)
- Provider dispatch → IOPaint provider: dispatches request (evidence: `src/providers/index.ts`)
- Provider dispatch → Custom HTTP provider: dispatches request (evidence: `src/providers/index.ts`)
- Provider dispatch → ComfyUI provider: dispatches request (evidence: `src/providers/index.ts`)
- Siliconed provider → Siliconed control: invokes control (evidence: `src/providers/siliconed.ts`)
- Siliconed provider → Compute target planning: checks target (evidence: `src/providers/siliconed.ts`)
- Siliconed control → Upscale planning: builds upscale args (evidence: `src/core/silicontrol.ts`)
- Settings panel → Settings storage: configures settings (evidence: `src/components/SettingsPanel.tsx`)
- Settings panel → Prompt templates: edits templates (evidence: `src/components/SettingsPanel.tsx`)
- Generation pipeline → Prompt templates: applies override (evidence: `src/task/pipeline.ts`)
- Settings storage → Prompt templates: normalizes templates (evidence: `src/settings/store.ts`)
- Settings storage → Compute target planning: normalizes target (evidence: `src/settings/store.ts`)
- Settings panel → Canvas expansion capture: configures expansion
- Redraw panel → Upscale planning: exposes upscale workflow (evidence: `src/components/RedrawPanel.tsx`)
