You've already forked agentic-coding-workflow
bugfix
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
// agent_home.go 实现 agent CLI 受管 home 目录的物化与重定向 env 注入。
|
||||
//
|
||||
// 每个 AgentKind 一个受管 home:<agent_homes_dir>/<agent_kind_id>/。spawn 前把
|
||||
// DB 中的配置文件解密落盘(全量覆写受管文件,不清空目录 —— agent 运行期写入的
|
||||
// 缓存 / 凭据得以保留),再按 client_type 注入配置目录重定向变量。受管 home 位于
|
||||
// DataDir 下,容器场景随持久卷存活。
|
||||
// 受管 home 按 user + agent-kind 维度隔离:<agent_homes_dir>/<user_id>/<agent_kind_id>/。
|
||||
// 早期实现仅按 agent-kind 维度(多个用户共享同一 home 与缓存凭据),沙箱化要求
|
||||
// per-USER home,故 home 路径以 user_id 为一级目录、agent_kind_id 为二级目录。
|
||||
// spawn 前把 DB 中的配置文件解密落盘(全量覆写受管文件,不清空目录 —— agent 运行期
|
||||
// 写入的缓存 / 凭据得以保留),再按 client_type 注入配置目录重定向变量。受管 home 位于
|
||||
// DataDir 下,容器场景随持久卷存活。旧的 per-kind 目录无害遗留,下次 spawn 用新路径。
|
||||
package acp
|
||||
|
||||
import (
|
||||
@@ -16,9 +18,10 @@ import (
|
||||
)
|
||||
|
||||
// materializeAgentHome 创建受管 home 并物化该 AgentKind 的全部配置文件。
|
||||
// home 按 user + agent-kind 隔离:<AgentHomesDir>/<user_id>/<kind_id>。
|
||||
// 返回 home 绝对路径。配置文件为空时仍创建目录(agent 需要可写 home)。
|
||||
func (s *Supervisor) materializeAgentHome(ctx context.Context, kind *AgentKind) (string, error) {
|
||||
home, err := filepath.Abs(filepath.Join(s.cfg.AgentHomesDir, kind.ID.String()))
|
||||
func (s *Supervisor) materializeAgentHome(ctx context.Context, sess *Session, kind *AgentKind) (string, error) {
|
||||
home, err := filepath.Abs(filepath.Join(s.cfg.AgentHomesDir, sess.UserID.String(), kind.ID.String()))
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("resolve agent home: %w", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user