Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

1.5 KB
Raw Blame
import { AppWindow, Bot, Cpu, FileCode2, FilePen, FolderOpen, FolderPlus, Globe, GraduationCap, KeyRound, LayoutTemplate, Library, MapPin, Megaphone, MessageCircleQuestion, PanelLeft, PanelRight, Puzzle, Radio, Sparkles, Terminal, Wrench, type LucideIcon } from 'lucide-react';

import type { GhostPermissionItem } from '../../../../shared/ghost';

const PERMISSION_ICON: Record<GhostPermissionItem['kind'], LucideIcon> = {
  cindy: Sparkles,
  agent: Bot,
  node: Cpu,
  tool: Wrench,
  command: Terminal,
  panel: PanelRight,
  'main-view': AppWindow,
  'task-view': PanelRight,
  code: FileCode2,
  subscribe: Radio,
  card: LayoutTemplate,
  network: Globe,
  notify: Megaphone,
  confirm: MessageCircleQuestion,
  fs: FilePen,
  library: Library,
  deviceSync: Radio,
  'session-context': MapPin,
  pick: FolderOpen,
  preview: AppWindow,
  'browser-extension': Puzzle,
  skill: GraduationCap,
  workspace: FolderPlus,
};

/**
 * Chooses a visual affordance without changing the host-owned permission title or meaning.
 * Shared by the plugin detail page and the install confirmation dialog.
 */
export function permissionItemIcon(item: GhostPermissionItem): LucideIcon {
  if (item.labelKey === 'panelLeft') return PanelLeft;
  if (
    item.labelKey === 'networkSecret' ||
    item.labelKey === 'networkSecretOauth' ||
    item.labelKey === 'networkSecretGhCli' ||
    item.labelKey === 'networkSecretIdentity'
  ) {
    return KeyRound;
  }
  return PERMISSION_ICON[item.kind];
}