feat(agent): ensure clean container and isolate workspace artifacts strictly to host volume

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
WeiCHEN
2026-09-13 02:50:18 +00:00
committed by weichen
co-authored by Cursor
parent 3ffcab4502
commit 4c35888a4e
6 changed files with 94 additions and 16 deletions
+27 -3
View File
@@ -13,9 +13,13 @@ import (
func main() {
taskKey := flag.String("task", "intake", "任务标识 (intake, research, cdo_quote 等)")
backend := flag.String("backend", "stub", "智能体后端 (stub, pi-agent, cursor-cli)")
backend := flag.String("backend", "", "智能体后端 (留空则读取 .env 配置,可选: stub, pi-agent, cursor-cli)")
project := flag.String("project", "医疗器械研发演示项目", "项目名称")
customer := flag.String("customer", "北京水木东方", "客户名称")
device := flag.String("device", "医疗器械", "设备类型")
use := flag.String("use", "临床诊疗", "预期用途")
market := flag.String("market", "国内", "目标市场")
materials := flag.String("materials", "", "输入补充材料内容")
envPath := flag.String("env", ".env", "环境配置文件路径")
flag.Parse()
@@ -25,16 +29,32 @@ func main() {
os.Exit(1)
}
activeBackend := cfg.AgentBackend
if *backend != "" {
activeBackend = *backend
cfg.AgentBackend = *backend
}
var materialsList []bizdev.MaterialInput
if *materials != "" {
materialsList = []bizdev.MaterialInput{
{
Filename: "user_input.md",
Content: []byte(*materials),
},
}
}
svc := bizdev.NewService(cfg)
res, err := svc.ExecuteTask(context.Background(), bizdev.TaskRunRequest{
TaskKey: *taskKey,
ProjectName: *project,
CustomerName: *customer,
Backend: *backend,
DeviceType: *device,
IntendedUse: *use,
TargetMarket: *market,
Materials: materialsList,
Backend: activeBackend,
})
if err != nil {
fmt.Fprintf(os.Stderr, "任务执行失败: %v\n", err)
@@ -47,7 +67,11 @@ func main() {
fmt.Printf("=== 任务执行成功 [%s] ===\n", res.TaskKey)
fmt.Printf("耗时: %v\n", res.Duration)
fmt.Printf("工作区: %s\n", res.WorkDir)
fmt.Printf("宿主机受控工作区: %s\n", res.WorkDir)
fmt.Printf("交付文档产物: %s\n", filepath.Join(res.WorkDir, "output.md"))
if _, err := os.Stat(filepath.Join(res.WorkDir, "execution.log")); err == nil {
fmt.Printf("执行审计日志: %s\n", filepath.Join(res.WorkDir, "execution.log"))
}
fmt.Printf("使用的后端: %s\n", res.BackendUsed)
if len(res.Attachments) > 0 {
fmt.Printf("附加产物:\n")