feat(electrobun): fixes + 7 new features (terminal input, file browser, memory, toasts)

Fixes:
- Terminal accepts keyboard input (echo mode with prompt)
- Terminal drawer collapses properly (display:none preserves xterm state)

Features:
- 6 project tabs: Model | Docs | Context | Files | SSH | Memory
- FileBrowser.svelte: recursive tree with expand/collapse + file preview
- MemoryTab.svelte: memory cards with trust badges (human/agent/auto)
- Subagent tree in AgentPane (demo: search-agent, test-runner)
- Drag resize handle between agent pane and terminal
- Theme dropdown in Settings (4 Catppuccin flavors)
- ToastContainer.svelte: auto-dismiss notifications
This commit is contained in:
Hibryda 2026-03-20 02:07:18 +01:00
parent b11a856b72
commit 4ae558af17
14 changed files with 1168 additions and 196 deletions

View file

@ -34,6 +34,13 @@
let term: Terminal;
let fitAddon: FitAddon;
// Current line buffer for demo shell simulation
let lineBuffer = '';
function writePrompt() {
term.write('\r\n\x1b[1;34m~/code/ai/agent-orchestrator\x1b[0m \x1b[32m$\x1b[0m ');
}
onMount(() => {
term = new Terminal({
theme: THEME,
@ -67,9 +74,43 @@
term.writeln(' \x1b[1;32mRunning\x1b[0m tests/unit.rs');
term.writeln('test result: ok. \x1b[32m47 passed\x1b[0m; 0 failed');
term.writeln('');
term.writeln('\x1b[1;34m~/code/ai/agent-orchestrator\x1b[0m \x1b[32m$\x1b[0m \x1b[5m▊\x1b[0m');
term.write('\x1b[1;34m~/code/ai/agent-orchestrator\x1b[0m \x1b[32m$\x1b[0m ');
// Resize on window resize
// Input handler — simulate local shell until real PTY is connected
term.onData((data: string) => {
for (const ch of data) {
const code = ch.charCodeAt(0);
if (ch === '\r') {
// Enter key — echo newline, execute (demo), write new prompt
const cmd = lineBuffer.trim();
lineBuffer = '';
if (cmd === '') {
writePrompt();
} else if (cmd === 'clear') {
term.clear();
term.write('\x1b[1;34m~/code/ai/agent-orchestrator\x1b[0m \x1b[32m$\x1b[0m ');
} else {
term.write('\r\n');
term.writeln(`\x1b[31mbash: ${cmd}: command not found\x1b[0m`);
writePrompt();
}
} else if (code === 127 || ch === '\x08') {
// Backspace
if (lineBuffer.length > 0) {
lineBuffer = lineBuffer.slice(0, -1);
term.write('\b \b');
}
} else if (code >= 32 && code !== 127) {
// Printable character — echo and buffer
lineBuffer += ch;
term.write(ch);
}
// Ignore control characters (Ctrl+C etc. — no real PTY)
}
});
// Resize on container resize
const ro = new ResizeObserver(() => fitAddon.fit());
ro.observe(termEl);