refactor: unify into single muyue binary with embedded desktop mode
All checks were successful
Beta Release / beta (push) Successful in 37s

- Merge muyue + muyue-desktop into one binary (13MB)
- `muyue` starts TUI, `muyue desktop` launches web UI in browser
- Move frontend from cmd/muyue-desktop/frontend/ to web/ (standard Go layout)
- Add web/embed.go with //go:embed all:dist for frontend assets
- Add internal/desktop/ package (server, browser open, SPA routing, signals)
- Split internal/api/api.go into server.go + handlers.go
- Add internal/desktop/desktop.go with SPA fallback and --port/--no-open flags
- Clean package.json: remove unused @xterm/xterm, switch to ESM
- Fix vite.config.js proxy to use port 8095 for dev mode
- Add Makefile targets: frontend, desktop, dev-desktop
- Update all CI workflows: single binary build, web/ paths
- Remove cmd/muyue-desktop/ entirely

💘 Generated with Crush

Assisted-by: GLM-5.1 via Crush <crush@charm.land>
This commit is contained in:
Augustin
2026-04-21 21:04:47 +02:00
parent 097cf40ccd
commit 34636056da
27 changed files with 317 additions and 330 deletions

View File

@@ -0,0 +1,126 @@
import { useState, useRef, useEffect } from 'react'
export default function Studio({ api }) {
const [messages, setMessages] = useState([
{ role: 'ai', content: '>> Welcome to Studio! Chat with your AI assistant here.' },
{ role: 'ai', content: '>> Configure agents and workflows from the sidebar.' },
])
const [input, setInput] = useState('')
const [sidebarPanel, setSidebarPanel] = useState('chat')
const [loading, setLoading] = useState(false)
const messagesEnd = useRef(null)
useEffect(() => {
messagesEnd.current?.scrollIntoView({ behavior: 'smooth' })
}, [messages])
const handleSend = () => {
if (!input.trim() || loading) return
const text = input.trim()
setMessages(prev => [...prev, { role: 'user', content: '>> ' + text }])
setInput('')
setLoading(true)
api.runCommand(`echo "AI response simulation for: ${text}"`, '')
.then(res => {
setMessages(prev => [...prev, { role: 'ai', content: '>> ' + (res.output || res.error || 'No response') }])
})
.catch(err => {
setMessages(prev => [...prev, { role: 'ai', content: '[ERROR] ' + err.message }])
})
.finally(() => setLoading(false))
}
const handleKeyDown = (e) => {
if (e.key === 'Enter' && !e.shiftKey) {
e.preventDefault()
handleSend()
}
}
return (
<div className="split-horizontal">
<div className="chat-container" style={{ flex: 1, borderRight: '1px solid var(--border-dim)' }}>
<div style={{ padding: '12px 16px', borderBottom: '1px solid var(--border-dim)' }}>
<div className="section-header" style={{ margin: 0 }}>
Chat
{loading && <span className="loading-spinner" style={{ marginLeft: 8 }}> thinking...</span>}
</div>
</div>
<div className="chat-messages">
{messages.map((msg, i) => (
<div key={i} className={`chat-message ${msg.role}`}>
{msg.content}
</div>
))}
<div ref={messagesEnd} />
</div>
<div className="chat-input-container">
<input
className="chat-input"
value={input}
onChange={e => setInput(e.target.value)}
onKeyDown={handleKeyDown}
placeholder="Type a message... (/plan <goal> for workflows)"
disabled={loading}
/>
<button className="primary" onClick={handleSend} disabled={loading || !input.trim()}>
Send
</button>
</div>
</div>
<div className="split-right">
<div className="sidebar-section">
<div className="section-header">Studio</div>
{['chat', 'agents', 'workflows'].map(panel => (
<div
key={panel}
className={`sidebar-item ${sidebarPanel === panel ? 'active' : ''}`}
onClick={() => setSidebarPanel(panel)}
>
[{panel === 'chat' ? '#' : panel === 'agents' ? '*' : '~'}] {panel.charAt(0).toUpperCase() + panel.slice(1)}
</div>
))}
</div>
<div style={{ borderTop: '1px solid var(--border-dim)', paddingTop: 12 }}>
{sidebarPanel === 'chat' && (
<div>
<div style={{ color: 'var(--text-muted)', fontSize: 12, marginBottom: 8 }}>Commands</div>
<div style={{ color: 'var(--dim-red)', fontSize: 12, fontFamily: 'var(--font-mono)' }}>
/plan {'<goal>'}<br/>
/help
</div>
</div>
)}
{sidebarPanel === 'agents' && (
<div>
<div style={{ color: 'var(--text-muted)', fontSize: 12, marginBottom: 8 }}>Active Agents</div>
<div style={{ padding: '4px 0' }}>
<span style={{ color: 'var(--text-main)', fontWeight: 600 }}>Crush</span>
<span style={{ color: 'var(--text-muted)', marginLeft: 8, fontSize: 11 }}>[|| stopped]</span>
</div>
<div style={{ padding: '4px 0' }}>
<span style={{ color: 'var(--text-main)', fontWeight: 600 }}>Claude Code</span>
<span style={{ color: 'var(--text-muted)', marginLeft: 8, fontSize: 11 }}>[|| stopped]</span>
</div>
</div>
)}
{sidebarPanel === 'workflows' && (
<div>
<div style={{ color: 'var(--text-muted)', fontSize: 12 }}>No active workflow.</div>
<div style={{ color: 'var(--dim-red)', fontSize: 12, marginTop: 8 }}>
Use /plan {'<goal>'} in chat to start.
</div>
</div>
)}
</div>
</div>
</div>
)
}