mofa-stage


Namemofa-stage JSON
Version 2 PyPI version JSON
download
home_pageNone
SummaryWeb-based development tool for managing and editing Nodes and Dataflows in the MoFA framework
upload_time2025-07-13 12:09:27
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT
keywords mofa ai-agent development-tool web-ui stage
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # MoFA_Stage

English | [δΈ­ζ–‡](README_cn.md)

MoFA_Stage is a web-based development tool for managing and editing Nodes and Dataflows in the MoFA framework.

## Features

- **Agent Management**
  - Browse Agent list
  - Create and copy Agents
  - Edit Agent files
  - Run and stop Agents
  - View execution logs

- **Terminal Access**
  - Web terminal
  - SSH connections
  - ttyd integration

- **Code Editing**
  - Text editor
  - File browser
  - VSCode Server integration (optional)

## Technology Stack

**Backend**
- Python + Flask
- WebSocket support
- SSH terminal integration
- RESTful API

**Frontend**
- Vue 3 + Element Plus
- Monaco editor

**Third-party Services**
- ttyd (recommended)
- code-server (optional)


### Quick Start

#### Environment Requirements

**System Support**
- Linux (supports apt-get and yum package managers)
- macOS
- Windows is not currently supported, WSL (Windows Subsystem for Linux) is recommended

**Software Requirements**
- Python 3.8 or higher
- Node.js 14 or higher
- MoFA framework installed

#### Installation and Run Scripts

The project provides two scripts:

- **install**: One-click installation of all dependencies
  ```bash
  chmod +x install
  ./install
  ```
  Automatically installs backend/frontend dependencies with options for Docker or traditional installation. After installation, it will prompt whether to run, selecting yes will execute the run script. For local deployment, choose non-docker deployment.

- **run**: One-click service startup
  ```bash
  chmod +x run
  ./run
  ```
  Supports both Docker and traditional deployment modes. For local deployment, choose non-docker deployment.

##### Docker Deployment (Recommended)

###### Using Docker avoids all environment issues for the fastest deployment:

```bash
# Simply run the installation script to choose docker deployment
./install
./run

# Or configure separately:

# One-line frontend deployment
docker run -d -p 3000:80 liyao1119/mofa-stage-frontend

# Start backend
cd backend && python app.py
```

**πŸš€ Quick Start (30-second deployment)**

**Method 1: Using Official Image (Recommended)**

```bash
# 1. Pull and start frontend
docker run -d -p 3000:80 --name mofa-frontend \
  --add-host=host.docker.internal:host-gateway \
  liyao1119/mofa-stage-frontend:latest

# 2. Clone repository and start backend
git clone https://github.com/mofa-org/mofa-stage.git
cd mofa-stage/backend
pip install -r requirements.txt
python app.py

# 3. Access system
# Open browser: http://localhost:3000
```

**Method 2: Local Build**

```bash
# 1. Clone code
git clone https://github.com/mofa-org/mofa-stage.git
cd mofa-stage

# 2. Use installation script (supports Docker mode selection)
./install

# 3. Start services
./run
```

**πŸ“‹ System Requirements**

