[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-cloudflare--sandbox-sdk":3,"tool-cloudflare--sandbox-sdk":62},[4,18,26,36,46,54],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":17},4358,"openclaw","openclaw\u002Fopenclaw","OpenClaw 是一款专为个人打造的本地化 AI 助手，旨在让你在自己的设备上拥有完全可控的智能伙伴。它打破了传统 AI 助手局限于特定网页或应用的束缚，能够直接接入你日常使用的各类通讯渠道，包括微信、WhatsApp、Telegram、Discord、iMessage 等数十种平台。无论你在哪个聊天软件中发送消息，OpenClaw 都能即时响应，甚至支持在 macOS、iOS 和 Android 设备上进行语音交互，并提供实时的画布渲染功能供你操控。\n\n这款工具主要解决了用户对数据隐私、响应速度以及“始终在线”体验的需求。通过将 AI 部署在本地，用户无需依赖云端服务即可享受快速、私密的智能辅助，真正实现了“你的数据，你做主”。其独特的技术亮点在于强大的网关架构，将控制平面与核心助手分离，确保跨平台通信的流畅性与扩展性。\n\nOpenClaw 非常适合希望构建个性化工作流的技术爱好者、开发者，以及注重隐私保护且不愿被单一生态绑定的普通用户。只要具备基础的终端操作能力（支持 macOS、Linux 及 Windows WSL2），即可通过简单的命令行引导完成部署。如果你渴望拥有一个懂你",349277,3,"2026-04-06T06:32:30",[13,14,15,16],"Agent","开发框架","图像","数据工具","ready",{"id":19,"name":20,"github_repo":21,"description_zh":22,"stars":23,"difficulty_score":10,"last_commit_at":24,"category_tags":25,"status":17},3808,"stable-diffusion-webui","AUTOMATIC1111\u002Fstable-diffusion-webui","stable-diffusion-webui 是一个基于 Gradio 构建的网页版操作界面，旨在让用户能够轻松地在本地运行和使用强大的 Stable Diffusion 图像生成模型。它解决了原始模型依赖命令行、操作门槛高且功能分散的痛点，将复杂的 AI 绘图流程整合进一个直观易用的图形化平台。\n\n无论是希望快速上手的普通创作者、需要精细控制画面细节的设计师，还是想要深入探索模型潜力的开发者与研究人员，都能从中获益。其核心亮点在于极高的功能丰富度：不仅支持文生图、图生图、局部重绘（Inpainting）和外绘（Outpainting）等基础模式，还独创了注意力机制调整、提示词矩阵、负向提示词以及“高清修复”等高级功能。此外，它内置了 GFPGAN 和 CodeFormer 等人脸修复工具，支持多种神经网络放大算法，并允许用户通过插件系统无限扩展能力。即使是显存有限的设备，stable-diffusion-webui 也提供了相应的优化选项，让高质量的 AI 艺术创作变得触手可及。",162132,"2026-04-05T11:01:52",[14,15,13],{"id":27,"name":28,"github_repo":29,"description_zh":30,"stars":31,"difficulty_score":32,"last_commit_at":33,"category_tags":34,"status":17},1381,"everything-claude-code","affaan-m\u002Feverything-claude-code","everything-claude-code 是一套专为 AI 编程助手（如 Claude Code、Codex、Cursor 等）打造的高性能优化系统。它不仅仅是一组配置文件，而是一个经过长期实战打磨的完整框架，旨在解决 AI 代理在实际开发中面临的效率低下、记忆丢失、安全隐患及缺乏持续学习能力等核心痛点。\n\n通过引入技能模块化、直觉增强、记忆持久化机制以及内置的安全扫描功能，everything-claude-code 能显著提升 AI 在复杂任务中的表现，帮助开发者构建更稳定、更智能的生产级 AI 代理。其独特的“研究优先”开发理念和针对 Token 消耗的优化策略，使得模型响应更快、成本更低，同时有效防御潜在的攻击向量。\n\n这套工具特别适合软件开发者、AI 研究人员以及希望深度定制 AI 工作流的技术团队使用。无论您是在构建大型代码库，还是需要 AI 协助进行安全审计与自动化测试，everything-claude-code 都能提供强大的底层支持。作为一个曾荣获 Anthropic 黑客大奖的开源项目，它融合了多语言支持与丰富的实战钩子（hooks），让 AI 真正成长为懂上",159636,2,"2026-04-17T23:33:34",[14,13,35],"语言模型",{"id":37,"name":38,"github_repo":39,"description_zh":40,"stars":41,"difficulty_score":42,"last_commit_at":43,"category_tags":44,"status":17},8272,"opencode","anomalyco\u002Fopencode","OpenCode 是一款开源的 AI 编程助手（Coding Agent），旨在像一位智能搭档一样融入您的开发流程。它不仅仅是一个代码补全插件，而是一个能够理解项目上下文、自主规划任务并执行复杂编码操作的智能体。无论是生成全新功能、重构现有代码，还是排查难以定位的 Bug，OpenCode 都能通过自然语言交互高效完成，显著减少开发者在重复性劳动和上下文切换上的时间消耗。\n\n这款工具专为软件开发者、工程师及技术研究人员设计，特别适合希望利用大模型能力来提升编码效率、加速原型开发或处理遗留代码维护的专业人群。其核心亮点在于完全开源的架构，这意味着用户可以审查代码逻辑、自定义行为策略，甚至私有化部署以保障数据安全，彻底打破了传统闭源 AI 助手的“黑盒”限制。\n\n在技术体验上，OpenCode 提供了灵活的终端界面（Terminal UI）和正在测试中的桌面应用程序，支持 macOS、Windows 及 Linux 全平台。它兼容多种包管理工具，安装便捷，并能无缝集成到现有的开发环境中。无论您是追求极致控制权的资深极客，还是渴望提升产出的独立开发者，OpenCode 都提供了一个透明、可信",144296,1,"2026-04-16T14:50:03",[13,45],"插件",{"id":47,"name":48,"github_repo":49,"description_zh":50,"stars":51,"difficulty_score":32,"last_commit_at":52,"category_tags":53,"status":17},2271,"ComfyUI","Comfy-Org\u002FComfyUI","ComfyUI 是一款功能强大且高度模块化的视觉 AI 引擎，专为设计和执行复杂的 Stable Diffusion 图像生成流程而打造。它摒弃了传统的代码编写模式，采用直观的节点式流程图界面，让用户通过连接不同的功能模块即可构建个性化的生成管线。\n\n这一设计巧妙解决了高级 AI 绘图工作流配置复杂、灵活性不足的痛点。用户无需具备编程背景，也能自由组合模型、调整参数并实时预览效果，轻松实现从基础文生图到多步骤高清修复等各类复杂任务。ComfyUI 拥有极佳的兼容性，不仅支持 Windows、macOS 和 Linux 全平台，还广泛适配 NVIDIA、AMD、Intel 及苹果 Silicon 等多种硬件架构，并率先支持 SDXL、Flux、SD3 等前沿模型。\n\n无论是希望深入探索算法潜力的研究人员和开发者，还是追求极致创作自由度的设计师与资深 AI 绘画爱好者，ComfyUI 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",108322,"2026-04-10T11:39:34",[14,15,13],{"id":55,"name":56,"github_repo":57,"description_zh":58,"stars":59,"difficulty_score":32,"last_commit_at":60,"category_tags":61,"status":17},6121,"gemini-cli","google-gemini\u002Fgemini-cli","gemini-cli 是一款由谷歌推出的开源 AI 命令行工具，它将强大的 Gemini 大模型能力直接集成到用户的终端环境中。对于习惯在命令行工作的开发者而言，它提供了一条从输入提示词到获取模型响应的最短路径，无需切换窗口即可享受智能辅助。\n\n这款工具主要解决了开发过程中频繁上下文切换的痛点，让用户能在熟悉的终端界面内直接完成代码理解、生成、调试以及自动化运维任务。无论是查询大型代码库、根据草图生成应用，还是执行复杂的 Git 操作，gemini-cli 都能通过自然语言指令高效处理。\n\n它特别适合广大软件工程师、DevOps 人员及技术研究人员使用。其核心亮点包括支持高达 100 万 token 的超长上下文窗口，具备出色的逻辑推理能力；内置 Google 搜索、文件操作及 Shell 命令执行等实用工具；更独特的是，它支持 MCP（模型上下文协议），允许用户灵活扩展自定义集成，连接如图像生成等外部能力。此外，个人谷歌账号即可享受免费的额度支持，且项目基于 Apache 2.0 协议完全开源，是提升终端工作效率的理想助手。",100752,"2026-04-10T01:20:03",[45,13,15,14],{"id":63,"github_repo":64,"name":65,"description_en":66,"description_zh":67,"ai_summary_zh":67,"readme_en":68,"readme_zh":69,"quickstart_zh":70,"use_case_zh":71,"hero_image_url":72,"owner_login":73,"owner_name":74,"owner_avatar_url":75,"owner_bio":76,"owner_company":77,"owner_location":77,"owner_email":77,"owner_twitter":77,"owner_website":78,"owner_url":79,"languages":80,"stars":118,"forks":119,"last_commit_at":120,"license":121,"difficulty_score":10,"env_os":122,"env_gpu":122,"env_ram":122,"env_deps":123,"category_tags":128,"github_topics":129,"view_count":32,"oss_zip_url":77,"oss_zip_packed_at":77,"status":17,"created_at":137,"updated_at":138,"faqs":139,"releases":168},8739,"cloudflare\u002Fsandbox-sdk","sandbox-sdk","Run sandboxed code environments on Cloudflare's edge network","sandbox-sdk 是一款由 Cloudflare 推出的开源开发工具，旨在帮助开发者在边缘网络上构建安全、隔离的代码执行环境。它核心解决了在云端运行不可信代码时的安全风险难题，通过为每段代码提供独立的容器化沙箱，有效防止恶意操作影响主系统或其他服务。\n\n这款工具特别适合需要集成代码解释器、交互式开发环境、数据分析平台或自动化 CI\u002FCD 流程的后端开发者与架构师。无论是构建能实时运行用户提交 Python 脚本的 AI 助手，还是搭建在线编程练习平台，sandbox-sdk 都能让应用在 Cloudflare 的全球边缘节点上直接执行命令、管理文件系统甚至暴露临时服务，而无需自建复杂的容器集群。\n\n其独特亮点在于“边缘原生”架构，将沉重的容器隔离技术与轻量的 Serverless 模式完美结合。开发者只需几行代码即可调用沙箱能力，既享受了容器级的严格安全隔离，又保留了边缘计算的低延迟与高扩展性优势。配合完善的 TypeScript 支持和本地调试功能，sandbox-sdk 让高风险的代码执行场景变得简单、可控且高效，是构建下一代动态 Web 应用的理想基石。","\u003Cimg width=\"1362\" height=\"450\" alt=\"Image\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fcloudflare_sandbox-sdk_readme_996ca42267af.png\" \u002F>\n\n# Cloudflare Sandbox SDK\n\n[![npm version](https:\u002F\u002Fimg.shields.io\u002Fnpm\u002Fv\u002F@cloudflare\u002Fsandbox)](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@cloudflare\u002Fsandbox)\n[![npm downloads](https:\u002F\u002Fimg.shields.io\u002Fnpm\u002Fdw\u002F@cloudflare\u002Fsandbox)](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@cloudflare\u002Fsandbox)\n\n**Build secure, isolated code execution environments on Cloudflare.**\n\nThe Sandbox SDK lets you run untrusted code safely in isolated containers. Execute commands, manage files, run background processes, and expose services — all from your Workers applications.\n\nPerfect for AI code execution, interactive development environments, data analysis platforms, CI\u002FCD systems, and any application that needs secure code execution at the edge.\n\n## Getting Started\n\n### Prerequisites\n\n1. Install [Node.js](https:\u002F\u002Fdocs.npmjs.com\u002Fdownloading-and-installing-node-js-and-npm) (version 16.17.0 or later)\n2. Ensure Docker is running locally ([see setup guide](https:\u002F\u002Fdevelopers.cloudflare.com\u002Fsandbox\u002Fget-started\u002F#ensure-docker-is-running-locally))\n3. For deploying to production, sign up for a [Cloudflare account](https:\u002F\u002Fdash.cloudflare.com\u002Fsign-up\u002Fworkers-and-pages)\n\n### 1. Create a new project\n\nCreate a new Sandbox SDK project using the minimal template:\n\n```bash\nnpm create cloudflare@latest -- my-sandbox --template=cloudflare\u002Fsandbox-sdk\u002Fexamples\u002Fminimal\ncd my-sandbox\n```\n\n### 2. Test locally\n\nStart the development server:\n\n```bash\nnpm run dev\n```\n\n> **Note:** First run builds the Docker container (2-3 minutes). Subsequent runs are much faster.\n\nTest the endpoints:\n\n```bash\n# Execute Python code\ncurl http:\u002F\u002Flocalhost:8787\u002Frun\n\n# File operations\ncurl http:\u002F\u002Flocalhost:8787\u002Ffile\n```\n\n### 3. Deploy to production\n\nDeploy your Worker and container:\n\n```bash\nnpx wrangler deploy\n```\n\n> **Wait for provisioning:** After first deployment, wait 2-3 minutes before making requests.\n\n**📖 [View the complete getting started guide](https:\u002F\u002Fdevelopers.cloudflare.com\u002Fsandbox\u002Fget-started\u002F)** for detailed instructions and explanations.\n\n## Quick API Example\n\n```typescript\nimport { getSandbox, proxyToSandbox, type Sandbox } from '@cloudflare\u002Fsandbox';\n\nexport { Sandbox } from '@cloudflare\u002Fsandbox';\n\ntype Env = {\n  Sandbox: DurableObjectNamespace\u003CSandbox>;\n};\n\nexport default {\n  async fetch(request: Request, env: Env): Promise\u003CResponse> {\n    \u002F\u002F Required for preview URLs\n    const proxyResponse = await proxyToSandbox(request, env);\n    if (proxyResponse) return proxyResponse;\n\n    const url = new URL(request.url);\n    const sandbox = getSandbox(env.Sandbox, 'my-sandbox');\n\n    \u002F\u002F Execute Python code\n    if (url.pathname === '\u002Frun') {\n      const result = await sandbox.exec('python3 -c \"print(2 + 2)\"');\n      return Response.json({ output: result.stdout, success: result.success });\n    }\n\n    \u002F\u002F Work with files\n    if (url.pathname === '\u002Ffile') {\n      await sandbox.writeFile('\u002Fworkspace\u002Fhello.txt', 'Hello, Sandbox!');\n      const file = await sandbox.readFile('\u002Fworkspace\u002Fhello.txt');\n      return Response.json({ content: file.content });\n    }\n\n    return new Response('Try \u002Frun or \u002Ffile');\n  }\n};\n```\n\n## Documentation\n\n**📖 [Full Documentation](https:\u002F\u002Fdevelopers.cloudflare.com\u002Fsandbox\u002F)**\n\n- [Get Started Guide](https:\u002F\u002Fdevelopers.cloudflare.com\u002Fsandbox\u002Fget-started\u002F) - Step-by-step tutorial\n- [API Reference](https:\u002F\u002Fdevelopers.cloudflare.com\u002Fsandbox\u002Fapi\u002F) - Complete API docs\n- [Guides](https:\u002F\u002Fdevelopers.cloudflare.com\u002Fsandbox\u002Fguides\u002F) - Execute commands, manage files, expose services\n- [Examples](https:\u002F\u002Fdevelopers.cloudflare.com\u002Fsandbox\u002Ftutorials\u002F) - AI agents, data analysis, CI\u002FCD pipelines\n\n## Key Features\n\n- **Secure Isolation** - Each sandbox runs in its own container\n- **Edge-Native** - Runs on Cloudflare's global network\n- **Code Interpreter** - Execute Python and JavaScript with rich outputs\n- **File System Access** - Read, write, and manage files\n- **Command Execution** - Run any command with streaming support\n- **Preview URLs** - Expose services with public URLs\n- **Git Integration** - Clone repositories directly\n\n## Contributing\n\nWe welcome contributions from the community! See [CONTRIBUTING.md](.\u002FCONTRIBUTING.md) for guidelines on:\n\n- Setting up your development environment\n- Creating pull requests\n- Code style and testing requirements\n\n## Development\n\nThis repository contains the SDK source code. Quick start:\n\n```bash\n# Clone the repo\ngit clone https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\ncd sandbox-sdk\n\n# Install dependencies\nnpm install\n\n# Run tests\nnpm test\n\n# Build the project\nnpm run build\n\n# Type checking and linting\nnpm run check\n```\n\n## Examples\n\nSee the [examples directory](.\u002Fexamples) for complete working examples:\n\n- [Minimal](.\u002Fexamples\u002Fminimal) - Start here: exec commands, read\u002Fwrite files\n- [Code Interpreter](.\u002Fexamples\u002Fcode-interpreter) - Give [gpt-oss](https:\u002F\u002Fdevelopers.cloudflare.com\u002Fworkers-ai\u002Fmodels\u002Fgpt-oss-120b\u002F) on Workers AI a Python REPL\n- [Claude Code](.\u002Fexamples\u002Fclaude-code) - Run [Claude Code](https:\u002F\u002Fclaude.ai\u002Fcode) headless on any repo\n- [OpenAI Agents](.\u002Fexamples\u002Fopenai-agents) - `Shell` and `Editor` tools for [OpenAI Agents SDK](https:\u002F\u002Fopenai.github.io\u002Fopenai-agents-js\u002F)\n- [OpenCode](.\u002Fexamples\u002Fopencode) - [OpenCode](https:\u002F\u002Fgithub.com\u002Fsst\u002Fopencode) web UI or [SDK](https:\u002F\u002Fopencode.ai\u002Fdocs\u002Fsdk\u002F) in a sandbox\n- [TypeScript Validator](.\u002Fexamples\u002Ftypescript-validator) - Build with npm in sandbox, execute in [isolates](https:\u002F\u002Fdevelopers.cloudflare.com\u002Fworkers\u002Fruntime-apis\u002Fbindings\u002Fworker-loader\u002F)\n\n## Status\n\n**Beta** - The SDK is in active development. APIs may change before v1.0.\n\n## License\n\n[Apache License 2.0](LICENSE)\n\n## Links\n\n- [Documentation](https:\u002F\u002Fdevelopers.cloudflare.com\u002Fsandbox\u002F)\n- [GitHub Issues](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fissues)\n- [Developer Discord](https:\u002F\u002Fdiscord.cloudflare.com)\n- [Cloudflare Developers](https:\u002F\u002Ftwitter.com\u002FCloudflareDev)\n","\u003Cimg width=\"1362\" height=\"450\" alt=\"图片\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fcloudflare_sandbox-sdk_readme_996ca42267af.png\" \u002F>\n\n# Cloudflare 沙箱 SDK\n\n[![npm 版本](https:\u002F\u002Fimg.shields.io\u002Fnpm\u002Fv\u002F@cloudflare\u002Fsandbox)](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@cloudflare\u002Fsandbox)\n[![npm 下载量](https:\u002F\u002Fimg.shields.io\u002Fnpm\u002Fdw\u002F@cloudflare\u002Fsandbox)](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@cloudflare\u002Fsandbox)\n\n**在 Cloudflare 上构建安全、隔离的代码执行环境。**\n\nSandbox SDK 允许您在隔离的容器中安全地运行不受信任的代码。您可以从 Workers 应用程序中执行命令、管理文件、运行后台进程以及暴露服务。\n\n非常适合用于 AI 代码执行、交互式开发环境、数据分析平台、CI\u002FCD 系统，以及任何需要在边缘进行安全代码执行的应用场景。\n\n## 快速入门\n\n### 前提条件\n\n1. 安装 [Node.js](https:\u002F\u002Fdocs.npmjs.com\u002Fdownloading-and-installing-node-js-and-npm)（版本 16.17.0 或更高）\n2. 确保本地已运行 Docker（[参见设置指南](https:\u002F\u002Fdevelopers.cloudflare.com\u002Fsandbox\u002Fget-started\u002F#ensure-docker-is-running-locally)）\n3. 若要部署到生产环境，请注册一个 [Cloudflare 账户](https:\u002F\u002Fdash.cloudflare.com\u002Fsign-up\u002Fworkers-and-pages)\n\n### 1. 创建新项目\n\n使用最小模板创建一个新的 Sandbox SDK 项目：\n\n```bash\nnpm create cloudflare@latest -- my-sandbox --template=cloudflare\u002Fsandbox-sdk\u002Fexamples\u002Fminimal\ncd my-sandbox\n```\n\n### 2. 在本地测试\n\n启动开发服务器：\n\n```bash\nnpm run dev\n```\n\n> **注意：** 首次运行会构建 Docker 容器（2-3 分钟）。后续运行会快得多。\n\n测试端点：\n\n```bash\n# 执行 Python 代码\ncurl http:\u002F\u002Flocalhost:8787\u002Frun\n\n# 文件操作\ncurl http:\u002F\u002Flocalhost:8787\u002Ffile\n```\n\n### 3. 部署到生产环境\n\n部署您的 Worker 和容器：\n\n```bash\nnpx wrangler deploy\n```\n\n> **等待资源调配：** 首次部署后，请等待 2-3 分钟再发起请求。\n\n**📖 [查看完整的入门指南](https:\u002F\u002Fdevelopers.cloudflare.com\u002Fsandbox\u002Fget-started\u002F)**，获取详细说明和解释。\n\n## API 快速示例\n\n```typescript\nimport { getSandbox, proxyToSandbox, type Sandbox } from '@cloudflare\u002Fsandbox';\n\nexport { Sandbox } from '@cloudflare\u002Fsandbox';\n\ntype Env = {\n  Sandbox: DurableObjectNamespace\u003CSandbox>;\n};\n\nexport default {\n  async fetch(request: Request, env: Env): Promise\u003CResponse> {\n    \u002F\u002F 预览 URL 所需\n    const proxyResponse = await proxyToSandbox(request, env);\n    if (proxyResponse) return proxyResponse;\n\n    const url = new URL(request.url);\n    const sandbox = getSandbox(env.Sandbox, 'my-sandbox');\n\n    \u002F\u002F 执行 Python 代码\n    if (url.pathname === '\u002Frun') {\n      const result = await sandbox.exec('python3 -c \"print(2 + 2)\"');\n      return Response.json({ output: result.stdout, success: result.success });\n    }\n\n    \u002F\u002F 处理文件\n    if (url.pathname === '\u002Ffile') {\n      await sandbox.writeFile('\u002Fworkspace\u002Fhello.txt', 'Hello, Sandbox!');\n      const file = await sandbox.readFile('\u002Fworkspace\u002Fhello.txt');\n      return Response.json({ content: file.content });\n    }\n\n    return new Response('尝试 \u002Frun 或 \u002Ffile');\n  }\n};\n```\n\n## 文档\n\n**📖 [完整文档](https:\u002F\u002Fdevelopers.cloudflare.com\u002Fsandbox\u002F)**\n\n- [入门指南](https:\u002F\u002Fdevelopers.cloudflare.com\u002Fsandbox\u002Fget-started\u002F) - 分步教程\n- [API 参考](https:\u002F\u002Fdevelopers.cloudflare.com\u002Fsandbox\u002Fapi\u002F) - 完整的 API 文档\n- [指南](https:\u002F\u002Fdevelopers.cloudflare.com\u002Fsandbox\u002Fguides\u002F) - 执行命令、管理文件、暴露服务\n- [示例](https:\u002F\u002Fdevelopers.cloudflare.com\u002Fsandbox\u002Ftutorials\u002F) - AI 代理、数据分析、CI\u002FCD 流水线\n\n## 核心特性\n\n- **安全隔离** - 每个沙箱都在独立的容器中运行\n- **原生边缘** - 运行在 Cloudflare 的全球网络上\n- **代码解释器** - 执行 Python 和 JavaScript，并获得丰富的输出\n- **文件系统访问** - 读取、写入和管理文件\n- **命令执行** - 运行任意命令，并支持流式处理\n- **预览 URL** - 使用公共 URL 暴露服务\n- **Git 集成** - 直接克隆仓库\n\n## 贡献\n\n我们欢迎社区贡献！请参阅 [CONTRIBUTING.md](.\u002FCONTRIBUTING.md)，了解以下内容的指导原则：\n\n- 设置开发环境\n- 创建拉取请求\n- 代码风格和测试要求\n\n## 开发\n\n此仓库包含 SDK 的源代码。快速入门：\n\n```bash\n# 克隆仓库\ngit clone https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\ncd sandbox-sdk\n\n# 安装依赖\nnpm install\n\n# 运行测试\nnpm test\n\n# 构建项目\nnpm run build\n\n# 类型检查和代码格式化\nnpm run check\n```\n\n## 示例\n\n请参阅 [examples 目录](.\u002Fexamples)，获取完整的可运行示例：\n\n- [最小示例](.\u002Fexamples\u002Fminimal) - 从这里开始：执行命令、读写文件\n- [代码解释器](.\u002Fexamples\u002Fcode-interpreter) - 为 Workers AI 上的 [gpt-oss](https:\u002F\u002Fdevelopers.cloudflare.com\u002Fworkers-ai\u002Fmodels\u002Fgpt-oss-120b\u002F) 提供一个 Python REPL\n- [Claude Code](.\u002Fexamples\u002Fclaude-code) - 在任何仓库上无头运行 [Claude Code](https:\u002F\u002Fclaude.ai\u002Fcode)\n- [OpenAI 代理](.\u002Fexamples\u002Fopenai-agents) - 为 [OpenAI 代理 SDK](https:\u002F\u002Fopenai.github.io\u002Fopenai-agents-js\u002F) 提供 `Shell` 和 `Editor` 工具\n- [OpenCode](.\u002Fexamples\u002Fopencode) - 将 [OpenCode](https:\u002F\u002Fgithub.com\u002Fsst\u002Fopencode) 的 Web UI 或 [SDK](https:\u002F\u002Fopencode.ai\u002Fdocs\u002Fsdk\u002F) 放置在沙箱中\n- [TypeScript 验证器](.\u002Fexamples\u002Ftypescript-validator) - 在沙箱中使用 npm 构建，并在 [isolates](https:\u002F\u002Fdevelopers.cloudflare.com\u002Fworkers\u002Fruntime-apis\u002Fbindings\u002Fworker-loader\u002F) 中执行\n\n## 当前状态\n\n**Beta** - SDK 处于积极开发中。API 在 v1.0 发布前可能会发生变化。\n\n## 许可证\n\n[Apache License 2.0](LICENSE)\n\n## 链接\n\n- [文档](https:\u002F\u002Fdevelopers.cloudflare.com\u002Fsandbox\u002F)\n- [GitHub 问题](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fissues)\n- [开发者 Discord](https:\u002F\u002Fdiscord.cloudflare.com)\n- [Cloudflare 开发者](https:\u002F\u002Ftwitter.com\u002FCloudflareDev)","# Cloudflare Sandbox SDK 快速上手指南\n\nCloudflare Sandbox SDK 允许你在 Cloudflare 的全球边缘网络上构建安全、隔离的代码执行环境。它非常适合用于 AI 代码执行、交互式开发环境、数据分析平台以及需要安全运行不可信代码的应用场景。\n\n## 环境准备\n\n在开始之前，请确保你的开发环境满足以下要求：\n\n1.  **Node.js**: 版本需为 16.17.0 或更高。\n    *   国内开发者建议使用 [Node.js 国内镜像](https:\u002F\u002Fnpmmirror.com\u002Fmirrors\u002Fnode\u002F) 进行安装。\n2.  **Docker**: 必须在本地运行 Docker 引擎（SDK 本地测试依赖容器）。\n    *   请参考 [Docker 官方安装指南](https:\u002F\u002Fdocs.docker.com\u002Fget-docker\u002F) 或配置国内加速源。\n3.  **Cloudflare 账号**: 如果计划部署到生产环境，需要注册 [Cloudflare 账号](https:\u002F\u002Fdash.cloudflare.com\u002Fsign-up\u002Fworkers-and-pages)。\n\n## 安装步骤\n\n使用官方提供的最小化模板快速创建新项目：\n\n```bash\nnpm create cloudflare@latest -- my-sandbox --template=cloudflare\u002Fsandbox-sdk\u002Fexamples\u002Fminimal\ncd my-sandbox\n```\n\n> **提示**：如果你在国内遇到 npm 下载速度慢的问题，可以临时切换镜像源：\n> `npm config set registry https:\u002F\u002Fregistry.npmmirror.com`\n\n## 基本使用\n\n### 1. 本地运行与测试\n\n启动开发服务器。首次运行时会自动构建 Docker 容器（约需 2-3 分钟），后续运行速度将显著提升。\n\n```bash\nnpm run dev\n```\n\n服务器启动后（默认端口 8787），你可以测试以下端点：\n\n*   **执行 Python 代码**:\n    ```bash\n    curl http:\u002F\u002Flocalhost:8787\u002Frun\n    ```\n*   **文件操作测试**:\n    ```bash\n    curl http:\u002F\u002Flocalhost:8787\u002Ffile\n    ```\n\n### 2. 核心代码示例\n\n以下是如何在 Worker 中调用 Sandbox API 执行命令和管理文件的最小化示例：\n\n```typescript\nimport { getSandbox, proxyToSandbox, type Sandbox } from '@cloudflare\u002Fsandbox';\n\nexport { Sandbox } from '@cloudflare\u002Fsandbox';\n\ntype Env = {\n  Sandbox: DurableObjectNamespace\u003CSandbox>;\n};\n\nexport default {\n  async fetch(request: Request, env: Env): Promise\u003CResponse> {\n    \u002F\u002F 处理预览 URL 所需的代理逻辑\n    const proxyResponse = await proxyToSandbox(request, env);\n    if (proxyResponse) return proxyResponse;\n\n    const url = new URL(request.url);\n    \u002F\u002F 获取沙箱实例\n    const sandbox = getSandbox(env.Sandbox, 'my-sandbox');\n\n    \u002F\u002F 示例 1: 执行 Python 代码\n    if (url.pathname === '\u002Frun') {\n      const result = await sandbox.exec('python3 -c \"print(2 + 2)\"');\n      return Response.json({ output: result.stdout, success: result.success });\n    }\n\n    \u002F\u002F 示例 2: 文件读写操作\n    if (url.pathname === '\u002Ffile') {\n      await sandbox.writeFile('\u002Fworkspace\u002Fhello.txt', 'Hello, Sandbox!');\n      const file = await sandbox.readFile('\u002Fworkspace\u002Fhello.txt');\n      return Response.json({ content: file.content });\n    }\n\n    return new Response('Try \u002Frun or \u002Ffile');\n  }\n};\n```\n\n### 3. 部署到生产环境\n\n完成开发后，使用 Wrangler 将 Worker 和容器部署到 Cloudflare 全球网络：\n\n```bash\nnpx wrangler deploy\n```\n\n> **注意**：首次部署后，基础设施可能需要 2-3 分钟的预热时间，之后即可正常接收请求。","一家在线教育平台需要为用户提供实时的 Python 代码练习环境，让用户在浏览器中编写并运行数据分析脚本，同时确保恶意代码不会破坏服务器。\n\n### 没有 sandbox-sdk 时\n- **安全风险高**：直接在主服务器上使用 `eval` 或子进程运行用户代码，一旦遇到死循环或文件系统攻击，极易导致整个服务瘫痪。\n- **部署架构重**：为了隔离风险，不得不维护独立的虚拟机集群或复杂的 Kubernetes 容器组，运维成本高昂且扩容缓慢。\n- **全球延迟大**：集中式的代码执行服务器位于单一区域，海外用户提交代码后需等待数秒才能看到运行结果，体验流畅度差。\n- **资源浪费严重**：即使没有用户在使用，预分配的容器实例也在持续消耗计算资源和费用。\n\n### 使用 sandbox-sdk 后\n- **原生安全隔离**：sandbox-sdk 利用 Cloudflare 边缘网络为每个用户请求启动独立的微容器，彻底阻断代码对宿主系统的访问，杜绝逃逸风险。\n- **无服务器化运维**：开发者只需在 Worker 中调用几行 API 即可管理文件与执行命令，无需关心底层容器编排，实现真正的 Serverless 体验。\n- **边缘低延迟执行**：代码在全球最近的边缘节点运行，用户提交脚本后毫秒级返回结果，提供如同本地 IDE 般的流畅交互感。\n- **按需弹性计费**：仅在代码实际运行时才消耗资源，空闲时无任何成本，完美适配波峰波谷明显的教育场景。\n\nsandbox-sdk 将高风险的代码执行任务转化为安全、低成本且全球分布的边缘原子能力，让构建实时交互式编程平台变得像编写普通网页一样简单。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fcloudflare_sandbox-sdk_996ca422.png","cloudflare","Cloudflare","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fcloudflare_e3c846c2.jpg","",null,"https:\u002F\u002Fwww.cloudflare.com","https:\u002F\u002Fgithub.com\u002Fcloudflare",[81,85,89,93,97,101,105,108,112,115],{"name":82,"color":83,"percentage":84},"TypeScript","#3178c6",95.6,{"name":86,"color":87,"percentage":88},"Python","#3572A5",2.3,{"name":90,"color":91,"percentage":92},"Dockerfile","#384d54",0.6,{"name":94,"color":95,"percentage":96},"JavaScript","#f1e05a",0.5,{"name":98,"color":99,"percentage":100},"Shell","#89e051",0.4,{"name":102,"color":103,"percentage":104},"CSS","#663399",0.2,{"name":106,"color":107,"percentage":104},"Astro","#ff5a03",{"name":109,"color":110,"percentage":111},"Go","#00ADD8",0.1,{"name":113,"color":114,"percentage":111},"HTML","#e34c26",{"name":116,"color":117,"percentage":111},"HCL","#844FBA",986,87,"2026-04-17T14:21:24","NOASSERTION","未说明",{"notes":124,"python":122,"dependencies":125},"本地开发必须安装并运行 Docker；首次运行构建容器需 2-3 分钟；生产环境部署需要 Cloudflare 账户；该工具主要用于在 Cloudflare Workers 上运行隔离的代码执行环境，支持执行 Python 和 JavaScript 代码。",[126,127],"Node.js >= 16.17.0","Docker",[14,15,13],[130,131,132,133,134,135,136],"agent","agents","ai","code-interpreter","containers","devtools","sandbox","2026-03-27T02:49:30.150509","2026-04-18T09:20:14.230941",[140,145,150,155,160,164],{"id":141,"question_zh":142,"answer_zh":143,"source_url":144},39175,"使用 execStreaming 运行长时间任务时，容器意外关闭或流挂起怎么办？","需要定期调用 `sandbox.renewActivityTimeout()` 来延长容器活动超时时间，防止 Cloudflare 因空闲而关闭容器。同时，不能仅依赖流的错误事件，因为容器崩溃或连接关闭时流可能不会报错。建议实现一个健康检查循环：定期调用 `sandbox.getState()` 检查状态是否为 \"healthy\"，并在读取流时使用带超时的竞争机制（timeout race）来检测故障。如果检测到不健康状态，应主动终止流程并处理错误。","https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fissues\u002F101",{"id":146,"question_zh":147,"answer_zh":148,"source_url":149},39176,"本地开发服务器重载时遇到 \"Session already exists\" 错误如何解决？","该问题通常发生在本地开发环境（wrangler dev）服务器重载时，会话状态未正确清理。维护者已发布修复版本。临时解决方案是确保使用最新的 npm 包版本。如果问题依旧，可以尝试在 `package.json` 中暂时指向特定的修复分支版本（如通过 `pkg.pr.new` 链接），或者等待主版本更新合并。确保升级到包含该修复的最新 SDK 版本即可解决此问题。","https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fissues\u002F120",{"id":151,"question_zh":152,"answer_zh":153,"source_url":154},39177,"调用 listFiles 方法时 Promise 永远不返回（挂起）是什么原因？","这是一个 SDK 的关键 Bug，已在后续版本中修复。如果您使用的是 0.4.11 或更早版本，可能会遇到此问题。解决方案是将 `@cloudflare\u002Fsandbox` 包升级到最新版本。维护者确认该问题是由内部逻辑缺陷导致的，升级后 `listFiles` 方法将能正常解析并返回文件列表。","https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fissues\u002F166",{"id":156,"question_zh":157,"answer_zh":158,"source_url":159},39178,"在 production 环境中预览应用时请求被拦截或返回 403 Forbidden 怎么办？","这通常是因为代码中显式设置了 `Host` 请求头（例如为了本地预览匹配特定域名）。Cloudflare 在生产环境中出于安全考虑，会阻止任意流量伪造 `Host` 头，以防攻击者欺骗服务。解决方法是修改应用程序代码，移除对特定 `Host` 头的依赖，不要手动设置该头部，让 Cloudflare 自动处理路由和主机名解析。","https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fissues\u002F250",{"id":161,"question_zh":162,"answer_zh":163,"source_url":144},39179,"即使设置了 keepAlive: true，为什么沙箱仍在 10 分钟后收到 SIGTERM 信号？","在本地开发环境（`npx wrangler dev`）中，`keepAlive` 标志的行为可能与生产环境不同，或者在特定版本（如 0.4.11）中存在限制。如果在本地测试发现该标志未被尊重，建议首先尝试部署到生产环境验证行为是否一致。如果生产环境也有此问题，请确保升级到最新的 SDK 和 Worker 镜像版本，因为维护者持续在改进长运行进程的生命周期管理。此外，仍需配合手动续期活动超时（renewActivityTimeout）作为双重保险。",{"id":165,"question_zh":166,"answer_zh":167,"source_url":154},39180,"如何在沙箱启动完成时执行自定义回调或钩子？","目前 SDK 尚未内置直接的“启动完成”回调钩子。用户目前的变通方案是自己实现生命周期钩子来监听容器状态。社区已提出功能请求，希望在 SDK 中增加原生支持，允许注册回调函数以便在容器命名并完全启动时触发。在当前版本中，建议通过轮询 `sandbox.getState()` 直到状态变为稳定，或者结合日志监控来实现类似的逻辑。",[169,174,179,184,189,194,199,204,209,214,219,224,229,234,239,244,249,254,259,264],{"id":170,"version":171,"summary_zh":172,"released_at":173},315111,"@cloudflare\u002Fsandbox@0.8.11","### 补丁变更\n\n-   [#585](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fpull\u002F585) [`ab84333`](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fcommit\u002Fab843334764e0fe0fe268e406f2332d3381bd94e) 感谢 [@aron-cf](https:\u002F\u002Fgithub.com\u002Faron-cf)! - 添加了沙箱桥接器——一个将 REST 请求转换为沙箱持久对象操作的 HTTP API。可以将该桥接器部署为独立的 Cloudflare Worker，通过 HTTP 暴露会话管理、命令执行、文件读写、PTY 以及工作区挂载\u002F卸载等功能。还包括一个可选的预热池持久对象，用于预先置备沙箱，以降低冷启动延迟。\n\n    可从 `@cloudflare\u002Fsandbox\u002Fbridge` 中导入桥接器工厂和预热池。\n\n    ```ts\n    import { bridge } from '@cloudflare\u002Fsandbox\u002Fbridge';\n    export { Sandbox } from '@cloudflare\u002Fsandbox';\n    export { WarmPool } from '@cloudflare\u002Fsandbox\u002Fbridge';\n\n    export default bridge({\n      fetch(request, env, ctx) {\n        \u002F\u002F 在此处编写您的代码\n        return new Response('OK');\n      }\n    });\n    ```\n","2026-04-15T16:43:40",{"id":175,"version":176,"summary_zh":177,"released_at":178},315112,"@cloudflare\u002Fsandbox@0.8.10","### 补丁变更\n\n-   [#577](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fpull\u002F577) [`a56898c`](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fcommit\u002Fa56898cc83944a5d43ce3ab75cdba8025d51e2fc) 感谢 [@whoiskatrin](https:\u002F\u002Fgithub.com\u002Fwhoiskatrin)! - 通过在恢复过程中直接从 R2 挂载备份归档，而非先将其下载到容器本地存储，从而优化备份恢复流程。\n","2026-04-13T18:10:49",{"id":180,"version":181,"summary_zh":182,"released_at":183},315113,"@cloudflare\u002Fsandbox@0.8.9","### 补丁变更\n\n-   [#570](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fpull\u002F570) [`8363119`](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fcommit\u002F8363119c5cf70a48a81a7a515fb14a9c0ae890be) 感谢 [@aron-cf](https:\u002F\u002Fgithub.com\u002Faron-cf)! - 修复了当 FUSE 文件系统卸载失败时，`unmountBucket()` 会静默成功的问题。该方法现在会检查 `fusermount` 的退出码，并在失败时抛出 `BucketUnmountError` 异常；成功卸载后会清理挂载目录；同时，容器镜像中包含了 `fusermount` 所需的 `\u002Fetc\u002Fmtab` 符号链接。\n\n-   [#573](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fpull\u002F573) [`cc14fc7`](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fcommit\u002Fcc14fc7e931f7b92cee05010eeb5aa74cc44209b) 感谢 [@whoiskatrin](https:\u002F\u002Fgithub.com\u002Fwhoiskatrin)! - 将 `gitCheckout()` 的默认克隆超时时间增加至 10 分钟，以避免大型仓库或较慢的 Git 远程仓库在默认 2 分钟超时后失败。\n    现在，如果检出操作需要更多时间，可以通过 `cloneTimeoutMs` 选项在每次调用时覆盖 Git 克隆子进程的超时时间。","2026-04-10T12:47:49",{"id":185,"version":186,"summary_zh":187,"released_at":188},315114,"@cloudflare\u002Fsandbox@0.8.8","### 补丁变更\n\n-   [#571](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fpull\u002F571) [`c5db840`](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fcommit\u002Fc5db84092ad8d3ea1c0e98b54e1b58d7a953b32b) 感谢 [@whoiskatrin](https:\u002F\u002Fgithub.com\u002Fwhoiskatrin)! - 要求使用 `@cloudflare\u002Fcontainers` 0.3.0，以便 Sandbox 应用程序能够获取最新的 Containers 平台更新。\n","2026-04-09T21:53:02",{"id":190,"version":191,"summary_zh":192,"released_at":193},315115,"@cloudflare\u002Fsandbox@0.8.7","### 补丁变更\n\n-   [#565](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fpull\u002F565) [`ffcbd3a`](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fcommit\u002Fffcbd3ab9584c7e717f6d4d19538bb57cbd88d69) 感谢 [@whoiskatrin](https:\u002F\u002Fgithub.com\u002Fwhoiskatrin)! - 要求使用 `@cloudflare\u002Fcontainers` 0.2.3 或更高版本。\n\n-   [#550](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fpull\u002F550) [`1db32ea`](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fcommit\u002F1db32ea02f1374b4c79d9bf05f50424b4166402b) 感谢 [@scuffi](https:\u002F\u002Fgithub.com\u002Fscuffi)! - 在您的 Sandbox 中将 `interceptHttps = true` 设置后，容器启动时会自动信任 Cloudflare 注入的 CA 证书，从而实现出站 HTTPS 流量的拦截。\n","2026-04-08T16:25:07",{"id":195,"version":196,"summary_zh":197,"released_at":198},315116,"@cloudflare\u002Fsandbox@0.8.6","### 补丁变更\n\n-   [#557](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fpull\u002F557) [`f17045b`](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fcommit\u002Ff17045ba9202d2a1d0e59161b279fd75a31d458f) 感谢 [@AshishKumar4](https:\u002F\u002Fgithub.com\u002FAshishKumar4)! - 修复使用 WebSocket 传输时的启动死锁问题。\n\n    如果沙盒在 `onStart()` 中调用 `exec()` 或其他 SDK 方法，可能会陷入无限超时循环，从而需要重启。现在这一问题已得到自动处理。","2026-04-07T16:07:20",{"id":200,"version":201,"summary_zh":202,"released_at":203},315117,"@cloudflare\u002Fsandbox@0.8.5","### 补丁变更\n\n-   [#559](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fpull\u002F559) [`b42a57f`](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fcommit\u002Fb42a57f712a711d8892a07022ff589bbea4bafce) 感谢 [@whoiskatrin](https:\u002F\u002Fgithub.com\u002Fwhoiskatrin)! - 允许 `createBackup()` 和 `restoreBackup()` 将目标目录设置为 `\u002Fapp` 下的子目录。\n    这使得备份能够适用于自定义镜像，这些镜像会将应用文件存放在 `\u002Fapp` 而不是 `\u002Fworkspace` 中。","2026-04-07T15:44:03",{"id":205,"version":206,"summary_zh":207,"released_at":208},315118,"@cloudflare\u002Fsandbox@0.8.4","### 补丁变更\n\n-   [#542](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fpull\u002F542) [`eb55c28`](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fcommit\u002Feb55c286ac508a70e53f1f7acfaa4f8c1e84156a) 感谢 [@dependabot](https:\u002F\u002Fgithub.com\u002Fapps\u002Fdependabot)! - 将 Go 工具链升级至 1.25，并更新桌面容器版本中的依赖项，其中包括一项针对图像处理的安全修复（CVE-2026-33809）。\n","2026-04-01T18:59:37",{"id":210,"version":211,"summary_zh":212,"released_at":213},315119,"@cloudflare\u002Fsandbox@0.8.3","### 补丁变更\n\n-   [#515](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fpull\u002F515) [`bf54f69`](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fcommit\u002Fbf54f696790ed9ef6b83ea4c6d3caef881940f4c) 感谢 [@Muhammad-Bin-Ali](https:\u002F\u002Fgithub.com\u002FMuhammad-Bin-Ali)! - 修复并行创建代码上下文速度慢的问题。现在并发创建多个上下文（例如一次创建 10 个）不再与请求数量呈线性增长——执行耗时从约 5 秒降至约 500 毫秒。\n\n-   [#493](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fpull\u002F493) [`fdd3efa`](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fcommit\u002Ffdd3efa45a97198c7b69c8578885ca29af803680) 感谢 [@whoiskatrin](https:\u002F\u002Fgithub.com\u002Fwhoiskatrin)! - 为那些会断开连接并在稍后重新连接，但仍需知道期间文件是否发生更改的应用程序添加了 `checkChanges()` 方法。\n\n    在后续调用中使用返回的 `version` 来判断指定路径是未更改、已更改，还是需要进行完整同步。保留的更改状态仅在当前容器的生命周期内有效。","2026-04-01T13:53:01",{"id":215,"version":216,"summary_zh":217,"released_at":218},315120,"@cloudflare\u002Fsandbox@0.8.2","### 补丁变更\n\n-   [#544](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fpull\u002F544) [`9a2f553`](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fcommit\u002F9a2f553b06cf15a38e629de49d0d7b1d0bec10b7) 感谢 [@whoiskatrin](https:\u002F\u002Fgithub.com\u002Fwhoiskatrin)! - 要求使用 `@cloudflare\u002Fcontainers` 0.2.2 或更高版本，以便在工作仍在进行时，长时间运行的流式命令能够在 `sleepAfter` 时间过后继续保持活跃状态。\n","2026-04-01T12:41:29",{"id":220,"version":221,"summary_zh":222,"released_at":223},315121,"@cloudflare\u002Fsandbox@0.8.1","### Patch Changes\n\n-   [#487](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fpull\u002F487) [`19076fb`](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fcommit\u002F19076fb6c80d2981c2f2e40dcda0911247e81543) Thanks [@scuffi](https:\u002F\u002Fgithub.com\u002Fscuffi)! - Process termination now walks the command's process tree so killing a process also terminates child processes started by that command\n","2026-03-30T17:03:19",{"id":225,"version":226,"summary_zh":227,"released_at":228},315122,"@cloudflare\u002Fsandbox@0.8.0","### Minor Changes\r\n\r\n-   [#519](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fpull\u002F519) [`4103149`](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fcommit\u002F41031498a412f2bff125254d8d5b904a508b3847) Thanks [@scuffi](https:\u002F\u002Fgithub.com\u002Fscuffi)! - Add outbound HTTP interception for sandboxes. Define `outbound` or `outboundByHost` handlers on your Sandbox class to intercept, modify, or block HTTP requests made from within the sandbox - with full access to Workers bindings like KV and R2. `ContainerProxy` is also exported directly from `@cloudflare\u002Fsandbox`. Bumps `@cloudflare\u002Fcontainers` dependency to 0.2.0+.","2026-03-26T14:13:02",{"id":230,"version":231,"summary_zh":232,"released_at":233},315123,"@cloudflare\u002Fsandbox@0.7.21","### Patch Changes\n\n-   [#523](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fpull\u002F523) [`e3fd7a6`](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fcommit\u002Fe3fd7a69a16bc50c36b80fda44301f326a160b91) Thanks [@dependabot](https:\u002F\u002Fgithub.com\u002Fapps\u002Fdependabot)! - Bump picomatch\n\n-   [#456](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fpull\u002F456) [`734f16d`](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fcommit\u002F734f16d2b1787f5af6798858842d04d3f8dc1c5e) Thanks [@whoiskatrin](https:\u002F\u002Fgithub.com\u002Fwhoiskatrin)! - Structured logging for Workers Observability and Containers Logs. All operations emit queryable fields (`event`, `outcome`, `durationMs`, `command`, `exitCode`, `sessionId`) that can be filtered and aggregated in the dashboard. Presigned R2 URL parameters and embedded git URL credentials are redacted from all log fields. Set `SANDBOX_LOG_FORMAT=pretty` for readable local dev output.\n","2026-03-26T13:33:26",{"id":235,"version":236,"summary_zh":237,"released_at":238},315124,"@cloudflare\u002Fsandbox@0.7.20","### Patch Changes\n\n-   [#500](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fpull\u002F500) [`fcfb350`](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fcommit\u002Ffcfb35021860927548cd7209f6fc7bea38c53e04) Thanks [@aron-cf](https:\u002F\u002Fgithub.com\u002Faron-cf)! - Bump wrangler to 4.76.0\n\n-   [#486](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fpull\u002F486) [`db66675`](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fcommit\u002Fdb66675d437de051384fc6802c30d0785decfaec) Thanks [@berry1001](https:\u002F\u002Fgithub.com\u002Fberry1001)! - Fix supervisor-mode sandbox shutdown so inactivity `SIGTERM` cleanly exits the `\u002Fsandbox` process even when the user CMD has already exited or daemonized work in the background.\n","2026-03-24T10:45:56",{"id":240,"version":241,"summary_zh":242,"released_at":243},315125,"@cloudflare\u002Fsandbox@0.7.19","### Patch Changes\n\n-   [#503](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fpull\u002F503) [`05caafc`](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fcommit\u002F05caafc1a746bc98e293776836bb9ae1fdd2f332) Thanks [@scuffi](https:\u002F\u002Fgithub.com\u002Fscuffi)! - Add automatic detection of S3 credentials when mounting buckets. Now we do not need to explicitly declare credentials when mounting buckets if they are set as environment variables in the Durable Object.\n\n-   [`1c3b75b`](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fcommit\u002F1c3b75b00b3514fbd54ffca7735da5ca3899c6fc) Thanks [@ghostwriternr](https:\u002F\u002Fgithub.com\u002Fghostwriternr)! - Fix `sleepAfter` configuration silently reverting to the default after the sandbox restarts. The configured sleep timeout is now retained reliably across the sandbox lifecycle.\n\n-   [#507](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fpull\u002F507) [`5e55a38`](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fcommit\u002F5e55a38280f96a84b145d8c4074eb71b4d3f15ff) Thanks [@whoiskatrin](https:\u002F\u002Fgithub.com\u002Fwhoiskatrin)! - Reduce waitIntervalMS default to 300ms\n","2026-03-23T12:30:45",{"id":245,"version":246,"summary_zh":247,"released_at":248},315126,"@cloudflare\u002Fsandbox@0.7.18","### Patch Changes\n\n-   [#363](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fpull\u002F363) [`60967cd`](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fcommit\u002F60967cd15e82929efbbacee00cdfb80d457b3b10) Thanks [@Destreyf](https:\u002F\u002Fgithub.com\u002FDestreyf)! - Add custom environment variable support to OpenCode integration.\n    Enable with `env` in `OpencodeOptions` to pass variables like OTEL endpoints or trace context.\n\n-   [#489](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fpull\u002F489) [`80da532`](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fcommit\u002F80da5321e9154d58ed24db0bb1aa822ed0b70c84) Thanks [@maschwenk](https:\u002F\u002Fgithub.com\u002Fmaschwenk)! - Fix environment variables not being inherited by PTY sessions opened via `sandbox.terminal`. Variables set with `setEnvVars()` were not being passed to the terminal environment.\n\n-   [#468](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fpull\u002F468) [`378a85c`](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fcommit\u002F378a85c2815755d22ea398a12cf787d0d3c2f72d) Thanks [@scuffi](https:\u002F\u002Fgithub.com\u002Fscuffi)! - Add local R2 bucket mounting for development via bidirectional sync\n","2026-03-16T16:20:32",{"id":250,"version":251,"summary_zh":252,"released_at":253},315127,"@cloudflare\u002Fsandbox@0.7.17","### Patch Changes\n\n-   [#474](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fpull\u002F474) [`5b0ce89`](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fcommit\u002F5b0ce89eedb63d9920eaf82046a12e3837e1b660) Thanks [@whoiskatrin](https:\u002F\u002Fgithub.com\u002Fwhoiskatrin)! - Add `gitignore` and `excludes` options to `createBackup()`.\n    -   `gitignore: true` excludes gitignored files when the directory is inside a git repo.\n        If git is not installed, a warning is logged and the backup proceeds without git-based exclusions.\n    -   `excludes: string[]` allows explicit glob patterns to exclude from the backup.\n    -   Both default to off\u002Fempty — existing behavior is unchanged.\n","2026-03-10T18:44:17",{"id":255,"version":256,"summary_zh":257,"released_at":258},315128,"@cloudflare\u002Fsandbox@0.7.16","### Patch Changes\n\n-   [#470](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fpull\u002F470) [`887b032`](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fcommit\u002F887b0321990a3e23f8060229ecc06210affb3f1c) Thanks [@maschwenk](https:\u002F\u002Fgithub.com\u002Fmaschwenk)! - Pass session env vars and working directory to PTY on creation\n","2026-03-10T16:33:17",{"id":260,"version":261,"summary_zh":262,"released_at":263},315129,"@cloudflare\u002Fsandbox@0.7.15","### Patch Changes\n\n-   [#400](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fpull\u002F400) [`92e1fda`](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fcommit\u002F92e1fdabb5313b9c23a755cebb9f8807954ca346) Thanks [@whoiskatrin](https:\u002F\u002Fgithub.com\u002Fwhoiskatrin)! - Improve idle timeout handling for long-running streams over WebSocket transport.\n\n    Streams now remain open as long as data is flowing, timing out only after 5 minutes of inactivity.\n\n-   [#450](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fpull\u002F450) [`75dc1f9`](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fcommit\u002F75dc1f9ae127479de782934d307c1acdbd2591d2) Thanks [@scuffi](https:\u002F\u002Fgithub.com\u002Fscuffi)! - Support per-command and per-session timeouts for exec\n\n    Timeouts now propagate correctly through the full stack. Per-command `timeout` on `exec()` takes priority over session-level `commandTimeoutMs` set via `createSession()`, which takes priority over the container-level `COMMAND_TIMEOUT_MS` environment variable.\n","2026-03-10T11:07:42",{"id":265,"version":266,"summary_zh":267,"released_at":268},315130,"@cloudflare\u002Fsandbox@0.7.14","### Patch Changes\n\n-   [#476](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fpull\u002F476) [`440eb1f`](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fcommit\u002F440eb1fa929b8e57d69c055f256f9b9c40f2d36e) Thanks [@berry1001](https:\u002F\u002Fgithub.com\u002Fberry1001)! - Fix sandboxes staying awake indefinitely after disabling `keepAlive`. Calling `setKeepAlive(false)` now correctly re-arms the `sleepAfter` timeout so the sandbox returns to its configured sleep lifecycle.\n\n-   [#469](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fpull\u002F469) [`856f4dd`](https:\u002F\u002Fgithub.com\u002Fcloudflare\u002Fsandbox-sdk\u002Fcommit\u002F856f4dd80c853fe857f4ecb88c3dc52a3e0bf110) Thanks [@maschwenk](https:\u002F\u002Fgithub.com\u002Fmaschwenk)! - Add `shell` option to `PtyOptions` to allow specifying which shell to spawn (e.g. `zsh`, `sh`, `fish`). Defaults to `bash` when not specified.\n","2026-03-09T15:39:14"]