// 顶栏动作:默认仅图标,hover 横向展开文字(与 CountBadge 同交互) const maestroIconActionCss = ` .m-iact{display:inline-flex;align-items:center;height:28px;padding:0 8px;cursor:pointer;font-family:var(--mono);font-size:11.5px;font-weight:600;letter-spacing:.08em;line-height:1;background:transparent;color:var(--muted);border:1px solid var(--line);border-radius:var(--radius-sm,4px);transition:color .12s,border-color .12s;white-space:nowrap} .m-iact svg{flex:none} .m-iact .m-iact-label{max-width:0;opacity:0;overflow:hidden;transition:max-width .28s ease,opacity .22s ease,margin-left .28s ease} .m-iact:hover{color:var(--green);border-color:var(--green-dim)} .m-iact:hover .m-iact-label{max-width:9em;opacity:1;margin-left:6px} `; function ensureIconActionCss() { if (document.getElementById('m-iact-css')) return; const s = document.createElement('style'); s.id = 'm-iact-css'; s.textContent = maestroIconActionCss; document.head.appendChild(s); } function IconAction({ icon, label, title, onClick }) { ensureIconActionCss(); return ( ); } const iactSvg = { fill: 'none', stroke: 'currentColor', strokeWidth: 2, strokeLinecap: 'round', strokeLinejoin: 'round', width: 14, height: 14, viewBox: '0 0 24 24' }; function SyncIcon() { return ; } function ConfigIcon() { return ; } function LangIcon() { return ; } function SunIcon() { return ; } function MoonIcon() { return ; } function LangMenu({ t, lang, onSelectLang }) { const [open, setOpen] = React.useState(false); const ref = React.useRef(null); React.useEffect(() => { if (!open) return; const onDoc = (e) => { if (ref.current && !ref.current.contains(e.target)) setOpen(false); }; document.addEventListener('mousedown', onDoc); return () => document.removeEventListener('mousedown', onDoc); }, [open]); return ( setOpen(!open)}> } label={t.lang} title={t.langTip} onClick={() => {}} /> {open ? (
{window.MAESTRO_LANGS.map(([code, name]) => { const active = code === lang; return ( ); })}
) : null}
); } // 顶栏:项目标题 + 徽章组 + 动作;agent 执行面板 function Topbar({ project, counts, onSync, onToggleConfig, t, theme, onToggleTheme, lang, onSelectLang }) { const { Button, CountBadge } = window.MaestroDesignSystem_a6a290; return (
{project.name}
{project.path} · {project.branch} · {project.autonomy}
} label={t.config} title={t.configTip} onClick={onToggleConfig} /> : } label={theme === 'light' ? t.themeDark : t.themeLight} title={t.themeTip} onClick={onToggleTheme} />
); } function ConfigPanel({ project, onSave, onClose, onSync, t }) { const { Button, Input, Select } = window.MaestroDesignSystem_a6a290; return (
{t.lastSync}
); } function AgentSection({ agents, quota, t }) { const { SectionHead, QuotaMeter } = window.MaestroDesignSystem_a6a290; return (
{t.agentSection}{agents.length > 0 ? agents.length : ''}} sticky /> {quota ? (
{t.quota}
) : null} {agents.length === 0 ? (
{t.agentEmpty}
) : (
{agents.length} RUNNING
{agents.map((a) => (
{a.title} {a.kind} {a.meta} · {a.time} {t.since}
))}
)}
); } Object.assign(window, { MaestroKitTopbar: Topbar, MaestroKitConfigPanel: ConfigPanel, MaestroKitAgentSection: AgentSection });