Star Office UI

repository·master·Indexed 27 days ago

https://github.com/ringhyacinth/star-office-ui

A pixel-style AI office dashboard that visualizes the real-time status of AI agents through animated characters in a virtual office. It includes a Python backend state service, API endpoints for agent status management, and desktop shell wrappers using Tauri and Electron. Features include integration with OpenClaw agents, canonical state normalization, and AI-generated RPG backgrounds via Gemini.

Tokens
11.8K
Snippets
23
Records
92
Agent score
93%

What's inside star-office-ui

  1. Capabilities of the Electron Shell

    master

    The Electron shell provides a desktop container that supports the following features:

    • Frontend Reuse: Uses the existing frontend at http://127.0.0.1:19000/?desktop=1.
    • Mini Page Support: Reuses desktop-pet/src/minimized.html.
    • Backend Integration: Automatically launches the Python backend on startup if it is not already running.
    • Window Management: Supports switching between the main window and the mini window.
    • System Tray: Includes a persistent menu bar/tray icon.
    • Tauri Compatibility: Injects a window.__TAURI__ compatibility layer via preload to minimize changes to existing frontend logic.
  2. Project Structure Overview

    master

    The Star-Office-UI repository is organized into the following main components:

    • backend/: Flask-based backend containing app.py, requirements.txt, and run.sh.
    • frontend/: Frontend pages and assets including index.html, join.html, invite.html, and layout.js.
    • desktop-pet/: Electron desktop wrapper (optional).
    • docs/: Documentation and screenshots.
    • office-agent-push.py: Guest push script.
    • set_state.py: Script for switching statuses.
    • state.sample.json: Template for the state file.
    • join-keys.sample.json: Template for Join Keys (used to generate join-keys.json on startup).
    • SKILL.md: OpenClaw Skill definition.
    • LICENSE: MIT License.
  3. Manual Setup of Star Office UI

    master

    To set up Star Office UI manually, ensure you have Python 3.10+ installed. Follow these steps to clone the repository, install dependencies, initialize the state, and start the backend server.

    1. Clone the repository.
    2. Install the required Python packages.
    3. Create the state.json file from the sample.
    4. Run the backend application.

    Once running, the dashboard is accessible at http://127.0.0.1:19000.

    # 1) Clone the repo
    git clone https://github.com/ringhyacinth/Star-Office-UI.git
    cd Star-Office-UI
    
    # 2) Install dependencies (Python 3.10+ required)
    python3 -m pip install -r backend/requirements.txt
    
    # 3) Initialize state file (first run)
    cp state.sample.json state.json
    
    # 4) Start the backend
    cd backend
    python3 app.py
  4. Integrate with OpenClaw Agents

    master

    If you are using OpenClaw, you can automate status synchronization by adding rules to your SOUL.md or Agent rule files.

    Rule Template:

    ## Star Office 状态同步规则
    - 接到任务时:先执行 `python3 set_state.py <状态> "<描述>"` 再开始工作
    - 完成任务后:执行 `python3 set_state.py idle "待命中"` 再回复

    Status to Area Mapping:

    • idle $\rightarrow$ 🛋 Rest Area (Sofa)
    • writing, researching, executing, syncing $\rightarrow$ 💻 Work Area (Desk)
    • error $\rightarrow$ 🐛 Bug Area
  5. Join the office using fixed Join Keys

    master

    Multiple remote OpenClaw agents can join the office using the join-agent mechanism. The system now supports fixed, reusable Join Keys instead of one-time use keys.

    Available Keys:

    • ocj_starteam01 through ocj_starteam08

    Concurrency Limits: Each key has a maxConcurrent limit (default is 3 concurrent online agents). If you attempt to join a 4th agent using the same key, the server will return a 429 error.

  6. Invite Guest Agents to the Office

    master

    To allow other agents to appear on your dashboard, follow these steps:

    1. Prepare Join Keys: On the first run, the backend generates join-keys.json from join-keys.sample.json. Edit this file to add or modify keys. Each key supports up to 3 concurrent users.
    2. Guest Setup: The guest agent must use the office-agent-push.py script. They need to configure the following variables in the script:
      • JOIN_KEY: The key you assigned.
      • AGENT_NAME: The display name for the agent.
      • OFFICE_URL: The URL of your Star Office instance.
    3. Run Push Script: The guest executes python3 office-agent-push.py to start pushing status updates every 15 seconds.
    JOIN_KEY = "ocj_starteam02"          # The key you assign
    AGENT_NAME = "Alice's Lobster"       # Display name
    OFFICE_URL = "https://office.hyacinth.im"  # Your office URL
  7. Integrate OpenClaw with Star Desktop Pet via state.json

    master

    To drive the Star Desktop Pet's behavior (icons, emojis, animations, and pathfinding), an external agent like OpenClaw must write or update a state.json file located in the desktop pet's working directory. The pet polls this file approximately every 2 seconds.

    Implementation Steps

    1. Locate the directory: Find the directory containing state.json and the layers/ folder.
    2. Write the file: Create or overwrite state.json using UTF-8 encoding.
    3. Update on change: Write to the file only when the state changes; high-frequency writing is unnecessary due to the 2s polling interval.
    {
      "state": "writing"
    }
  8. Use the upgraded Join Key mechanism

    master

    The Join Key mechanism has been upgraded from one-time keys to fixed, reusable keys. This allows multiple remote OpenClaw instances to join the same office.

    Default Keys:

    • ocj_starteam01 through ocj_starteam08

    Concurrency Limits: Each key has a maxConcurrent limit (default is 3). If a 4th instance attempts to join using the same key, the request will be rejected with an HTTP 429 error.

  9. Add Copyright and Asset Usage Restrictions to README

    master

    When preparing the project for open-source release, you must add a "Copyright and Asset Usage Restrictions" (美术资产版权与使用限制) section to the README.md. The standard requirement is:

    • Code is provided under an open-source license (e.g., MIT).
    • Artistic assets belong to their original authors/studios.
    • Assets are for learning/demonstration purposes only and commercial use is prohibited.
  10. Run the Desktop Pet version

    master

    The desktop-pet/ directory contains an Electron-based wrapper that turns the pixel office into a transparent desktop pet. This is an experimental feature primarily tested on macOS.

    1. Navigate to the desktop-pet directory.
    2. Install dependencies via npm.
    3. Run the development command.

    Note: The wrapper automatically starts the Python backend and displays http://127.0.0.1:19000/?desktop=1.

    cd desktop-pet
    npm install
    npm run dev