feat(app): add composition root, stageflow, ContextUpdate, and SSE transport

Move construction and document OnOutbox out of server, give HTTP/CLI a shared task use case, and block already-cleared import/event arch rules.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
weichen
2026-09-15 05:40:15 +00:00
co-authored by Cursor
parent 652cea1605
commit 84c0841acb
26 changed files with 1140 additions and 247 deletions
+7 -3
View File
@@ -10,7 +10,7 @@ import (
"syscall"
"time"
"chat-agent-system/internal/bizdev"
"chat-agent-system/internal/app"
"chat-agent-system/internal/config"
"chat-agent-system/internal/server"
)
@@ -38,12 +38,16 @@ func main() {
cfg.AgentBackend = *backend
}
svc, err := bizdev.NewService(cfg)
rt, err := app.New(cfg)
if err != nil {
fmt.Fprintf(os.Stderr, "业务服务初始化失败: %v\n", err)
os.Exit(1)
}
srv := server.NewServer(cfg, svc)
if err := rt.Start(context.Background()); err != nil {
fmt.Fprintf(os.Stderr, "后台 worker 启动失败: %v\n", err)
os.Exit(1)
}
srv := server.NewFromRuntime(rt)
addr := fmt.Sprintf("%s:%d", cfg.HTTPHost, cfg.HTTPPort)
fmt.Println("==================================================================")