feat(workspace): leader dual workspace with auto-copy to team on delegate

- Revert leader workspace override: leader keeps personal workspace as
  default, team workspace accessible via ToolTeamWorkspaceFromCtx
- Auto-copy: when leader creates team_tasks, scan subject+description
  for file paths → copy from personal to team workspace so members can
  access them
- Safety: Lstat (reject symlinks), 10MB size cap, .env excluded from
  allowed extensions, path traversal blocked
- Prompt hint: clarify members can only access team workspace files,
  referenced files are auto-copied
This commit is contained in:
viettranx committed 2026-03-31 12:10:55 +07:00
1 parent 8193d10fe9
commit 36b43ed7f1
5 files changed
+264 -3

No files matched your search

+2 -3
View File
@@ -167,9 +167,8 @@ func (l *Loop) injectContext(ctx context.Context, req *RunRequest) (contextSetup
slog.Warn("failed to create team workspace directory", "workspace", wsDir, "error", err)
}
ctx = tools.WithToolTeamWorkspace(ctx, wsDir)
if team.LeadAgentID == l.agentUUID {
ctx = tools.WithToolWorkspace(ctx, wsDir)
}
// Leader keeps personal workspace (set at line 110-132) as default.
// Team workspace accessible via ToolTeamWorkspaceFromCtx for delegation.
if req.TeamID == "" {
ctx = tools.WithToolTeamID(ctx, team.ID.String())
}