diff --git a/src/components/connection/connection-item.tsx b/src/components/connection/connection-item.tsx
index 7f7e8235a77e51d972529cdc31efed59e7541c7a..be2ea4844a6d223457d15e418a3f46957194156b 100644
--- a/src/components/connection/connection-item.tsx
+++ b/src/components/connection/connection-item.tsx
@@ -23,7 +23,7 @@ const Tag = styled("span")(({ theme }) => ({
 }));
 
 interface Props {
-  value: ApiType.ConnectionsItem;
+  value: IConnectionsItem;
 }
 
 const ConnectionItem = (props: Props) => {
diff --git a/src/components/connection/connection-table.tsx b/src/components/connection/connection-table.tsx
index 2111c8117d5ba145f3281de8b9e693f8fc46efdc..35dfdd603bf9f31728bb8fefb0b7f3cf790e4f3a 100644
--- a/src/components/connection/connection-table.tsx
+++ b/src/components/connection/connection-table.tsx
@@ -4,7 +4,7 @@ import { DataGrid, GridColDef } from "@mui/x-data-grid";
 import parseTraffic from "@/utils/parse-traffic";
 
 interface Props {
-  connections: ApiType.ConnectionsItem[];
+  connections: IConnectionsItem[];
 }
 
 const ConnectionTable = (props: Props) => {
diff --git a/src/components/layout/layout-traffic.tsx b/src/components/layout/layout-traffic.tsx
index c7247db6e29454d881e1414c46b14cc422dd993f..b122d21273c4d9b397f0ed15017484f320650f8d 100644
--- a/src/components/layout/layout-traffic.tsx
+++ b/src/components/layout/layout-traffic.tsx
@@ -45,7 +45,7 @@ const LayoutTraffic = () => {
       ws = new WebSocket(`ws://${server}/traffic?token=${secret}`);
 
       ws.addEventListener("message", (event) => {
-        const data = JSON.parse(event.data) as ApiType.TrafficItem;
+        const data = JSON.parse(event.data) as ITrafficItem;
         trafficRef.current?.appendData(data);
         setTraffic(data);
       });
diff --git a/src/components/layout/use-log-setup.ts b/src/components/layout/use-log-setup.ts
index efd372fcd8f1c398adca90998c7505dea115fdb1..a56339313f3e569cacc15619b052ed0b7448a42f 100644
--- a/src/components/layout/use-log-setup.ts
+++ b/src/components/layout/use-log-setup.ts
@@ -21,7 +21,7 @@ export default function useLogSetup() {
     getClashLogs().then(setLogData);
 
     const handler = (event: MessageEvent<any>) => {
-      const data = JSON.parse(event.data) as ApiType.LogItem;
+      const data = JSON.parse(event.data) as ILogItem;
       const time = dayjs().format("MM-DD HH:mm:ss");
       setLogData((l) => {
         if (l.length >= MAX_LOG_NUM) l.shift();
diff --git a/src/components/log/log-item.tsx b/src/components/log/log-item.tsx
index fff9729d9b5a3c127fc66eef1e8f404e46c828af..c1086f6339fe172d9fd47c015bffa4a1dc624c8a 100644
--- a/src/components/log/log-item.tsx
+++ b/src/components/log/log-item.tsx
@@ -20,7 +20,7 @@ const Item = styled(Box)(({ theme }) => ({
 }));
 
 interface Props {
-  value: ApiType.LogItem;
+  value: ILogItem;
 }
 
 const LogItem = (props: Props) => {
diff --git a/src/components/profile/enhanced.tsx b/src/components/profile/enhanced.tsx
index 3c38913960aa9ed80ce5ecc75c54dff29332c712..cb5ec606fd8b602031facf217ac21ed51b815ac3 100644
--- a/src/components/profile/enhanced.tsx
+++ b/src/components/profile/enhanced.tsx
@@ -14,7 +14,7 @@ import ProfileMore from "./profile-more";
 import Notice from "../base/base-notice";
 
 interface Props {
-  items: CmdType.ProfileItem[];
+  items: IProfileItem[];
   chain: string[];
 }
 
diff --git a/src/components/profile/info-editor.tsx b/src/components/profile/info-editor.tsx
index 4044dba97169651a467799b7a78a6327b4876890..950943e34600778b7f6eeb03d2463cc38450b14c 100644
--- a/src/components/profile/info-editor.tsx
+++ b/src/components/profile/info-editor.tsx
@@ -21,7 +21,7 @@ import Notice from "../base/base-notice";
 
 interface Props {
   open: boolean;
-  itemData: CmdType.ProfileItem;
+  itemData: IProfileItem;
   onClose: () => void;
 }
 
diff --git a/src/components/profile/profile-item.tsx b/src/components/profile/profile-item.tsx
index d29c96977ba93c0095490c8a9691aed28ec3e3c2..c721d771f97a609c1ef2f4c1795cc555d6626263 100644
--- a/src/components/profile/profile-item.tsx
+++ b/src/components/profile/profile-item.tsx
@@ -29,7 +29,7 @@ const round = keyframes`
 
 interface Props {
   selected: boolean;
-  itemData: CmdType.ProfileItem;
+  itemData: IProfileItem;
   onSelect: (force: boolean) => void;
 }
 
@@ -117,7 +117,7 @@ const ProfileItem = (props: Props) => {
     setAnchorEl(null);
     setLoadingCache((cache) => ({ ...cache, [itemData.uid]: true }));
 
-    const option: Partial<CmdType.ProfileOption> = {};
+    const option: Partial<IProfileOption> = {};
 
     if (type === 0) {
       option.with_proxy = false;
diff --git a/src/components/profile/profile-more.tsx b/src/components/profile/profile-more.tsx
index 328962eeebc0bbcafcf72739a3e91ce5a184aa7e..e8cfba2c283582aa334a8579222471674f1cb9c6 100644
--- a/src/components/profile/profile-more.tsx
+++ b/src/components/profile/profile-more.tsx
@@ -21,7 +21,7 @@ import Notice from "../base/base-notice";
 
 interface Props {
   selected: boolean;
-  itemData: CmdType.ProfileItem;
+  itemData: IProfileItem;
   enableNum: number;
   logInfo?: [string, string][];
   onEnable: () => void;
diff --git a/src/components/proxy/proxy-global.tsx b/src/components/proxy/proxy-global.tsx
index d741fed298934b5260bb4ea3b5ed669520ba8d3e..58651d5669051e3a71ae12cfadf731f57950a69c 100644
--- a/src/components/proxy/proxy-global.tsx
+++ b/src/components/proxy/proxy-global.tsx
@@ -13,7 +13,7 @@ import ProxyItem from "./proxy-item";
 interface Props {
   groupName: string;
   curProxy?: string;
-  proxies: ApiType.ProxyItem[];
+  proxies: IProxyItem[];
 }
 
 // this component will be used for DIRECT/GLOBAL
diff --git a/src/components/proxy/proxy-group.tsx b/src/components/proxy/proxy-group.tsx
index d25e3950137f9db96944fb62f150c24e09f43c0f..827359fd72a5810837cf33fafe4e12b2f6c29063 100644
--- a/src/components/proxy/proxy-group.tsx
+++ b/src/components/proxy/proxy-group.tsx
@@ -30,7 +30,7 @@ import ProxyHead from "./proxy-head";
 import ProxyItem from "./proxy-item";
 
 interface Props {
-  group: ApiType.ProxyGroupItem;
+  group: IProxyGroupItem;
 }
 
 const ProxyGroup = ({ group }: Props) => {
diff --git a/src/components/proxy/proxy-item.tsx b/src/components/proxy/proxy-item.tsx
index 14ebbe8620c8089c0411be395ed377f0d8ca3fc0..5dbdb3180f51060909ff4dd7ebfbedf5ba374db6 100644
--- a/src/components/proxy/proxy-item.tsx
+++ b/src/components/proxy/proxy-item.tsx
@@ -17,7 +17,7 @@ import BaseLoading from "../base/base-loading";
 
 interface Props {
   groupName: string;
-  proxy: ApiType.ProxyItem;
+  proxy: IProxyItem;
   selected: boolean;
   showType?: boolean;
   sx?: SxProps<Theme>;
diff --git a/src/components/proxy/use-filter-sort.ts b/src/components/proxy/use-filter-sort.ts
index 2a0ce705f946e4937b80208ffcbbe1f9c17c6d01..c5c3cba13dc9f6318989effbb08690b638d0fc65 100644
--- a/src/components/proxy/use-filter-sort.ts
+++ b/src/components/proxy/use-filter-sort.ts
@@ -5,7 +5,7 @@ import delayManager from "@/services/delay";
 export type ProxySortType = 0 | 1 | 2;
 
 export default function useFilterSort(
-  proxies: ApiType.ProxyItem[],
+  proxies: IProxyItem[],
   groupName: string,
   filterText: string,
   sortType: ProxySortType
@@ -47,7 +47,7 @@ const regex2 = /type=(.*)/i;
  * according to the regular conditions
  */
 function filterProxies(
-  proxies: ApiType.ProxyItem[],
+  proxies: IProxyItem[],
   groupName: string,
   filterText: string
 ) {
@@ -87,7 +87,7 @@ function filterProxies(
  * sort the proxy
  */
 function sortProxies(
-  proxies: ApiType.ProxyItem[],
+  proxies: IProxyItem[],
   groupName: string,
   sortType: ProxySortType
 ) {
diff --git a/src/components/rule/rule-item.tsx b/src/components/rule/rule-item.tsx
index b663e866c5501dcfabb90290a439636513dd09ba..6e01e06d8b31c3d686b561b8860b5289c60a6a7e 100644
--- a/src/components/rule/rule-item.tsx
+++ b/src/components/rule/rule-item.tsx
@@ -19,7 +19,7 @@ const COLOR = [
 
 interface Props {
   index: number;
-  value: ApiType.RuleItem;
+  value: IRuleItem;
 }
 
 const parseColor = (text: string) => {
diff --git a/src/components/setting/mods/sysproxy-viewer.tsx b/src/components/setting/mods/sysproxy-viewer.tsx
index ec7939e6b0f6a65eed1f8eeb343628ad613cbf12..c442ef4b5b348d7c6d394c4b22009f5e12a1feec 100644
--- a/src/components/setting/mods/sysproxy-viewer.tsx
+++ b/src/components/setting/mods/sysproxy-viewer.tsx
@@ -89,7 +89,7 @@ const SysproxyViewer = ({ handler }: Props) => {
       return;
     }
 
-    const patch: Partial<CmdType.VergeConfig> = {};
+    const patch: Partial<IVergeConfig> = {};
 
     if (value.guard !== enable_proxy_guard) {
       patch.enable_proxy_guard = value.guard;
diff --git a/src/components/setting/mods/theme-mode-switch.tsx b/src/components/setting/mods/theme-mode-switch.tsx
index c8ee8afb1cdc2d0105d0bbe1b04cb956cc3bcadb..595dd6a3a61190d127c473e9455d5718696e0b67 100644
--- a/src/components/setting/mods/theme-mode-switch.tsx
+++ b/src/components/setting/mods/theme-mode-switch.tsx
@@ -1,7 +1,7 @@
 import { useTranslation } from "react-i18next";
 import { Button, ButtonGroup } from "@mui/material";
 
-type ThemeValue = CmdType.VergeConfig["theme_mode"];
+type ThemeValue = IVergeConfig["theme_mode"];
 
 interface Props {
   value?: ThemeValue;
diff --git a/src/components/setting/setting-clash.tsx b/src/components/setting/setting-clash.tsx
index fdc7a3879cbed4c53dfb4891d8652df4c9fb6309..06934f1e12b977faf80a6401db757af01f95be15 100644
--- a/src/components/setting/setting-clash.tsx
+++ b/src/components/setting/setting-clash.tsx
@@ -46,10 +46,10 @@ const SettingClash = ({ onError }: Props) => {
   const controllerHandler = useModalHandler();
 
   const onSwitchFormat = (_e: any, value: boolean) => value;
-  const onChangeData = (patch: Partial<ApiType.ConfigData>) => {
+  const onChangeData = (patch: Partial<IConfigData>) => {
     mutateClash((old) => ({ ...(old! || {}), ...patch }), false);
   };
-  const onUpdateData = async (patch: Partial<ApiType.ConfigData>) => {
+  const onUpdateData = async (patch: Partial<IConfigData>) => {
     await updateConfigs(patch);
     await patchClashConfig(patch);
   };
diff --git a/src/components/setting/setting-system.tsx b/src/components/setting/setting-system.tsx
index c0866452fb3ff0e09b607c5355c2b0538232d377..ee0dc6fab65a680b82d820f374d93ac55f8c9f66 100644
--- a/src/components/setting/setting-system.tsx
+++ b/src/components/setting/setting-system.tsx
@@ -46,7 +46,7 @@ const SettingSystem = ({ onError }: Props) => {
   } = vergeConfig ?? {};
 
   const onSwitchFormat = (_e: any, value: boolean) => value;
-  const onChangeData = (patch: Partial<CmdType.VergeConfig>) => {
+  const onChangeData = (patch: Partial<IVergeConfig>) => {
     mutateVerge({ ...vergeConfig, ...patch }, false);
   };
 
diff --git a/src/components/setting/setting-verge.tsx b/src/components/setting/setting-verge.tsx
index ad05cf73098ec6cf4cd279f9631d7ce03e9e66d9..7bfa416b5a390a5dd86a70f615311aa45f3cd84a 100644
--- a/src/components/setting/setting-verge.tsx
+++ b/src/components/setting/setting-verge.tsx
@@ -42,7 +42,7 @@ const SettingVerge = ({ onError }: Props) => {
   const [configOpen, setConfigOpen] = useState(false);
 
   const onSwitchFormat = (_e: any, value: boolean) => value;
-  const onChangeData = (patch: Partial<CmdType.VergeConfig>) => {
+  const onChangeData = (patch: Partial<IVergeConfig>) => {
     mutateVerge({ ...vergeConfig, ...patch }, false);
   };
 
diff --git a/src/hooks/use-verge-config.ts b/src/hooks/use-verge-config.ts
index 0de7a8077caacd1003a48a39992f4e4b6e269822..42eea7fba3d219555e7fdb5098c3efa907fb1d90 100644
--- a/src/hooks/use-verge-config.ts
+++ b/src/hooks/use-verge-config.ts
@@ -4,7 +4,7 @@ import { getVergeConfig, patchVergeConfig } from "@/services/cmds";
 export const useVergeConfig = () => {
   const { data, mutate } = useSWR("getVergeConfig", getVergeConfig);
 
-  const patchVerge = async (value: Partial<CmdType.VergeConfig>) => {
+  const patchVerge = async (value: Partial<IVergeConfig>) => {
     await patchVergeConfig(value);
     mutate();
   };
diff --git a/src/pages/connections.tsx b/src/pages/connections.tsx
index 79ba71f8af1a7abf1e1acc11221feafb80a3137b..059bd63b2aec9df4b287490ed278f73f2a4632f0 100644
--- a/src/pages/connections.tsx
+++ b/src/pages/connections.tsx
@@ -22,14 +22,14 @@ import ConnectionTable from "@/components/connection/connection-table";
 
 const initConn = { uploadTotal: 0, downloadTotal: 0, connections: [] };
 
-type OrderFunc = (list: ApiType.ConnectionsItem[]) => ApiType.ConnectionsItem[];
+type OrderFunc = (list: IConnectionsItem[]) => IConnectionsItem[];
 
 const ConnectionsPage = () => {
   const { t, i18n } = useTranslation();
 
   const [filterText, setFilterText] = useState("");
   const [curOrderOpt, setOrderOpt] = useState("Default");
-  const [connData, setConnData] = useState<ApiType.Connections>(initConn);
+  const [connData, setConnData] = useState<IConnections>(initConn);
 
   const [setting, setSetting] = useRecoilState(atomConnectionSetting);
 
@@ -60,7 +60,7 @@ const ConnectionsPage = () => {
       ws = new WebSocket(`ws://${server}/connections?token=${secret}`);
 
       ws.addEventListener("message", (event) => {
-        const data = JSON.parse(event.data) as ApiType.Connections;
+        const data = JSON.parse(event.data) as IConnections;
 
         // 与前一次connections的展示顺序尽量保持一致
         setConnData((old) => {
diff --git a/src/services/api.ts b/src/services/api.ts
index 625f96eef28e3196ef6f8a793dd2eadf64ec0521..8ff75b7fc75dac6f742ad8477ffaf6bba8dc5551 100644
--- a/src/services/api.ts
+++ b/src/services/api.ts
@@ -50,11 +50,11 @@ export async function getVersion() {
 /// Get current base configs
 export async function getClashConfig() {
   const instance = await getAxios();
-  return instance.get("/configs") as Promise<ApiType.ConfigData>;
+  return instance.get("/configs") as Promise<IConfigData>;
 }
 
 /// Update current configs
-export async function updateConfigs(config: Partial<ApiType.ConfigData>) {
+export async function updateConfigs(config: Partial<IConfigData>) {
   const instance = await getAxios();
   return instance.patch("/configs", config);
 }
@@ -63,7 +63,7 @@ export async function updateConfigs(config: Partial<ApiType.ConfigData>) {
 export async function getRules() {
   const instance = await getAxios();
   const response = await instance.get<any, any>("/rules");
-  return response?.rules as ApiType.RuleItem[];
+  return response?.rules as IRuleItem[];
 }
 
 /// Get Proxy delay
@@ -90,7 +90,7 @@ export async function updateProxy(group: string, proxy: string) {
 async function getProxiesInner() {
   const instance = await getAxios();
   const response = await instance.get<any, any>("/proxies");
-  return (response?.proxies || {}) as Record<string, ApiType.ProxyItem>;
+  return (response?.proxies || {}) as Record<string, IProxyItem>;
 }
 
 /// Get the Proxy information
@@ -116,7 +116,7 @@ export async function getProxies() {
 
   const { GLOBAL: global, DIRECT: direct, REJECT: reject } = proxyRecord;
 
-  let groups: ApiType.ProxyGroupItem[] = [];
+  let groups: IProxyGroupItem[] = [];
 
   if (global?.all) {
     groups = global.all
@@ -142,7 +142,7 @@ export async function getProxies() {
     )
   );
 
-  const _global: ApiType.ProxyGroupItem = {
+  const _global: IProxyGroupItem = {
     ...global,
     all: global?.all?.map((item) => generateItem(item)) || [],
   };
@@ -155,10 +155,7 @@ export async function getProviders() {
   const instance = await getAxios();
   const response = await instance.get<any, any>("/providers/proxies");
 
-  const providers = (response.providers || {}) as Record<
-    string,
-    ApiType.ProviderItem
-  >;
+  const providers = (response.providers || {}) as Record<string, IProviderItem>;
 
   return Object.fromEntries(
     Object.entries(providers).filter(([key, item]) => {
@@ -179,7 +176,7 @@ export async function providerHealthCheck(name: string) {
 export async function getConnections() {
   const instance = await getAxios();
   const result = await instance.get("/connections");
-  return result as any as ApiType.Connections;
+  return result as any as IConnections;
 }
 
 // Close specific connection
diff --git a/src/services/cmds.ts b/src/services/cmds.ts
index 13441347189c31b522107d028b34b228794739e8..168378ec8d7cd361a45f2d9097f15982f9bdbf45 100644
--- a/src/services/cmds.ts
+++ b/src/services/cmds.ts
@@ -21,23 +21,23 @@ export async function getClashLogs() {
       }
       return null;
     })
-    .filter(Boolean) as ApiType.LogItem[];
+    .filter(Boolean) as ILogItem[];
 }
 
 export async function getProfiles() {
-  return invoke<CmdType.ProfilesConfig>("get_profiles");
+  return invoke<IProfilesConfig>("get_profiles");
 }
 
 export async function enhanceProfiles() {
   return invoke<void>("enhance_profiles");
 }
 
-export async function patchProfilesConfig(profiles: CmdType.ProfilesConfig) {
+export async function patchProfilesConfig(profiles: IProfilesConfig) {
   return invoke<void>("patch_profiles_config", { profiles });
 }
 
 export async function createProfile(
-  item: Partial<CmdType.ProfileItem>,
+  item: Partial<IProfileItem>,
   fileData?: string | null
 ) {
   return invoke<void>("create_profile", { item, fileData });
@@ -62,10 +62,7 @@ export async function importProfile(url: string) {
   });
 }
 
-export async function updateProfile(
-  index: string,
-  option?: CmdType.ProfileOption
-) {
+export async function updateProfile(index: string, option?: IProfileOption) {
   return invoke<void>("update_profile", { index, option });
 }
 
@@ -75,13 +72,13 @@ export async function deleteProfile(index: string) {
 
 export async function patchProfile(
   index: string,
-  profile: Partial<CmdType.ProfileItem>
+  profile: Partial<IProfileItem>
 ) {
   return invoke<void>("patch_profile", { index, profile });
 }
 
 export async function getClashInfo() {
-  return invoke<CmdType.ClashInfo | null>("get_clash_info");
+  return invoke<IClashInfo | null>("get_clash_info");
 }
 
 export async function getRuntimeConfig() {
@@ -100,15 +97,15 @@ export async function getRuntimeLogs() {
   return invoke<Record<string, [string, string][]>>("get_runtime_logs");
 }
 
-export async function patchClashConfig(payload: Partial<ApiType.ConfigData>) {
+export async function patchClashConfig(payload: Partial<IConfigData>) {
   return invoke<void>("patch_clash_config", { payload });
 }
 
 export async function getVergeConfig() {
-  return invoke<CmdType.VergeConfig>("get_verge_config");
+  return invoke<IVergeConfig>("get_verge_config");
 }
 
-export async function patchVergeConfig(payload: CmdType.VergeConfig) {
+export async function patchVergeConfig(payload: IVergeConfig) {
   return invoke<void>("patch_verge_config", { payload });
 }
 
diff --git a/src/services/delay.ts b/src/services/delay.ts
index 502b5e14c6cb45c250c550f95230831b7212fc27..3086808d9c79671ced46fc72d4dd698a6256e384 100644
--- a/src/services/delay.ts
+++ b/src/services/delay.ts
@@ -56,7 +56,7 @@ class DelayManager {
   }
 
   /// 暂时修复provider的节点延迟排序的问题
-  getDelayFix(proxy: ApiType.ProxyItem, group: string) {
+  getDelayFix(proxy: IProxyItem, group: string) {
     if (!proxy.provider) return this.getDelay(proxy.name, group);
 
     if (proxy.history.length > 0) {
diff --git a/src/services/states.ts b/src/services/states.ts
index 48b66e8b09cbfd9b38bdd2c3021a0c53d8c150de..8ef38c26174a19b5a7fe274b6f74da040c1ed98a 100644
--- a/src/services/states.ts
+++ b/src/services/states.ts
@@ -10,7 +10,7 @@ export const atomClashPort = atom<number>({
   default: 0,
 });
 
-export const atomLogData = atom<ApiType.LogItem[]>({
+export const atomLogData = atom<ILogItem[]>({
   key: "atomLogData",
   default: [],
 });
@@ -50,10 +50,10 @@ export const atomConnectionSetting = atom<IConnectionSetting>({
 
       try {
         const value = localStorage.getItem(key);
-        const data = value == null ? { layout: "list" } : JSON.parse(value);
+        const data = value == null ? { layout: "table" } : JSON.parse(value);
         setSelf(data);
       } catch {
-        setSelf({ layout: "list" });
+        setSelf({ layout: "table" });
       }
 
       onSet((newValue) => {
diff --git a/src/services/types.d.ts b/src/services/types.d.ts
index e84a281a1ff958e7efb208425cadf3a16f6a1f66..aea39387dc860d1d4542f6619bbb37a0e69e2b9b 100644
--- a/src/services/types.d.ts
+++ b/src/services/types.d.ts
@@ -1,243 +1,240 @@
 /**
  * Some interface for clash api
  */
-declare namespace ApiType {
-  interface ConfigData {
-    port: number;
-    mode: string;
-    ipv6: boolean;
-    "socket-port": number;
-    "allow-lan": boolean;
-    "log-level": string;
-    "mixed-port": number;
-    "redir-port": number;
-    "socks-port": number;
-    "tproxy-port": number;
-    "external-controller": string;
-    secret: string;
-  }
-
-  interface RuleItem {
-    type: string;
-    payload: string;
-    proxy: string;
-  }
+interface IConfigData {
+  port: number;
+  mode: string;
+  ipv6: boolean;
+  "socket-port": number;
+  "allow-lan": boolean;
+  "log-level": string;
+  "mixed-port": number;
+  "redir-port": number;
+  "socks-port": number;
+  "tproxy-port": number;
+  "external-controller": string;
+  secret: string;
+}
 
-  interface ProxyItem {
-    name: string;
-    type: string;
-    udp: boolean;
-    history: {
-      time: string;
-      delay: number;
-    }[];
-    all?: string[];
-    now?: string;
-    provider?: string; // 记录是否来自provider
-  }
+interface IRuleItem {
+  type: string;
+  payload: string;
+  proxy: string;
+}
 
-  type ProxyGroupItem = Omit<ProxyItem, "all"> & {
-    all: ProxyItem[];
-  };
+interface IProxyItem {
+  name: string;
+  type: string;
+  udp: boolean;
+  history: {
+    time: string;
+    delay: number;
+  }[];
+  all?: string[];
+  now?: string;
+  provider?: string; // 记录是否来自provider
+}
 
-  interface ProviderItem {
-    name: string;
-    type: string;
-    proxies: ProxyItem[];
-    updatedAt: string;
-    vehicleType: string;
-  }
+type IProxyGroupItem = Omit<IProxyItem, "all"> & {
+  all: IProxyItem[];
+};
+
+interface IProviderItem {
+  name: string;
+  type: string;
+  proxies: IProxyItem[];
+  updatedAt: string;
+  vehicleType: string;
+}
 
-  interface TrafficItem {
-    up: number;
-    down: number;
-  }
+interface ITrafficItem {
+  up: number;
+  down: number;
+}
+
+interface ILogItem {
+  type: string;
+  time?: string;
+  payload: string;
+}
 
-  interface LogItem {
+interface IConnectionsItem {
+  id: string;
+  metadata: {
+    network: string;
     type: string;
-    time?: string;
-    payload: string;
-  }
-
-  interface ConnectionsItem {
-    id: string;
-    metadata: {
-      network: string;
-      type: string;
-      host: string;
-      sourceIP: string;
-      sourcePort: string;
-      destinationPort: string;
-      destinationIP?: string;
-      process?: string;
-      processPath?: string;
-    };
-    upload: number;
-    download: number;
-    start: string;
-    chains: string[];
-    rule: string;
-    rulePayload: string;
-    curUpload?: number; // upload speed, calculate at runtime
-    curDownload?: number; // download speed, calculate at runtime
-  }
+    host: string;
+    sourceIP: string;
+    sourcePort: string;
+    destinationPort: string;
+    destinationIP?: string;
+    process?: string;
+    processPath?: string;
+  };
+  upload: number;
+  download: number;
+  start: string;
+  chains: string[];
+  rule: string;
+  rulePayload: string;
+  curUpload?: number; // upload speed, calculate at runtime
+  curDownload?: number; // download speed, calculate at runtime
+}
 
-  interface Connections {
-    downloadTotal: number;
-    uploadTotal: number;
-    connections: ConnectionsItem[];
-  }
+interface IConnections {
+  downloadTotal: number;
+  uploadTotal: number;
+  connections: IConnectionsItem[];
 }
 
 /**
  * Some interface for command
  */
-declare namespace CmdType {
-  type ProfileType = "local" | "remote" | "merge" | "script";
-
-  interface ClashInfo {
-    status: string;
-    port?: string; // clash mixed port
-    server?: string; // external-controller
-    secret?: string;
-  }
-
-  interface ProfileItem {
-    uid: string;
-    type?: ProfileType | string;
+
+type IProfileType = "local" | "remote" | "merge" | "script";
+
+interface IClashInfo {
+  status: string;
+  port?: string; // clash mixed port
+  server?: string; // external-controller
+  secret?: string;
+}
+
+interface IProfileItem {
+  uid: string;
+  type?: IProfileType | string;
+  name?: string;
+  desc?: string;
+  file?: string;
+  url?: string;
+  updated?: number;
+  selected?: {
     name?: string;
-    desc?: string;
-    file?: string;
-    url?: string;
-    updated?: number;
-    selected?: {
-      name?: string;
-      now?: string;
-    }[];
-    extra?: {
-      upload: number;
-      download: number;
-      total: number;
-      expire: number;
-    };
-    option?: ProfileOption;
-  }
-
-  interface ProfileOption {
-    user_agent?: string;
-    with_proxy?: boolean;
-    self_proxy?: boolean;
-    update_interval?: number;
-  }
-
-  interface ProfilesConfig {
-    current?: string;
-    chain?: string[];
-    valid?: string[];
-    items?: ProfileItem[];
-  }
-
-  interface VergeConfig {
-    language?: string;
-    clash_core?: string;
-    theme_mode?: "light" | "dark" | "system";
-    theme_blur?: boolean;
-    traffic_graph?: boolean;
-    enable_tun_mode?: boolean;
-    enable_auto_launch?: boolean;
-    enable_service_mode?: boolean;
-    enable_silent_start?: boolean;
-    enable_system_proxy?: boolean;
-    enable_proxy_guard?: boolean;
-    proxy_guard_duration?: number;
-    system_proxy_bypass?: string;
-    web_ui_list?: string[];
-    hotkeys?: string[];
-    theme_setting?: {
-      primary_color?: string;
-      secondary_color?: string;
-      primary_text?: string;
-      secondary_text?: string;
-      info_color?: string;
-      error_color?: string;
-      warning_color?: string;
-      success_color?: string;
-      font_family?: string;
-      css_injection?: string;
-    };
-    auto_close_connection?: boolean;
-    default_latency_test?: string;
-  }
-
-  type ClashConfigValue = any;
-
-  interface ProfileMerge {
-    // clash config fields (default supports)
-    rules?: ClashConfigValue;
-    proxies?: ClashConfigValue;
-    "proxy-groups"?: ClashConfigValue;
-    "proxy-providers"?: ClashConfigValue;
-    "rule-providers"?: ClashConfigValue;
-    // clash config fields (use flag)
-    tun?: ClashConfigValue;
-    dns?: ClashConfigValue;
-    hosts?: ClashConfigValue;
-    script?: ClashConfigValue;
-    profile?: ClashConfigValue;
-    payload?: ClashConfigValue;
-    "interface-name"?: ClashConfigValue;
-    "routing-mark"?: ClashConfigValue;
-    // functional fields
-    use?: string[];
-    "prepend-rules"?: any[];
-    "append-rules"?: any[];
-    "prepend-proxies"?: any[];
-    "append-proxies"?: any[];
-    "prepend-proxy-groups"?: any[];
-    "append-proxy-groups"?: any[];
-    // fix
-    ebpf?: any;
-    experimental?: any;
-    iptables?: any;
-    sniffer?: any;
-    authentication?: any;
-    "bind-address"?: any;
-    "external-ui"?: any;
-    "auto-redir"?: any;
-    "socks-port"?: any;
-    "redir-port"?: any;
-    "tproxy-port"?: any;
-    "geodata-mode"?: any;
-    "tcp-concurrent"?: any;
-  }
-
-  // partial of the clash config
-  type ProfileData = Partial<{
-    rules: any[];
-    proxies: any[];
-    "proxy-groups": any[];
-    "proxy-providers": any[];
-    "rule-providers": any[];
-
-    [k: string]: any;
-  }>;
-
-  interface ChainItem {
-    item: ProfileItem;
-    merge?: ProfileMerge;
-    script?: string;
-  }
-
-  interface EnhancedPayload {
-    chain: ChainItem[];
-    valid: string[];
-    current: ProfileData;
-    callback: string;
-  }
-
-  interface EnhancedResult {
-    data: ProfileData;
-    status: string;
-    error?: string;
-  }
+    now?: string;
+  }[];
+  extra?: {
+    upload: number;
+    download: number;
+    total: number;
+    expire: number;
+  };
+  option?: IProfileOption;
+}
+
+interface IProfileOption {
+  user_agent?: string;
+  with_proxy?: boolean;
+  self_proxy?: boolean;
+  update_interval?: number;
+}
+
+interface IProfilesConfig {
+  current?: string;
+  chain?: string[];
+  valid?: string[];
+  items?: IProfileItem[];
+}
+
+interface IVergeConfig {
+  language?: string;
+  clash_core?: string;
+  theme_mode?: "light" | "dark" | "system";
+  theme_blur?: boolean;
+  traffic_graph?: boolean;
+  enable_tun_mode?: boolean;
+  enable_auto_launch?: boolean;
+  enable_service_mode?: boolean;
+  enable_silent_start?: boolean;
+  enable_system_proxy?: boolean;
+  enable_proxy_guard?: boolean;
+  proxy_guard_duration?: number;
+  system_proxy_bypass?: string;
+  web_ui_list?: string[];
+  hotkeys?: string[];
+  theme_setting?: {
+    primary_color?: string;
+    secondary_color?: string;
+    primary_text?: string;
+    secondary_text?: string;
+    info_color?: string;
+    error_color?: string;
+    warning_color?: string;
+    success_color?: string;
+    font_family?: string;
+    css_injection?: string;
+  };
+  auto_close_connection?: boolean;
+  default_latency_test?: string;
+}
+
+type IClashConfigValue = any;
+
+interface IProfileMerge {
+  // clash config fields (default supports)
+  rules?: IClashConfigValue;
+  proxies?: IClashConfigValue;
+  "proxy-groups"?: IClashConfigValue;
+  "proxy-providers"?: IClashConfigValue;
+  "rule-providers"?: IClashConfigValue;
+  // clash config fields (use flag)
+  tun?: IClashConfigValue;
+  dns?: IClashConfigValue;
+  hosts?: IClashConfigValue;
+  script?: IClashConfigValue;
+  profile?: IClashConfigValue;
+  payload?: IClashConfigValue;
+  "interface-name"?: IClashConfigValue;
+  "routing-mark"?: IClashConfigValue;
+  // functional fields
+  use?: string[];
+  "prepend-rules"?: any[];
+  "append-rules"?: any[];
+  "prepend-proxies"?: any[];
+  "append-proxies"?: any[];
+  "prepend-proxy-groups"?: any[];
+  "append-proxy-groups"?: any[];
+  // fix
+  ebpf?: any;
+  experimental?: any;
+  iptables?: any;
+  sniffer?: any;
+  authentication?: any;
+  "bind-address"?: any;
+  "external-ui"?: any;
+  "auto-redir"?: any;
+  "socks-port"?: any;
+  "redir-port"?: any;
+  "tproxy-port"?: any;
+  "geodata-mode"?: any;
+  "tcp-concurrent"?: any;
+}
+
+// partial of the clash config
+type IProfileData = Partial<{
+  rules: any[];
+  proxies: any[];
+  "proxy-groups": any[];
+  "proxy-providers": any[];
+  "rule-providers": any[];
+
+  [k: string]: any;
+}>;
+
+interface IChainItem {
+  item: IProfileItem;
+  merge?: IProfileMerge;
+  script?: string;
+}
+
+interface IEnhancedPayload {
+  chain: IChainItem[];
+  valid: string[];
+  current: IProfileData;
+  callback: string;
+}
+
+interface IEnhancedResult {
+  data: IProfileData;
+  status: string;
+  error?: string;
 }