Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
5071a9d
docs: handoff lessons from feat/multi-infra for stateful-infra
May 19, 2026
1c93355
chore: move stateful handoff to .plans, ignore planning dir
May 19, 2026
c6c01e2
chore: gitignore local tooling dirs (.cursor, ccc, codegraph)
May 19, 2026
3b32f41
feat(stateful): stateful sandbox provider and coding preview path
May 21, 2026
33d288a
feat(stateful): expose TCB gateway per-port helpers and tool port scr…
May 21, 2026
5c6aa1f
feat(stateful): template warmup UX and clearer AGS sandbox errors
May 21, 2026
0da8dbf
chore: gitignore server sqlite at package root and format
May 21, 2026
8f96190
merge: origin/main into feature/stateful-infra
May 21, 2026
90a5e41
docs(stateful): align docs and init with AGS/TRW sandbox
May 21, 2026
cd610e1
feat(stateful): sandbox progress, public TCR default, and docs
May 21, 2026
20dedbd
merge(upstream): sync TencentCloudBase/main through a878ddb
May 21, 2026
b923df7
docs: record upstream hard fork and main sync through a878ddb
May 21, 2026
5952631
feat(web): logs pane terminal clear/copy controls
May 25, 2026
0699323
feat(stateful): AGS sandbox lifecycle, TRW alignment, and UI progress
May 25, 2026
6c44358
docs: align README/setup with stateful; add CloudRun deploy
May 25, 2026
93ae345
merge(upstream): sync origin/main through 4592517
May 25, 2026
95b1564
fix(web): file-browser setState for jotai partial update
May 25, 2026
1f88430
feat(server): stateful sandbox auth mode and docs alignment
May 25, 2026
72a238b
style(server): format sandbox-config after pre-commit hook
May 25, 2026
d530b8d
feat(stateful): dual sandbox/LLM status, delete-all, and sandbox TTL
May 26, 2026
b8859a9
fix(stateful): ttyd terminal via TRW preview proxy
May 26, 2026
d762a4a
fix(tasks): fast delete-all without blocking on sandbox archive
May 26, 2026
a1ac3f5
fix(web): shared Jotai store for task list and instant delete-all
May 26, 2026
182b7f0
refactor(env): split local vs cloud env files and streamline init
May 27, 2026
edd890b
fix(web): unblock Docker build and improve cloud ASK_USER_BASE_URL
May 27, 2026
c5cf2d4
docs(deploy): clarify local vs cloud paths and improve deploy UX
May 27, 2026
2289248
fix(server): use ESM-safe manager-node import for AGS sandbox API
May 27, 2026
87db2c8
fix(server): MCP policies, git archive env, and mcporter schema parse
May 27, 2026
8af240f
fix(server): stop forwarding browser Origin on preview WebSocket proxy
May 27, 2026
0d4e65b
merge: trial integrate origin/main into stateful-infra
May 27, 2026
6022c27
docs: record upstream merge trial at dc70b08
May 27, 2026
1e20ed4
docs: fix upstream sync status date to 2026-05-27
May 27, 2026
81dcf89
docs: upstream sync merged into feature/stateful-infra
May 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 58 additions & 55 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,50 +1,78 @@
# ============================================================
# .env.example - 环境变量模板
# 复制为 .env.local 后填入实际值,或直接运行 ./init.sh 自动生成
# ============================================================
# =============================================================================
# OpenVibeCoding — environment variable reference (DO NOT put secrets here)
# =============================================================================
#
# Generated artifacts (gitignored):
# .env.local — local dev only (`pnpm dev:server` --env-file=../../.env.local)
# .env.cloud — cloud deploy + runtime (`pnpm deploy:cloud` reads this file; API sync to service)
#
# Run `./init.sh` twice if needed: choose 1) .env.local OR 2) .env.cloud (one file per run).
#
# Monorepo note: frontend (Vite) and backend (Hono) share ONE Node env at runtime.
# - Local: server :3001, web :5174 proxies /api → no second secret file for web
# - Cloud: single container serves API + static build; only .env.cloud matters there
#
# Two encryption keys (both server-only, never VITE_*):
# JWE_SECRET — session cookies (base64, 32 random bytes)
# ENCRYPTION_KEY — MCP connector secrets at rest (hex, 64 chars)
# =============================================================================

# ==================== Session / encryption ====================

# ==================== Required ====================

# Session 加密密钥(init.sh 会自动生成)
JWE_SECRET=
ENCRYPTION_KEY=