- Docker Desktop ([Download](https://www.docker.com/products/docker-desktop/))
- Python 3.8+ (backend only)
- 4GB available memory

### Development Mode (Manual Startup)

1. Start the backend
```bash
cd backend
python app.py
```

2. Start the frontend (development mode)
```bash
cd frontend
npm run dev
```

Access http://localhost:3000.

### Production Deployment

1. Build the frontend
```bash
cd frontend
npm run build  # Generates in the dist directory
```

2. Deployment methods (choose one)

**Using Nginx**

```nginx
server {
    listen 80;
    
    # Static files
    location / {
        root /path/to/mofa_stage/frontend/dist;
        try_files $uri $uri/ /index.html;
    }
    
    # API forwarding
    location /api {
        proxy_pass http://localhost:5002;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
    }
    
    # WebSocket
    location /api/webssh {
        proxy_pass http://localhost:5001;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }
}
```

**Simple Deployment**

Using Python's built-in HTTP server:
```bash
cd frontend/dist
python -m http.server 3000
```

Start the backend:
```bash
cd backend
python app.py
```

## Common Issues

### Port Occupation

If you encounter port occupation issues, you can use this command to release ports:

```bash
for port in 3000 5001 5002 7681; do
    pid=$(lsof -t -i:$port)
    if [ -n "$pid" ]; then
        kill -9 $pid
        echo "Released port $port"
    fi
done
```

### Port Description

| Service | Port | Description |
|---------|------|-------------|
| Frontend | 3000 | Web interface |
| Backend API | 5002 | Flask service |
| WebSSH | 5001 | SSH terminal |
| ttyd | 7681 | Web terminal |
| VS Code | 8080 | Code editor |

### ttyd Installation Failure

If ttyd automatic installation fails, you can refer to the [ttyd GitHub page](https://github.com/tsl0922/ttyd) for manual installation.

### Docker-Specific Issues

**Q: Port already in use?**
```bash
# Check process using port 3000
lsof -i :3000
# Or change port mapping
docker run -d -p 8000:80 ...
```

**Q: Container cannot connect to backend?**
Make sure backend service is running:
```bash
cd backend && python app.py
```

**Q: How to update to latest version?**
```bash
docker pull liyao1119/mofa-stage-frontend:latest
docker stop mofa-frontend
docker rm mofa-frontend
# Re-run docker run command
```

**Q: How to view container logs?**
```bash
docker logs mofa-frontend
```

## Docker Advanced Configuration

### Custom Build

```bash
cd frontend
# Build after modifying configuration
docker build -t my-mofa-frontend .
docker run -d -p 3000:80 my-mofa-frontend
```

### Troubleshooting

1. **Check if Docker is running properly**
   ```bash
   docker ps
   ```

2. **Check network connections**
   ```bash
   curl http://localhost:3000
   curl http://localhost:5002/api/settings
   ```

3. **Restart container**
   ```bash
   docker restart mofa-frontend
   ```

## Directory Structure

```
mofa-stage/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ app.py              # Main application
β”‚   β”œβ”€β”€ config.py           # Configuration
β”‚   β”œβ”€β”€ routes/             # API routes
β”‚   β”‚   β”œβ”€β”€ agents.py       # Agent management
β”‚   β”‚   β”œβ”€β”€ terminal.py     # Terminal features
β”‚   β”‚   β”œβ”€β”€ webssh.py       # SSH connections
β”‚   β”‚   β”œβ”€β”€ vscode.py       # VSCode integration
β”‚   β”‚   β”œβ”€β”€ settings.py     # Settings management
β”‚   β”‚   β”œβ”€β”€ ttyd.py         # ttyd integration
β”‚   β”‚   └── mermaid.py      # Chart rendering
β”‚   β”œβ”€β”€ utils/              # Utility modules
β”‚   β”‚   β”œβ”€β”€ mofa_cli.py     # MoFA command wrapper
β”‚   β”‚   β”œβ”€β”€ file_ops.py     # File operations
β”‚   β”‚   └── ttyd_manager.py # ttyd management
β”‚   └── requirements.txt    # Python dependencies
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ views/          # Page components
β”‚   β”‚   β”œβ”€β”€ components/     # UI components
β”‚   β”‚   β”œβ”€β”€ api/            # API calls
β”‚   β”‚   β”œβ”€β”€ store/          # State management
β”‚   β”‚   └── router/         # Routing
β”‚   └── package.json        # Node.js dependencies
β”œβ”€β”€ install.sh              # Installation script
└── run.sh                  # Startup script
```

## User Journey
<img width="914" height="586" alt="image" src="https://github.com/user-attachments/assets/ae9ae4bc-8fd2-4da4-8d79-714f72fa4205" />

```mermaid
graph TD
    A[πŸ”§ Environment Setup] --> B[βš™οΈ System Configuration]
    B --> C[πŸ€– Agent Development]
    C --> D[πŸ”„ Dataflow Orchestration]
    D --> E[πŸ” Debugging & Optimization]
    
    A --> A1[Install MoFA Framework]
    A --> A2[Launch MoFA Stage]
    A --> A3[Access Web Interface]
    
    B --> B1[Configure MoFA Path]
    B --> B2[Select Terminal Mode]
    B --> B3[Test Connections]
    
    C --> C1[Browse Agent List]
    C --> C2[Create New Agent]
    C --> C3[Edit Agent Code]
    C --> C4[Test Agent]
    
    D --> D1[Create Dataflow]
    D --> D2[Connect Agents]
    D --> D3[Set Parameters]
    D --> D4[Run Dataflow]
    
    E --> E1[View Execution Logs]
    E --> E2[Use Terminal Debugging]
    E --> E3[Performance Monitoring]
    E --> E4[Version Management]
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "mofa-stage",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "MoFA Team <mofa-dev@example.com>",
    "keywords": "mofa, ai-agent, development-tool, web-ui, stage",
    "author": null,
    "author_email": "MoFA Team <mofa-dev@example.com>",
    "download_url": "https://files.pythonhosted.org/packages/67/50/e9863bf5592e6be2ce452cf0e08ab9ed2c8f74b78d611153b086436f63dd/mofa_stage-2.tar.gz",
    "platform": null,
    "description": "# MoFA_Stage\n\nEnglish | [\u4e2d\u6587](README_cn.md)\n\nMoFA_Stage is a web-based development tool for managing and editing Nodes and Dataflows in the MoFA framework.\n\n## Features\n\n- **Agent Management**\n  - Browse Agent list\n  - Create and copy Agents\n  - Edit Agent files\n  - Run and stop Agents\n  - View execution logs\n\n- **Terminal Access**\n  - Web terminal\n  - SSH connections\n  - ttyd integration\n\n- **Code Editing**\n  - Text editor\n  - File browser\n  - VSCode Server integration (optional)\n\n## Technology Stack\n\n**Backend**\n- Python + Flask\n- WebSocket support\n- SSH terminal integration\n- RESTful API\n\n**Frontend**\n- Vue 3 + Element Plus\n- Monaco editor\n\n**Third-party Services**\n- ttyd (recommended)\n- code-server (optional)\n\n\n### Quick Start\n\n#### Environment Requirements\n\n**System Support**\n- Linux (supports apt-get and yum package managers)\n- macOS\n- Windows is not currently supported, WSL (Windows Subsystem for Linux) is recommended\n\n**Software Requirements**\n- Python 3.8 or higher\n- Node.js 14 or higher\n- MoFA framework installed\n\n#### Installation and Run Scripts\n\nThe project provides two scripts:\n\n- **install**: One-click installation of all dependencies\n  ```bash\n  chmod +x install\n  ./install\n  ```\n  Automatically installs backend/frontend dependencies with options for Docker or traditional installation. After installation, it will prompt whether to run, selecting yes will execute the run script. For local deployment, choose non-docker deployment.\n\n- **run**: One-click service startup\n  ```bash\n  chmod +x run\n  ./run\n  ```\n  Supports both Docker and traditional deployment modes. For local deployment, choose non-docker deployment.\n\n##### Docker Deployment (Recommended)\n\n###### Using Docker avoids all environment issues for the fastest deployment:\n\n```bash\n# Simply run the installation script to choose docker deployment\n./install\n./run\n\n# Or configure separately:\n\n# One-line frontend deployment\ndocker run -d -p 3000:80 liyao1119/mofa-stage-frontend\n\n# Start backend\ncd backend && python app.py\n```\n\n**\ud83d\ude80 Quick Start (30-second deployment)**\n\n**Method 1: Using Official Image (Recommended)**\n\n```bash\n# 1. Pull and start frontend\ndocker run -d -p 3000:80 --name mofa-frontend \\\n  --add-host=host.docker.internal:host-gateway \\\n  liyao1119/mofa-stage-frontend:latest\n\n# 2. Clone repository and start backend\ngit clone https://github.com/mofa-org/mofa-stage.git\ncd mofa-stage/backend\npip install -r requirements.txt\npython app.py\n\n# 3. Access system\n# Open browser: http://localhost:3000\n```\n\n**Method 2: Local Build**\n\n```bash\n# 1. Clone code\ngit clone https://github.com/mofa-org/mofa-stage.git\ncd mofa-stage\n\n# 2. Use installation script (supports Docker mode selection)\n./install\n\n# 3. Start services\n./run\n```\n\n**\ud83d\udccb System Requirements**\n\n- Docker Desktop ([Download](https://www.docker.com/products/docker-desktop/))\n- Python 3.8+ (backend only)\n- 4GB available memory\n\n### Development Mode (Manual Startup)\n\n1. Start the backend\n```bash\ncd backend\npython app.py\n```\n\n2. Start the frontend (development mode)\n```bash\ncd frontend\nnpm run dev\n```\n\nAccess http://localhost:3000.\n\n### Production Deployment\n\n1. Build the frontend\n```bash\ncd frontend\nnpm run build  # Generates in the dist directory\n```\n\n2. Deployment methods (choose one)\n\n**Using Nginx**\n\n```nginx\nserver {\n    listen 80;\n    \n    # Static files\n    location / {\n        root /path/to/mofa_stage/frontend/dist;\n        try_files $uri $uri/ /index.html;\n    }\n    \n    # API forwarding\n    location /api {\n        proxy_pass http://localhost:5002;\n        proxy_set_header Host $host;\n        proxy_set_header X-Real-IP $remote_addr;\n    }\n    \n    # WebSocket\n    location /api/webssh {\n        proxy_pass http://localhost:5001;\n        proxy_http_version 1.1;\n        proxy_set_header Upgrade $http_upgrade;\n        proxy_set_header Connection \"upgrade\";\n    }\n}\n```\n\n**Simple Deployment**\n\nUsing Python's built-in HTTP server:\n```bash\ncd frontend/dist\npython -m http.server 3000\n```\n\nStart the backend:\n```bash\ncd backend\npython app.py\n```\n\n## Common Issues\n\n### Port Occupation\n\nIf you encounter port occupation issues, you can use this command to release ports:\n\n```bash\nfor port in 3000 5001 5002 7681; do\n    pid=$(lsof -t -i:$port)\n    if [ -n \"$pid\" ]; then\n        kill -9 $pid\n        echo \"Released port $port\"\n    fi\ndone\n```\n\n### Port Description\n\n| Service | Port | Description |\n|---------|------|-------------|\n| Frontend | 3000 | Web interface |\n| Backend API | 5002 | Flask service |\n| WebSSH | 5001 | SSH terminal |\n| ttyd | 7681 | Web terminal |\n| VS Code | 8080 | Code editor |\n\n### ttyd Installation Failure\n\nIf ttyd automatic installation fails, you can refer to the [ttyd GitHub page](https://github.com/tsl0922/ttyd) for manual installation.\n\n### Docker-Specific Issues\n\n**Q: Port already in use?**\n```bash\n# Check process using port 3000\nlsof -i :3000\n# Or change port mapping\ndocker run -d -p 8000:80 ...\n```\n\n**Q: Container cannot connect to backend?**\nMake sure backend service is running:\n```bash\ncd backend && python app.py\n```\n\n**Q: How to update to latest version?**\n```bash\ndocker pull liyao1119/mofa-stage-frontend:latest\ndocker stop mofa-frontend\ndocker rm mofa-frontend\n# Re-run docker run command\n```\n\n**Q: How to view container logs?**\n```bash\ndocker logs mofa-frontend\n```\n\n## Docker Advanced Configuration\n\n### Custom Build\n\n```bash\ncd frontend\n# Build after modifying configuration\ndocker build -t my-mofa-frontend .\ndocker run -d -p 3000:80 my-mofa-frontend\n```\n\n### Troubleshooting\n\n1. **Check if Docker is running properly**\n   ```bash\n   docker ps\n   ```\n\n2. **Check network connections**\n   ```bash\n   curl http://localhost:3000\n   curl http://localhost:5002/api/settings\n   ```\n\n3. **Restart container**\n   ```bash\n   docker restart mofa-frontend\n   ```\n\n## Directory Structure\n\n```\nmofa-stage/\n\u251c\u2500\u2500 backend/\n\u2502   \u251c\u2500\u2500 app.py              # Main application\n\u2502   \u251c\u2500\u2500 config.py           # Configuration\n\u2502   \u251c\u2500\u2500 routes/             # API routes\n\u2502   \u2502   \u251c\u2500\u2500 agents.py       # Agent management\n\u2502   \u2502   \u251c\u2500\u2500 terminal.py     # Terminal features\n\u2502   \u2502   \u251c\u2500\u2500 webssh.py       # SSH connections\n\u2502   \u2502   \u251c\u2500\u2500 vscode.py       # VSCode integration\n\u2502   \u2502   \u251c\u2500\u2500 settings.py     # Settings management\n\u2502   \u2502   \u251c\u2500\u2500 ttyd.py         # ttyd integration\n\u2502   \u2502   \u2514\u2500\u2500 mermaid.py      # Chart rendering\n\u2502   \u251c\u2500\u2500 utils/              # Utility modules\n\u2502   \u2502   \u251c\u2500\u2500 mofa_cli.py     # MoFA command wrapper\n\u2502   \u2502   \u251c\u2500\u2500 file_ops.py     # File operations\n\u2502   \u2502   \u2514\u2500\u2500 ttyd_manager.py # ttyd management\n\u2502   \u2514\u2500\u2500 requirements.txt    # Python dependencies\n\u251c\u2500\u2500 frontend/\n\u2502   \u251c\u2500\u2500 src/\n\u2502   \u2502   \u251c\u2500\u2500 views/          # Page components\n\u2502   \u2502   \u251c\u2500\u2500 components/     # UI components\n\u2502   \u2502   \u251c\u2500\u2500 api/            # API calls\n\u2502   \u2502   \u251c\u2500\u2500 store/          # State management\n\u2502   \u2502   \u2514\u2500\u2500 router/         # Routing\n\u2502   \u2514\u2500\u2500 package.json        # Node.js dependencies\n\u251c\u2500\u2500 install.sh              # Installation script\n\u2514\u2500\u2500 run.sh                  # Startup script\n```\n\n## User Journey\n<img width=\"914\" height=\"586\" alt=\"image\" src=\"https://github.com/user-attachments/assets/ae9ae4bc-8fd2-4da4-8d79-714f72fa4205\" />\n\n```mermaid\ngraph TD\n    A[\ud83d\udd27 Environment Setup] --> B[\u2699\ufe0f System Configuration]\n    B --> C[\ud83e\udd16 Agent Development]\n    C --> D[\ud83d\udd04 Dataflow Orchestration]\n    D --> E[\ud83d\udd0d Debugging & Optimization]\n    \n    A --> A1[Install MoFA Framework]\n    A --> A2[Launch MoFA Stage]\n    A --> A3[Access Web Interface]\n    \n    B --> B1[Configure MoFA Path]\n    B --> B2[Select Terminal Mode]\n    B --> B3[Test Connections]\n    \n    C --> C1[Browse Agent List]\n    C --> C2[Create New Agent]\n    C --> C3[Edit Agent Code]\n    C --> C4[Test Agent]\n    \n    D --> D1[Create Dataflow]\n    D --> D2[Connect Agents]\n    D --> D3[Set Parameters]\n    D --> D4[Run Dataflow]\n    \n    E --> E1[View Execution Logs]\n    E --> E2[Use Terminal Debugging]\n    E --> E3[Performance Monitoring]\n    E --> E4[Version Management]\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Web-based development tool for managing and editing Nodes and Dataflows in the MoFA framework",
    "version": "2",
    "project_urls": {
        "Bug Reports": "https://github.com/mofa-org/mofa-stage/issues",
        "Documentation": "https://github.com/mofa-org/mofa-stage#readme",
        "Homepage": "https://github.com/mofa-org/mofa-stage",
        "Repository": "https://github.com/mofa-org/mofa-stage"
    },
    "split_keywords": [
        "mofa",
        " ai-agent",
        " development-tool",
        " web-ui",
        " stage"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "99c0022d7d1fd97e5a1ac602f44bdd29153d9a20993db0a5d001af027144cdb9",
                "md5": "813ad8af9c13bc329b3673ec896f725a",
                "sha256": "c688835b3e58796c24605cc33451635f9917f0db441579287c9903f0ec7114ab"
            },
            "downloads": -1,
            "filename": "mofa_stage-2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "813ad8af9c13bc329b3673ec896f725a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 32143133,
            "upload_time": "2025-07-13T12:09:10",
            "upload_time_iso_8601": "2025-07-13T12:09:10.040804Z",
            "url": "https://files.pythonhosted.org/packages/99/c0/022d7d1fd97e5a1ac602f44bdd29153d9a20993db0a5d001af027144cdb9/mofa_stage-2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "6750e9863bf5592e6be2ce452cf0e08ab9ed2c8f74b78d611153b086436f63dd",
                "md5": "0947d15269aef171984b43877fc51849",
                "sha256": "8229051ba40b7f0ae6a8995c085920ee985e237e23d0c9f200a2a6993066242a"
            },
            "downloads": -1,
            "filename": "mofa_stage-2.tar.gz",
            "has_sig": false,
            "md5_digest": "0947d15269aef171984b43877fc51849",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 49840041,
            "upload_time": "2025-07-13T12:09:27",
            "upload_time_iso_8601": "2025-07-13T12:09:27.163225Z",
            "url": "https://files.pythonhosted.org/packages/67/50/e9863bf5592e6be2ce452cf0e08ab9ed2c8f74b78d611153b086436f63dd/mofa_stage-2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-13 12:09:27",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "mofa-org",
    "github_project": "mofa-stage",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "mofa-stage"
}
        
Elapsed time: 0.90767s