Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
branches: [main, master]
pull_request:

permissions:
contents: read

jobs:
lint-and-test:
runs-on: ubuntu-latest
Expand All @@ -19,13 +22,13 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ruff pytest
python -m pip install -r requirements-dev.txt

- name: Lint
run: ruff check server.py || true
run: python -m ruff check server.py tests

- name: Test
run: pytest || true
run: python -m pytest -q

- name: Smoke import
run: python -c "import server; print('import ok')"
8 changes: 4 additions & 4 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ Instructions for AI coding agents (OpenCode, Freebuff/Codebuff, Hermes workers,

## Project

- **What it is:** replace with one sentence.
- **Stack:** replace (language, framework, runtime).
- **Run locally:** `cp .env.example .env && docker compose up -d --build`, then open `http://127.0.0.1:8080`.
- **Health check:** `GET /healthz` must return 200.
- **What it is:** 3D virtual office dashboard for agent status.
- **Stack:** Python standard-library HTTP server and static Three.js UI.
- **Run locally:** `cp .env.example .env && docker compose up -d --build`, then open `http://127.0.0.1:9502`.
- **Health check:** `GET /api/config` must return 200.

## Commands

Expand Down
138 changes: 94 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,77 +1,127 @@
<div align="center">

![Offivo banner](docs/assets/banner.svg)

# Offivo

*Formerly VirtOffice (hermes-3d-office).*

Virtual office platform — shared workspaces, video rooms, team chat, and collaborative document editing with Docker deployment.
A 3D virtual office dashboard for agent status, served by Python with a static Three.js interface.

[![GitHub release](https://img.shields.io/github/v/release/OneByJorah/offivo?color=a78bfa&label=release&logo=github)](https://github.com/OneByJorah/offivo/releases)
[![npm version](https://img.shields.io/npm/v/offivo?color=a78bfa&label=npm&logo=npm)](https://www.npmjs.com/package/offivo)
[![Docker](https://img.shields.io/badge/Docker-2496ED?style=flat-square&logo=docker&logoColor=white)](https://www.docker.com/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?color=FFB300&logo=open-source-initiative&logoColor=FFB300)](https://opensource.org/licenses/MIT)
[![CI](https://github.com/OneByJorah/offivo/actions/workflows/ci.yml/badge.svg)](https://github.com/OneByJorah/offivo/actions/workflows/ci.yml)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)

</div>

![Offivo landing page](docs/screenshots/landing.png)
![Offivo office view](docs/screenshots/office.png)

## What This Is
## Why this exists

Offivo displays agents, their tasks, and their activity in an animated office.
It can read a JSON file or poll a Hermes status API, and sends updates to the browser through Server-Sent Events (SSE).
The Python server uses only the standard library; no Node build or npm installation is required.

Virtual office platform — shared workspaces, video rooms, team chat, and collaborative document editing with Docker deployment.
## Features

## Quick Start
- 3D office view at `/office.html`, with agent status and task details.
- JSON state endpoint at `/api/agents` and configuration at `/api/config`.
- Hermes API polling, JSON file input, and demo fallback when neither source supplies data.
- Webhook updates at `POST /webhook/agents`, broadcast through `/events`.
- A single-service Docker Compose setup.

### npm
## Quick start

```bash
npm install offivo
```
### From source

### Docker
Use Python 3.11 or later. On Windows, use `py -3` if `python` is not on PATH.

```bash
git clone https://github.com/OneByJorah/offivo.git
cd offivo
docker compose up -d
python server.py
```

### From Source
Open <http://127.0.0.1:9502/> for the landing page or
<http://127.0.0.1:9502/office.html> for the dashboard. Stop the server with Ctrl+C.
The server reads the repository's `agents.json` by default. Use a separate file for your own agents.
The browser loads Three.js from cdnjs and fonts from Google Fonts, so full rendering needs internet access.

### Docker Compose

From the repository directory, with Docker and Compose installed:

```bash
git clone https://github.com/OneByJorah/offivo.git
cd offivo
npm install
npm run dev
cp .env.example .env
docker compose up -d --build
```

## Features
In PowerShell, use `Copy-Item .env.example .env` for the copy step.
The same URLs above apply. Compose publishes only on `127.0.0.1`; `HOST=0.0.0.0`
in the example configuration is the bind address **inside the container**.
Compose mounts `./agents.json` read-only at `/app/agents.json`.

Stop the service with `docker compose down`.

## Configuration

The source command reads environment variables; it does **not** load `.env`.
Compose loads `.env` through `env_file`. Set variables in your shell when running Python directly.

- **Self-hosted** — run on your own hardware
- **Docker Compose** — full stack with one command
- **npm package** — install via npm
- **Dark theme** — operational UI
| Variable | Source default | Purpose |
| --- | --- | --- |
| `HOST` | `127.0.0.1` | Server bind address; Compose defaults to `0.0.0.0` inside the container. |
| `PORT` | `9502` | HTTP port. |
| `AGENTS_JSON_PATH` | `agents.json` beside `server.py` | JSON file; prefer an absolute path for a custom file. |
| `HERMES_AGENT_API` | Empty | Optional HTTP endpoint returning an agent array or an object containing `agents` or `results`. |
| `POLL_INTERVAL_SECONDS` | `5` | Source refresh interval in seconds. |
| `ENABLE_SSE` | `true` | Broadcast live events; `1`, `true`, and `yes` enable broadcasting. |

- **Shared workspaces** — virtual office spaces for teams
- **Video rooms** — WebRTC-based video conferencing
- **Team chat** — real-time messaging and channels
- **Document collaboration** — shared editing and comments
- **Docker Compose deployment** — multi-service stack
- **Dark theme** — modern, collaborative UI
An agent file can contain an array or an object with an `agents` array:

## Package Badges
```json
{"agents": [{"id": "demo-worker", "name": "Demo Worker", "status": "working", "task": "Example task"}]}
```

The server normalizes omitted display fields. An empty array means no agents.
Each refresh tries the configured Hermes API, then the file, then built-in demo agents.
`/api/config` reports the configured source, not whether the last fetch succeeded.

`POST /webhook/agents` accepts an array or `{"agents": [...]}` and updates the in-memory
state immediately. The next polling refresh replaces that state from the configured source;
use file or API input for persistent updates. The server has no authentication, so keep it on loopback.
See [Hermes integration](docs/HERMES_INTEGRATION.md) for bridge details.

## Architecture

[![GitHub release](https://img.shields.io/github/v/release/OneByJorah/offivo?color=a78bfa&label=release&logo=github)](https://github.com/OneByJorah/offivo/releases)
[![npm version](https://img.shields.io/npm/v/offivo?color=a78bfa&label=npm&logo=npm)](https://www.npmjs.com/package/offivo)
[![Docker](https://img.shields.io/badge/Docker-2496ED?style=flat-square&logo=docker&logoColor=white)](https://www.docker.com/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?color=FFB300&logo=open-source-initiative&logoColor=FFB300)](https://opensource.org/licenses/MIT)
```mermaid
flowchart LR
API[Hermes status API] --> Server[Python server]
File[Agent JSON file] --> Server
Hook[Webhook sender] --> Server
Server -->|Static HTML, JSON, SSE| Browser[Three.js dashboard]
```

## Development checks

Create and activate a virtual environment, then run:

```bash
python -m pip install -r requirements-dev.txt
python -m ruff check server.py tests
python -m pytest -q
```

Tests start loopback servers with temporary synthetic data and exercise static pages,
configuration, agent state, webhook updates, SSE, and the Python entry point.
CI runs the same lint and test commands and fails if either fails.
The npm scripts are convenience wrappers for Python commands, not a JavaScript runtime package.

## Roadmap

Propose improvements through [issues](https://github.com/OneByJorah/offivo/issues).

## Contributing

[Open an issue](https://github.com/OneByJorah/offivo/issues) to report a bug or request a feature.
See [CONTRIBUTING.md](CONTRIBUTING.md) and [AGENTS.md](AGENTS.md).

## Security

See [SECURITY.md](SECURITY.md) for reporting instructions.

## License

MIT — see [LICENSE](LICENSE).
MIT; see [LICENSE](LICENSE).
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ services:
image: ghcr.io/onebyjorah/offivo:latest
container_name: offivo
ports:
- "${PORT:-9502}:${PORT:-9502}"
- "127.0.0.1:${PORT:-9502}:${PORT:-9502}"
env_file:
- .env
environment:
Expand Down
19 changes: 10 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "offivo",
"version": "1.0.0",
"description": "Virtual office platform \u2014 shared workspaces, video rooms, team chat, and collaborative document editing with Docker deployment.",
"main": "index.js",
"description": "3D agent dashboard with a Python server, JSON state API, and Server-Sent Events.",
"scripts": {
"test": "echo 'ok' && exit 0"
"start": "python server.py",
"test": "python -m pytest -q"
},
"keywords": [
"offivo",
Expand All @@ -22,12 +22,13 @@
"url": "https://github.com/OneByJorah/offivo/issues"
},
"homepage": "https://github.com/OneByJorah/offivo#readme",
"publishConfig": {
"access": "public"
},
"files": [
"dist/",
"server.py",
"public/",
"README.md",
"LICENSE"
],
"publishConfig": {
"access": "public"
}
}
]
}
8 changes: 8 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[tool.pytest.ini_options]
testpaths = ["tests"]

[tool.ruff]
target-version = "py311"

[tool.ruff.lint]
select = ["E4", "E7", "E9", "F"]
2 changes: 2 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pytest==9.2.0
ruff==0.17.3
20 changes: 11 additions & 9 deletions server.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Hermes 3D Office Dashboard Server

Serves the static 3D office dashboard and provides a live agent-state API.
Three wiring modes are supported out of the box:
Four wiring modes are supported out of the box:

1. Demo mode - Auto-generated sample agents (default).
2. Hermes status API - Poll HERMES_AGENT_API for live agents.
Expand All @@ -12,7 +12,7 @@

Environment variables (see .env.example):
PORT Server port (default 9502)
HOST Bind address (default 0.0.0.0)
HOST Bind address (default 127.0.0.1)
HERMES_AGENT_API URL to Hermes GET /api/agents/status endpoint
AGENTS_JSON_PATH Path to agents.json file drop
POLL_INTERVAL_SECONDS Polling interval for HERMES_AGENT_API
Expand All @@ -38,7 +38,7 @@
AGENTS_JSON_PATH = os.environ.get("AGENTS_JSON_PATH", "").strip() or str(Path(__file__).parent / "agents.json")
POLL_INTERVAL = int(os.environ.get("POLL_INTERVAL_SECONDS", "5"))
ENABLE_SSE = os.environ.get("ENABLE_SSE", "true").lower() in ("1", "true", "yes")
DEMO_MODE = not (HERMES_AGENT_API or AGENTS_JSON_PATH)
DEMO_MODE = not (HERMES_AGENT_API or Path(AGENTS_JSON_PATH).exists())

DIRECTORY = Path(__file__).parent / "public"
ROOT = Path(__file__).parent
Expand Down Expand Up @@ -136,7 +136,7 @@ def _read_agents_json():
if path.exists():
with path.open("r", encoding="utf-8") as f:
data = json.load(f)
if isinstance(data, list) and data:
if isinstance(data, list):
return data
if isinstance(data, dict) and "agents" in data:
return data["agents"]
Expand Down Expand Up @@ -286,11 +286,12 @@ def do_GET(self):
return

def do_POST(self):
global latest_agents
parsed = urlparse(self.path)
if parsed.path == "/webhook/agents":
try:
body = self._read_json_body()
agents = body.get("agents", body if isinstance(body, list) else [])
agents = body if isinstance(body, list) else body.get("agents", [])
normalized = [_normalize_agent(a) for a in agents]
with state_lock:
latest_agents = normalized
Expand Down Expand Up @@ -356,12 +357,13 @@ def main():
socketserver.ThreadingTCPServer.allow_reuse_address = True
socketserver.ThreadingTCPServer.daemon_threads = True
with socketserver.ThreadingTCPServer((HOST, PORT), Handler) as httpd:
port = httpd.server_address[1]
mode = "DEMO" if DEMO_MODE else ("Hermes API" if HERMES_AGENT_API else "agents.json file")
print(f"Hermes 3D Office running at http://{HOST}:{PORT}", flush=True)
print(f"Hermes 3D Office running at http://{HOST}:{port}", flush=True)
print(f"Mode: {mode}", flush=True)
print(f"Agent API: http://{HOST}:{PORT}/api/agents", flush=True)
print(f"Webhook: POST http://{HOST}:{PORT}/webhook/agents", flush=True)
print(f"Config: http://{HOST}:{PORT}/api/config", flush=True)
print(f"Agent API: http://{HOST}:{port}/api/agents", flush=True)
print(f"Webhook: POST http://{HOST}:{port}/webhook/agents", flush=True)
print(f"Config: http://{HOST}:{port}/api/config", flush=True)
httpd.serve_forever()


Expand Down
Loading
Loading