# ==================== Local vs cloud server ====================
# | Variable | .env.local | .env.cloud |
# |-------------------|-------------------|-------------------|
# | PORT | 3001 | 80 |
# | NODE_ENV | development | production |
# | ASK_USER_BASE_URL | http://127.0.0.1:3001 | 公网根 URL;init 可占位,deploy:cloud 首次成功后写回 |

PORT=3001
NODE_ENV=development
ASK_USER_BASE_URL=http://127.0.0.1:3001

DATABASE_PATH=.data/app.db
DB_PROVIDER=cloudbase
DB_COLLECTION_PREFIX=vibe_agent_

MAX_SANDBOX_DURATION=300
WORKSPACE_ISOLATION=shared
SANDBOX_TTL_SECONDS=1800

# ==================== Auth ====================

# 认证方式:local / github / cloudbase(逗号分隔可多选)
NEXT_PUBLIC_AUTH_PROVIDERS=local
AUTH_GITHUB_MODE=direct

# ==================== CloudBase ====================
# ==================== CloudBase platform ====================

# 腾讯云 API 密钥(访问管理 → API 密钥管理)
TCB_SECRET_ID=
TCB_SECRET_KEY=
TCB_ENV_ID=
TCB_REGION=ap-shanghai
TCB_PROVISION_MODE=shared

# CloudBase 环境 ID
# TCB_ENV_ID=

# 区域,默认 ap-shanghai
# TCB_REGION=ap-shanghai
# ==================== CodeBuddy(Copilot 登录) ====================

# 用户环境模式:shared(默认)或 isolated
# TCB_PROVISION_MODE=shared
# CODEBUDDY_API_KEY=

# ==================== CodeBuddy Auth ====================
# ==================== CloudBase AI+(自定义模型列表 / 模型调用) ====================
# 与 CODEBUDDY_API_KEY 不同;init 在配置 models.json / opencode.json 前收集一次

# 方式一:API Key(推荐,个人用户可直接使用)
# 获取地址:https://copilot.tencent.com/profile/
# CODEBUDDY_API_KEY=
# CLOUDBASE_API_KEY=
# CODEBUDDY_USE_CUSTOM_MODELS=true
# CODEBUDDY_INTERNET_ENVIRONMENT=internal

# 方式二:OAuth(企业旗舰版)
# CODEBUDDY_CLIENT_ID=
# CODEBUDDY_CLIENT_SECRET=
# CODEBUDDY_OAUTH_ENDPOINT=https://copilot.tencent.com/oauth2/token

# ==================== Rate Limiting ====================
# ==================== Stateful sandbox ====================

MAX_MESSAGES_PER_DAY=50
MAX_SANDBOX_DURATION=300
TCB_API_KEY=
# ENABLE_AUTH_MODE=false
# TCB_ACCESS_TOKEN=
# STATEFUL_SANDBOX_IMAGE=

# ==================== OpenCode Runtime (Optional) ====================

Expand All @@ -56,50 +84,25 @@ MAX_SANDBOX_DURATION=300
# OPENCODE_BIN=/absolute/path/to/coding-agent-template/node_modules/.bin/opencode
# OPENCODE_BIN=

# ==================== Sandbox ====================

# 镜像类型:personal(默认)或 enterprise
# SANDBOX_IMAGE_TYPE=personal
# SANDBOX_IMAGE_URI=
# 企业版镜像需要 RegistryId,通常由 setup:tcr 自动写入
# SANDBOX_IMAGE_REGISTRY_ID=
# SANDBOX_IMAGE_PORT=9000

# 工作空间隔离模式:
# shared - 同一 envId 下所有 task 共享 SCF 容器实例,通过目录隔离工作区
# isolated - 每个 task 独立 SCF session,完全隔离文件系统(默认)
WORKSPACE_ISOLATION=isolated

# Vite 原生错误 overlay 开关(创建沙箱时注入,需要重建沙箱生效)
# 设为 false 可关闭预览中 Vite 自带的全屏错误遮罩,改由平台侧 banner 展示构建错误
# VITE_DEV_OVERLAY=false

# ==================== TCR ====================
# ==================== TCR (optional, setup-tcr.mjs) ====================

# TCR 容器镜像配置(由 pnpm setup:tcr 自动写入)
# TCR_EDITION=personal
# TCR_EDITION=personal | enterprise
# TCR_NAMESPACE=
# TCR_PASSWORD=
# TCR_IMAGE=

# TCR 企业版配置(仅 TCR_EDITION=enterprise 时需要)
# TCR_DOMAIN=example.tencentcloudcr.com
# TCR_REGION=ap-guangzhou
# TCR_DOCKER_USERNAME=
# TCR_TOKEN_ID=

