Files
cherry-studio/cagents/python-cli-web-poc
Vaayne 9fe14311fc feat(agents): enhance POC interface styling with Cherry Studio design system
- Integrate complete Cherry Studio CSS variables and design patterns
- Implement proper light/dark theme support with system preference detection
- Enhance message bubbles to match Cherry Studio's chat interface styling
- Add Cherry Studio-compatible scrollbar styling with theme-aware colors
- Improve typography with Ubuntu font family and proper font stacks
- Add comprehensive hover states, transitions, and micro-interactions
- Implement accessibility improvements including focus states and reduced motion
- Add theme toggle functionality with persistent preferences
- Enhance header styling to match Cherry Studio's navbar design
- Add animation effects consistent with Cherry Studio's motion design
- Improve responsive design for mobile and tablet viewports
- Add high contrast mode support for better accessibility

The POC interface now provides a polished, professional appearance that
seamlessly integrates with Cherry Studio's design language and user experience.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-03 11:43:02 +08:00
..

Python CLI Web Interface POC

A proof-of-concept web interface for running Python CLI applications with real-time input/output interaction.

Features

  • Web-based Terminal: Chat-like interface for running Python commands
  • Real-time I/O: Bidirectional communication with Python processes
  • Interactive Input: Support for Python scripts that require user input
  • Process Management: Start, monitor, and kill Python processes
  • WebSocket Communication: Low-latency real-time updates

Quick Start

  1. Install dependencies:

    npm install
    
  2. Start the server:

    npm start
    
  3. Open your browser:

    • Navigate to http://localhost:3000
    • The interface will load automatically

Usage Examples

Basic Python Commands

python --version
python -c "print('Hello World')"

Interactive Scripts

python test-script.py
python simple-calc.py

Test Scripts Included

  • test-script.py: Demonstrates user input, output streaming, and interactive features
  • simple-calc.py: Simple calculator that takes mathematical expressions

How It Works

  1. Frontend: HTML/CSS/JS interface that looks like a terminal/chat
  2. WebSocket: Real-time bidirectional communication
  3. Node.js Backend: Spawns Python processes and manages I/O
  4. Process Management: Each command runs in its own Python process

Architecture

┌─────────────────┐    WebSocket    ┌──────────────────┐    spawn()    ┌─────────────┐
│   Web Browser   │ ◄─────────────► │   Node.js Server │ ◄──────────► │   Python    │
│   (Frontend)    │                 │   (Backend)      │               │   Process   │
└─────────────────┘                 └──────────────────┘               └─────────────┘

Key Files

  • server.js - Node.js server with WebSocket support
  • public/index.html - Web interface
  • public/script.js - Frontend JavaScript logic
  • public/style.css - Interface styling
  • test-script.py - Sample interactive Python script

Development

The POC supports:

  • Running Python commands
  • Real-time output streaming
  • Interactive input handling
  • Process termination
  • Error handling
  • Connection status monitoring
  • Auto-reconnection

Limitations

This is a POC with basic security. For production use, consider:

  • Input sanitization
  • Process sandboxing
  • Authentication/authorization
  • Resource limits
  • Proper error handling