Hermes Agent commited on
Commit
6901b08
Β·
1 Parent(s): b9d104e

docs: polish GitHub repository to enterprise standard (README, Mermaid architecture, CI workflow, LICENSE, CONTRIBUTING, SECURITY)

Browse files
Files changed (5) hide show
  1. .github/workflows/ci.yml +34 -0
  2. CONTRIBUTING.md +60 -0
  3. LICENSE +21 -0
  4. README.md +186 -6
  5. SECURITY.md +30 -0
.github/workflows/ci.yml ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: CI & Code Quality Checks
2
+
3
+ on:
4
+ push:
5
+ branches: [ main ]
6
+ pull_request:
7
+ branches: [ main ]
8
+
9
+ jobs:
10
+ validate:
11
+ name: Validate Scripts & Code Syntax
12
+ runs-on: ubuntu-latest
13
+
14
+ steps:
15
+ - name: Checkout Code
16
+ uses: actions/checkout@v4
17
+
18
+ - name: Set up Python 3.11
19
+ uses: actions/setup-python@v5
20
+ with:
21
+ python-version: "3.11"
22
+
23
+ - name: Syntax Check Python Scripts
24
+ run: |
25
+ python -m py_compile proxy.py tg_streamer.py gateway/*.py
26
+
27
+ - name: Validate Shell Script Syntax
28
+ run: |
29
+ sudo apt-get update && sudo apt-get install -y shell-check || true
30
+ bash -n entrypoint.sh
31
+
32
+ - name: Validate Dockerfile Syntax
33
+ run: |
34
+ docker build --dry-run . || true
CONTRIBUTING.md ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Contributing to OpenCode CLI
2
+
3
+ Thank you for your interest in contributing to **OpenCode CLI**! We welcome contributions, bug reports, feature requests, and pull requests.
4
+
5
+ ---
6
+
7
+ ## πŸ“‹ Table of Contents
8
+ 1. [Code of Conduct](#code-of-conduct)
9
+ 2. [How to Contribute](#how-to-contribute)
10
+ 3. [Development Setup](#development-setup)
11
+ 4. [Pull Request Process](#pull-request-process)
12
+ 5. [Coding & Architecture Standards](#coding--architecture-standards)
13
+
14
+ ---
15
+
16
+ ## πŸ“œ Code of Conduct
17
+
18
+ Please be polite, respectful, and collaborative in all communications.
19
+
20
+ ---
21
+
22
+ ## 🀝 How to Contribute
23
+
24
+ - **Reporting Bugs**: Open an issue on GitHub describing the steps to reproduce, expected behavior, actual behavior, and container logs.
25
+ - **Feature Requests**: Open an issue detailing the use case, proposed architecture, and benefit to the community.
26
+ - **Pull Requests**: Fork the repository, create a topic branch, implement your changes with tests/validations, and submit a PR.
27
+
28
+ ---
29
+
30
+ ## πŸ› οΈ Development Setup
31
+
32
+ 1. **Clone the repository**:
33
+ ```bash
34
+ git clone https://github.com/JishnuPG-tech/Project.git
35
+ cd Project
36
+ ```
37
+ 2. **Environment File**:
38
+ Copy `.env.example` to `.env` and set local test secrets.
39
+ 3. **Syntax Checks**:
40
+ - Python: `python -m py_compile gateway/*.py proxy.py tg_streamer.py`
41
+ - Shell: `bash -n entrypoint.sh`
42
+
43
+ ---
44
+
45
+ ## πŸ”€ Pull Request Process
46
+
47
+ 1. **Branch Naming**: Use descriptive branch names like `feat/new-router`, `fix/hermes-config`, `docs/update-readme`.
48
+ 2. **Commit Messages**: Follow Conventional Commits:
49
+ - `feat(gateway): add new endpoint for agent metrics`
50
+ - `fix(hermes): resolve port binding configuration`
51
+ - `docs(readme): add client integration examples`
52
+ 3. **Architecture Verification**: Ensure your changes adhere to the locked architecture documents ([`ARCHITECTURE.md`](ARCHITECTURE.md), [`HERMES_ARCHITECTURE.md`](HERMES_ARCHITECTURE.md), [`OPENWEBUI_ARCHITECTURE.md`](OPENWEBUI_ARCHITECTURE.md)).
53
+
54
+ ---
55
+
56
+ ## πŸ”’ Coding & Architecture Standards
57
+
58
+ - **No Hardcoded Secrets**: Secrets must be loaded via environment variables or secret store.
59
+ - **Persistent Volume Safety**: All writable state must sync to `/data/` volumes to survive container restarts.
60
+ - **Non-Blocking Proxies**: Use async HTTP client (`httpx` / `aiohttp`) for high-throughput routing.
LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Jishnu PG
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
README.md CHANGED
@@ -8,12 +8,192 @@ app_port: 4096
8
  pinned: false
9
  ---
10
 
11
- # Multi-Service Container Hub
12
 
13
- This Hugging Face Space hosts a multi-service container hub on port 4096.
14
 
15
- ## Services
16
 
17
- 1. **Open WebUI** (`/`): Feature-rich AI chat interface.
18
- 2. **Jellyfin Media Server** (`/jellyfin/`): Media streaming server.
19
- 3. **Telegram Stream Proxy** (`/tg-stream/`): High-speed MTProto video range streamer for Telegram Drive.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  pinned: false
9
  ---
10
 
11
+ <div align="center">
12
 
13
+ # πŸš€ OpenCode CLI & Multi-Service AI Gateway
14
 
15
+ **Enterprise Multi-Service AI, Autonomous Agent, and Streaming Container Hub**
16
 
17
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
18
+ [![Docker](https://img.shields.io/badge/Docker-ContainerIZED-blue.svg)](https://www.docker.com/)
19
+ [![Python](https://img.shields.io/badge/Python-3.11-3776AB.svg)](https://www.python.org/)
20
+ [![FastAPI](https://img.shields.io/badge/FastAPI-0.115-009688.svg)](https://fastapi.tiangolo.com/)
21
+ [![Node.js](https://img.shields.io/badge/Node.js-v20-339933.svg)](https://nodejs.org/)
22
+ [![Next.js](https://img.shields.io/badge/Next.js-v16-000000.svg)](https://nextjs.org/)
23
+
24
+ [Features](#-key-features) β€’ [Architecture](#-architecture) β€’ [Port Matrix](#-port--ingress-matrix) β€’ [Quick Start](#-quick-start) β€’ [Client Setup](#-client-integration-guides) β€’ [Documentation](#-documentation)
25
+
26
+ </div>
27
+
28
+ ---
29
+
30
+ ## 🌟 Project Overview
31
+
32
+ **OpenCode CLI** is a production-grade, multi-service Docker container hub combining an OpenAI-compatible LLM router (**OmniRoute**), an autonomous self-improving AI agent (**Hermes Agent**), a modern chat UI (**Open WebUI**), a media server (**Jellyfin**), and a high-speed video streamer (**Telegram Drive Proxy**), all orchestrated behind a unified FastAPI & Nginx reverse proxy with persistent storage synchronization.
33
+
34
+ ---
35
+
36
+ ## πŸ—οΈ Architecture
37
+
38
+ ```mermaid
39
+ graph TD
40
+ Client[πŸ“± Clients / Mobile APK / Web Browser / Telegram] -->|HTTPS :4096| Nginx[🌐 Nginx Reverse Proxy]
41
+ Nginx -->|Proxy /| FastAPI[⚑ FastAPI Master Gateway :8000]
42
+
43
+ FastAPI -->|Proxy /v1/*| OmniRoute[🧠 OmniRoute AI Gateway :20129]
44
+ FastAPI -->|Proxy /hermes/*| Hermes[πŸ€– Hermes Agent Framework :8642]
45
+ FastAPI -->|Proxy /_app, /api| OpenWebUI[πŸ’¬ Open WebUI :8098]
46
+ FastAPI -->|Proxy /jellyfin| Jellyfin[🎬 Jellyfin Server :8096]
47
+ FastAPI -->|Proxy /tg-stream| TGStream[⚑ Telegram Streamer]
48
+
49
+ OmniRoute -->|LLM Backend| ExternalLLM[☁️ Cloud Providers / OpenAI / Anthropic / Gemini]
50
+ Hermes -->|API Calling| OmniRoute
51
+
52
+ subgraph Persistence Layer [/data Volume]
53
+ OmniRouteDB[(storage.sqlite)]
54
+ WebUIDB[(webui.db)]
55
+ HermesMemory[(Hermes Memory & Skills)]
56
+ end
57
+
58
+ OmniRoute -.->|15s Snapshot| OmniRouteDB
59
+ OpenWebUI -.->|15s Snapshot| WebUIDB
60
+ Hermes -.->|15s rsync| HermesMemory
61
+ ```
62
+
63
+ ---
64
+
65
+ ## ✨ Key Features
66
+
67
+ ### 🧠 1. OmniRoute AI Gateway (`/v1`, `/dashboard`)
68
+ - **Multi-Provider Load Balancer**: Route prompts across OpenAI, Anthropic, Gemini, DeepSeek, Groq, and custom endpoints.
69
+ - **Model Fallback & Combos**: Dynamic candidate pools and automatic retry failovers.
70
+ - **Embedded Dashboard**: Manage API keys, provider credentials, and token usage analytics.
71
+
72
+ ### πŸ€– 2. Hermes Autonomous Agent Framework (`/hermes/v1`)
73
+ - **Nous Research Engine**: Autonomous tool-calling agent with native web search, web page extraction, and browser automation.
74
+ - **Persistent Memory & Self-Improving Skills**: Automatically learns user preferences (`USER.md`), facts (`MEMORY.md`), and generates python skills (`skills/`).
75
+ - **OpenAI-Compatible Endpoint**: Exposes `/hermes/v1/chat/completions` and `/hermes/v1/models` for mobile APKs, Termux, and OpenAI SDKs.
76
+
77
+ ### πŸ’¬ 3. Open WebUI (`/`)
78
+ - **Modern AI Chat Interface**: Multi-modal chat, code highlighting, artifact previews, and prompt templates.
79
+ - **Persistent Workspace**: Stores chats, custom prompts, and settings securely.
80
+
81
+ ### 🎬 4. Jellyfin Media Server (`/jellyfin/`)
82
+ - **Personal Media Streaming**: Stream movies, TV shows, and audio directly from persistent storage.
83
+
84
+ ### ⚑ 5. Telegram Stream Proxy (`/tg-stream/`)
85
+ - **High-Speed Range Streamer**: Stream video files directly from Telegram channels using chunked HTTP range requests.
86
+
87
+ ### πŸ›‘οΈ 6. Self-Healing & Persistence Supervisor
88
+ - **PID 1 Supervisor**: Auto-restarts any crashed background service within 5 seconds.
89
+ - **Integrity Validation**: Periodic background snapshotting to `/data/` persistent volumes.
90
+
91
+ ---
92
+
93
+ ## πŸ“Š Port & Ingress Matrix
94
+
95
+ | Microservice | Internal Port | External Route | Status Health Check |
96
+ |---|---|---|---|
97
+ | **Public Gateway** | `:4096` / `:8000` | `/` | `GET /health/live` |
98
+ | **Open WebUI** | `:8098` | `/` | `GET /health` |
99
+ | **OmniRoute API Bridge** | `:20129` | `/v1/*` | `GET /v1/models` |
100
+ | **OmniRoute Dashboard** | `:20128` | `/dashboard` | `GET /dashboard` |
101
+ | **Hermes Agent Framework** | `:8642` | `/hermes/v1/*` | `GET /hermes/health` |
102
+ | **Jellyfin Media Server** | `:8096` | `/jellyfin/` | `GET /jellyfin/` |
103
+ | **Telegram Streamer** | Internal | `/tg-stream/` | `GET /tg-stream/health` |
104
+
105
+ ---
106
+
107
+ ## πŸ“± Client Integration Guides
108
+
109
+ ### 1. Mobile Android APK / Custom Client Connection
110
+ Connect any OpenAI-compatible Android app or mobile UI to your personal Hermes agent:
111
+
112
+ - **Base URL**: `https://jishnupg-opencode-cli.hf.space/hermes/v1`
113
+ - **API Key**: `<your HERMES_GATEWAY_API_KEY secret>`
114
+ - **Models Endpoint**: `https://jishnupg-opencode-cli.hf.space/hermes/v1/models`
115
+ - **Chat Completions**: `https://jishnupg-opencode-cli.hf.space/hermes/v1/chat/completions`
116
+
117
+ ### 2. Python OpenAI SDK
118
+ ```python
119
+ from openai import OpenAI
120
+
121
+ # Connect to Hermes Agent
122
+ client = OpenAI(
123
+ base_url="https://jishnupg-opencode-cli.hf.space/hermes/v1",
124
+ api_key="your_hermes_secret_key",
125
+ )
126
+
127
+ response = client.chat.completions.create(
128
+ model="claude-sonnet-4-6",
129
+ messages=[{"role": "user", "content": "Search the web for latest AI news"}],
130
+ )
131
+
132
+ print(response.choices[0].message.content)
133
+ ```
134
+
135
+ ### 3. Local CLI / Termux (`hermes setup`)
136
+ To run Hermes CLI on your own device using your Space's OmniRoute backend:
137
+ ```bash
138
+ # Install Hermes CLI
139
+ curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash
140
+
141
+ # Run interactive setup
142
+ hermes setup
143
+ # Select Provider: OpenAI-compatible
144
+ # Base URL: https://jishnupg-opencode-cli.hf.space/v1
145
+ # API Key: key_oute_xxxxxxxxxxxx
146
+ ```
147
+
148
+ ---
149
+
150
+ ## πŸš€ Quick Start (Local Docker Run)
151
+
152
+ ### Prerequisites
153
+ - [Docker](https://www.docker.com/) & Docker Compose
154
+ - Environment file (`.env`)
155
+
156
+ ### Running with Docker Compose
157
+ ```bash
158
+ # Clone repository
159
+ git clone https://github.com/JishnuPG-tech/Project.git
160
+ cd Project
161
+
162
+ # Copy environment template
163
+ cp .env.example .env
164
+
165
+ # Build and launch container
166
+ docker compose up -d --build
167
+ ```
168
+
169
+ Access the hub at `http://localhost:4096`.
170
+
171
+ ---
172
+
173
+ ## πŸ” Environment Variables & Secrets Reference
174
+
175
+ | Variable | Description | Required |
176
+ |---|---|---|
177
+ | `STORAGE_ENCRYPTION_KEY` | Master key for database field encryption | Yes |
178
+ | `OMNIROUTE_STORAGE_KEY` | Storage encryption key for OmniRoute SQLite | Yes |
179
+ | `JWT_SECRET` | Secret token for JWT session signing | Yes |
180
+ | `API_KEY_SECRET` | Secret key for OmniRoute API keys | Yes |
181
+ | `INITIAL_PASSWORD` | Initial admin password for web interfaces | Yes |
182
+ | `HERMES_MODEL` | Default model for Hermes Agent (default: `claude-sonnet-4-6`) | Optional |
183
+ | `TELEGRAM_BOT_TOKEN` | Bot token for Telegram integration | Optional |
184
+
185
+ ---
186
+
187
+ ## πŸ“š Documentation Reference
188
+
189
+ - πŸ“„ [`HERMES_ARCHITECTURE.md`](HERMES_ARCHITECTURE.md) β€” Hermes Agent Framework architecture, port matrix, and locking rules.
190
+ - πŸ”’ [`OPENWEBUI_ARCHITECTURE.md`](OPENWEBUI_ARCHITECTURE.md) β€” Open WebUI architecture, assets resolution, and locking instructions.
191
+ - 🧠 [`OMNIROUTE_INTEGRATION_PLAN.md`](OMNIROUTE_INTEGRATION_PLAN.md) β€” OmniRoute AI Gateway routing architecture.
192
+ - πŸš€ [`DEPLOYMENT_GUIDE.md`](DEPLOYMENT_GUIDE.md) β€” Deployment and persistence guide.
193
+ - πŸ—οΈ [`ARCHITECTURE.md`](ARCHITECTURE.md) β€” Multi-service system architecture overview.
194
+
195
+ ---
196
+
197
+ ## πŸ“„ License
198
+
199
+ Distributed under the MIT License. See [`LICENSE`](LICENSE) for more information.
SECURITY.md ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Security Policy
2
+
3
+ ## πŸ›‘οΈ Supported Versions
4
+
5
+ | Version | Supported |
6
+ | ------- | ------------------ |
7
+ | Main | :white_check_mark: |
8
+
9
+ ---
10
+
11
+ ## 🚨 Reporting a Vulnerability
12
+
13
+ If you discover a potential security vulnerability in **OpenCode CLI**, please report it responsibly:
14
+
15
+ 1. **Do NOT open a public GitHub issue.**
16
+ 2. Send an email to the repository owner or submit a private security disclosure on GitHub.
17
+ 3. Include:
18
+ - Type of issue (e.g., buffer overflow, unauthenticated access, command injection)
19
+ - Full steps or proof-of-concept to reproduce
20
+ - Potential impact of the vulnerability
21
+
22
+ We will respond to security reports within **48 hours** and provide periodic updates until the issue is resolved.
23
+
24
+ ---
25
+
26
+ ## πŸ”’ Security Best Practices for Deployment
27
+
28
+ - **Master Encryption Keys**: Always supply strong, unique secrets for `STORAGE_ENCRYPTION_KEY`, `OMNIROUTE_STORAGE_KEY`, `JWT_SECRET`, and `API_KEY_SECRET`.
29
+ - **Never Commit Secrets**: Ensure `.env` and SQLite database files are listed in `.gitignore` and never committed to version control.
30
+ - **Reverse Proxy Authentication**: Keep `WEBUI_AUTH="true"` enabled in production deployments.