const STATUS_LABEL = { init: '新建', analyzing: '分析拆解中', plan_review: '待确认拆解', decomposed: '已拆解', speccing: '写方案中', spec_review: '待确认方案', ready: '可执行', blocked: '被依赖阻塞', queued: '排队中', executing: '执行中', exec_review: '待审/合', failed: '失败', needs_attention: '需人工', done: '完成', paused: '暂停', cancelled: '取消', }; const STATUS_GROUP = { init: 'idle', analyzing: 'work', speccing: 'work', plan_review: 'gate', spec_review: 'gate', exec_review: 'gate', decomposed: 'container', ready: 'go', queued: 'go', executing: 'run', blocked: 'hold', paused: 'hold', failed: 'bad', needs_attention: 'bad', done: 'done', cancelled: 'dead', }; const css = ` .m-chip{flex:none;display:inline-flex;align-items:center;gap:5px;font-family:var(--mono);font-size:11px;padding:1px 8px;border:1px solid var(--line);color:var(--muted);white-space:nowrap;border-radius:var(--radius-xs,3px)} .m-chip::before{content:'';width:6px;height:6px;border-radius:50%;background:currentColor} .m-chip--work{color:var(--cyan);border-color:var(--cyan-dim)} .m-chip--gate{color:var(--violet);border-color:var(--violet-dim)} .m-chip--gate::before{animation:maestro-pulse 1.4s infinite} .m-chip--container{color:#9bb4c8;border-color:#2c3c4a} .m-chip--go{color:var(--green);border-color:var(--green-dim)} .m-chip--run{color:var(--cyan);border-color:var(--cyan);box-shadow:0 0 10px rgba(89,200,216,.25)} .m-chip--run::before{animation:maestro-pulse .8s infinite} .m-chip--hold{color:var(--faint)} .m-chip--bad{color:var(--red);border-color:var(--red-dim)} .m-chip--bad::before{animation:maestro-pulse 1s infinite} .m-chip--done{color:var(--bg-deep);background:var(--green);border-color:var(--green);font-weight:700} .m-chip--dead{color:var(--faint);text-decoration:line-through} .m-chip--dead::before{background:var(--faint)} `; function ensureCss() { if (typeof document === 'undefined' || document.getElementById('m-chip-css')) return; const s = document.createElement('style'); s.id = 'm-chip-css'; s.textContent = css; document.head.appendChild(s); } export function StatusChip({ status = 'init', label }) { ensureCss(); const group = STATUS_GROUP[status] || 'idle'; return ( {label || STATUS_LABEL[status] || status} ); }