Skip to content

armgit / Wake

Public Imported from GitHub
0

All your AI agent sessions in one place — browse, search, resume. Rust + GPUI.

Rust
3.5 KB
Raw Blame
use anyhow::Result;
use gpui::{AssetSource, SharedString};
use std::borrow::Cow;

/// 内嵌 lucide 图标(ISC License)。GPUI 无 SF Symbols,以 lucide 作为图标系统。
pub struct Assets;

macro_rules! icons {
    ($($name:literal),* $(,)?) => {
        fn lookup(path: &str) -> Option<&'static [u8]> {
            match path {
                $(concat!("icons/", $name, ".svg") =>
                    Some(include_bytes!(concat!("../assets/icons/", $name, ".svg"))),)*
                _ => None,
            }
        }
        #[allow(dead_code)]
        pub const ICON_NAMES: &[&str] = &[$($name),*];
    };
}

/// Agent 品牌图标(彩色 PNG,640×640 带 alpha)。经 `img()` 渲染,
/// 不走 Icon——品牌色必须原样保留,不能被 text_color 着色。
/// 文件名即 `AgentId::as_str()`,见 `AgentId::brand_icon()`。
macro_rules! brands {
    ($($name:literal),* $(,)?) => {
        fn lookup_brand(path: &str) -> Option<&'static [u8]> {
            match path {
                $(concat!("brands/", $name, ".png") =>
                    Some(include_bytes!(concat!("../assets/brands/", $name, ".png"))),)*
                _ => None,
            }
        }
    };
}

brands!(
    "claude-code",
    "codex",
    "qoder",
    "qoder-light",
    "copilot",
    "copilot-light",
    "cursor",
    "cursor-light",
    "opencode",
    "opencode-light",
    "kiro",
    "gemini",
    "pi",
    "pi-light",
    "omp",
    "grok",
    "grok-light",
    "kimi",
    "kimi-light",
    "antigravity",
    "deepseek",
    "hermes",
    "hermes-light",
    "openclaw",
    "codebuddy",
    "workbuddy",
    "zcode",
    "craft-agents",
    "devin",
    "devin-light",
    "kilo",
    "kilo-light",
    "grok-bot",
    "mimo-code",
    "mimo-code-light",
);

fn lookup_product(path: &str) -> Option<&'static [u8]> {
    match path {
        "brands/wake.svg" => Some(include_bytes!("../assets/icon.svg")),
        _ => None,
    }
}

icons!(
    // gpui-component TitleBar 的 Linux 窗口控制按钮(IconName::Window* 按这
    // 四个路径取图;缺了按钮就渲染成隐形热区——2026-08-24 Codex review)
    "window-minimize",
    "window-maximize",
    "window-restore",
    "window-close",
    // 底部工具条的页切换:Sessions 用双气泡(单气泡 message-square 留给消息级用途)
    "messages-square",
    // Memory 页(侧栏模式标题与底部工具条入口)
    "brain",
    // Skills 页(底部工具条入口与 All Skills 行);列表上方"读不出来"的提示行
    "puzzle",
    "triangle-alert",
    "star",
    "pin",
    "download",
    "folder",
    "calendar",
    "trash-2",
    "search",
    "arrow-up-down",
    "brush-cleaning",
    "sliders-horizontal",
    "palette",
    "check",
    "copy",
    "pin-filled",
    "star-filled",
    "terminal",
    "message-square",
    "layers",
    "close",
    "git-branch",
    "corner-left-up",
    "corner-down-right",
    "refresh-cw",
    "inbox",
    "chevron-down",
    "chevron-left",
    "chevron-right",
    "loader-circle",
    "loader",
    "circle-x",
    "file-text",
    "user",
    "more-horizontal",
    "hard-drive",
    "server",
    "database",
    "settings",
    "plus",
    "info",
    "chart-column",
    "plug",
);

impl AssetSource for Assets {
    fn load(&self, path: &str) -> Result<Option<Cow<'static, [u8]>>> {
        Ok(lookup(path)
            .or_else(|| lookup_brand(path))
            .or_else(|| lookup_product(path))
            .map(Cow::Borrowed))
    }

    fn list(&self, _path: &str) -> Result<Vec<SharedString>> {
        Ok(Vec::new())
    }
}