sandbox

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Sandbox - Visual Canvas

沙箱 - 可视化画布

Push HTML content to a live-updating canvas server for visual previews, dashboards, and agent-driven UI.
将HTML内容推送到实时更新的画布服务器,以实现可视化预览、仪表板和Agent驱动的UI。

Commands

命令

/sandbox start        - Start the canvas server (returns URL)
/sandbox push <html>  - Push HTML content to the canvas
/sandbox reset        - Reset canvas to blank state
/sandbox screenshot   - Take a screenshot of the current canvas
/sandbox status       - Show canvas server status and settings
/sandbox start        - 启动画布服务器(返回URL)
/sandbox push <html>  - 将HTML内容推送到画布
/sandbox reset        - 将画布重置为空白状态
/sandbox screenshot   - 捕获当前画布的截图
/sandbox status       - 显示画布服务器状态和设置

Environment Variables

环境变量

VariableDescription
CANVAS_ALLOW_JS_EVAL
Enable JavaScript evaluation in canvas (default:
false
)
ALLOW_UNSAFE_SANDBOX
Enable unsafe sandbox mode (default:
false
)
变量描述
CANVAS_ALLOW_JS_EVAL
启用画布中的JavaScript求值(默认值:
false
ALLOW_UNSAFE_SANDBOX
启用不安全沙箱模式(默认值:
false

Examples

示例

/sandbox start
/sandbox push <h1>Hello World</h1><p>Live preview</p>
/sandbox screenshot
/sandbox status
/sandbox reset
/sandbox start
/sandbox push <h1>Hello World</h1><p>Live preview</p>
/sandbox screenshot
/sandbox status
/sandbox reset

How It Works

工作原理

  1. /sandbox start
    launches a local HTTP server that serves the canvas page
  2. /sandbox push <html>
    sends HTML to the canvas, rendered in real time
  3. /sandbox screenshot
    captures the current canvas state as an image
  4. /sandbox reset
    clears all HTML, CSS, and JS from the canvas
  5. /sandbox status
    shows whether the server is running, the URL, and content sizes
  1. /sandbox start
    启动一个本地HTTP服务器,提供画布页面
  2. /sandbox push <html>
    将HTML发送到画布,实时渲染
  3. /sandbox screenshot
    将当前画布状态捕获为图片
  4. /sandbox reset
    清除画布中的所有HTML、CSS和JS
  5. /sandbox status
    显示服务器是否运行、URL以及内容大小