# ==================== GitHub OAuth (Optional) ====================
# ==================== Optional ====================

# GITHUB_CLIENT_ID=
# GITHUB_CLIENT_SECRET=

# ==================== Git Archive (Optional) ====================

# 工作区 Git 归档配置
# GIT_ARCHIVE_REPO=
# GIT_ARCHIVE_USER=
# GIT_ARCHIVE_TOKEN=

# ==================== Proxy (Optional) ====================

# http_proxy=
15 changes: 14 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# env files
# env files — only root .env.example is committed; all secrets live in .env.local / .env.cloud
.env*
!.env.example

Expand Down Expand Up @@ -70,6 +70,9 @@ data/*.db-wal
packages/server/data/*.db
packages/server/data/*.db-shm
packages/server/data/*.db-wal
packages/server/*.db
packages/server/*.db-shm
packages/server/*.db-wal
packages/server/.data/*.db
packages/server/.data/*.db-shm
packages/server/.data/*.db-wal
Expand All @@ -90,6 +93,16 @@ CodeBuddy Code_decompiled
CodeBuddy Code_files
decompiled
decompiled-ui
.plans/
.cursor/

# CocoIndex Code (ccc)
.cocoindex_code/
/.cocoindex_code/

# CodeGraph
.codegraph/

# opencode project-level config (auto-generated tool overrides)
.opencode/tools/
.opencode/opencode.json
Expand Down
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
22
4 changes: 2 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ SSE poll 检测 isDone → 发 [DONE] → removeAgent()
- 沙箱 = SCF 容器(基于自定义 Docker 镜像)
- 工具重定向:CLI 的文件/命令工具通过 HTTP API 路由到沙箱
- MCP Proxy:CloudBase 工具通过 sandbox 内的 mcporter 发现和执行
- 隔离模式:`WORKSPACE_ISOLATION=isolated`(每 task 独立)/ `shared`(共享 session
- 沙箱实例模式:`WORKSPACE_ISOLATION=shared`(默认,每 env 一实例)/ `isolated`(每 task 一实例

### 数据库

Expand All @@ -151,7 +151,7 @@ releaseEnv() → 销毁 CAM + 环境资源
## 调试

- `AGENT_DEBUG_JSONL=1` — 开启完整消息日志(写入 `debug-jsonl/` 目录)
- `packages/server/.env` 中的 `NODE_ENV=development` — 开发模式详细错误
- `.env.local` 中的 `NODE_ENV=development` — 开发模式详细错误
- Agent Registry 日志前缀:`[Registry]`
- SSE Poll 日志前缀:`[SSE poll]`
- 沙箱日志前缀:`[sandbox]`
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ All notable changes to this project will be documented in this file.

### Added

- **沙箱 infra(Stateful + 沙箱业务镜像)**:`StatefulSandboxProvider` + `ensureStatefulTool` + 沙箱业务镜像 数据面;移除 SCF `scf-sandbox-manager` / `sandbox-mcp-proxy`;预览经 OpenVibeCoding → gateway → 沙箱业务镜像 `/preview/5173/`;终端 ttyd `/preview/7681/`;镜像更新后 `stateful-tool-warmup` 轮询

### Changed

- **沙箱子工作区 Scope API 已移除**(旧 SCF 多端口 5173–5199);工作区统一 `/home/user`

- **CodeBuddy 自定义模型支持**:`CODEBUDDY_USE_CUSTOM_MODELS=true` 时按 `.config/.codebuddy/models.json` 模板加载模型列表,前端 listModels / SDK modelId 校验都走自定义白名单;`false` 时保留 SYSTEM_MODELS 写死的官方列表
- **环境隔离粒度配置**(Issue #14):admin 可在 `/admin/settings` 切换 `shared` / `isolated` / `task` 三种 provision mode,DB 优先级高于 env 默认,配 source badge 与重置按钮
- **环境池(Environment Pool)**:预创建 CloudBase 环境 + CAM + Policy,task/isolated 模式获取环境从分钟级降到毫秒级
Expand Down
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ FROM node:22-slim AS build

WORKDIR /app

# git: install-skills.sh clones cloudbase-skills via npx
RUN apt-get update && apt-get install -y --no-install-recommends git ca-certificates \
&& rm -rf /var/lib/apt/lists/*

# Enable corepack for pnpm
RUN corepack enable && corepack prepare pnpm@latest --activate

Expand Down
Loading