diff --git a/frontend/src/api/option-service/option.types.ts b/frontend/src/api/option-service/option.types.ts index ae8bdbf1d1..e18071dc57 100644 --- a/frontend/src/api/option-service/option.types.ts +++ b/frontend/src/api/option-service/option.types.ts @@ -77,6 +77,9 @@ export interface WebClientFeatureFlags { /** When true, the personal ``Agent`` page is replaced by Agent Profiles * (``/settings/agents``). Off by default until bug bash. */ enable_agent_profiles_page?: boolean; + /** When true, org admins can add, edit and delete the organization's + * shared Agent Profiles on the Agent Profiles page. Off by default. */ + enable_org_agent_profiles?: boolean; } export interface ACPModelOption { diff --git a/frontend/src/components/features/settings/agent-profiles/agent-profile-form-state.ts b/frontend/src/components/features/settings/agent-profiles/agent-profile-form-state.ts index e94e6615d0..b67c6c8671 100644 --- a/frontend/src/components/features/settings/agent-profiles/agent-profile-form-state.ts +++ b/frontend/src/components/features/settings/agent-profiles/agent-profile-form-state.ts @@ -2,6 +2,7 @@ import type { AgentKind, AgentProfile, AgentProfileSaveInput, + AgentProfileScope, } from "#/api/agent-profiles-service/agent-profiles-service.api"; import type { ACPProviderConfig } from "#/api/option-service/option.types"; import type { SettingsFieldSchema, SettingsSchema } from "#/types/settings"; @@ -90,6 +91,12 @@ export interface AgentProfileFormDeps { /** The agent-settings schema; its condenser / verification sections are edited per profile. */ schema?: SettingsSchema | null; defaultLlmProfileRef: string; + /** + * The collection being edited. An org profile is shared configuration, so + * its save body never references a member's MCP servers and always names + * its secrets explicitly (OHE-3088). Defaults to ``personal``. + */ + profileScope?: AgentProfileScope; } export function newAgentProfileFormState( @@ -119,6 +126,14 @@ export function newAgentProfileFormState( }; } +/** The wire value of a picker: ``null`` (no restriction) or the chosen names. */ +function scopeRefs( + mode: ProfileScopeMode, + selected: string[], +): string[] | null { + return mode === "custom" ? selected : null; +} + /** A persona replaces the default prompt; a suffix extends it. */ function systemPromptModeFor( persona: string, @@ -245,9 +260,13 @@ export function buildAgentProfileSaveInput( deps: AgentProfileFormDeps, stored?: AgentProfile | null, ): AgentProfileSaveInput { - const mcpServerRefs = state.mcpMode === "custom" ? state.mcpSelected : null; - const secretRefs = - state.secretsMode === "custom" ? state.secretsSelected : null; + const isOrg = deps.profileScope === "org"; + const mcpServerRefs = isOrg + ? [] + : scopeRefs(state.mcpMode, state.mcpSelected); + const secretRefs = isOrg + ? state.secretsSelected + : scopeRefs(state.secretsMode, state.secretsSelected); if (state.agentKind === "acp") { const tokens = tokenizeCommand(state.acpCommandText); diff --git a/frontend/src/components/features/settings/agent-profiles/agent-profile-form.tsx b/frontend/src/components/features/settings/agent-profiles/agent-profile-form.tsx index 63e7757a12..2200c4cc2c 100644 --- a/frontend/src/components/features/settings/agent-profiles/agent-profile-form.tsx +++ b/frontend/src/components/features/settings/agent-profiles/agent-profile-form.tsx @@ -1,5 +1,8 @@ import { useTranslation } from "react-i18next"; -import type { AgentKind } from "#/api/agent-profiles-service/agent-profiles-service.api"; +import type { + AgentKind, + AgentProfileScope, +} from "#/api/agent-profiles-service/agent-profiles-service.api"; import type { ACPProviderConfig } from "#/api/option-service/option.types"; import type { LlmProfileSummary } from "#/api/settings-service/profiles-service.api"; import { AcpCredentialsSection } from "#/components/features/settings/acp-credentials-section"; @@ -68,6 +71,12 @@ interface AgentProfileFormProps { skillsLoadFailed?: boolean; /** Credentials for the selected ACP preset; saved as global secrets. */ credentialForm: AcpCredentialForm; + /** + * The collection being edited. An org profile is OpenHands-only, has no + * MCP servers and always names its secrets, so the agent-kind selector, the + * MCP section and the secrets mode switch are left out (OHE-3088). + */ + profileScope?: AgentProfileScope; } function toggleName(list: string[], name: string, checked: boolean): string[] { @@ -79,7 +88,8 @@ function toggleName(list: string[], name: string, checked: boolean): string[] { * The fields of one Agent Profile. Controlled: the owning view holds the * state and persists it. Mirrors the Agent Canvas profile editor for the * settings OHE supports (agent kind, LLM profile, tools, parallel tool calls, - * system prompt, MCP server and secret scopes, skills, ACP launch). + * system prompt, MCP server and secret scopes, skills, ACP launch), narrowed + * to organization-scoped settings for an org profile. */ export function AgentProfileForm({ state, @@ -98,9 +108,11 @@ export function AgentProfileForm({ skills, skillsLoadFailed = false, credentialForm, + profileScope = "personal", }: AgentProfileFormProps) { const { t } = useTranslation(); const isAcp = state.agentKind === "acp"; + const isOrg = profileScope === "org"; const systemPromptMissing = isSystemPromptMissing(state); const toolsMissing = isToolSelectionMissing(state); @@ -142,19 +154,27 @@ export function AgentProfileForm({ ...danglingMcpRefs.map((name) => ({ name, description: null })), ]; const knownSecrets = new Set(secrets.map(({ name }) => name)); + // An org profile always names its secrets; a personal one only when narrowed. + const hasSecretList = isOrg || state.secretsMode === "custom"; const secretCatalog: ProfileScopeItem[] = [ ...secrets, - ...(state.secretsMode === "custom" + ...(hasSecretList ? state.secretsSelected .filter((name) => !knownSecrets.has(name)) .map((name) => ({ name, description: null })) : []), ]; + let secretsHintKey = I18nKey.SETTINGS$AGENT_PROFILE_SECRETS_ALL_HINT; + if (isOrg) { + secretsHintKey = I18nKey.SETTINGS$AGENT_PROFILE_ORG_SECRETS_HINT; + } else if (state.secretsMode === "custom") { + secretsHintKey = I18nKey.SETTINGS$AGENT_PROFILE_SECRETS_CHOOSE_HINT; + } return (
- {/* Agent type — only when the ACP feature flag is on */} - {isAcpEnabled && ( + {/* Agent type — only when the ACP feature flag is on; org profiles are OpenHands-only */} + {isAcpEnabled && !isOrg && (
)} - {/* MCP servers (both kinds): all configured, or an explicit subset */} -
- - {t(I18nKey.SETTINGS$AGENT_PROFILE_MCP)} - - { - if (!key) return; - const mcpMode = key as ProfileScopeMode; - const patch: Partial = { mcpMode }; - // Seed a first switch to "choose" with every configured server, - // so narrowing starts from what the agent had. - if (mcpMode === "custom" && state.mcpSelected.length === 0) { - patch.mcpSelected = mcpServers.map(({ name }) => name); - } - onChange(patch); - }} - /> - {mcpCatalog.length > 0 ? ( - name) - } - isDisabled={isDisabled || state.mcpMode === "standard"} - onToggle={(name, checked) => - onChange({ - mcpSelected: toggleName(state.mcpSelected, name, checked), - }) - } + {/* MCP servers (both kinds): all configured, or an explicit subset. + Not for org profiles: MCP servers are per member, so an org profile + launches with none. */} + {!isOrg && ( +
+ + {t(I18nKey.SETTINGS$AGENT_PROFILE_MCP)} + + { + if (!key) return; + const mcpMode = key as ProfileScopeMode; + const patch: Partial = { mcpMode }; + // Seed a first switch to "choose" with every configured server, + // so narrowing starts from what the agent had. + if (mcpMode === "custom" && state.mcpSelected.length === 0) { + patch.mcpSelected = mcpServers.map(({ name }) => name); + } + onChange(patch); + }} /> - ) : ( + {mcpCatalog.length > 0 ? ( + name) + } + isDisabled={isDisabled || state.mcpMode === "standard"} + onToggle={(name, checked) => + onChange({ + mcpSelected: toggleName(state.mcpSelected, name, checked), + }) + } + /> + ) : ( + + {t(I18nKey.SETTINGS$AGENT_PROFILE_MCP_NONE)} + + )} + {danglingMcpRefs.length > 0 ? ( + + {t(I18nKey.SETTINGS$AGENT_PROFILE_MCP_DANGLING, { + names: danglingMcpRefs.join(", "), + })} + + ) : null} - {t(I18nKey.SETTINGS$AGENT_PROFILE_MCP_NONE)} - - )} - {danglingMcpRefs.length > 0 ? ( - - {t(I18nKey.SETTINGS$AGENT_PROFILE_MCP_DANGLING, { - names: danglingMcpRefs.join(", "), - })} + {t( + state.mcpMode === "custom" + ? I18nKey.SETTINGS$AGENT_PROFILE_MCP_CHOOSE_HINT + : I18nKey.SETTINGS$AGENT_PROFILE_MCP_ALL_HINT, + )} - ) : null} - - {t( - state.mcpMode === "custom" - ? I18nKey.SETTINGS$AGENT_PROFILE_MCP_CHOOSE_HINT - : I18nKey.SETTINGS$AGENT_PROFILE_MCP_ALL_HINT, - )} - -
+
+ )} {/* OpenHands: condenser and verification, from the agent-settings schema */} {!isAcp && @@ -689,53 +713,56 @@ export function AgentProfileForm({ ); })} - {/* Secrets (both kinds): no restriction, or an explicit subset */} + {/* Secrets (both kinds): no restriction, or an explicit subset. + An org profile always lists the org-shared secrets it may use. */}
{t(I18nKey.SETTINGS$AGENT_PROFILE_SECRETS)} - { - if (!key) return; - const secretsMode = key as ProfileScopeMode; - const patch: Partial = { secretsMode }; - // An external agent needs its provider credentials to sign in: - // pre-select them when narrowing the scope for an ACP profile. - if (secretsMode === "custom" && isAcp) { - const providerSecrets = credentialForm.fields.map( - ({ name }) => name, - ); - patch.secretsSelected = [ - ...new Set([...state.secretsSelected, ...providerSecrets]), - ]; - } - onChange(patch); - }} - /> + {!isOrg ? ( + { + if (!key) return; + const secretsMode = key as ProfileScopeMode; + const patch: Partial = { secretsMode }; + // An external agent needs its provider credentials to sign in: + // pre-select them when narrowing the scope for an ACP profile. + if (secretsMode === "custom" && isAcp) { + const providerSecrets = credentialForm.fields.map( + ({ name }) => name, + ); + patch.secretsSelected = [ + ...new Set([...state.secretsSelected, ...providerSecrets]), + ]; + } + onChange(patch); + }} + /> + ) : null} {secretCatalog.length > 0 ? ( name) } - isDisabled={isDisabled || state.secretsMode === "standard"} + isDisabled={isDisabled || !hasSecretList} onToggle={(name, checked) => onChange({ secretsSelected: toggleName( @@ -748,15 +775,15 @@ export function AgentProfileForm({ /> ) : ( - {t(I18nKey.SETTINGS$AGENT_PROFILE_SECRETS_NONE)} + {t( + isOrg + ? I18nKey.SETTINGS$AGENT_PROFILE_ORG_SECRETS_NONE + : I18nKey.SETTINGS$AGENT_PROFILE_SECRETS_NONE, + )} )} - {t( - state.secretsMode === "custom" - ? I18nKey.SETTINGS$AGENT_PROFILE_SECRETS_CHOOSE_HINT - : I18nKey.SETTINGS$AGENT_PROFILE_SECRETS_ALL_HINT, - )} + {t(secretsHintKey)}
@@ -805,7 +832,11 @@ export function AgentProfileForm({ )} - {t(I18nKey.SETTINGS$AGENT_PROFILE_SKILLS_HINT)} + {t( + isOrg + ? I18nKey.SETTINGS$AGENT_PROFILE_ORG_SKILLS_HINT + : I18nKey.SETTINGS$AGENT_PROFILE_SKILLS_HINT, + )}
)} diff --git a/frontend/src/components/features/settings/agent-profiles/agent-profile-row.tsx b/frontend/src/components/features/settings/agent-profiles/agent-profile-row.tsx index 7a4bb42996..de3019d6c0 100644 --- a/frontend/src/components/features/settings/agent-profiles/agent-profile-row.tsx +++ b/frontend/src/components/features/settings/agent-profiles/agent-profile-row.tsx @@ -18,6 +18,8 @@ interface AgentProfileRowProps { onEdit: (profile: AgentProfileSummary) => void; onDelete: (profile: AgentProfileSummary) => void; isActivating: boolean; + /** True when the viewer may edit and delete the organization's profiles. */ + canManageOrg?: boolean; } export function AgentProfileRow({ @@ -27,15 +29,19 @@ export function AgentProfileRow({ onEdit, onDelete, isActivating, + canManageOrg = false, }: AgentProfileRowProps) { const { t } = useTranslation(); const [menuOpen, setMenuOpen] = useState(false); const triggerRef = useRef(null); - // Only the member's own profiles are editable here; the org's shared ones - // (listed in their own section) are managed by admins and can just be set - // as this member's default. - const canManage = profile.scope === "personal"; + // The member's own profiles are always editable here. The org's shared ones + // (listed in their own section) are managed by admins; other members can + // just set one as their default. A legacy ACP org profile can only be + // deleted: the org editor supports the OpenHands agent alone. + const isOrgProfile = profile.scope !== "personal"; + const canDelete = !isOrgProfile || canManageOrg; + const canEdit = canDelete && !(isOrgProfile && profile.agent_kind === "acp"); // Secondary label: the referenced LLM profile (OpenHands) or the ACP kind. const secondary = profile.agent_kind === "openhands" @@ -90,9 +96,9 @@ export function AgentProfileRow({ {menuOpen && ( onEdit(profile) : undefined} + onEdit={canEdit ? () => onEdit(profile) : undefined} onSetActive={() => onActivate(profile)} - onDelete={canManage ? () => onDelete(profile) : undefined} + onDelete={canDelete ? () => onDelete(profile) : undefined} isActive={isActive} isActivating={isActivating} onClose={() => setMenuOpen(false)} diff --git a/frontend/src/components/features/settings/agent-profiles/agent-profiles-body.tsx b/frontend/src/components/features/settings/agent-profiles/agent-profiles-body.tsx index add48a5c98..68cb0257d1 100644 --- a/frontend/src/components/features/settings/agent-profiles/agent-profiles-body.tsx +++ b/frontend/src/components/features/settings/agent-profiles/agent-profiles-body.tsx @@ -19,6 +19,8 @@ interface AgentProfilesBodyProps { onEdit: (profile: AgentProfileSummary) => void; onDelete: (profile: AgentProfileSummary) => void; isActivating: boolean; + /** True when the viewer may edit and delete the organization's profiles. */ + canManageOrg?: boolean; } export function AgentProfilesBody({ @@ -30,6 +32,7 @@ export function AgentProfilesBody({ onEdit, onDelete, isActivating, + canManageOrg = false, }: AgentProfilesBodyProps) { const { t } = useTranslation(); @@ -73,6 +76,7 @@ export function AgentProfilesBody({ onEdit={onEdit} onDelete={onDelete} isActivating={isActivating} + canManageOrg={canManageOrg} /> ))} diff --git a/frontend/src/components/features/settings/agent-profiles/agent-profiles-manager.tsx b/frontend/src/components/features/settings/agent-profiles/agent-profiles-manager.tsx index 046c1a84a3..72b1e28455 100644 --- a/frontend/src/components/features/settings/agent-profiles/agent-profiles-manager.tsx +++ b/frontend/src/components/features/settings/agent-profiles/agent-profiles-manager.tsx @@ -1,6 +1,9 @@ import { useState } from "react"; import { useTranslation } from "react-i18next"; -import { AgentProfileSummary } from "#/api/agent-profiles-service/agent-profiles-service.api"; +import { + AgentProfileScope, + AgentProfileSummary, +} from "#/api/agent-profiles-service/agent-profiles-service.api"; import { BrandButton } from "#/components/features/settings/brand-button"; import { useActivateAgentProfile } from "#/hooks/mutation/use-activate-agent-profile"; import { useAgentProfiles } from "#/hooks/query/use-agent-profiles"; @@ -11,23 +14,29 @@ import { AgentProfilesBody } from "./agent-profiles-body"; import { DeleteAgentProfileModal } from "./delete-agent-profile-modal"; interface AgentProfilesManagerProps { - onAddProfile: () => void; + onAddProfile: (scope: AgentProfileScope) => void; onEditProfile: (profile: AgentProfileSummary) => void; /** True until the editor's inputs (settings, schema) have loaded. */ isAddDisabled?: boolean; + /** True until the org editor's inputs (the org's shared secrets too) have loaded. */ + isAddOrgDisabled?: boolean; + /** True when the viewer may add, edit and delete the organization's profiles. */ + canManageOrg?: boolean; } /** * The member's agent-profile library, laid out like the Secrets page: the * member's own profiles first, then the organization's shared ones in a - * section of their own (hidden when the org has none). Org profiles are - * read-only here -- a member can only set one as their default; managing - * them is OHE-3088. + * section of their own. For most members the org section is read-only (they + * can set one as their default) and hidden when the org has none; an admin + * with ``canManageOrg`` sees it always, with Add, Edit and Delete. */ export function AgentProfilesManager({ onAddProfile, onEditProfile, isAddDisabled = false, + isAddOrgDisabled = isAddDisabled, + canManageOrg = false, }: AgentProfilesManagerProps) { const { t } = useTranslation(); const { data, isLoading, error } = useAgentProfiles(); @@ -66,7 +75,7 @@ export function AgentProfilesManager({ type="button" variant="primary" className="ml-auto" - onClick={onAddProfile} + onClick={() => onAddProfile("personal")} isDisabled={isAddDisabled} > {t(I18nKey.SETTINGS$ADD_AGENT_PROFILE)} @@ -85,19 +94,37 @@ export function AgentProfilesManager({ /> - {!isLoading && !error && orgProfiles.length > 0 && ( + {!isLoading && !error && (orgProfiles.length > 0 || canManageOrg) && (
-
-

- {t(I18nKey.SETTINGS$ORG_AGENT_PROFILES_TITLE)} -

-

- {t(I18nKey.SETTINGS$ORG_AGENT_PROFILES_DESCRIPTION)} -

-
+
+
+

+ {t(I18nKey.SETTINGS$ORG_AGENT_PROFILES_TITLE)} +

+

+ {t( + canManageOrg + ? I18nKey.SETTINGS$ORG_AGENT_PROFILES_ADMIN_DESCRIPTION + : I18nKey.SETTINGS$ORG_AGENT_PROFILES_DESCRIPTION, + )} +

+
+ {canManageOrg ? ( + onAddProfile("org")} + isDisabled={isAddOrgDisabled} + > + {t(I18nKey.SETTINGS$ADD_ORG_AGENT_PROFILE)} + + ) : null} +
)} diff --git a/frontend/src/components/features/settings/agent-profiles/agent-profiles-view.tsx b/frontend/src/components/features/settings/agent-profiles/agent-profiles-view.tsx index b099aa1b9b..3df7cfaa60 100644 --- a/frontend/src/components/features/settings/agent-profiles/agent-profiles-view.tsx +++ b/frontend/src/components/features/settings/agent-profiles/agent-profiles-view.tsx @@ -6,6 +6,7 @@ import { useTranslation } from "react-i18next"; import AgentProfilesService, { AgentProfile, AgentProfileSaveInput, + AgentProfileScope, AgentProfileSummary, } from "#/api/agent-profiles-service/agent-profiles-service.api"; import type { ACPProviderConfig } from "#/api/option-service/option.types"; @@ -16,7 +17,9 @@ import { useSaveAgentProfile } from "#/hooks/mutation/use-save-agent-profile"; import { useAgentProfiles } from "#/hooks/query/use-agent-profiles"; import { useAgentSettingsSchema } from "#/hooks/query/use-agent-settings-schema"; import { useConfig } from "#/hooks/query/use-config"; -import { useSearchSecrets } from "#/hooks/query/use-get-secrets"; +import { useOrgSecrets, useSearchSecrets } from "#/hooks/query/use-get-secrets"; +import { useMe } from "#/hooks/query/use-me"; +import { usePermission } from "#/hooks/organizations/use-permissions"; import { useSkills } from "#/hooks/query/use-skills"; import { useToolCatalog } from "#/hooks/query/use-tool-catalog"; import SkillsService from "#/api/skills-service"; @@ -74,6 +77,27 @@ function configuredMcpServers(raw: unknown): ProfileScopeItem[] { return items; } +/** + * The org editor's view of a profile's scopes: no MCP servers, and an explicit + * secrets list -- every org-shared secret when the stored profile had no list + * (OHE-3088). The save body enforces the same shape. + */ +function withOrgScopes( + state: AgentProfileFormState, + stored: AgentProfile | null, + orgSecretNames: string[], +): AgentProfileFormState { + return { + ...state, + mcpMode: "custom", + mcpSelected: [], + secretsMode: "custom", + secretsSelected: Array.isArray(stored?.secret_refs) + ? state.secretsSelected + : orgSecretNames, + }; +} + /** Serialized save body, or ``null`` while the form holds an invalid value. */ function snapshotInput( state: AgentProfileFormState, @@ -88,10 +112,11 @@ function snapshotInput( } /** - * The personal Agent Profiles page: the member's profile library with an - * in-place create/edit editor, mirroring the Agent Canvas experience. Every - * write targets ``scope=personal``; the org's shared profiles are listed for - * activation only. + * The Agent Profiles page: the member's profile library with an in-place + * create/edit editor, mirroring the Agent Canvas experience. Writes carry the + * scope of the collection being edited: a member's own profiles, or -- for an + * org admin with the org-profiles flag on -- the organization's shared ones, + * which the editor narrows to organization-scoped settings (OHE-3088). */ export function AgentProfilesView() { const { t } = useTranslation(); @@ -104,6 +129,9 @@ export function AgentProfilesView() { const { data: llmProfilesData } = useLlmProfiles(); // Same query as the ACP credential form, so the list is fetched once. const secretsQuery = useSearchSecrets(); + const orgSecrets = useOrgSecrets(); + const { data: me } = useMe(); + const { hasPermission } = usePermission(me?.role ?? "member"); const { data: skills, isError: skillsLoadFailed } = useSkills(); const saveProfile = useSaveAgentProfile(); const renameProfile = useRenameAgentProfile(); @@ -112,6 +140,9 @@ export function AgentProfilesView() { const isEditorReady = !!settings; const [viewMode, setViewMode] = useState("list"); + // The collection the open editor writes to. + const [editingScope, setEditingScope] = + useState("personal"); const [profileName, setProfileName] = useState(""); const [editingProfile, setEditingProfile] = useState( null, @@ -149,6 +180,16 @@ export function AgentProfilesView() { const acpProviders = config?.acp_providers ?? EMPTY_ACP_PROVIDERS; const isAcpEnabled = !!config?.feature_flags?.enable_acp; + // Org admins manage the organization's shared profiles here when the + // org-profiles flag is on; everyone else only sets one as their default. + const canManageOrg = + !!config?.feature_flags?.enable_org_agent_profiles && + hasPermission("manage_org_agent_profiles"); + const isOrgEditor = editingScope === "org"; + // The org editor seeds its secrets list from the org's shared secrets, so + // it also waits for that list to have loaded. + const isOrgEditorReady = + isEditorReady && !orgSecrets.isLoading && !orgSecrets.isError; const fields = useMemo( () => schema?.sections.flatMap((section) => section.fields), [schema], @@ -165,8 +206,15 @@ export function AgentProfilesView() { toolConcurrencyField, schema: schema ?? null, defaultLlmProfileRef, + profileScope: editingScope, }), - [acpProviders, toolConcurrencyField, schema, defaultLlmProfileRef], + [ + acpProviders, + toolConcurrencyField, + schema, + defaultLlmProfileRef, + editingScope, + ], ); const mcpConfigRaw = settings?.agent_settings?.mcp_config; const mcpServers = useMemo( @@ -184,6 +232,21 @@ export function AgentProfilesView() { })), [secretsQuery.data], ); + // An org profile may only reference the organization's shared secrets, + // listed under the raw names the org endpoints use. + const orgSecretItems = useMemo( + () => + orgSecrets.data.map((secret) => ({ + name: secret.name, + description: secret.description ?? null, + scope: "organization" as const, + })), + [orgSecrets.data], + ); + const orgSecretNames = useMemo( + () => orgSecretItems.map(({ name }) => name), + [orgSecretItems], + ); // Skills with the scope of the marketplace they come from, as the Skills // page derives it; organization-marketplace skills get the badge. @@ -194,9 +257,14 @@ export function AgentProfilesView() { // editor is open. const inheritedMarketplaces = settings?.inherited_marketplaces; const registeredMarketplaces = settings?.registered_marketplaces; + // An org profile loads organization and instance skills only, so its + // picker leaves out the member's own marketplaces and skills. const marketplaces = useMemo( - () => [...(inheritedMarketplaces ?? []), ...(registeredMarketplaces ?? [])], - [inheritedMarketplaces, registeredMarketplaces], + () => [ + ...(inheritedMarketplaces ?? []), + ...(isOrgEditor ? [] : (registeredMarketplaces ?? [])), + ], + [inheritedMarketplaces, registeredMarketplaces, isOrgEditor], ); const { data: marketplaceSkills, isError: isMarketplaceSkillsError } = useQuery({ @@ -233,7 +301,19 @@ export function AgentProfilesView() { const skillItems = useMemo(() => { const items: ProfileScopeItem[] = []; const seen = new Set(); - for (const skill of skills ?? []) { + // An org profile loads organization and instance skills only: the + // server's global skills and those of the inherited marketplaces, never + // the member's own. + const marketplaceSources = new Set( + marketplaces.map((mp) => `marketplace:${mp.name}`), + ); + const serverSkills = (skills ?? []).filter( + (skill) => + !isOrgEditor || + skill.source === "global" || + marketplaceSources.has(skill.source), + ); + for (const skill of serverSkills) { if (!seen.has(skill.name)) { seen.add(skill.name); items.push({ name: skill.name }); @@ -252,7 +332,7 @@ export function AgentProfilesView() { } } return items; - }, [skills, marketplaceSkills, marketplaces]); + }, [skills, marketplaceSkills, marketplaces, isOrgEditor]); // ACP credentials are global secrets keyed by the selected preset. const selectedPreset = @@ -282,32 +362,50 @@ export function AgentProfilesView() { // ── Navigation between list and editor ─────────────────────────────────── const handleBackToList = useCallback(() => { setViewMode("list"); + setEditingScope("personal"); setEditingProfile(null); setProfileName(""); setFormState(null); setInitialInput(null); }, []); - const handleAddProfile = useCallback(() => { - if (!isEditorReady) return; - setEditingProfile(null); - setProfileName(""); - setFormState(newAgentProfileFormState(deps)); - setInitialInput(null); - setViewMode("create"); - }, [deps, isEditorReady]); + const handleAddProfile = useCallback( + (scope: AgentProfileScope) => { + if (scope === "org" ? !isOrgEditorReady : !isEditorReady) return; + const scopedDeps = { ...deps, profileScope: scope }; + let state = newAgentProfileFormState(scopedDeps); + if (scope === "org") state = withOrgScopes(state, null, orgSecretNames); + setEditingScope(scope); + setEditingProfile(null); + setProfileName(""); + setFormState(state); + setInitialInput(null); + setViewMode("create"); + }, + [deps, isEditorReady, isOrgEditorReady, orgSecretNames], + ); const handleEditProfile = useCallback( async (summary: AgentProfileSummary) => { - if (!isEditorReady) return; + // A summary without a scope (an older backend) is an org profile. + const scope: AgentProfileScope = + summary.scope === "personal" ? "personal" : "org"; + if (scope === "org" ? !isOrgEditorReady : !isEditorReady) return; + const scopedDeps = { ...deps, profileScope: scope }; try { const detail = await AgentProfilesService.getProfile( summary.name, - "personal", + scope, ); const { profile } = detail; - const storedState = agentProfileFormStateFromProfile(profile, deps); + const storedState = agentProfileFormStateFromProfile( + profile, + scopedDeps, + ); let state = storedState; + if (scope === "org") { + state = withOrgScopes(state, profile, orgSecretNames); + } if (profile.agent_kind === "openhands") { // A profile can reference an LLM profile that has since been // deleted; fall back to the default so a dangling ref self-heals @@ -321,12 +419,21 @@ export function AgentProfilesView() { state = { ...state, llmProfileRef: defaultLlmProfileRef }; } } + setEditingScope(scope); setEditingProfile(profile); setProfileName(profile.name); setFormState(state); - // Dirty-tracking compares against what is stored, so a healed ref - // counts as a change the user can save. - setInitialInput(snapshotInput(storedState, deps, profile)); + // Dirty-tracking compares against the profile as stored (hence no + // org enforcement in these deps), so a healed ref, or the org + // editor's shape forced onto a legacy org profile, counts as a + // change the user can save. + setInitialInput( + snapshotInput( + storedState, + { ...scopedDeps, profileScope: undefined }, + profile, + ), + ); setViewMode("edit"); } catch (error) { const message = retrieveAxiosErrorMessage(error as AxiosError); @@ -336,9 +443,11 @@ export function AgentProfilesView() { [ deps, isEditorReady, + isOrgEditorReady, llmProfilesData, llmProfiles, defaultLlmProfileRef, + orgSecretNames, t, ], ); @@ -381,7 +490,7 @@ export function AgentProfilesView() { await renameProfile.mutateAsync({ name: originalName, newName: trimmedName, - scope: "personal", + scope: editingScope, }); // The rename is committed even if the save below fails: remember the // new name so a retry saves instead of renaming again. @@ -395,7 +504,7 @@ export function AgentProfilesView() { await saveProfile.mutateAsync({ name: trimmedName, profile, - scope: "personal", + scope: editingScope, }); displaySuccessToast( @@ -419,6 +528,8 @@ export function AgentProfilesView() { onAddProfile={handleAddProfile} onEditProfile={handleEditProfile} isAddDisabled={!isEditorReady} + isAddOrgDisabled={!isOrgEditorReady} + canManageOrg={canManageOrg} /> ); } @@ -430,6 +541,14 @@ export function AgentProfilesView() { snapshotInput(formState, deps, editingProfile) !== initialInput; const hasUnsavedChanges = viewMode === "create" || nameDirty || formDirty || credentialForm.isDirty; + // An org profile saved before the org editor existed still lets members + // use their own secrets and MCP servers; saving it here changes that. + const isLegacyOrgProfile = + isOrgEditor && + viewMode === "edit" && + !!editingProfile && + (!Array.isArray(editingProfile.mcp_server_refs) || + !Array.isArray(editingProfile.secret_refs)); return (
@@ -453,6 +572,22 @@ export function AgentProfilesView() { {t(I18nKey.SETTINGS$AGENT_PROFILE_SAVE_HINT)}

) : null} + {isOrgEditor ? ( +

+ {t(I18nKey.SETTINGS$ORG_AGENT_PROFILE_EDITOR_HINT)} +

+ ) : null} + {isLegacyOrgProfile ? ( +

+ {t(I18nKey.SETTINGS$ORG_AGENT_PROFILE_LEGACY_WARNING)} +

+ ) : null}
@@ -488,10 +623,11 @@ export function AgentProfilesView() { toolsLoading={isToolCatalogPending} toolsLoadFailed={isToolCatalogError} mcpServers={mcpServers} - secrets={secretItems} + secrets={isOrgEditor ? orgSecretItems : secretItems} skills={skillItems} skillsLoadFailed={skillsLoadFailed || isMarketplaceSkillsError} credentialForm={credentialForm} + profileScope={editingScope} />
diff --git a/frontend/src/i18n/declaration.ts b/frontend/src/i18n/declaration.ts index 11d98a4417..604821f2f8 100644 --- a/frontend/src/i18n/declaration.ts +++ b/frontend/src/i18n/declaration.ts @@ -2259,4 +2259,11 @@ export enum I18nKey { SETTINGS$AGENT_PROFILE_TOOLS_REQUIRED = "SETTINGS$AGENT_PROFILE_TOOLS_REQUIRED", SETTINGS$AGENT_PROFILE_TOOLS_LOAD_FAILED = "SETTINGS$AGENT_PROFILE_TOOLS_LOAD_FAILED", SETTINGS$AGENT_PROFILE_TOOLS_UNKNOWN = "SETTINGS$AGENT_PROFILE_TOOLS_UNKNOWN", + SETTINGS$ADD_ORG_AGENT_PROFILE = "SETTINGS$ADD_ORG_AGENT_PROFILE", + SETTINGS$ORG_AGENT_PROFILES_ADMIN_DESCRIPTION = "SETTINGS$ORG_AGENT_PROFILES_ADMIN_DESCRIPTION", + SETTINGS$ORG_AGENT_PROFILE_EDITOR_HINT = "SETTINGS$ORG_AGENT_PROFILE_EDITOR_HINT", + SETTINGS$ORG_AGENT_PROFILE_LEGACY_WARNING = "SETTINGS$ORG_AGENT_PROFILE_LEGACY_WARNING", + SETTINGS$AGENT_PROFILE_ORG_SECRETS_HINT = "SETTINGS$AGENT_PROFILE_ORG_SECRETS_HINT", + SETTINGS$AGENT_PROFILE_ORG_SECRETS_NONE = "SETTINGS$AGENT_PROFILE_ORG_SECRETS_NONE", + SETTINGS$AGENT_PROFILE_ORG_SKILLS_HINT = "SETTINGS$AGENT_PROFILE_ORG_SKILLS_HINT", } diff --git a/frontend/src/i18n/translation.json b/frontend/src/i18n/translation.json index 1887bb608a..a70e086f93 100644 --- a/frontend/src/i18n/translation.json +++ b/frontend/src/i18n/translation.json @@ -38401,5 +38401,124 @@ "de": "Nicht im Werkzeugkatalog dieses Servers: {{names}}", "uk": "Немає в каталозі інструментів цього сервера: {{names}}", "ca": "No són al catàleg d'eines d'aquest servidor: {{names}}" + }, + "SETTINGS$ADD_ORG_AGENT_PROFILE": { + "en": "Add organization profile", + "ja": "組織プロファイルを追加", + "zh-CN": "添加组织配置文件", + "zh-TW": "新增組織設定檔", + "ko-KR": "조직 프로필 추가", + "no": "Legg til organisasjonsprofil", + "it": "Aggiungi profilo dell'organizzazione", + "pt": "Adicionar perfil da organização", + "es": "Añadir perfil de la organización", + "ar": "إضافة ملف تعريف للمؤسسة", + "fr": "Ajouter un profil d'organisation", + "tr": "Kuruluş profili ekle", + "de": "Organisationsprofil hinzufügen", + "uk": "Додати профіль організації", + "ca": "Afegeix un perfil de l'organització" + }, + "SETTINGS$ORG_AGENT_PROFILES_ADMIN_DESCRIPTION": { + "en": "Shared with everyone in your organization. They run on organization settings only: organization-shared secrets, organization LLM profiles and organization or instance skills, with no MCP servers.", + "ja": "組織の全員と共有されます。組織の設定のみで動作します: 組織共有のシークレット、組織の LLM プロファイル、組織またはインスタンスのスキル。MCP サーバーは使用しません。", + "zh-CN": "与组织中的所有人共享。它们仅使用组织设置运行:组织共享的密钥、组织 LLM 配置文件以及组织或实例技能,不使用 MCP 服务器。", + "zh-TW": "與組織中的所有人共用。它們僅以組織設定執行:組織共用的密鑰、組織 LLM 設定檔以及組織或執行個體技能,不使用 MCP 伺服器。", + "ko-KR": "조직의 모든 구성원과 공유됩니다. 조직 설정만으로 실행됩니다: 조직 공유 시크릿, 조직 LLM 프로필, 조직 또는 인스턴스 스킬이며 MCP 서버는 사용하지 않습니다.", + "no": "Delt med alle i organisasjonen din. De kjører bare på organisasjonsinnstillinger: organisasjonsdelte hemmeligheter, organisasjonens LLM-profiler og organisasjons- eller instansferdigheter, uten MCP-servere.", + "it": "Condivisi con tutti nella tua organizzazione. Usano solo le impostazioni dell'organizzazione: segreti condivisi dall'organizzazione, profili LLM dell'organizzazione e skill dell'organizzazione o dell'istanza, senza server MCP.", + "pt": "Compartilhados com todos na sua organização. Eles usam apenas configurações da organização: segredos compartilhados pela organização, perfis de LLM da organização e habilidades da organização ou da instância, sem servidores MCP.", + "es": "Compartidos con todos en tu organización. Funcionan solo con la configuración de la organización: secretos compartidos por la organización, perfiles de LLM de la organización y habilidades de la organización o de la instancia, sin servidores MCP.", + "ar": "مشتركة مع الجميع في مؤسستك. تعمل بإعدادات المؤسسة فقط: الأسرار المشتركة للمؤسسة، وملفات تعريف LLM الخاصة بالمؤسسة، ومهارات المؤسسة أو المثيل، دون خوادم MCP.", + "fr": "Partagés avec tout le monde dans votre organisation. Ils s'exécutent uniquement avec les paramètres de l'organisation : secrets partagés de l'organisation, profils LLM de l'organisation et compétences de l'organisation ou de l'instance, sans serveurs MCP.", + "tr": "Kuruluşunuzdaki herkesle paylaşılır. Yalnızca kuruluş ayarlarıyla çalışırlar: kuruluşça paylaşılan gizli anahtarlar, kuruluş LLM profilleri ve kuruluş veya örnek yetenekleri; MCP sunucusu kullanmazlar.", + "de": "Mit allen in Ihrer Organisation geteilt. Sie laufen ausschließlich mit Organisationseinstellungen: organisationsweit geteilte Geheimnisse, LLM-Profile der Organisation und Fähigkeiten der Organisation oder Instanz, ohne MCP-Server.", + "uk": "Доступні всім у вашій організації. Вони працюють лише з налаштуваннями організації: спільні секрети організації, LLM-профілі організації та навички організації чи інстансу, без серверів MCP.", + "ca": "Compartits amb tothom de la vostra organització. Funcionen només amb la configuració de l'organització: secrets compartits de l'organització, perfils LLM de l'organització i habilitats de l'organització o de la instància, sense servidors MCP." + }, + "SETTINGS$ORG_AGENT_PROFILE_EDITOR_HINT": { + "en": "An organization profile uses organization settings only, never a member's personal ones: organization-shared secrets, organization LLM profiles, organization or instance skills, and no MCP servers. Any member can start conversations and automations with it.", + "ja": "組織プロファイルは組織の設定のみを使用し、メンバーの個人設定は使用しません: 組織共有のシークレット、組織の LLM プロファイル、組織またはインスタンスのスキル。MCP サーバーは使用しません。どのメンバーもこれで会話や自動化を開始できます。", + "zh-CN": "组织配置文件仅使用组织设置,绝不使用成员的个人设置:组织共享的密钥、组织 LLM 配置文件、组织或实例技能,且不使用 MCP 服务器。任何成员都可以用它启动对话和自动化。", + "zh-TW": "組織設定檔僅使用組織設定,絕不使用成員的個人設定:組織共用的密鑰、組織 LLM 設定檔、組織或執行個體技能,且不使用 MCP 伺服器。任何成員都可以用它啟動對話和自動化。", + "ko-KR": "조직 프로필은 구성원의 개인 설정이 아닌 조직 설정만 사용합니다: 조직 공유 시크릿, 조직 LLM 프로필, 조직 또는 인스턴스 스킬이며 MCP 서버는 사용하지 않습니다. 모든 구성원이 이 프로필로 대화와 자동화를 시작할 수 있습니다.", + "no": "En organisasjonsprofil bruker bare organisasjonsinnstillinger, aldri et medlems personlige: organisasjonsdelte hemmeligheter, organisasjonens LLM-profiler, organisasjons- eller instansferdigheter, og ingen MCP-servere. Alle medlemmer kan starte samtaler og automatiseringer med den.", + "it": "Un profilo dell'organizzazione usa solo le impostazioni dell'organizzazione, mai quelle personali di un membro: segreti condivisi dall'organizzazione, profili LLM dell'organizzazione, skill dell'organizzazione o dell'istanza e nessun server MCP. Qualsiasi membro può avviare conversazioni e automazioni con esso.", + "pt": "Um perfil da organização usa apenas configurações da organização, nunca as pessoais de um membro: segredos compartilhados pela organização, perfis de LLM da organização, habilidades da organização ou da instância e nenhum servidor MCP. Qualquer membro pode iniciar conversas e automações com ele.", + "es": "Un perfil de la organización usa solo la configuración de la organización, nunca la personal de un miembro: secretos compartidos por la organización, perfiles de LLM de la organización, habilidades de la organización o de la instancia y ningún servidor MCP. Cualquier miembro puede iniciar conversaciones y automatizaciones con él.", + "ar": "يستخدم ملف تعريف المؤسسة إعدادات المؤسسة فقط، وليس الإعدادات الشخصية لأي عضو: الأسرار المشتركة للمؤسسة، وملفات تعريف LLM الخاصة بالمؤسسة، ومهارات المؤسسة أو المثيل، دون خوادم MCP. يمكن لأي عضو بدء محادثات وأتمتة به.", + "fr": "Un profil d'organisation utilise uniquement les paramètres de l'organisation, jamais ceux d'un membre : secrets partagés de l'organisation, profils LLM de l'organisation, compétences de l'organisation ou de l'instance, et aucun serveur MCP. Tout membre peut démarrer des conversations et des automatisations avec lui.", + "tr": "Bir kuruluş profili yalnızca kuruluş ayarlarını kullanır, bir üyenin kişisel ayarlarını asla kullanmaz: kuruluşça paylaşılan gizli anahtarlar, kuruluş LLM profilleri, kuruluş veya örnek yetenekleri ve MCP sunucusu yok. Her üye bu profille konuşma ve otomasyon başlatabilir.", + "de": "Ein Organisationsprofil nutzt ausschließlich Organisationseinstellungen, nie die persönlichen eines Mitglieds: organisationsweit geteilte Geheimnisse, LLM-Profile der Organisation, Fähigkeiten der Organisation oder Instanz und keine MCP-Server. Jedes Mitglied kann damit Unterhaltungen und Automatisierungen starten.", + "uk": "Профіль організації використовує лише налаштування організації, ніколи особисті налаштування учасника: спільні секрети організації, LLM-профілі організації, навички організації чи інстансу та жодних серверів MCP. Будь-який учасник може запускати з ним розмови й автоматизації.", + "ca": "Un perfil de l'organització fa servir només la configuració de l'organització, mai la personal d'un membre: secrets compartits de l'organització, perfils LLM de l'organització, habilitats de l'organització o de la instància, i cap servidor MCP. Qualsevol membre pot iniciar-hi converses i automatitzacions." + }, + "SETTINGS$ORG_AGENT_PROFILE_LEGACY_WARNING": { + "en": "This profile still lets members use their own secrets and MCP servers. Saving it here makes it organization-only: members launching it get only the organization-shared secrets chosen below and no MCP servers.", + "ja": "このプロファイルでは、メンバーはまだ自分のシークレットと MCP サーバーを使用できます。ここで保存すると組織専用になります: これで起動するメンバーは、下で選択した組織共有のシークレットのみを受け取り、MCP サーバーは使用しません。", + "zh-CN": "此配置文件目前仍允许成员使用自己的密钥和 MCP 服务器。在此保存后将变为仅限组织:使用它启动的成员只会获得下方选择的组织共享密钥,且没有 MCP 服务器。", + "zh-TW": "此設定檔目前仍允許成員使用自己的密鑰和 MCP 伺服器。在此儲存後將變為僅限組織:使用它啟動的成員只會取得下方選擇的組織共用密鑰,且沒有 MCP 伺服器。", + "ko-KR": "이 프로필은 아직 구성원이 자신의 시크릿과 MCP 서버를 사용할 수 있게 합니다. 여기서 저장하면 조직 전용이 됩니다: 이 프로필로 시작하는 구성원은 아래에서 선택한 조직 공유 시크릿만 받고 MCP 서버는 사용하지 않습니다.", + "no": "Denne profilen lar fortsatt medlemmer bruke sine egne hemmeligheter og MCP-servere. Lagrer du den her, blir den kun for organisasjonen: medlemmer som starter den, får bare de organisasjonsdelte hemmelighetene valgt nedenfor og ingen MCP-servere.", + "it": "Questo profilo consente ancora ai membri di usare i propri segreti e server MCP. Salvandolo qui diventa solo dell'organizzazione: i membri che lo avviano ricevono solo i segreti condivisi dall'organizzazione scelti sotto e nessun server MCP.", + "pt": "Este perfil ainda permite que os membros usem seus próprios segredos e servidores MCP. Salvá-lo aqui o torna exclusivo da organização: os membros que o iniciarem receberão apenas os segredos compartilhados pela organização escolhidos abaixo e nenhum servidor MCP.", + "es": "Este perfil aún permite que los miembros usen sus propios secretos y servidores MCP. Guardarlo aquí lo convierte en exclusivo de la organización: los miembros que lo inicien recibirán solo los secretos compartidos por la organización elegidos abajo y ningún servidor MCP.", + "ar": "لا يزال هذا الملف يسمح للأعضاء باستخدام أسرارهم وخوادم MCP الخاصة بهم. حفظه هنا يجعله خاصًا بالمؤسسة فقط: يحصل الأعضاء الذين يشغّلونه على الأسرار المشتركة للمؤسسة المختارة أدناه فقط، دون خوادم MCP.", + "fr": "Ce profil permet encore aux membres d'utiliser leurs propres secrets et serveurs MCP. L'enregistrer ici le rend réservé à l'organisation : les membres qui le lancent n'obtiennent que les secrets partagés de l'organisation choisis ci-dessous et aucun serveur MCP.", + "tr": "Bu profil hâlâ üyelerin kendi gizli anahtarlarını ve MCP sunucularını kullanmasına izin veriyor. Burada kaydetmek onu yalnızca kuruluşa özel yapar: profili başlatan üyeler yalnızca aşağıda seçilen kuruluşça paylaşılan gizli anahtarları alır ve MCP sunucusu kullanmaz.", + "de": "Dieses Profil lässt Mitglieder noch ihre eigenen Geheimnisse und MCP-Server verwenden. Wird es hier gespeichert, gilt es nur noch für die Organisation: Mitglieder, die es starten, erhalten nur die unten gewählten organisationsweit geteilten Geheimnisse und keine MCP-Server.", + "uk": "Цей профіль досі дозволяє учасникам використовувати власні секрети та сервери MCP. Збереження тут робить його лише організаційним: учасники, які його запускають, отримують лише вибрані нижче спільні секрети організації та жодних серверів MCP.", + "ca": "Aquest perfil encara permet que els membres facin servir els seus propis secrets i servidors MCP. Desar-lo aquí el fa exclusiu de l'organització: els membres que l'iniciïn només rebran els secrets compartits de l'organització triats a sota i cap servidor MCP." + }, + "SETTINGS$AGENT_PROFILE_ORG_SECRETS_HINT": { + "en": "Organization-shared secrets this agent may use. Members' personal secrets are never passed to an organization profile.", + "ja": "このエージェントが使用できる組織共有のシークレット。メンバーの個人シークレットが組織プロファイルに渡されることはありません。", + "zh-CN": "此智能体可以使用的组织共享密钥。成员的个人密钥绝不会传递给组织配置文件。", + "zh-TW": "此代理程式可以使用的組織共用密鑰。成員的個人密鑰絕不會傳遞給組織設定檔。", + "ko-KR": "이 에이전트가 사용할 수 있는 조직 공유 시크릿입니다. 구성원의 개인 시크릿은 조직 프로필에 전달되지 않습니다.", + "no": "Organisasjonsdelte hemmeligheter denne agenten kan bruke. Medlemmers personlige hemmeligheter sendes aldri til en organisasjonsprofil.", + "it": "Segreti condivisi dall'organizzazione che questo agente può usare. I segreti personali dei membri non vengono mai passati a un profilo dell'organizzazione.", + "pt": "Segredos compartilhados pela organização que este agente pode usar. Os segredos pessoais dos membros nunca são passados a um perfil da organização.", + "es": "Secretos compartidos por la organización que este agente puede usar. Los secretos personales de los miembros nunca se pasan a un perfil de la organización.", + "ar": "الأسرار المشتركة للمؤسسة التي يمكن لهذا الوكيل استخدامها. لا تُمرَّر الأسرار الشخصية للأعضاء إلى ملف تعريف المؤسسة أبدًا.", + "fr": "Secrets partagés de l'organisation que cet agent peut utiliser. Les secrets personnels des membres ne sont jamais transmis à un profil d'organisation.", + "tr": "Bu ajanın kullanabileceği kuruluşça paylaşılan gizli anahtarlar. Üyelerin kişisel gizli anahtarları bir kuruluş profiline asla aktarılmaz.", + "de": "Organisationsweit geteilte Geheimnisse, die dieser Agent verwenden darf. Persönliche Geheimnisse von Mitgliedern werden nie an ein Organisationsprofil übergeben.", + "uk": "Спільні секрети організації, які може використовувати цей агент. Особисті секрети учасників ніколи не передаються профілю організації.", + "ca": "Secrets compartits de l'organització que aquest agent pot fer servir. Els secrets personals dels membres mai no es passen a un perfil de l'organització." + }, + "SETTINGS$AGENT_PROFILE_ORG_SECRETS_NONE": { + "en": "Your organization has no shared secrets yet.", + "ja": "組織にはまだ共有シークレットがありません。", + "zh-CN": "你的组织还没有共享密钥。", + "zh-TW": "你的組織還沒有共用密鑰。", + "ko-KR": "조직에 아직 공유 시크릿이 없습니다.", + "no": "Organisasjonen din har ingen delte hemmeligheter ennå.", + "it": "La tua organizzazione non ha ancora segreti condivisi.", + "pt": "Sua organização ainda não tem segredos compartilhados.", + "es": "Tu organización aún no tiene secretos compartidos.", + "ar": "لا توجد أسرار مشتركة في مؤسستك بعد.", + "fr": "Votre organisation n'a pas encore de secrets partagés.", + "tr": "Kuruluşunuzun henüz paylaşılan gizli anahtarı yok.", + "de": "Ihre Organisation hat noch keine geteilten Geheimnisse.", + "uk": "У вашій організації ще немає спільних секретів.", + "ca": "La vostra organització encara no té secrets compartits." + }, + "SETTINGS$AGENT_PROFILE_ORG_SKILLS_HINT": { + "en": "All organization and instance skills are on by default. Switch one off so this agent does not load it. Members' personal skills are not loaded by an organization profile.", + "ja": "組織とインスタンスのすべてのスキルはデフォルトでオンです。このエージェントに読み込ませたくないスキルはオフにしてください。組織プロファイルはメンバーの個人スキルを読み込みません。", + "zh-CN": "所有组织和实例技能默认开启。关闭某个技能以使此智能体不加载它。组织配置文件不会加载成员的个人技能。", + "zh-TW": "所有組織和執行個體技能預設開啟。關閉某個技能以使此代理程式不載入它。組織設定檔不會載入成員的個人技能。", + "ko-KR": "모든 조직 및 인스턴스 스킬은 기본적으로 켜져 있습니다. 이 에이전트가 로드하지 않도록 하려면 스킬을 끄세요. 조직 프로필은 구성원의 개인 스킬을 로드하지 않습니다.", + "no": "Alle organisasjons- og instansferdigheter er på som standard. Slå av en ferdighet for at denne agenten ikke skal laste den. Medlemmers personlige ferdigheter lastes ikke av en organisasjonsprofil.", + "it": "Tutte le skill dell'organizzazione e dell'istanza sono attive per impostazione predefinita. Disattivane una perché questo agente non la carichi. Le skill personali dei membri non vengono caricate da un profilo dell'organizzazione.", + "pt": "Todas as habilidades da organização e da instância ficam ativadas por padrão. Desative uma para que este agente não a carregue. As habilidades pessoais dos membros não são carregadas por um perfil da organização.", + "es": "Todas las habilidades de la organización y de la instancia están activadas de forma predeterminada. Desactiva una para que este agente no la cargue. Las habilidades personales de los miembros no se cargan con un perfil de la organización.", + "ar": "جميع مهارات المؤسسة والمثيل مفعّلة افتراضيًا. أوقف مهارة حتى لا يحمّلها هذا الوكيل. لا يحمّل ملف تعريف المؤسسة المهارات الشخصية للأعضاء.", + "fr": "Toutes les compétences de l'organisation et de l'instance sont activées par défaut. Désactivez-en une pour que cet agent ne la charge pas. Les compétences personnelles des membres ne sont pas chargées par un profil d'organisation.", + "tr": "Tüm kuruluş ve örnek yetenekleri varsayılan olarak açıktır. Bu ajanın bir yeteneği yüklememesi için onu kapatın. Üyelerin kişisel yetenekleri bir kuruluş profili tarafından yüklenmez.", + "de": "Alle Fähigkeiten der Organisation und Instanz sind standardmäßig aktiv. Schalten Sie eine aus, damit dieser Agent sie nicht lädt. Persönliche Fähigkeiten von Mitgliedern lädt ein Organisationsprofil nicht.", + "uk": "Усі навички організації та інстансу увімкнені за замовчуванням. Вимкніть навичку, щоб цей агент її не завантажував. Особисті навички учасників профіль організації не завантажує.", + "ca": "Totes les habilitats de l'organització i de la instància estan activades per defecte. Desactiveu-ne una perquè aquest agent no la carregui. Un perfil de l'organització no carrega les habilitats personals dels membres." } } diff --git a/frontend/src/utils/org/permissions.ts b/frontend/src/utils/org/permissions.ts index 7fbdfb6df3..49d9cea36b 100644 --- a/frontend/src/utils/org/permissions.ts +++ b/frontend/src/utils/org/permissions.ts @@ -11,6 +11,7 @@ type ViewBillingPermission = "view_billing"; type ManageSecretsPermission = "manage_secrets"; type ManageOrgSecretsPermission = "manage_org_secrets"; +type ManageOrgAgentProfilesPermission = "manage_org_agent_profiles"; type ManageMCPPermission = "manage_mcp"; type ManageIntegrationsPermission = "manage_integrations"; type ManageIntegrationProvidersPermission = "manage_integration_providers"; @@ -35,6 +36,7 @@ export type PermissionKey = | ViewBillingPermission | ManageSecretsPermission | ManageOrgSecretsPermission + | ManageOrgAgentProfilesPermission | ManageMCPPermission | ManageIntegrationsPermission | ManageIntegrationProvidersPermission @@ -77,6 +79,7 @@ const memberPerms: PermissionKey[] = [ const adminOnly: PermissionKey[] = [ "manage_org_secrets", + "manage_org_agent_profiles", "manage_integration_providers", "edit_llm_settings", "view_billing", diff --git a/openhands/app_server/web_client/default_web_client_config_injector.py b/openhands/app_server/web_client/default_web_client_config_injector.py index e290f2f1a8..43d949ee71 100644 --- a/openhands/app_server/web_client/default_web_client_config_injector.py +++ b/openhands/app_server/web_client/default_web_client_config_injector.py @@ -218,8 +218,8 @@ def _get_feature_flags() -> WebClientFeatureFlags: ENABLE_LINEAR, HIDE_USERS_PAGE, HIDE_BILLING_PAGE, HIDE_INTEGRATIONS_PAGE, HIDE_PERSONAL_WORKSPACES, OH_ENABLE_ONBOARDING, ENABLE_AGENT_CANVAS_BANNER, ENABLE_BYOR_EXPORT, ENABLE_SUPER_ADMIN, ENABLE_OAUTH_V2_LOGIN, - ENABLE_AGENT_CONTEXT_PAGE, and ENABLE_AGENT_PROFILES_PAGE from - environment. + ENABLE_AGENT_CONTEXT_PAGE, ENABLE_AGENT_PROFILES_PAGE, and + ENABLE_ORG_AGENT_PROFILES from environment. OH_ALLOW_USER_LLM_CONFIGURATION and ENABLE_ACP are the exceptions: they default to 'true' when unset. OH_ALLOW_USER_LLM_CONFIGURATION keeps the @@ -259,6 +259,7 @@ def _get_feature_flags() -> WebClientFeatureFlags: enable_litellm=_env_flag_enabled('ENABLE_LEGACY_LITELLM', 'true'), enable_agent_context_page=_env_flag_enabled('ENABLE_AGENT_CONTEXT_PAGE'), enable_agent_profiles_page=_env_flag_enabled('ENABLE_AGENT_PROFILES_PAGE'), + enable_org_agent_profiles=_env_flag_enabled('ENABLE_ORG_AGENT_PROFILES'), ) diff --git a/openhands/app_server/web_client/web_client_models.py b/openhands/app_server/web_client/web_client_models.py index eb1e2064f8..a457a31f80 100644 --- a/openhands/app_server/web_client/web_client_models.py +++ b/openhands/app_server/web_client/web_client_models.py @@ -82,6 +82,11 @@ class WebClientFeatureFlags(BaseModel): # UI-level only -- the agent-profiles API is not gated. enable_agent_context_page: bool = False enable_agent_profiles_page: bool = False + # ``enable_org_agent_profiles`` lets org admins add, edit and delete the + # organization's shared Agent Profiles on that page (OHE-3088). Set from + # ENABLE_ORG_AGENT_PROFILES. UI-level only -- the ``scope=org`` API and + # its org-scope constraints are not gated. + enable_org_agent_profiles: bool = False # This can be removed / replaced when a DeploymentMode (or similar) env var is created. @model_validator(mode='after')