Archived
602cd1586a
Axum HTTP server (port 7771) serving a single-page IDE with CodeMirror 6 syntax highlighting for engram-lang, a force-directed type graph visualizer, LSP (completions, hover, diagnostics), SSE-streamed build/run output, a plugin host with five first-party plugins, and a reasoning panel that proxies to engram-server. 28 tests across three crates, zero warnings.
21 lines
682 B
Rust
21 lines
682 B
Rust
//! SSE helpers for streaming build/run output.
|
|
|
|
use axum::response::sse::Event;
|
|
|
|
/// Build a line-output SSE event, classifying the line as error/warning/success/info.
|
|
pub fn classify_line(line: &str) -> Event {
|
|
let event_type = if line.to_lowercase().contains("error") {
|
|
"error"
|
|
} else if line.to_lowercase().contains("warning") || line.to_lowercase().contains("warn") {
|
|
"warning"
|
|
} else if line.to_lowercase().contains("compiled")
|
|
|| line.to_lowercase().contains("ok")
|
|
|| line.to_lowercase().contains("success")
|
|
{
|
|
"success"
|
|
} else {
|
|
"info"
|
|
};
|
|
Event::default().event(event_type).data(line.to_string())
|
|
}
|