Files
multica/packages/views/agents/components/agent-access-settings.tsx
Jiayuan Zhang 5541819f98 refactor(ui): unify collection page patterns (#5258)
* refactor(ui): unify collection page patterns

* refactor(agents): redesign agent detail workbench (#5263)

* refactor(agents): redesign agent detail workbench

* refactor(agents): refine capability and settings surfaces

* refactor(agents): rebuild general settings form

* refactor(agents): refine overview and settings

* refactor(agents): redesign custom args editor

* docs(ui): record consistency audit
2026-07-11 21:12:04 +08:00

51 lines
1.3 KiB
TypeScript

"use client";
import type { Agent, MemberWithUser } from "@multica/core/types";
import {
SettingsCard,
SettingsSection,
} from "../../settings/components/settings-layout";
import { useT } from "../../i18n";
import { AccessPicker } from "./inspector/access-picker";
export function AgentAccessSettings({
agent,
members,
currentUserId,
onDirtyChange,
onUpdate,
}: {
agent: Agent;
members: MemberWithUser[];
currentUserId: string | null;
onDirtyChange?: (dirty: boolean) => void;
onUpdate: (id: string, data: Record<string, unknown>) => Promise<void>;
}) {
const { t } = useT("agents");
return (
<SettingsSection
title={t(($) => $.access.section_title)}
description={t(($) => $.inspector.section_access_hint)}
>
<SettingsCard>
<AccessPicker
permissionMode={agent.permission_mode}
invocationTargets={agent.invocation_targets}
visibility={agent.visibility}
members={members}
ownerId={agent.owner_id}
canEdit={
currentUserId !== null && agent.owner_id === currentUserId
}
hasComposioAllowlist={
(agent.composio_toolkit_allowlist ?? []).length > 0
}
onDirtyChange={onDirtyChange}
onChange={(next) => onUpdate(agent.id, next)}
/>
</SettingsCard>
</SettingsSection>
);
}