diff --git a/CHANGELOG.md b/CHANGELOG.md index a87beb8..93fb45a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,19 @@ All notable changes to CodeCraft. Versions follow [Semantic Versioning](https://semver.org/); until 1.0, minor versions may contain breaking changes. +## [Unreleased] + +### Added + +- **Drafts in every chat.** What you have typed but not sent is kept: in the web UI and in the terminal client's server chats on the server (so you can continue on another device – it is picked up when you open or return to the chat, as long as you have no unsent edits of your own), in the terminal client's local chats in a file. Sending clears it. +- **Factory: chats open in an overlay on the desktop** (`#/factory/s/`), closed with one click, Esc (outside text fields) or the back button, with a button to open the chat as a full page. Every issue card has an *open chat* button for the newest phase chat that still exists. On small screens chats still open as pages. + +- **Factory main switch** at the top of the overview (web and PWA): green = running, yellow = stopping, red = stopped. Stopping is *soft*: no new review, build or acceptance starts, agents that are running finish their phase – the switch stays yellow until the last one is done, then turns red. Starting takes up work again at once. The state is kept across restarts; the board still updates while the factory is stopped. The colours come from the theme (new variables `--power-on`, `--power-warn`, `--power-off`, set in all 32 theme files). + +### Changed + +- The factory overview uses the full width of the window. + ## [v202611-00070] – 2026-11-20 ### Changed diff --git a/README.md b/README.md index f17eaff..4c699d6 100644 --- a/README.md +++ b/README.md @@ -332,6 +332,11 @@ phase the model, agent (CodeCraft or Claude Code), permission mode, timeout, tri technical failures, the skills that are switched on for it, plus the number of rework rounds (default 2). Failed or rejected issues can be restarted from the board, finished ones are closed with a comment. +**Main switch.** The switch at the top of the factory page starts and stops the whole factory. +*Stop* is soft: no new review, build or acceptance starts, running agents finish their phase. +The switch is green while the factory runs, yellow while it is stopping (agents still working) +and red once the last agent is done. The state survives restarts. + **Backlog.** The first column of the board lists every open issue of the configured repositories that is not in the factory yet. *Queue* gives an issue the factory label on the forge (so it enters the review at once); *Queue all* does it for the whole list. Issues of authors diff --git a/cli/src/app.rs b/cli/src/app.rs index 145bada..e0c054d 100644 --- a/cli/src/app.rs +++ b/cli/src/app.rs @@ -143,6 +143,33 @@ pub struct App { pending_note: Option>>, /// The factory issue ("repo#number") whose actions are open. factory_key: String, + /// Unsent input is kept per chat: on the server for server chats (so another device can continue it), + /// in a local file for local chats. + draft: DraftSync, +} + +struct DraftSync { + /// "remote:" or "local:" of the chat the draft belongs to. + key: String, + /// What the editor held at the last look, and since when. + seen: String, + changed: Instant, + /// What is stored (or was last stored) for this chat. + synced: String, + loaded: bool, + pull: Option>>, + last_pull: Instant, +} + +impl DraftSync { + fn new() -> Self { + Self { key: String::new(), seen: String::new(), changed: Instant::now(), synced: String::new(), loaded: false, pull: None, last_pull: Instant::now() } + } +} + +fn local_draft_path(id: &str) -> std::path::PathBuf { + let safe: String = id.chars().filter(|c| c.is_ascii_alphanumeric() || *c == '-' || *c == '_').collect(); + crate::conf::data_dir().join("drafts").join(format!("{safe}.txt")) } const SPINNER: &[&str] = &["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"]; @@ -316,6 +343,7 @@ impl App { dialog: Dialog::None, todos: session.todos.clone(), context: session.context_tokens, + draft: DraftSync::new(), session, effort: None, images: vec![], @@ -1441,7 +1469,93 @@ impl App { self.status = "loading models…".into(); } + /// Keep the unsent input of the current chat: load it when the chat changes, save it shortly after typing. + fn poll_draft(&mut self) { + let remote_id = self.remote.as_ref().map(|r| r.id.clone()); + let key = match &remote_id { + Some(id) => format!("remote:{id}"), + None => format!("local:{}", self.session.id), + }; + if self.draft.key != key { + self.draft = DraftSync::new(); + self.draft.key = key.clone(); + self.draft.seen = self.editor.text(); + match &remote_id { + Some(id) => self.draft_pull(id.clone()), + None => { + let text = std::fs::read_to_string(local_draft_path(&self.session.id)).unwrap_or_default(); + if self.editor.is_empty() && !text.is_empty() { + self.editor.set(&text); + self.draft.seen = text.clone(); + } + self.draft.synced = if self.editor.is_empty() { String::new() } else { self.draft.seen.clone() }; + self.draft.loaded = true; + } + } + } + if let Some(rx) = &mut self.draft.pull { + if let Ok(res) = rx.try_recv() { + self.draft.pull = None; + if let Ok(text) = res { + // First load: only into an empty field. Later: only when nothing was typed here since the last sync. + let untouched = if self.draft.loaded { self.editor.text() == self.draft.synced } else { self.editor.is_empty() }; + if untouched && text != self.editor.text() { + self.editor.set(&text); + self.draft.seen = text.clone(); + self.draft.synced = text; + } else if !self.draft.loaded { + self.draft.synced = if untouched { text } else { String::new() }; + } + self.draft.loaded = true; + } + } + } + let cur = self.editor.text(); + if cur != self.draft.seen { + self.draft.seen = cur; + self.draft.changed = Instant::now(); + } + if self.draft.loaded && self.draft.seen != self.draft.synced && self.draft.changed.elapsed() >= Duration::from_millis(700) { + let text = self.draft.seen.clone(); + self.draft.synced = text.clone(); + match (&remote_id, self.env.server.clone()) { + (Some(id), Some(server)) => { + let id = id.clone(); + tokio::spawn(async move { + let _ = remote::draft_put(&server, &id, &text).await; + }); + } + (None, _) => { + let path = local_draft_path(&self.session.id); + if text.trim().is_empty() { + let _ = std::fs::remove_file(&path); + } else if let Some(dir) = path.parent() { + let _ = std::fs::create_dir_all(dir); + let _ = std::fs::write(&path, &text); + } + } + _ => {} + } + } + // Pick up what was typed on another device while this field has no unsent edits. + if let (Some(id), true) = (&remote_id, self.draft.loaded && self.draft.pull.is_none() && self.draft.last_pull.elapsed() >= Duration::from_secs(10) && self.editor.text() == self.draft.synced) { + self.draft.last_pull = Instant::now(); + self.draft_pull(id.clone()); + } + } + + fn draft_pull(&mut self, id: String) { + let Some(server) = self.env.server.clone() else { return }; + let (tx, rx) = oneshot::channel(); + tokio::spawn(async move { + let _ = tx.send(remote::draft_get(&server, &id).await); + }); + self.draft.pull = Some(rx); + self.draft.last_pull = Instant::now(); + } + fn poll_pending(&mut self) { + self.poll_draft(); self.poll_remote(); if let Some(rx) = &mut self.pending_detect { if let Ok(found) = rx.try_recv() { diff --git a/cli/src/remote.rs b/cli/src/remote.rs index 70daab8..435d528 100644 --- a/cli/src/remote.rs +++ b/cli/src/remote.rs @@ -104,6 +104,16 @@ pub async fn prompt(server: &Server, id: &str, text: &str) -> Result<()> { server.post(&format!("/sessions/{id}/prompt"), json!({"text": text})).await.map(|_| ()) } +/// The unsent message of a server chat (typed in the web UI or in another terminal). +pub async fn draft_get(server: &Server, id: &str) -> Result { + let d = server.get(&format!("/sessions/{id}/composer-draft")).await?; + Ok(d["text"].as_str().unwrap_or("").to_string()) +} + +pub async fn draft_put(server: &Server, id: &str, text: &str) -> Result<()> { + server.put(&format!("/sessions/{id}/composer-draft"), json!({"text": text})).await.map(|_| ()) +} + pub async fn abort(server: &Server, id: &str) -> Result<()> { server.post(&format!("/sessions/{id}/abort"), json!({})).await.map(|_| ()) } diff --git a/cli/src/server.rs b/cli/src/server.rs index 480c0db..0ebeacc 100644 --- a/cli/src/server.rs +++ b/cli/src/server.rs @@ -74,6 +74,11 @@ impl Server { Ok(check(resp).await?.json().await?) } + pub async fn put(&self, path: &str, body: Value) -> Result { + let resp = self.http.put(format!("{}/api{path}", self.url)).bearer_auth(&self.token).json(&body).send().await.with_context(|| format!("cannot reach {}", self.url))?; + Ok(check(resp).await?.json().await?) + } + pub async fn post(&self, path: &str, body: Value) -> Result { let resp = self.http.post(format!("{}/api{path}", self.url)).bearer_auth(&self.token).json(&body).send().await.with_context(|| format!("cannot reach {}", self.url))?; Ok(check(resp).await?.json().await?) diff --git a/server/src/api.rs b/server/src/api.rs index 8a90a3b..c432fae 100644 --- a/server/src/api.rs +++ b/server/src/api.rs @@ -96,6 +96,7 @@ pub fn router(app: AppState) -> Router { .route("/sessions/{id}/compact", post(compact)) .route("/sessions/{id}/rewind", post(rewind)) .route("/sessions/{id}/job-draft", post(job_draft)) + .route("/sessions/{id}/composer-draft", get(get_composer_draft).put(put_composer_draft)) .route("/projects/overview", get(project_overview)) .route("/sessions/{id}/project-defaults", get(get_project_defaults).put(put_project_defaults).delete(delete_project_defaults)) .route("/sessions/{id}/check", get(get_check).put(put_check)) @@ -169,6 +170,7 @@ pub fn router(app: AppState) -> Router { .route("/account/factory/test", post(test_factory)) .route("/factory/overview", get(factory_overview)) .route("/factory/backlog", get(factory_backlog)) + .route("/factory/power", post(factory_power)) .route("/factory/backlog/enqueue", post(factory_enqueue)) .route("/factory/poll", post(factory_poll)) .route("/factory/issues/restart", post(factory_restart)) @@ -1660,6 +1662,27 @@ async fn reply_permission(Extension(user): Extension, State(app): State, State(app): State, Path(id): Path) -> ApiResult { + writable(&app, &user, &id)?; + let d = app.store.chat_draft(&id, &user.id)?; + Ok(Json(json!({"text": d.as_ref().map(|x| x.0.as_str()).unwrap_or(""), "updated_at": d.map(|x| x.1).unwrap_or(0)}))) +} + +#[derive(Deserialize)] +struct ComposerDraft { + text: String, +} + +async fn put_composer_draft(Extension(user): Extension, State(app): State, Path(id): Path, Json(b): Json) -> ApiResult { + writable(&app, &user, &id)?; + if b.text.len() > 200_000 { + return Err(ApiError(StatusCode::PAYLOAD_TOO_LARGE, "the draft is too long".into())); + } + let at = app.store.chat_draft_set(&id, &user.id, &b.text)?; + Ok(Json(json!({"updated_at": at}))) +} + async fn job_draft(Extension(user): Extension, State(app): State, Path(id): Path) -> ApiResult { let s = writable(&app, &user, &id)?; let (name, prompt) = runner::draft_job(&app, &s).await.map_err(|e| ApiError(StatusCode::BAD_GATEWAY, format!("{e:#}")))?; @@ -2751,11 +2774,39 @@ async fn factory_overview(Extension(user): Extension, State(app): State Value { + let on = app.store.user_setting::(&user.id, "factory_power").unwrap_or_default().on; + let active = app.store.factory_active(&user.id).unwrap_or(0); + json!({"on": on, "active": active, "state": crate::factory::power_state(on, active)}) +} + +#[derive(Deserialize)] +struct PowerBody { + on: bool, +} + +/// The master switch: stop = no new agent starts (running ones finish), start = take up work again right away. +async fn factory_power(Extension(user): Extension, State(app): State, headers: axum::http::HeaderMap, Json(b): Json) -> ApiResult { + app.store.set_user_setting(&user.id, "factory_power", &crate::factory::Power { on: b.on })?; + app.audit(Some(&user), if b.on { "factory.start" } else { "factory.stop" }, "", &crate::auth::client_ip(&headers)); + if b.on { + let (app2, user2) = (app.clone(), user.clone()); + tokio::spawn(async move { + let s: crate::factory::FactorySettings = app2.store.user_setting(&user2.id, "factory").unwrap_or_default(); + for cfg in s.repos.iter().filter(|r| r.enabled).map(|r| s.resolve(r)).filter(|r| !r.token.is_empty()) { + let _ = crate::factory::poll_repo(&app2, &user2, &cfg).await; + } + }); + } + Ok(Json(factory_power_json(&app, &user))) +} + /// Open issues per repository as the forge lists them; cached for a minute so that the board can ask often. static BACKLOG_CACHE: std::sync::OnceLock)>>> = std::sync::OnceLock::new(); diff --git a/server/src/factory.rs b/server/src/factory.rs index 3004914..707c124 100644 --- a/server/src/factory.rs +++ b/server/src/factory.rs @@ -17,6 +17,28 @@ pub const FACTORY_FOLDER: &str = "Factory"; pub const PHASES: [&str; 3] = ["review", "build", "qa"]; +/// The master switch of a user's factory. Switched off, no new agent starts (a soft stop: agents that +/// are running finish their phase); the poller still keeps the board up to date. +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct Power { + pub on: bool, +} + +impl Default for Power { + fn default() -> Self { + Self { on: true } + } +} + +/// "running" (on), "stopping" (off, agents still working) or "stopped" (off, nobody working). +pub fn power_state(on: bool, active: i64) -> &'static str { + match (on, active) { + (true, _) => "running", + (false, 0) => "stopped", + (false, _) => "stopping", + } +} + /// Status labels of an issue, in the order of the workflow. pub const STATUS_LABELS: [(&str, &str); 9] = [ ("factory", "0e8a16"), @@ -1478,6 +1500,7 @@ pub async fn poll_repo(app: &Arc, user: &User, cfg: &RepoCfg) -> Result<()> allowed.push(g.login().await?); } let issues = g.issues(&cfg.label).await?; + let power_on = app.store.user_setting::(&user.id, "factory_power").unwrap_or_default().on; for issue in issues { let n = issue_no(&issue); let author = issue["user"]["login"].as_str().unwrap_or(""); @@ -1498,7 +1521,7 @@ pub async fn poll_repo(app: &Arc, user: &User, cfg: &RepoCfg) -> Result<()> } "approved" | "rework" => { let feedback = if state == "rework" { row["note"].as_str().unwrap_or("").to_string() } else { String::new() }; - if app.store.factory_running(&cfg.url)? < cfg.max_parallel as i64 { + if power_on && app.store.factory_running(&cfg.url)? < cfg.max_parallel as i64 { let comments = g.comments(n as u64).await.unwrap_or_default(); app.store.factory_issue_set(&cfg.url, n, &[("title", json!(title)), ("state", json!("building"))])?; tokio::spawn(build(app.clone(), user.clone(), cfg.clone(), issue, comments, feedback)); @@ -1506,7 +1529,7 @@ pub async fn poll_repo(app: &Arc, user: &User, cfg: &RepoCfg) -> Result<()> continue; } "qa" => { - if app.store.factory_running(&cfg.url)? < cfg.max_parallel as i64 { + if power_on && app.store.factory_running(&cfg.url)? < cfg.max_parallel as i64 { app.store.factory_issue_set(&cfg.url, n, &[("title", json!(title))])?; // Mark the run before it starts so the next poll does not take it up again. app.store.factory_issue_set(&cfg.url, n, &[("state", json!("testing"))])?; @@ -1516,7 +1539,7 @@ pub async fn poll_repo(app: &Arc, user: &User, cfg: &RepoCfg) -> Result<()> } _ => false, }; - if !start || app.store.factory_running(&cfg.url)? >= cfg.max_parallel as i64 { + if !start || !power_on || app.store.factory_running(&cfg.url)? >= cfg.max_parallel as i64 { continue; } if comments.is_empty() { @@ -1907,6 +1930,15 @@ pub async fn create_project(app: &Arc, user: &User, settings: &mut FactoryS mod tests { use super::*; + #[test] + fn power_states() { + assert_eq!(power_state(true, 0), "running"); + assert_eq!(power_state(true, 3), "running"); + assert_eq!(power_state(false, 2), "stopping"); + assert_eq!(power_state(false, 0), "stopped"); + assert!(Power::default().on); + } + #[test] fn backlog_skips_tracked_and_queued_issues() { let cfg = repo("https://git.example.org/o/r.git"); diff --git a/server/src/store.rs b/server/src/store.rs index 030e50b..57e2a75 100644 --- a/server/src/store.rs +++ b/server/src/store.rs @@ -125,6 +125,13 @@ impl Store { last_status TEXT, created_at INTEGER NOT NULL ); + CREATE TABLE IF NOT EXISTS chat_drafts ( + session_id TEXT NOT NULL, + user_id TEXT NOT NULL, + text TEXT NOT NULL, + updated_at INTEGER NOT NULL, + PRIMARY KEY (session_id, user_id) + ); CREATE TABLE IF NOT EXISTS user_settings ( user_id TEXT NOT NULL, key TEXT NOT NULL, @@ -1569,13 +1576,42 @@ impl Store { Ok(rows.filter_map(|r| r.ok()).collect()) } + /// The unsent message of a chat, kept on the server so that it can be continued on another device. + pub fn chat_draft(&self, session: &str, user: &str) -> Result> { + Ok(self.conn.lock().unwrap().query_row("SELECT text, updated_at FROM chat_drafts WHERE session_id = ?1 AND user_id = ?2", params![session, user], |r| Ok((r.get(0)?, r.get(1)?))).optional()?) + } + + /// Store the unsent message (an empty text deletes it). + pub fn chat_draft_set(&self, session: &str, user: &str, text: &str) -> Result { + let conn = self.conn.lock().unwrap(); + let now = crate::types::now_ms(); + if text.trim().is_empty() { + conn.execute("DELETE FROM chat_drafts WHERE session_id = ?1 AND user_id = ?2", params![session, user])?; + } else { + conn.execute("INSERT INTO chat_drafts (session_id, user_id, text, updated_at) VALUES (?1,?2,?3,?4) ON CONFLICT(session_id, user_id) DO UPDATE SET text = ?3, updated_at = ?4", params![session, user, text, now])?; + } + Ok(now) + } + pub fn factory_issues(&self, owner: &str) -> Result> { let nums: Vec<(String, i64)> = { let conn = self.conn.lock().unwrap(); let mut st = conn.prepare("SELECT repo_url, number FROM factory_issues WHERE owner_id = ?1 ORDER BY updated_at DESC")?; st.query_map([owner], |r| Ok((r.get(0)?, r.get(1)?)))?.filter_map(|r| r.ok()).collect() }; - Ok(nums.into_iter().filter_map(|(r, n)| self.factory_issue(&r, n).ok().flatten()).collect()) + let mut rows: Vec = nums.into_iter().filter_map(|(r, n)| self.factory_issue(&r, n).ok().flatten()).collect(); + // The newest phase chat that still exists, for the "open chat" button of the card. + let conn = self.conn.lock().unwrap(); + if let Ok(mut chat) = conn.prepare("SELECT r.session_id, r.phase FROM factory_runs r WHERE r.repo_url = ?1 AND r.issue = ?2 AND EXISTS (SELECT 1 FROM sessions s WHERE s.id = r.session_id) ORDER BY r.started_at DESC LIMIT 1") { + for row in rows.iter_mut() { + let (repo, n) = (row["repo"].as_str().unwrap_or("").to_string(), row["number"].as_i64().unwrap_or(0)); + if let Ok((sid, phase)) = chat.query_row(params![repo, n], |x| Ok((x.get::<_, String>(0)?, x.get::<_, String>(1)?))) { + row["chat_session"] = json!(sid); + row["chat_phase"] = json!(phase); + } + } + } + Ok(rows) } pub fn factory_run_add(&self, id: &str, owner: &str, repo: &str, issue: i64, phase: &str, round: i64, session: &str, model: &str) -> Result<()> { @@ -1597,6 +1633,11 @@ impl Store { Ok(self.conn.lock().unwrap().query_row("SELECT COUNT(*) FROM factory_issues WHERE repo_url = ?1 AND state IN ('review', 'building', 'testing')", [repo], |r| r.get(0))?) } + /// Phases of this user that are running right now (any repository). + pub fn factory_active(&self, owner: &str) -> Result { + Ok(self.conn.lock().unwrap().query_row("SELECT COUNT(*) FROM factory_issues WHERE owner_id = ?1 AND state IN ('review', 'building', 'testing')", [owner], |r| r.get(0))?) + } + /// Runs with token and cost totals (joined from the usage table). pub fn factory_runs(&self, owner: &str, repo: Option<&str>, issue: Option, limit: i64) -> Result> { let conn = self.conn.lock().unwrap(); @@ -2022,3 +2063,28 @@ mod link_tests { std::fs::remove_dir_all(&dir).unwrap(); } } + +#[cfg(test)] +mod draft_tests { + use super::*; + + #[test] + fn drafts_are_kept_per_chat_and_user_and_cleared_when_empty() { + let dir = std::env::temp_dir().join(format!("cc-drafts-{}", std::process::id())); + std::fs::create_dir_all(&dir).unwrap(); + let store = Store::open(&dir.join("t.db")).unwrap(); + assert!(store.chat_draft("s1", "u1").unwrap().is_none()); + store.chat_draft_set("s1", "u1", "half a message").unwrap(); + store.chat_draft_set("s1", "u2", "someone else").unwrap(); + store.chat_draft_set("s2", "u1", "other chat").unwrap(); + assert_eq!(store.chat_draft("s1", "u1").unwrap().unwrap().0, "half a message"); + store.chat_draft_set("s1", "u1", "continued on another device").unwrap(); + assert_eq!(store.chat_draft("s1", "u1").unwrap().unwrap().0, "continued on another device"); + assert_eq!(store.chat_draft("s1", "u2").unwrap().unwrap().0, "someone else"); + // Sending clears it. + store.chat_draft_set("s1", "u1", " \n").unwrap(); + assert!(store.chat_draft("s1", "u1").unwrap().is_none()); + assert_eq!(store.chat_draft("s2", "u1").unwrap().unwrap().0, "other chat"); + let _ = std::fs::remove_dir_all(&dir); + } +} diff --git a/web/src/App.tsx b/web/src/App.tsx index c105298..4871e9f 100644 --- a/web/src/App.tsx +++ b/web/src/App.tsx @@ -128,7 +128,7 @@ export function App() { ); else if (section === "settings") content = ; else if (section === "p" && arg) content = ; - else if (section === "factory") content = ; + else if (section === "factory") content = ; else if (section === "stats") content = ; else if (section === "images") content = ; else if (section === "jobs" && arg) content = ; diff --git a/web/src/components/ChatView.tsx b/web/src/components/ChatView.tsx index b979b21..fd20829 100644 --- a/web/src/components/ChatView.tsx +++ b/web/src/components/ChatView.tsx @@ -543,6 +543,57 @@ function OlderLoader({ sessionId, afterSummary, scrollRef }: { sessionId: string ); } +/** + * Keep the unsent message of a chat on the server, so that it survives a reload and can be continued + * on another device: it is saved shortly after typing, loaded when the chat opens and again when the + * window comes back – as long as this device has no unsaved edits of its own. + */ +function useDraftSync(sessionId: string, text: string, setText: (s: string) => void, readOnly: boolean) { + const synced = useRef(null); + const current = useRef(text); + current.current = text; + const pull = (initial: boolean) => { + if (readOnly) return; + get<{ text: string }>(`/sessions/${sessionId}/composer-draft`) + .then((d) => { + // Only take over when nothing was typed here since the last sync (on opening: when the field is empty). + const untouched = initial ? current.current === "" : current.current === (synced.current ?? ""); + if (synced.current === null) synced.current = initial && current.current !== "" ? "" : d.text; + if (untouched && d.text !== current.current) { + synced.current = d.text; + setText(d.text); + } else if (initial && current.current === "") synced.current = d.text; + }) + .catch(() => {}); + }; + useEffect(() => { + synced.current = null; + pull(true); + const again = () => document.visibilityState === "visible" && pull(false); + document.addEventListener("visibilitychange", again); + window.addEventListener("focus", again); + const h = setInterval(again, 10000); + return () => { + document.removeEventListener("visibilitychange", again); + window.removeEventListener("focus", again); + clearInterval(h); + }; + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [sessionId, readOnly]); + useEffect(() => { + if (readOnly || synced.current === null || text === synced.current) return; + const h = setTimeout(() => { + const value = text; + put(`/sessions/${sessionId}/composer-draft`, { text: value }) + .then(() => { + synced.current = value; + }) + .catch(() => {}); + }, 700); + return () => clearTimeout(h); + }, [text, sessionId, readOnly]); +} + export function ChatView({ sessionId, onMenu, onClosePane }: { sessionId: string; onMenu: () => void; onClosePane?: () => void }) { const t = useT(); const session = useStore((s) => s.sessionById[sessionId]); @@ -572,6 +623,7 @@ export function ChatView({ sessionId, onMenu, onClosePane }: { sessionId: string const models = useModels(); const [loadError, setLoadError] = useState(); const [text, setText] = useState(() => takePrefill(sessionId) ?? ""); + useDraftSync(sessionId, text, setText, readOnly); const [stats, setStats] = useState(); const [showStats, setShowStats] = useState(false); const [editingTitle, setEditingTitle] = useState(false); diff --git a/web/src/components/Factory.tsx b/web/src/components/Factory.tsx index f75a66c..8c2fdd9 100644 --- a/web/src/components/Factory.tsx +++ b/web/src/components/Factory.tsx @@ -7,6 +7,7 @@ import { Icon } from "./Icon"; import { Spinner } from "./Activity"; import { ModelSelect } from "./ModelSelect"; import { RecreateDialog } from "./FactoryDraft"; +import { ChatOverlay, openFactoryChat } from "./FactoryChat"; import { ReleaseDialog, ReleasesPanel, type ReleaseRow } from "./FactoryRelease"; interface PrInfo { @@ -76,6 +77,9 @@ interface Issue { pr_url: string; branch: string; rounds: number; + /** Newest phase chat that still exists. */ + chat_session?: string; + chat_phase?: Phase; created_at: number; updated_at: number; } @@ -114,8 +118,15 @@ interface RepoInfo { running: number; version?: string | null; } +interface Power { + on: boolean; + /** Agents that are working right now. */ + active: number; + state: "running" | "stopping" | "stopped"; +} interface Overview { area: boolean; + power?: Power; repos: RepoInfo[]; issues: Issue[]; runs: Run[]; @@ -147,7 +158,7 @@ function fmtDuration(ms: number) { const runMs = (r: Run, now: number) => (r.ended_at ?? now) - r.started_at; /** Software factory: spec issues in Gitea are reviewed, built and accepted by agents with a model per phase. */ -export function Factory({ onMenu }: { onMenu: () => void }) { +export function Factory({ onMenu, overlayId }: { onMenu: () => void; overlayId?: string }) { const t = useT(); const [tab, setTab] = useState<"overview" | "settings">("overview"); return ( @@ -168,14 +179,33 @@ export function Factory({ onMenu }: { onMenu: () => void }) {
-
+
{tab === "overview" ? setTab("settings")} /> : }
+ {overlayId && } ); } +/** The factory's main switch, coloured by state: green = running, yellow = stopping, red = stopped. */ +function PowerSwitch({ power, onToggle }: { power: Power; onToggle: (on: boolean) => void }) { + const t = useT(); + const label = power.state === "running" ? t("factory.power.running") : power.state === "stopping" ? t("factory.power.stopping", { n: power.active }) : t("factory.power.stopped"); + const hint = power.on ? t("factory.power.stopHint") : t("factory.power.startHint"); + return ( + + ); +} + function FactoryOverview({ onSettings }: { onSettings: () => void }) { const t = useT(); const [data, setData] = useState(); @@ -417,10 +447,21 @@ function FactoryOverview({ onSettings }: { onSettings: () => void }) { } }; const phaseRunning = !!selected && ["review", "building", "testing"].includes(selected.state); + /** Master switch: a soft stop – no new agent starts, running ones finish their phase. */ + const setPower = async (on: boolean) => { + try { + const power = await post("/factory/power", { on }); + setData((d) => (d ? { ...d, power } : d)); + void reload(); + } catch (e: any) { + toast(e.message); + } + }; return ( <> {!data.area &&
{t("factory.noArea")}
} + {data.power && void setPower(on)} />}
{t("factory.kpi.running")}
@@ -539,8 +580,32 @@ function FactoryOverview({ onSettings }: { onSettings: () => void }) { const tokens = rs.reduce((a, r) => a + r.input_tokens + r.output_tokens, 0); return ( diff --git a/web/src/components/FactoryChat.tsx b/web/src/components/FactoryChat.tsx new file mode 100644 index 0000000..5b88500 --- /dev/null +++ b/web/src/components/FactoryChat.tsx @@ -0,0 +1,47 @@ +import { useEffect } from "react"; +import { navigate } from "../router"; +import { useT } from "../i18n"; +import { ChatView } from "./ChatView"; +import { Icon } from "./Icon"; + +/** Desktop only: chats of the factory open over the board and are closed with one click. */ +export const isDesktop = () => window.matchMedia("(min-width: 801px)").matches; + +/** Open the chat of a phase: in the overlay on the desktop, as a page on small screens. */ +export function openFactoryChat(sessionId: string) { + navigate(isDesktop() ? `/factory/s/${sessionId}` : `/s/${sessionId}`); +} + +export function ChatOverlay({ id }: { id: string }) { + const t = useT(); + const close = () => navigate("/factory"); + useEffect(() => { + const onKey = (e: KeyboardEvent) => { + // Esc closes – unless it is meant for a field, a dialog or the image viewer on top. + const el = document.activeElement; + const typing = el instanceof HTMLTextAreaElement || el instanceof HTMLInputElement || el instanceof HTMLSelectElement; + if (e.key === "Escape" && !typing && !document.querySelector(".modal-backdrop, .viewer-overlay")) close(); + }; + window.addEventListener("keydown", onKey); + return () => window.removeEventListener("keydown", onKey); + }, []); + return ( +
e.target === e.currentTarget && close()}> +
+
+ {t("factory.chatOverlay")} + + + +
+
+ +
+
+
+ ); +} diff --git a/web/src/i18n/de.ts b/web/src/i18n/de.ts index a792018..8684a0c 100644 --- a/web/src/i18n/de.ts +++ b/web/src/i18n/de.ts @@ -1235,6 +1235,14 @@ export const de: Messages = { "factory.backlog.empty": "Keine offenen Issues außerhalb der Factory", "factory.backlog.error": "Der Forge konnte für einige Projekte nicht gelesen werden", "factory.col.backlog": "Backlog", + "factory.chatOverlay": "Chat der Factory", + "factory.openFull": "Als Seite öffnen", + "factory.openFullHint": "Den Chat im ganzen Fenster öffnen", + "factory.power.running": "Factory läuft", + "factory.power.stopping": "Factory stoppt – {n} Agent(en) arbeiten noch", + "factory.power.stopped": "Factory gestoppt", + "factory.power.stopHint": "Klicken zum Stoppen: keine neuen Agenten, laufende werden fertig", + "factory.power.startHint": "Klicken, um die Factory zu starten", "factory.col.review": "Prüfung", "factory.col.question": "Rückfragen", "factory.col.approved": "Freigegeben", diff --git a/web/src/i18n/en.ts b/web/src/i18n/en.ts index 53b3eae..39596ea 100644 --- a/web/src/i18n/en.ts +++ b/web/src/i18n/en.ts @@ -1234,6 +1234,14 @@ export const en = { "factory.backlog.empty": "No open issues outside the factory", "factory.backlog.error": "The forge could not be read for some projects", "factory.col.backlog": "Backlog", + "factory.chatOverlay": "Chat of the factory", + "factory.openFull": "Open as page", + "factory.openFullHint": "Open the chat in the full window", + "factory.power.running": "Factory running", + "factory.power.stopping": "Factory stopping – {n} agent(s) still working", + "factory.power.stopped": "Factory stopped", + "factory.power.stopHint": "Click to stop: no new agents start, running ones finish", + "factory.power.startHint": "Click to start the factory", "factory.col.review": "Review", "factory.col.question": "Questions", "factory.col.approved": "Approved", diff --git a/web/src/styles.css b/web/src/styles.css index b64deb1..1276434 100644 --- a/web/src/styles.css +++ b/web/src/styles.css @@ -5168,6 +5168,142 @@ td.fold-indent { grid-column: span 2; min-width: 0; } +/* Main switch of the factory. The colours come from the theme (--power-on / -warn / -off). */ +.factory-power { + --tone: var(--power-off, var(--red)); + display: flex; + align-items: center; + gap: 14px; + width: 100%; + margin: 0 0 12px; + padding: 10px 16px; + text-align: left; + color: var(--fg0); + background: color-mix(in srgb, var(--tone) 18%, var(--bg1)); + border: 2px solid var(--tone); + border-radius: 12px; + cursor: pointer; + transition: background 0.25s, border-color 0.25s; +} +.factory-power.running { + --tone: var(--power-on, var(--green)); +} +.factory-power.stopping { + --tone: var(--power-warn, var(--accent)); +} +.factory-power.stopped { + --tone: var(--power-off, var(--red)); +} +.factory-power:hover { + background: color-mix(in srgb, var(--tone) 26%, var(--bg1)); +} +.factory-power-track { + position: relative; + flex: none; + width: 52px; + height: 28px; + border-radius: 14px; + background: var(--tone); + transition: background 0.25s; +} +.factory-power-knob { + position: absolute; + top: 3px; + left: 3px; + width: 22px; + height: 22px; + border-radius: 50%; + background: var(--bg0); + box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35); + transition: transform 0.2s; +} +/* on = knob right; stopping is still "off" but pulses until the last agent is done */ +.factory-power.running .factory-power-knob { + transform: translateX(24px); +} +.factory-power.stopping .factory-power-track { + animation: factory-pulse 1.4s ease-in-out infinite; +} +.factory-power-text { + display: flex; + flex-direction: column; + gap: 1px; +} +.factory-power-text b { + font-size: 15px; +} + +/* Chats of the factory open over the board. */ +.chat-overlay { + position: fixed; + inset: 0; + z-index: 25; + background: rgba(0, 0, 0, 0.5); + display: flex; + align-items: center; + justify-content: center; + padding: 3vh 3vw; +} +.chat-overlay-box { + width: min(1200px, 100%); + height: 100%; + background: var(--bg0); + border: 1px solid var(--bg2); + border-radius: 12px; + box-shadow: var(--shadow, 0 12px 40px rgba(0, 0, 0, 0.45)); + display: flex; + flex-direction: column; + overflow: hidden; +} +.chat-overlay-bar { + display: flex; + align-items: center; + gap: 8px; + padding: 8px 12px; + background: var(--bg1); + border-bottom: 1px solid var(--bg2); +} +.chat-overlay-body { + flex: 1; + min-height: 0; + display: flex; + flex-direction: column; +} +@media (max-width: 800px) { + .chat-overlay { + padding: 0; + } + .chat-overlay-box { + border-radius: 0; + border: 0; + } +} +.factory-card-head { + display: flex; + align-items: center; + justify-content: space-between; + gap: 6px; + width: 100%; +} +.factory-open { + display: inline-flex; + align-items: center; + justify-content: center; + width: 22px; + height: 22px; + border-radius: 6px; + color: var(--muted); + cursor: pointer; +} +.factory-open:hover, +.factory-open:focus-visible { + color: var(--fg0); + background: var(--bg2); +} +.factory-open .icon { + width: 15px; + height: 15px; +} .factory-card.active { border-color: var(--accent); } diff --git a/web/src/themes/ash-dark.css b/web/src/themes/ash-dark.css index 45b3bf5..0a898db 100644 --- a/web/src/themes/ash-dark.css +++ b/web/src/themes/ash-dark.css @@ -21,6 +21,10 @@ --on-accent: #1c1b1f; --red: #c15c46; --green: #8f9a5c; + /* Factory master switch: running / stopping / stopped */ + --power-on: #8f9a5c; + --power-warn: #d9b45a; + --power-off: #c15c46; --aqua: #8aa89a; --blue: #7c9aa1; --purple: #b47e99; diff --git a/web/src/themes/ash-light.css b/web/src/themes/ash-light.css index 88ed13c..7ed7f85 100644 --- a/web/src/themes/ash-light.css +++ b/web/src/themes/ash-light.css @@ -21,6 +21,10 @@ --on-accent: #ffffff; --red: #96392a; --green: #5c6631; + /* Factory master switch: running / stopping / stopped */ + --power-on: #5c6631; + --power-warn: #9a7413; + --power-off: #96392a; --aqua: #3d6b72; --blue: #3d6b72; --purple: #7c4a66; diff --git a/web/src/themes/catppuccin-dark.css b/web/src/themes/catppuccin-dark.css index 27ec665..952e816 100644 --- a/web/src/themes/catppuccin-dark.css +++ b/web/src/themes/catppuccin-dark.css @@ -21,6 +21,10 @@ --on-accent: #1e1e2e; --red: #f38ba8; --green: #a6e3a1; + /* Factory master switch: running / stopping / stopped */ + --power-on: #a6e3a1; + --power-warn: #f9e2af; + --power-off: #f38ba8; --aqua: #94e2d5; --blue: #89b4fa; --purple: #f5c2e7; diff --git a/web/src/themes/catppuccin-light.css b/web/src/themes/catppuccin-light.css index 9d85ecb..49dd5a6 100644 --- a/web/src/themes/catppuccin-light.css +++ b/web/src/themes/catppuccin-light.css @@ -21,6 +21,10 @@ --on-accent: #ffffff; --red: #d20f39; --green: #40a02b; + /* Factory master switch: running / stopping / stopped */ + --power-on: #40a02b; + --power-warn: #df8e1d; + --power-off: #d20f39; --aqua: #179299; --blue: #1e66f5; --purple: #ea76cb; diff --git a/web/src/themes/coffee-dark.css b/web/src/themes/coffee-dark.css index 2b0b2dd..b5b7d65 100644 --- a/web/src/themes/coffee-dark.css +++ b/web/src/themes/coffee-dark.css @@ -21,6 +21,10 @@ --on-accent: #1d150f; --red: #d78a6f; --green: #b5b27a; + /* Factory master switch: running / stopping / stopped */ + --power-on: #a9b86a; + --power-warn: #e8c36a; + --power-off: #d4694f; --aqua: #9fb8a8; --blue: #a3b4c7; --purple: #cf90a2; diff --git a/web/src/themes/coffee-light.css b/web/src/themes/coffee-light.css index 671d784..fefc3f1 100644 --- a/web/src/themes/coffee-light.css +++ b/web/src/themes/coffee-light.css @@ -21,6 +21,10 @@ --on-accent: #ffffff; --red: #a4405e; --green: #4f6b00; + /* Factory master switch: running / stopping / stopped */ + --power-on: #4f6b00; + --power-warn: #a8780a; + --power-off: #a93a2e; --aqua: #3f6b5e; --blue: #8e2d53; --purple: #7a003b; diff --git a/web/src/themes/dracula-dark.css b/web/src/themes/dracula-dark.css index 22d1d69..3a0d1df 100644 --- a/web/src/themes/dracula-dark.css +++ b/web/src/themes/dracula-dark.css @@ -21,6 +21,10 @@ --on-accent: #282a36; --red: #ff5555; --green: #50fa7b; + /* Factory master switch: running / stopping / stopped */ + --power-on: #50fa7b; + --power-warn: #f1fa8c; + --power-off: #ff5555; --aqua: #8be9fd; --blue: #8be9fd; --purple: #ff79c6; diff --git a/web/src/themes/dracula-light.css b/web/src/themes/dracula-light.css index e61085c..932672f 100644 --- a/web/src/themes/dracula-light.css +++ b/web/src/themes/dracula-light.css @@ -21,6 +21,10 @@ --on-accent: #ffffff; --red: #cb3a2a; --green: #14710a; + /* Factory master switch: running / stopping / stopped */ + --power-on: #14710a; + --power-warn: #846e15; + --power-off: #cb3a2a; --aqua: #036a96; --blue: #036a96; --purple: #a3144d; diff --git a/web/src/themes/everforest-dark.css b/web/src/themes/everforest-dark.css index 845484d..8176c6f 100644 --- a/web/src/themes/everforest-dark.css +++ b/web/src/themes/everforest-dark.css @@ -21,6 +21,10 @@ --on-accent: #2d353b; --red: #e67e80; --green: #a7c080; + /* Factory master switch: running / stopping / stopped */ + --power-on: #a7c080; + --power-warn: #dbbc7f; + --power-off: #e67e80; --aqua: #83c092; --blue: #7fbbb3; --purple: #d699b6; diff --git a/web/src/themes/everforest-light.css b/web/src/themes/everforest-light.css index 7ec7499..ba9807a 100644 --- a/web/src/themes/everforest-light.css +++ b/web/src/themes/everforest-light.css @@ -21,6 +21,10 @@ --on-accent: #2d353b; --red: #f85552; --green: #8da101; + /* Factory master switch: running / stopping / stopped */ + --power-on: #8da101; + --power-warn: #dfa000; + --power-off: #f85552; --aqua: #35a77c; --blue: #3a94c5; --purple: #df69ba; diff --git a/web/src/themes/github-dark.css b/web/src/themes/github-dark.css index 6bb65e2..400b0be 100644 --- a/web/src/themes/github-dark.css +++ b/web/src/themes/github-dark.css @@ -21,6 +21,10 @@ --on-accent: #0d1117; --red: #f85149; --green: #3fb950; + /* Factory master switch: running / stopping / stopped */ + --power-on: #3fb950; + --power-warn: #d29922; + --power-off: #f85149; --aqua: #39c5cf; --blue: #58a6ff; --purple: #bc8cff; diff --git a/web/src/themes/github-light.css b/web/src/themes/github-light.css index ca947ba..50d0d74 100644 --- a/web/src/themes/github-light.css +++ b/web/src/themes/github-light.css @@ -21,6 +21,10 @@ --on-accent: #ffffff; --red: #d1242f; --green: #1a7f37; + /* Factory master switch: running / stopping / stopped */ + --power-on: #1a7f37; + --power-warn: #9a6700; + --power-off: #d1242f; --aqua: #1b7c83; --blue: #0969da; --purple: #8250df; diff --git a/web/src/themes/gruvbox-dark.css b/web/src/themes/gruvbox-dark.css index 7900fa1..4a469bf 100644 --- a/web/src/themes/gruvbox-dark.css +++ b/web/src/themes/gruvbox-dark.css @@ -22,6 +22,10 @@ --on-accent: #282828; --red: #fb4934; --green: #b8bb26; + /* Factory master switch: running / stopping / stopped */ + --power-on: #b8bb26; + --power-warn: #fabd2f; + --power-off: #fb4934; --aqua: #8ec07c; --blue: #83a598; --purple: #d3869b; diff --git a/web/src/themes/gruvbox-light.css b/web/src/themes/gruvbox-light.css index 9ee1f08..de259bc 100644 --- a/web/src/themes/gruvbox-light.css +++ b/web/src/themes/gruvbox-light.css @@ -21,6 +21,10 @@ --on-accent: #282828; --red: #9d0006; --green: #79740e; + /* Factory master switch: running / stopping / stopped */ + --power-on: #79740e; + --power-warn: #b57614; + --power-off: #9d0006; --aqua: #427b58; --blue: #076678; --purple: #8f3f71; diff --git a/web/src/themes/harbor-dark.css b/web/src/themes/harbor-dark.css index 75a0103..a4001ab 100644 --- a/web/src/themes/harbor-dark.css +++ b/web/src/themes/harbor-dark.css @@ -21,6 +21,10 @@ --on-accent: #1b1b1b; --red: #f44336; --green: #a99b7a; + /* Factory master switch: running / stopping / stopped */ + --power-on: #8fae72; + --power-warn: #e0b350; + --power-off: #f44336; --aqua: #8a9ba6; --blue: #77838a; --purple: #e58980; diff --git a/web/src/themes/harbor-light.css b/web/src/themes/harbor-light.css index 2601aec..9f5c4fa 100644 --- a/web/src/themes/harbor-light.css +++ b/web/src/themes/harbor-light.css @@ -21,6 +21,10 @@ --on-accent: #ffffff; --red: #b14752; --green: #556753; + /* Factory master switch: running / stopping / stopped */ + --power-on: #5a7a43; + --power-warn: #a87b1a; + --power-off: #b14752; --aqua: #3d727d; --blue: #4c6c94; --purple: #8a5b81; diff --git a/web/src/themes/kanagawa-dark.css b/web/src/themes/kanagawa-dark.css index 9f6a398..8d0422f 100644 --- a/web/src/themes/kanagawa-dark.css +++ b/web/src/themes/kanagawa-dark.css @@ -21,6 +21,10 @@ --on-accent: #1f1f28; --red: #e46876; --green: #98bb6c; + /* Factory master switch: running / stopping / stopped */ + --power-on: #98bb6c; + --power-warn: #e6c384; + --power-off: #e46876; --aqua: #7aa89f; --blue: #7fb4ca; --purple: #957fb8; diff --git a/web/src/themes/kanagawa-light.css b/web/src/themes/kanagawa-light.css index d004b2c..9066621 100644 --- a/web/src/themes/kanagawa-light.css +++ b/web/src/themes/kanagawa-light.css @@ -21,6 +21,10 @@ --on-accent: #ffffff; --red: #c84053; --green: #6f894e; + /* Factory master switch: running / stopping / stopped */ + --power-on: #6f894e; + --power-warn: #b07a00; + --power-off: #c84053; --aqua: #597b75; --blue: #4d699b; --purple: #624c83; diff --git a/web/src/themes/nord-dark.css b/web/src/themes/nord-dark.css index 1fd2c2b..6520fdb 100644 --- a/web/src/themes/nord-dark.css +++ b/web/src/themes/nord-dark.css @@ -21,6 +21,10 @@ --on-accent: #2e3440; --red: #bf616a; --green: #a3be8c; + /* Factory master switch: running / stopping / stopped */ + --power-on: #a3be8c; + --power-warn: #ebcb8b; + --power-off: #bf616a; --aqua: #8fbcbb; --blue: #81a1c1; --purple: #b48ead; diff --git a/web/src/themes/nord-light.css b/web/src/themes/nord-light.css index 0d03b14..f74335d 100644 --- a/web/src/themes/nord-light.css +++ b/web/src/themes/nord-light.css @@ -21,6 +21,10 @@ --on-accent: #ffffff; --red: #a9434d; --green: #5f7d48; + /* Factory master switch: running / stopping / stopped */ + --power-on: #5f7d48; + --power-warn: #9a7b2f; + --power-off: #a9434d; --aqua: #4d8a89; --blue: #5e81ac; --purple: #8f6a8a; diff --git a/web/src/themes/one-dark.css b/web/src/themes/one-dark.css index 9817001..5910038 100644 --- a/web/src/themes/one-dark.css +++ b/web/src/themes/one-dark.css @@ -21,6 +21,10 @@ --on-accent: #282c34; --red: #e06c75; --green: #98c379; + /* Factory master switch: running / stopping / stopped */ + --power-on: #98c379; + --power-warn: #e5c07b; + --power-off: #e06c75; --aqua: #56b6c2; --blue: #61afef; --purple: #c678dd; diff --git a/web/src/themes/one-light.css b/web/src/themes/one-light.css index 94b28d9..691814d 100644 --- a/web/src/themes/one-light.css +++ b/web/src/themes/one-light.css @@ -21,6 +21,10 @@ --on-accent: #ffffff; --red: #e45649; --green: #50a14f; + /* Factory master switch: running / stopping / stopped */ + --power-on: #50a14f; + --power-warn: #c18401; + --power-off: #e45649; --aqua: #0184bc; --blue: #4078f2; --purple: #a626a4; diff --git a/web/src/themes/rosepine-dark.css b/web/src/themes/rosepine-dark.css index 2b84a48..0585cb9 100644 --- a/web/src/themes/rosepine-dark.css +++ b/web/src/themes/rosepine-dark.css @@ -21,6 +21,10 @@ --on-accent: #191724; --red: #eb6f92; --green: #9ccfd8; + /* Factory master switch: running / stopping / stopped */ + --power-on: #95b88f; + --power-warn: #f6c177; + --power-off: #eb6f92; --aqua: #9ccfd8; --blue: #31748f; --purple: #c4a7e7; diff --git a/web/src/themes/rosepine-light.css b/web/src/themes/rosepine-light.css index 2bc5e2e..fcdaf9a 100644 --- a/web/src/themes/rosepine-light.css +++ b/web/src/themes/rosepine-light.css @@ -21,6 +21,10 @@ --on-accent: #ffffff; --red: #b4637a; --green: #56949f; + /* Factory master switch: running / stopping / stopped */ + --power-on: #5e8f60; + --power-warn: #c98a1b; + --power-off: #b4637a; --aqua: #56949f; --blue: #286983; --purple: #907aa9; diff --git a/web/src/themes/solarized-dark.css b/web/src/themes/solarized-dark.css index 2ef02ad..1b34fe3 100644 --- a/web/src/themes/solarized-dark.css +++ b/web/src/themes/solarized-dark.css @@ -21,6 +21,10 @@ --on-accent: #002b36; --red: #dc322f; --green: #859900; + /* Factory master switch: running / stopping / stopped */ + --power-on: #859900; + --power-warn: #b58900; + --power-off: #dc322f; --aqua: #2aa198; --blue: #268bd2; --purple: #6c71c4; diff --git a/web/src/themes/solarized-light.css b/web/src/themes/solarized-light.css index e00bd23..80bf5d3 100644 --- a/web/src/themes/solarized-light.css +++ b/web/src/themes/solarized-light.css @@ -21,6 +21,10 @@ --on-accent: #002b36; --red: #dc322f; --green: #859900; + /* Factory master switch: running / stopping / stopped */ + --power-on: #859900; + --power-warn: #b58900; + --power-off: #dc322f; --aqua: #2aa198; --blue: #268bd2; --purple: #6c71c4; diff --git a/web/src/themes/tintenblau-dark.css b/web/src/themes/tintenblau-dark.css index cae9b54..8c41b44 100644 --- a/web/src/themes/tintenblau-dark.css +++ b/web/src/themes/tintenblau-dark.css @@ -21,6 +21,10 @@ --on-accent: #232a44; --red: #d47a6a; --green: #96b4bc; + /* Factory master switch: running / stopping / stopped */ + --power-on: #8fb98a; + --power-warn: #e0b860; + --power-off: #d47a6a; --aqua: #96b4bc; --blue: #7aa0cc; --purple: #c896b2; diff --git a/web/src/themes/tintenblau-light.css b/web/src/themes/tintenblau-light.css index 2b88e0c..e77c26a 100644 --- a/web/src/themes/tintenblau-light.css +++ b/web/src/themes/tintenblau-light.css @@ -21,6 +21,10 @@ --on-accent: #f0ead9; --red: #8a3028; --green: #4a5a3a; + /* Factory master switch: running / stopping / stopped */ + --power-on: #4a6b3a; + --power-warn: #9a7218; + --power-off: #8a3028; --aqua: #3a5a6a; --blue: #3a5a8a; --purple: #5a4a72; diff --git a/web/src/themes/tokyonight-dark.css b/web/src/themes/tokyonight-dark.css index 4428f40..f09c2d5 100644 --- a/web/src/themes/tokyonight-dark.css +++ b/web/src/themes/tokyonight-dark.css @@ -21,6 +21,10 @@ --on-accent: #24283b; --red: #f7768e; --green: #9ece6a; + /* Factory master switch: running / stopping / stopped */ + --power-on: #9ece6a; + --power-warn: #e0af68; + --power-off: #f7768e; --aqua: #73daca; --blue: #7aa2f7; --purple: #bb9af7; diff --git a/web/src/themes/tokyonight-light.css b/web/src/themes/tokyonight-light.css index 41cc5c1..0d224d7 100644 --- a/web/src/themes/tokyonight-light.css +++ b/web/src/themes/tokyonight-light.css @@ -21,6 +21,10 @@ --on-accent: #ffffff; --red: #f52a65; --green: #587539; + /* Factory master switch: running / stopping / stopped */ + --power-on: #587539; + --power-warn: #8c6c3e; + --power-off: #f52a65; --aqua: #118c74; --blue: #2e7de9; --purple: #9854f1; diff --git a/web/src/themes/vscode-dark.css b/web/src/themes/vscode-dark.css index 9afe773..a8482d4 100644 --- a/web/src/themes/vscode-dark.css +++ b/web/src/themes/vscode-dark.css @@ -21,6 +21,10 @@ --on-accent: #ffffff; --red: #f14c4c; --green: #89d185; + /* Factory master switch: running / stopping / stopped */ + --power-on: #89d185; + --power-warn: #cca700; + --power-off: #f14c4c; --aqua: #4ec9b0; --blue: #3794ff; --purple: #c586c0; diff --git a/web/src/themes/vscode-light.css b/web/src/themes/vscode-light.css index 3471442..1015b56 100644 --- a/web/src/themes/vscode-light.css +++ b/web/src/themes/vscode-light.css @@ -21,6 +21,10 @@ --on-accent: #ffffff; --red: #cd3131; --green: #388a34; + /* Factory master switch: running / stopping / stopped */ + --power-on: #388a34; + --power-warn: #bf8803; + --power-off: #cd3131; --aqua: #267f99; --blue: #005fb8; --purple: #af00db; diff --git a/web/src/whatsnew.ts b/web/src/whatsnew.ts index 3e0ae0c..62347c3 100644 --- a/web/src/whatsnew.ts +++ b/web/src/whatsnew.ts @@ -3,6 +3,10 @@ * under "unreleased"; scripts/release.sh renames the key to the release version. */ export const WHATS_NEW: Record = { + unreleased: { + en: ["Unsent messages are saved per chat and can be continued on another device (web and terminal client)", "Factory: main switch (green running, yellow stopping, red stopped) with a soft stop – running agents finish", "Factory: chats open in an overlay on the desktop; every issue card has an open-chat button; the overview uses the full width"], + de: ["Ungesendete Nachrichten werden pro Chat gespeichert und lassen sich auf einem anderen Gerät fortsetzen (Web und Terminal-Client)", "Factory: Hauptschalter (grün läuft, gelb stoppt, rot gestoppt) mit sanftem Stopp – laufende Agenten werden fertig", "Factory: Chats öffnen auf dem Desktop in einem Overlay; jede Issue-Karte hat einen Chat-Knopf; die Übersicht nutzt die volle Breite"], + }, "202611-00070": { en: ["Factory backlog: wider column, titles on one line"], de: ["Factory-Backlog: breitere Spalte, Titel einzeilig"],