feat: configurable workspace sharing with per-agent DM/group/user controls

Add workspace_sharing config in other_config JSONB to control per-user
workspace isolation. When enabled, users share the base workspace directory
instead of isolated subfolders — configurable separately for DMs and groups,
with a per-user allowlist override.

Backend: WorkspaceSharingConfig struct, ParseWorkspaceSharing(), conditional
isolation in loop.go/loop_history.go, 7 unit tests.
Frontend: prominent always-visible config section with contact search
combobox, sticky save bar layout fix, i18n (en/vi/zh).
This commit is contained in:
viettranx committed 2026-03-12 10:54:17 +07:00
1 parent a75e977dca
commit 25b24ebd50
15 files changed
+361 -7

No files matched your search

+21
View File
@@ -39,6 +39,27 @@ func (l *Loop) scanWebToolResult(toolName string, result *tools.Result) {
}
}
// shouldShareWorkspace checks if the given user should share the base workspace
// directory (skip per-user subfolder isolation) based on workspace_sharing config.
func (l *Loop) shouldShareWorkspace(userID, peerKind string) bool {
ws := l.workspaceSharing
if ws == nil {
return false
}
for _, u := range ws.SharedUsers {
if u == userID {
return true
}
}
switch peerKind {
case "direct":
return ws.SharedDM
case "group":
return ws.SharedGroup
}
return false
}
// InvalidateUserWorkspace clears the cached workspace for a user,
// forcing the next request to re-read from user_agent_profiles.
func (l *Loop) InvalidateUserWorkspace(userID string) {