# sleet1k/orca-quota-panel architecture

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

- Interactive diagram: https://gitdiagram.com/sleet1k/orca-quota-panel
- Repository: https://github.com/sleet1k/orca-quota-panel

## Overview

Quota Panel is an Orca sidebar plugin for monitoring OpenRouter daily quota and managing quota-aware modes, credentials, settings, skill installation, and automation. The user workflow runs from the panel through worker request handlers to quota status or saved settings; the worker also installs the bundled skill and synchronizes its configuration with Orca automation. Edges rely on README statements and the shown worker excerpts; panel internals and the skill script were not sampled, so their details are limited.

Main entry points: [`src/worker.ts`](https://github.com/sleet1k/orca-quota-panel/blob/master/src/worker.ts) (Plugin worker), [`src/panel.html`](https://github.com/sleet1k/orca-quota-panel/blob/master/src/panel.html) (Quota panel), [`skill/quota-aware-planning`](https://github.com/sleet1k/orca-quota-panel/tree/master/skill/quota-aware-planning) (Quota planning skill), [`skill/quota-aware-planning/config.json`](https://github.com/sleet1k/orca-quota-panel/blob/master/skill/quota-aware-planning/config.json) (Skill configuration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Panel Interface"]
  node_panel["Quota panel<br/>[panel.html]"]
  node_contract["Request contract<br/>[protocol.ts]"]
end

subgraph group_worker["Quota Worker"]
  node_worker["Plugin worker<br/>[worker.ts]"]
end

subgraph group_settings["Settings and State"]
  node_plugin_storage[("Orca plugin storage")]
  node_key_file["Skill key file"]
  node_mode_file["Mode file"]
end

subgraph group_skill["Skill and Automation"]
  node_skill_bundle["Quota planning skill"]
  node_skill_config["Skill configuration<br/>[config.json]"]
  node_bot_skills["Orca bot skill installs"]
  node_opencode["OpenCode skill mirror"]
end

node_user(("Orca user"))
node_openrouter["OpenRouter API"]
node_orca_cli["Orca CLI"]

node_user -->|"uses"| node_panel
node_panel -->|"sends requests"| node_worker
node_worker -->|"returns status"| node_panel
node_worker -->|"polls quota"| node_openrouter
node_worker -->|"reads and writes"| node_plugin_storage
node_worker -->|"reads and exports key"| node_key_file
node_worker -->|"reads and writes mode"| node_mode_file
node_worker -->|"installs from"| node_skill_bundle
node_worker -->|"installs skill"| node_bot_skills
node_worker -->|"mirrors skill"| node_opencode
node_worker -->|"loads defaults"| node_skill_config
node_worker -->|"syncs automation"| node_orca_cli
node_worker -->|"serves logs and settings"| node_panel

click node_panel "https://github.com/sleet1k/orca-quota-panel/blob/master/src/panel.html"
click node_contract "https://github.com/sleet1k/orca-quota-panel/blob/master/src/protocol.ts"
click node_worker "https://github.com/sleet1k/orca-quota-panel/blob/master/src/worker.ts"
click node_skill_bundle "https://github.com/sleet1k/orca-quota-panel/tree/master/skill/quota-aware-planning"
click node_skill_config "https://github.com/sleet1k/orca-quota-panel/blob/master/skill/quota-aware-planning/config.json"

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_panel,node_contract,node_user toneBlue
class node_worker toneAmber
class node_plugin_storage,node_key_file,node_mode_file,node_openrouter toneMint
class node_skill_bundle,node_skill_config,node_bot_skills,node_opencode toneRose
class node_orca_cli toneIndigo
```

## Components

### Panel Interface

- [Quota panel](https://github.com/sleet1k/orca-quota-panel/blob/master/src/panel.html): `src/panel.html`
- [Request contract](https://github.com/sleet1k/orca-quota-panel/blob/master/src/protocol.ts): `src/protocol.ts`

### Quota Worker

- [Plugin worker](https://github.com/sleet1k/orca-quota-panel/blob/master/src/worker.ts): `src/worker.ts`

### Settings and State

- **Orca plugin storage**
- **Skill key file**
- **Mode file**

### Skill and Automation

- [Quota planning skill](https://github.com/sleet1k/orca-quota-panel/tree/master/skill/quota-aware-planning): `skill/quota-aware-planning`
- [Skill configuration](https://github.com/sleet1k/orca-quota-panel/blob/master/skill/quota-aware-planning/config.json): `skill/quota-aware-planning/config.json`
- **Orca bot skill installs**
- **OpenCode skill mirror**

### Other components

- **Orca user**
- **OpenRouter API**
- **Orca CLI**

## Connections

- Orca user → Quota panel: uses (evidence: `README.md`)
- Quota panel → Plugin worker: sends requests (evidence: `README.md`)
- Plugin worker → Quota panel: returns status
- Plugin worker → OpenRouter API: polls quota (evidence: `src/worker.ts`)
- Plugin worker → Orca plugin storage: reads and writes (evidence: `src/worker.ts`)
- Plugin worker → Skill key file: reads and exports key (evidence: `src/worker.ts`)
- Plugin worker → Mode file: reads and writes mode (evidence: `src/worker.ts`)
- Plugin worker → Quota planning skill: installs from (evidence: `src/worker.ts`)
- Plugin worker → Orca bot skill installs: installs skill (evidence: `src/worker.ts`)
- Plugin worker → OpenCode skill mirror: mirrors skill (evidence: `src/worker.ts`)
- Plugin worker → Skill configuration: loads defaults (evidence: `src/worker.ts`)
- Plugin worker → Orca CLI: syncs automation (evidence: `README.md`)
- Plugin worker → Quota panel: serves logs and settings
