(props: {
toolkit: ToolkitResponse;
showOwnerLabels: boolean;
policies: readonly ToolkitPolicyResponse[];
connections: readonly ToolkitConnectionResponse[];
tools: readonly ToolRow[];
integrations: readonly Integration[];
integrationPlugins: readonly IntegrationPlugin[];
mcpUrl: string;
onBack: () => void;
onRemoveToolkit: () => void;
onAddConnection: (pattern: string) => Promise<void> | void;
onRemoveConnection: (connectionId: string) => Promise<void> | void;
onSetPolicy: (pattern: string, action: ToolPolicyAction) => Promise<void> | void;
onClearPolicy: (pattern: string) => Promise<void> | void;
})
| 1032 | } |
| 1033 | |
| 1034 | function ToolkitWorkspace(props: { |
| 1035 | toolkit: ToolkitResponse; |
| 1036 | showOwnerLabels: boolean; |
| 1037 | policies: readonly ToolkitPolicyResponse[]; |
| 1038 | connections: readonly ToolkitConnectionResponse[]; |
| 1039 | tools: readonly ToolRow[]; |
| 1040 | integrations: readonly Integration[]; |
| 1041 | integrationPlugins: readonly IntegrationPlugin[]; |
| 1042 | mcpUrl: string; |
| 1043 | onBack: () => void; |
| 1044 | onRemoveToolkit: () => void; |
| 1045 | onAddConnection: (pattern: string) => Promise<void> | void; |
| 1046 | onRemoveConnection: (connectionId: string) => Promise<void> | void; |
| 1047 | onSetPolicy: (pattern: string, action: ToolPolicyAction) => Promise<void> | void; |
| 1048 | onClearPolicy: (pattern: string) => Promise<void> | void; |
| 1049 | }) { |
| 1050 | const [addOpen, setAddOpen] = useState(false); |
| 1051 | const [selectedToolId, setSelectedToolId] = useState<string | null>(null); |
| 1052 | const visibleTools = useMemo( |
| 1053 | () => props.tools.filter((tool) => toolCanAppearInToolkit(props.toolkit, tool)), |
| 1054 | [props.toolkit, props.tools], |
| 1055 | ); |
| 1056 | const connectionGroups = useMemo(() => buildConnectionGroups(visibleTools), [visibleTools]); |
| 1057 | const hiddenPersonalConnectionCount = useMemo(() => { |
| 1058 | if (props.toolkit.owner !== "org") return 0; |
| 1059 | return buildConnectionGroups(props.tools.filter((tool) => toolOwner(tool) === "user")).length; |
| 1060 | }, [props.toolkit.owner, props.tools]); |
| 1061 | const configuredConnections = useMemo( |
| 1062 | () => |
| 1063 | configuredConnectionViews( |
| 1064 | props.connections, |
| 1065 | connectionGroups, |
| 1066 | props.integrations, |
| 1067 | props.integrationPlugins, |
| 1068 | props.showOwnerLabels, |
| 1069 | ), |
| 1070 | [ |
| 1071 | connectionGroups, |
| 1072 | props.connections, |
| 1073 | props.integrationPlugins, |
| 1074 | props.integrations, |
| 1075 | props.showOwnerLabels, |
| 1076 | ], |
| 1077 | ); |
| 1078 | const legacyPolicyIds = useMemo( |
| 1079 | () => legacyConnectionPolicyIds(props.policies, connectionGroups, props.connections), |
| 1080 | [connectionGroups, props.connections, props.policies], |
| 1081 | ); |
| 1082 | const accessPolicies = useMemo( |
| 1083 | () => props.policies.filter((policy) => !legacyPolicyIds.has(policy.id)), |
| 1084 | [legacyPolicyIds, props.policies], |
| 1085 | ); |
| 1086 | const connectionPatterns = useMemo( |
| 1087 | () => configuredConnectionPatterns(props.connections, props.policies, legacyPolicyIds), |
| 1088 | [legacyPolicyIds, props.connections, props.policies], |
| 1089 | ); |
| 1090 | const configuredToolIds = useMemo(() => { |
| 1091 | const ids = new Set<string>(); |
nothing calls this directly
no test coverage detected