Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
585fdd58de | ||
|
|
171b87b766 | ||
|
|
58475ce65e | ||
|
|
e7dc04d4a9 | ||
|
|
57607918ee | ||
|
|
25e4167f56 |
No files matched your search
@@ -3,6 +3,32 @@
|
|||||||
All notable changes to CodeCraft. Versions follow [Semantic Versioning](https://semver.org/);
|
All notable changes to CodeCraft. Versions follow [Semantic Versioning](https://semver.org/);
|
||||||
until 1.0, minor versions may contain breaking changes.
|
until 1.0, minor versions may contain breaking changes.
|
||||||
|
|
||||||
|
## [v202611-00071] – 2026-11-20
|
||||||
|
|
||||||
|
### 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/<id>`), 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
|
||||||
|
|
||||||
|
- **Factory backlog:** the column is twice as wide and card titles stay on one line (the full title is in the tooltip).
|
||||||
|
|
||||||
|
## [v202611-00069] – 2026-11-20
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- **Factory: backlog column.** All open issues of the configured repositories that are not in the factory yet appear in a new column on the far left. Each card has a *Queue* button (and the column *Queue all*, with a confirmation): the issue gets the factory label on the forge and the factory takes it up straight away. Issues whose author may not file factory issues are shown but cannot be queued. The list is read from the forge (cached for a minute) and follows the project dropdown.
|
||||||
|
- **Factory: cards are tinted by status** – a faint background and border colour per state (review, question, approved, build, acceptance, failed, done), taken from the theme's own colours.
|
||||||
|
|
||||||
## [v202611-00068] – 2026-11-20
|
## [v202611-00068] – 2026-11-20
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img alt="Version v202611-00068" src="https://img.shields.io/badge/version-v202611--00068-d69e2e?style=flat-square">
|
<img alt="Version v202611-00071" src="https://img.shields.io/badge/version-v202611--00071-d69e2e?style=flat-square">
|
||||||
<img alt="License: MIT" src="https://img.shields.io/badge/license-MIT-689d6a?style=flat-square">
|
<img alt="License: MIT" src="https://img.shields.io/badge/license-MIT-689d6a?style=flat-square">
|
||||||
<img alt="Rust backend" src="https://img.shields.io/badge/backend-Rust-b7410e?style=flat-square&logo=rust">
|
<img alt="Rust backend" src="https://img.shields.io/badge/backend-Rust-b7410e?style=flat-square&logo=rust">
|
||||||
<img alt="React PWA" src="https://img.shields.io/badge/frontend-React%20PWA-2d81ff?style=flat-square&logo=react">
|
<img alt="React PWA" src="https://img.shields.io/badge/frontend-React%20PWA-2d81ff?style=flat-square&logo=react">
|
||||||
@@ -332,6 +332,17 @@ 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
|
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.
|
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
|
||||||
|
who are not allowed to file factory issues are shown but cannot be queued. Cards are tinted by
|
||||||
|
status.
|
||||||
|
|
||||||
**Files in the repository** (all optional, kept in `.factory/`):
|
**Files in the repository** (all optional, kept in `.factory/`):
|
||||||
|
|
||||||
| File | Purpose |
|
| File | Purpose |
|
||||||
|
|||||||
+114
@@ -143,6 +143,33 @@ pub struct App {
|
|||||||
pending_note: Option<oneshot::Receiver<Result<String>>>,
|
pending_note: Option<oneshot::Receiver<Result<String>>>,
|
||||||
/// The factory issue ("repo#number") whose actions are open.
|
/// The factory issue ("repo#number") whose actions are open.
|
||||||
factory_key: String,
|
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:<id>" or "local:<id>" 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<oneshot::Receiver<Result<String>>>,
|
||||||
|
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] = &["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
|
const SPINNER: &[&str] = &["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
|
||||||
@@ -316,6 +343,7 @@ impl App {
|
|||||||
dialog: Dialog::None,
|
dialog: Dialog::None,
|
||||||
todos: session.todos.clone(),
|
todos: session.todos.clone(),
|
||||||
context: session.context_tokens,
|
context: session.context_tokens,
|
||||||
|
draft: DraftSync::new(),
|
||||||
session,
|
session,
|
||||||
effort: None,
|
effort: None,
|
||||||
images: vec![],
|
images: vec![],
|
||||||
@@ -1441,7 +1469,93 @@ impl App {
|
|||||||
self.status = "loading models…".into();
|
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) {
|
fn poll_pending(&mut self) {
|
||||||
|
self.poll_draft();
|
||||||
self.poll_remote();
|
self.poll_remote();
|
||||||
if let Some(rx) = &mut self.pending_detect {
|
if let Some(rx) = &mut self.pending_detect {
|
||||||
if let Ok(found) = rx.try_recv() {
|
if let Ok(found) = rx.try_recv() {
|
||||||
|
|||||||
@@ -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(|_| ())
|
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<String> {
|
||||||
|
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<()> {
|
pub async fn abort(server: &Server, id: &str) -> Result<()> {
|
||||||
server.post(&format!("/sessions/{id}/abort"), json!({})).await.map(|_| ())
|
server.post(&format!("/sessions/{id}/abort"), json!({})).await.map(|_| ())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,6 +74,11 @@ impl Server {
|
|||||||
Ok(check(resp).await?.json().await?)
|
Ok(check(resp).await?.json().await?)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub async fn put(&self, path: &str, body: Value) -> Result<Value> {
|
||||||
|
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<Value> {
|
pub async fn post(&self, path: &str, body: Value) -> Result<Value> {
|
||||||
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))?;
|
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?)
|
Ok(check(resp).await?.json().await?)
|
||||||
|
|||||||
@@ -96,6 +96,7 @@ pub fn router(app: AppState) -> Router {
|
|||||||
.route("/sessions/{id}/compact", post(compact))
|
.route("/sessions/{id}/compact", post(compact))
|
||||||
.route("/sessions/{id}/rewind", post(rewind))
|
.route("/sessions/{id}/rewind", post(rewind))
|
||||||
.route("/sessions/{id}/job-draft", post(job_draft))
|
.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("/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}/project-defaults", get(get_project_defaults).put(put_project_defaults).delete(delete_project_defaults))
|
||||||
.route("/sessions/{id}/check", get(get_check).put(put_check))
|
.route("/sessions/{id}/check", get(get_check).put(put_check))
|
||||||
@@ -168,6 +169,9 @@ pub fn router(app: AppState) -> Router {
|
|||||||
.route("/account/factory", get(get_factory).put(put_factory))
|
.route("/account/factory", get(get_factory).put(put_factory))
|
||||||
.route("/account/factory/test", post(test_factory))
|
.route("/account/factory/test", post(test_factory))
|
||||||
.route("/factory/overview", get(factory_overview))
|
.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/poll", post(factory_poll))
|
||||||
.route("/factory/issues/restart", post(factory_restart))
|
.route("/factory/issues/restart", post(factory_restart))
|
||||||
.route("/factory/issue-chats", post(factory_new_issue_chat))
|
.route("/factory/issue-chats", post(factory_new_issue_chat))
|
||||||
@@ -1658,6 +1662,27 @@ async fn reply_permission(Extension(user): Extension<User>, State(app): State<Ap
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Instructions for an automation drafted from this chat (small model); the client creates the job.
|
/// Instructions for an automation drafted from this chat (small model); the client creates the job.
|
||||||
|
/// The unsent message of this chat (typed on any device).
|
||||||
|
async fn get_composer_draft(Extension(user): Extension<User>, State(app): State<AppState>, Path(id): Path<String>) -> 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<User>, State(app): State<AppState>, Path(id): Path<String>, Json(b): Json<ComposerDraft>) -> 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<User>, State(app): State<AppState>, Path(id): Path<String>) -> ApiResult {
|
async fn job_draft(Extension(user): Extension<User>, State(app): State<AppState>, Path(id): Path<String>) -> ApiResult {
|
||||||
let s = writable(&app, &user, &id)?;
|
let s = writable(&app, &user, &id)?;
|
||||||
let (name, prompt) = runner::draft_job(&app, &s).await.map_err(|e| ApiError(StatusCode::BAD_GATEWAY, format!("{e:#}")))?;
|
let (name, prompt) = runner::draft_job(&app, &s).await.map_err(|e| ApiError(StatusCode::BAD_GATEWAY, format!("{e:#}")))?;
|
||||||
@@ -2749,11 +2774,125 @@ async fn factory_overview(Extension(user): Extension<User>, State(app): State<Ap
|
|||||||
"area": app.factory_dir().is_some(),
|
"area": app.factory_dir().is_some(),
|
||||||
"repos": repos,
|
"repos": repos,
|
||||||
"issues": app.store.factory_issues(&user.id)?,
|
"issues": app.store.factory_issues(&user.id)?,
|
||||||
|
"power": factory_power_json(&app, &user),
|
||||||
"runs": app.store.factory_runs(&user.id, None, None, 300)?,
|
"runs": app.store.factory_runs(&user.id, None, None, 300)?,
|
||||||
"releases": app.store.factory_releases(&user.id, 10)?,
|
"releases": app.store.factory_releases(&user.id, 10)?,
|
||||||
})))
|
})))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn factory_power_json(app: &App, user: &User) -> Value {
|
||||||
|
let on = app.store.user_setting::<crate::factory::Power>(&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<User>, State(app): State<AppState>, headers: axum::http::HeaderMap, Json(b): Json<PowerBody>) -> 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::Mutex<std::collections::HashMap<String, (std::time::Instant, Vec<Value>)>>> = std::sync::OnceLock::new();
|
||||||
|
|
||||||
|
#[derive(Deserialize)]
|
||||||
|
struct BacklogQuery {
|
||||||
|
#[serde(default)]
|
||||||
|
refresh: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The backlog: open issues of the configured repositories that are not in the factory yet.
|
||||||
|
async fn factory_backlog(Extension(user): Extension<User>, State(app): State<AppState>, Query(q): Query<BacklogQuery>) -> ApiResult {
|
||||||
|
let s: crate::factory::FactorySettings = app.store.user_setting(&user.id, "factory")?;
|
||||||
|
let cache = BACKLOG_CACHE.get_or_init(Default::default);
|
||||||
|
let tracked_all = app.store.factory_issues(&user.id)?;
|
||||||
|
let (mut issues, mut errors) = (Vec::new(), Vec::new());
|
||||||
|
for cfg in s.repos.iter().filter(|r| r.enabled).map(|r| s.resolve(r)).filter(|r| !r.token.is_empty()) {
|
||||||
|
let key = format!("{}|{}", user.id, cfg.url);
|
||||||
|
let cached = cache.lock().unwrap().get(&key).filter(|(t, _)| !q.refresh && t.elapsed().as_secs() < 60).map(|(_, v)| v.clone());
|
||||||
|
let result = async {
|
||||||
|
let g = crate::factory::Forge::new(&cfg)?;
|
||||||
|
let open = match cached {
|
||||||
|
Some(v) => v,
|
||||||
|
None => {
|
||||||
|
let v = g.open_issues().await?;
|
||||||
|
cache.lock().unwrap().insert(key.clone(), (std::time::Instant::now(), v.clone()));
|
||||||
|
v
|
||||||
|
}
|
||||||
|
};
|
||||||
|
let allowed = crate::factory::allowed_authors(&g, &cfg).await?;
|
||||||
|
let tracked: Vec<i64> = tracked_all.iter().filter(|r| r["repo"].as_str() == Some(cfg.url.as_str())).map(|r| r["number"].as_i64().unwrap_or(0)).collect();
|
||||||
|
anyhow::Ok(crate::factory::backlog_of(&cfg, &open, &tracked, &allowed))
|
||||||
|
}
|
||||||
|
.await;
|
||||||
|
match result {
|
||||||
|
Ok(v) => issues.extend(v),
|
||||||
|
Err(e) => errors.push(format!("{}: {e:#}", cfg.url)),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Ok(Json(json!({"issues": issues, "errors": errors})))
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Deserialize)]
|
||||||
|
struct Enqueue {
|
||||||
|
repo: String,
|
||||||
|
numbers: Vec<i64>,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Put backlog issues into the process: give them the factory label, the next poll picks them up.
|
||||||
|
async fn factory_enqueue(Extension(user): Extension<User>, State(app): State<AppState>, headers: axum::http::HeaderMap, Json(b): Json<Enqueue>) -> ApiResult {
|
||||||
|
let cfg = factory_repo_cfg(&app, &user, &b.repo)?;
|
||||||
|
if b.numbers.is_empty() || b.numbers.len() > 100 {
|
||||||
|
return Err(ApiError(StatusCode::BAD_REQUEST, "1 to 100 issues".into()));
|
||||||
|
}
|
||||||
|
let bad = |e: anyhow::Error| ApiError(StatusCode::BAD_GATEWAY, format!("{e:#}"));
|
||||||
|
let g = crate::factory::Forge::new(&cfg).map_err(bad)?;
|
||||||
|
let allowed = crate::factory::allowed_authors(&g, &cfg).await.map_err(bad)?;
|
||||||
|
let open = g.open_issues().await.map_err(bad)?;
|
||||||
|
g.ensure_labels().await.map_err(bad)?;
|
||||||
|
let (mut queued, mut errors) = (Vec::new(), Vec::new());
|
||||||
|
for n in b.numbers {
|
||||||
|
let Some(issue) = open.iter().find(|i| crate::factory::issue_no(i) == n) else {
|
||||||
|
errors.push(json!({"number": n, "error": "not an open issue of this repository"}));
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
let author = issue["user"]["login"].as_str().unwrap_or("");
|
||||||
|
if !allowed.iter().any(|a| a.eq_ignore_ascii_case(author)) {
|
||||||
|
errors.push(json!({"number": n, "error": format!("the author {author} is not allowed to file factory issues (see the repository settings)")}));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
match g.add_label(n as u64, &cfg.label).await {
|
||||||
|
Ok(()) => queued.push(n),
|
||||||
|
Err(e) => errors.push(json!({"number": n, "error": format!("{e:#}")})),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
BACKLOG_CACHE.get_or_init(Default::default).lock().unwrap().remove(&format!("{}|{}", user.id, cfg.url));
|
||||||
|
app.audit(Some(&user), "factory.backlog.enqueue", &format!("{} {:?}", b.repo, queued), &crate::auth::client_ip(&headers));
|
||||||
|
// Take the issues up right away instead of waiting for the next poll.
|
||||||
|
if !queued.is_empty() {
|
||||||
|
let (app2, user2) = (app.clone(), user.clone());
|
||||||
|
tokio::spawn(async move {
|
||||||
|
let _ = crate::factory::poll_repo(&app2, &user2, &cfg).await;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
Ok(Json(json!({"queued": queued, "errors": errors})))
|
||||||
|
}
|
||||||
|
|
||||||
/// Look for new issues right now instead of waiting for the next poll.
|
/// Look for new issues right now instead of waiting for the next poll.
|
||||||
async fn factory_poll(Extension(user): Extension<User>, State(app): State<AppState>) -> ApiResult {
|
async fn factory_poll(Extension(user): Extension<User>, State(app): State<AppState>) -> ApiResult {
|
||||||
let s: crate::factory::FactorySettings = app.store.user_setting(&user.id, "factory")?;
|
let s: crate::factory::FactorySettings = app.store.user_setting(&user.id, "factory")?;
|
||||||
|
|||||||
+124
-4
@@ -17,6 +17,28 @@ pub const FACTORY_FOLDER: &str = "Factory";
|
|||||||
|
|
||||||
pub const PHASES: [&str; 3] = ["review", "build", "qa"];
|
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.
|
/// Status labels of an issue, in the order of the workflow.
|
||||||
pub const STATUS_LABELS: [(&str, &str); 9] = [
|
pub const STATUS_LABELS: [(&str, &str); 9] = [
|
||||||
("factory", "0e8a16"),
|
("factory", "0e8a16"),
|
||||||
@@ -556,6 +578,49 @@ impl Forge {
|
|||||||
Ok(out)
|
Ok(out)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// All open issues (pull requests excluded), up to 200, in the shape of `issues()`.
|
||||||
|
pub async fn open_issues(&self) -> Result<Vec<Value>> {
|
||||||
|
let mut out = Vec::new();
|
||||||
|
for page in 1..=4 {
|
||||||
|
let url = match self.kind {
|
||||||
|
Kind::Gitea => self.rp(&format!("/issues?state=open&type=issues&limit=50&page={page}")),
|
||||||
|
Kind::Github => self.rp(&format!("/issues?state=open&per_page=50&page={page}")),
|
||||||
|
Kind::Gitlab => self.rp(&format!("/issues?state=opened&per_page=50&page={page}")),
|
||||||
|
};
|
||||||
|
let v = self.call(reqwest::Method::GET, url, None).await?;
|
||||||
|
let a = v.as_array().cloned().unwrap_or_default();
|
||||||
|
let n = a.len();
|
||||||
|
for i in a {
|
||||||
|
if !i.get("pull_request").map_or(true, |p| p.is_null()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
out.push(if self.kind == Kind::Gitlab { norm_gitlab_issue(&i) } else { i });
|
||||||
|
}
|
||||||
|
if n < 50 {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Ok(out)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Add one label to an issue without touching its other labels.
|
||||||
|
pub async fn add_label(&self, issue: u64, name: &str) -> Result<()> {
|
||||||
|
match self.kind {
|
||||||
|
Kind::Gitea => {
|
||||||
|
let all = self.label_names().await?;
|
||||||
|
let id = all.iter().find(|l| l["name"].as_str() == Some(name)).map(|l| l["id"].clone()).with_context(|| format!("label {name} does not exist"))?;
|
||||||
|
self.call(reqwest::Method::POST, self.rp(&format!("/issues/{issue}/labels")), Some(json!({"labels": [id]}))).await?;
|
||||||
|
}
|
||||||
|
Kind::Github => {
|
||||||
|
self.call(reqwest::Method::POST, self.rp(&format!("/issues/{issue}/labels")), Some(json!({"labels": [name]}))).await?;
|
||||||
|
}
|
||||||
|
Kind::Gitlab => {
|
||||||
|
self.call(reqwest::Method::PUT, self.rp(&format!("/issues/{issue}")), Some(json!({"add_labels": name}))).await?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
/// Is the issue still open on the forge?
|
/// Is the issue still open on the forge?
|
||||||
pub async fn issue_is_open(&self, number: u64) -> Result<bool> {
|
pub async fn issue_is_open(&self, number: u64) -> Result<bool> {
|
||||||
let v = self.call(reqwest::Method::GET, self.rp(&format!("/issues/{number}")), None).await?;
|
let v = self.call(reqwest::Method::GET, self.rp(&format!("/issues/{number}")), None).await?;
|
||||||
@@ -738,7 +803,12 @@ impl Forge {
|
|||||||
|
|
||||||
/// GitLab issue → {number, title, body, user.login, html_url}.
|
/// GitLab issue → {number, title, body, user.login, html_url}.
|
||||||
fn norm_gitlab_issue(i: &Value) -> Value {
|
fn norm_gitlab_issue(i: &Value) -> Value {
|
||||||
json!({"number": i["iid"], "title": i["title"], "body": i["description"], "user": {"login": i["author"]["username"]}, "html_url": i["web_url"]})
|
json!({"number": i["iid"], "title": i["title"], "body": i["description"], "user": {"login": i["author"]["username"]}, "html_url": i["web_url"], "labels": i["labels"]})
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Label names of an issue (Gitea/GitHub: objects with a name, GitLab: plain strings).
|
||||||
|
pub fn issue_labels(i: &Value) -> Vec<String> {
|
||||||
|
i["labels"].as_array().map(|a| a.iter().filter_map(|l| l["name"].as_str().or_else(|| l.as_str()).map(String::from)).collect()).unwrap_or_default()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn urlenc(s: &str) -> String {
|
fn urlenc(s: &str) -> String {
|
||||||
@@ -1396,6 +1466,33 @@ pub(crate) async fn alert(app: &App, repo: &str, n: i64, what: &str, detail: &st
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// One pass over a repository: take up new issues, restart reviews after answers.
|
/// One pass over a repository: take up new issues, restart reviews after answers.
|
||||||
|
/// Who may file issues for the factory: the configured users, by default the token's owner.
|
||||||
|
pub async fn allowed_authors(g: &Forge, cfg: &RepoCfg) -> Result<Vec<String>> {
|
||||||
|
let mut allowed = cfg.allowed_users.clone();
|
||||||
|
if allowed.is_empty() {
|
||||||
|
allowed.push(g.login().await?);
|
||||||
|
}
|
||||||
|
Ok(allowed)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Open issues of the forge that are not in the factory (yet): the backlog.
|
||||||
|
/// `open` is the forge's list of open issues, `tracked` the issue numbers the factory already knows.
|
||||||
|
pub fn backlog_of(cfg: &RepoCfg, open: &[Value], tracked: &[i64], allowed: &[String]) -> Vec<Value> {
|
||||||
|
open.iter()
|
||||||
|
.filter_map(|i| {
|
||||||
|
let n = issue_no(i);
|
||||||
|
let author = i["user"]["login"].as_str().unwrap_or("");
|
||||||
|
let ok = allowed.iter().any(|a| a.eq_ignore_ascii_case(author));
|
||||||
|
let labelled = issue_labels(i).iter().any(|l| l == &cfg.label);
|
||||||
|
// Labelled issues of allowed authors are taken up by the next poll anyway.
|
||||||
|
if n == 0 || tracked.contains(&n) || (labelled && ok) {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
Some(json!({"repo": cfg.url, "number": n, "title": i["title"], "author": author, "url": i["html_url"], "allowed": ok, "labels": issue_labels(i)}))
|
||||||
|
})
|
||||||
|
.collect()
|
||||||
|
}
|
||||||
|
|
||||||
pub async fn poll_repo(app: &Arc<App>, user: &User, cfg: &RepoCfg) -> Result<()> {
|
pub async fn poll_repo(app: &Arc<App>, user: &User, cfg: &RepoCfg) -> Result<()> {
|
||||||
let g = Forge::new(cfg)?;
|
let g = Forge::new(cfg)?;
|
||||||
let mut allowed = cfg.allowed_users.clone();
|
let mut allowed = cfg.allowed_users.clone();
|
||||||
@@ -1403,6 +1500,7 @@ pub async fn poll_repo(app: &Arc<App>, user: &User, cfg: &RepoCfg) -> Result<()>
|
|||||||
allowed.push(g.login().await?);
|
allowed.push(g.login().await?);
|
||||||
}
|
}
|
||||||
let issues = g.issues(&cfg.label).await?;
|
let issues = g.issues(&cfg.label).await?;
|
||||||
|
let power_on = app.store.user_setting::<Power>(&user.id, "factory_power").unwrap_or_default().on;
|
||||||
for issue in issues {
|
for issue in issues {
|
||||||
let n = issue_no(&issue);
|
let n = issue_no(&issue);
|
||||||
let author = issue["user"]["login"].as_str().unwrap_or("");
|
let author = issue["user"]["login"].as_str().unwrap_or("");
|
||||||
@@ -1423,7 +1521,7 @@ pub async fn poll_repo(app: &Arc<App>, user: &User, cfg: &RepoCfg) -> Result<()>
|
|||||||
}
|
}
|
||||||
"approved" | "rework" => {
|
"approved" | "rework" => {
|
||||||
let feedback = if state == "rework" { row["note"].as_str().unwrap_or("").to_string() } else { String::new() };
|
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();
|
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"))])?;
|
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));
|
tokio::spawn(build(app.clone(), user.clone(), cfg.clone(), issue, comments, feedback));
|
||||||
@@ -1431,7 +1529,7 @@ pub async fn poll_repo(app: &Arc<App>, user: &User, cfg: &RepoCfg) -> Result<()>
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
"qa" => {
|
"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))])?;
|
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.
|
// 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"))])?;
|
app.store.factory_issue_set(&cfg.url, n, &[("state", json!("testing"))])?;
|
||||||
@@ -1441,7 +1539,7 @@ pub async fn poll_repo(app: &Arc<App>, user: &User, cfg: &RepoCfg) -> Result<()>
|
|||||||
}
|
}
|
||||||
_ => false,
|
_ => 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;
|
continue;
|
||||||
}
|
}
|
||||||
if comments.is_empty() {
|
if comments.is_empty() {
|
||||||
@@ -1832,6 +1930,28 @@ pub async fn create_project(app: &Arc<App>, user: &User, settings: &mut FactoryS
|
|||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
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");
|
||||||
|
let issue = |n: i64, author: &str, labels: &[&str]| json!({"number": n, "title": format!("t{n}"), "user": {"login": author}, "html_url": "u", "labels": labels.iter().map(|l| json!({"name": l})).collect::<Vec<_>>()});
|
||||||
|
let open = vec![issue(1, "me", &[]), issue(2, "me", &[&cfg.label]), issue(3, "me", &["bug"]), issue(4, "stranger", &[&cfg.label]), issue(5, "me", &[])];
|
||||||
|
let b = backlog_of(&cfg, &open, &[5], &["ME".to_string()]);
|
||||||
|
let nums: Vec<i64> = b.iter().map(|i| i["number"].as_i64().unwrap()).collect();
|
||||||
|
// 2 is labelled by an allowed author (the poll takes it), 5 is tracked; 4 stays visible but not allowed.
|
||||||
|
assert_eq!(nums, vec![1, 3, 4]);
|
||||||
|
assert_eq!(b[2]["allowed"], false);
|
||||||
|
assert_eq!(issue_labels(&json!({"labels": ["a", {"name": "b"}]})), vec!["a", "b"]);
|
||||||
|
}
|
||||||
|
|
||||||
fn repo(url: &str) -> RepoCfg {
|
fn repo(url: &str) -> RepoCfg {
|
||||||
serde_json::from_value(json!({"url": url, "token": "tok"})).unwrap()
|
serde_json::from_value(json!({"url": url, "token": "tok"})).unwrap()
|
||||||
}
|
}
|
||||||
|
|||||||
+67
-1
@@ -125,6 +125,13 @@ impl Store {
|
|||||||
last_status TEXT,
|
last_status TEXT,
|
||||||
created_at INTEGER NOT NULL
|
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 (
|
CREATE TABLE IF NOT EXISTS user_settings (
|
||||||
user_id TEXT NOT NULL,
|
user_id TEXT NOT NULL,
|
||||||
key TEXT NOT NULL,
|
key TEXT NOT NULL,
|
||||||
@@ -1569,13 +1576,42 @@ impl Store {
|
|||||||
Ok(rows.filter_map(|r| r.ok()).collect())
|
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<Option<(String, i64)>> {
|
||||||
|
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<i64> {
|
||||||
|
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<Vec<Value>> {
|
pub fn factory_issues(&self, owner: &str) -> Result<Vec<Value>> {
|
||||||
let nums: Vec<(String, i64)> = {
|
let nums: Vec<(String, i64)> = {
|
||||||
let conn = self.conn.lock().unwrap();
|
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")?;
|
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()
|
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<Value> = 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<()> {
|
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))?)
|
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<i64> {
|
||||||
|
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).
|
/// Runs with token and cost totals (joined from the usage table).
|
||||||
pub fn factory_runs(&self, owner: &str, repo: Option<&str>, issue: Option<i64>, limit: i64) -> Result<Vec<Value>> {
|
pub fn factory_runs(&self, owner: &str, repo: Option<&str>, issue: Option<i64>, limit: i64) -> Result<Vec<Value>> {
|
||||||
let conn = self.conn.lock().unwrap();
|
let conn = self.conn.lock().unwrap();
|
||||||
@@ -2022,3 +2063,28 @@ mod link_tests {
|
|||||||
std::fs::remove_dir_all(&dir).unwrap();
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
-1
@@ -128,7 +128,7 @@ export function App() {
|
|||||||
);
|
);
|
||||||
else if (section === "settings") content = <Settings tab={arg} onMenu={openMenu} />;
|
else if (section === "settings") content = <Settings tab={arg} onMenu={openMenu} />;
|
||||||
else if (section === "p" && arg) content = <ProjectPage key={arg} cwd={decodeURIComponent(arg)} onMenu={openMenu} />;
|
else if (section === "p" && arg) content = <ProjectPage key={arg} cwd={decodeURIComponent(arg)} onMenu={openMenu} />;
|
||||||
else if (section === "factory") content = <Factory onMenu={openMenu} />;
|
else if (section === "factory") content = <Factory onMenu={openMenu} overlayId={arg === "s" ? route[2] : undefined} />;
|
||||||
else if (section === "stats") content = <Stats onMenu={openMenu} />;
|
else if (section === "stats") content = <Stats onMenu={openMenu} />;
|
||||||
else if (section === "images") content = <Images onMenu={openMenu} />;
|
else if (section === "images") content = <Images onMenu={openMenu} />;
|
||||||
else if (section === "jobs" && arg) content = <JobEditor key={arg} id={arg} onMenu={openMenu} />;
|
else if (section === "jobs" && arg) content = <JobEditor key={arg} id={arg} onMenu={openMenu} />;
|
||||||
|
|||||||
@@ -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<string | null>(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 }) {
|
export function ChatView({ sessionId, onMenu, onClosePane }: { sessionId: string; onMenu: () => void; onClosePane?: () => void }) {
|
||||||
const t = useT();
|
const t = useT();
|
||||||
const session = useStore((s) => s.sessionById[sessionId]);
|
const session = useStore((s) => s.sessionById[sessionId]);
|
||||||
@@ -572,6 +623,7 @@ export function ChatView({ sessionId, onMenu, onClosePane }: { sessionId: string
|
|||||||
const models = useModels();
|
const models = useModels();
|
||||||
const [loadError, setLoadError] = useState<string>();
|
const [loadError, setLoadError] = useState<string>();
|
||||||
const [text, setText] = useState(() => takePrefill(sessionId) ?? "");
|
const [text, setText] = useState(() => takePrefill(sessionId) ?? "");
|
||||||
|
useDraftSync(sessionId, text, setText, readOnly);
|
||||||
const [stats, setStats] = useState<SessionStats>();
|
const [stats, setStats] = useState<SessionStats>();
|
||||||
const [showStats, setShowStats] = useState(false);
|
const [showStats, setShowStats] = useState(false);
|
||||||
const [editingTitle, setEditingTitle] = useState(false);
|
const [editingTitle, setEditingTitle] = useState(false);
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { Icon } from "./Icon";
|
|||||||
import { Spinner } from "./Activity";
|
import { Spinner } from "./Activity";
|
||||||
import { ModelSelect } from "./ModelSelect";
|
import { ModelSelect } from "./ModelSelect";
|
||||||
import { RecreateDialog } from "./FactoryDraft";
|
import { RecreateDialog } from "./FactoryDraft";
|
||||||
|
import { ChatOverlay, openFactoryChat } from "./FactoryChat";
|
||||||
import { ReleaseDialog, ReleasesPanel, type ReleaseRow } from "./FactoryRelease";
|
import { ReleaseDialog, ReleasesPanel, type ReleaseRow } from "./FactoryRelease";
|
||||||
|
|
||||||
interface PrInfo {
|
interface PrInfo {
|
||||||
@@ -76,9 +77,21 @@ interface Issue {
|
|||||||
pr_url: string;
|
pr_url: string;
|
||||||
branch: string;
|
branch: string;
|
||||||
rounds: number;
|
rounds: number;
|
||||||
|
/** Newest phase chat that still exists. */
|
||||||
|
chat_session?: string;
|
||||||
|
chat_phase?: Phase;
|
||||||
created_at: number;
|
created_at: number;
|
||||||
updated_at: number;
|
updated_at: number;
|
||||||
}
|
}
|
||||||
|
interface BacklogIssue {
|
||||||
|
repo: string;
|
||||||
|
number: number;
|
||||||
|
title: string;
|
||||||
|
author: string;
|
||||||
|
url: string;
|
||||||
|
allowed: boolean;
|
||||||
|
labels: string[];
|
||||||
|
}
|
||||||
interface Run {
|
interface Run {
|
||||||
id: string;
|
id: string;
|
||||||
repo: string;
|
repo: string;
|
||||||
@@ -105,8 +118,15 @@ interface RepoInfo {
|
|||||||
running: number;
|
running: number;
|
||||||
version?: string | null;
|
version?: string | null;
|
||||||
}
|
}
|
||||||
|
interface Power {
|
||||||
|
on: boolean;
|
||||||
|
/** Agents that are working right now. */
|
||||||
|
active: number;
|
||||||
|
state: "running" | "stopping" | "stopped";
|
||||||
|
}
|
||||||
interface Overview {
|
interface Overview {
|
||||||
area: boolean;
|
area: boolean;
|
||||||
|
power?: Power;
|
||||||
repos: RepoInfo[];
|
repos: RepoInfo[];
|
||||||
issues: Issue[];
|
issues: Issue[];
|
||||||
runs: Run[];
|
runs: Run[];
|
||||||
@@ -138,7 +158,7 @@ function fmtDuration(ms: number) {
|
|||||||
const runMs = (r: Run, now: number) => (r.ended_at ?? now) - r.started_at;
|
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. */
|
/** 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 t = useT();
|
||||||
const [tab, setTab] = useState<"overview" | "settings">("overview");
|
const [tab, setTab] = useState<"overview" | "settings">("overview");
|
||||||
return (
|
return (
|
||||||
@@ -159,14 +179,33 @@ export function Factory({ onMenu }: { onMenu: () => void }) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="page">
|
<div className="page">
|
||||||
<div className="page-inner" style={{ maxWidth: 1280 }}>
|
<div className="page-inner" style={{ maxWidth: tab === "overview" ? "none" : 1280 }}>
|
||||||
{tab === "overview" ? <FactoryOverview onSettings={() => setTab("settings")} /> : <FactorySettings />}
|
{tab === "overview" ? <FactoryOverview onSettings={() => setTab("settings")} /> : <FactorySettings />}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{overlayId && <ChatOverlay id={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 (
|
||||||
|
<button type="button" role="switch" aria-checked={power.on} className={`factory-power ${power.state}`} onClick={() => onToggle(!power.on)} title={hint}>
|
||||||
|
<span className="factory-power-track">
|
||||||
|
<span className="factory-power-knob" />
|
||||||
|
</span>
|
||||||
|
<span className="factory-power-text">
|
||||||
|
<b>{label}</b>
|
||||||
|
<span className="hint">{hint}</span>
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function FactoryOverview({ onSettings }: { onSettings: () => void }) {
|
function FactoryOverview({ onSettings }: { onSettings: () => void }) {
|
||||||
const t = useT();
|
const t = useT();
|
||||||
const [data, setData] = useState<Overview>();
|
const [data, setData] = useState<Overview>();
|
||||||
@@ -188,10 +227,21 @@ function FactoryOverview({ onSettings }: { onSettings: () => void }) {
|
|||||||
const [busy, setBusy] = useState(false);
|
const [busy, setBusy] = useState(false);
|
||||||
const [recreate, setRecreate] = useState(false);
|
const [recreate, setRecreate] = useState(false);
|
||||||
|
|
||||||
const reload = () =>
|
const [backlog, setBacklog] = useState<BacklogIssue[]>([]);
|
||||||
get<Overview>("/factory/overview")
|
const [backlogErrors, setBacklogErrors] = useState<string[]>([]);
|
||||||
|
const loadBacklog = (refresh = false) =>
|
||||||
|
get<{ issues: BacklogIssue[]; errors: string[] }>(`/factory/backlog${refresh ? "?refresh=1" : ""}`)
|
||||||
|
.then((r) => {
|
||||||
|
setBacklog(r.issues);
|
||||||
|
setBacklogErrors(r.errors);
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
const reload = () => {
|
||||||
|
void loadBacklog();
|
||||||
|
return get<Overview>("/factory/overview")
|
||||||
.then(setData)
|
.then(setData)
|
||||||
.catch((e) => toast(e.message));
|
.catch((e) => toast(e.message));
|
||||||
|
};
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
void reload();
|
void reload();
|
||||||
const h = setInterval(() => {
|
const h = setInterval(() => {
|
||||||
@@ -263,6 +313,24 @@ function FactoryOverview({ onSettings }: { onSettings: () => void }) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const issues = useMemo(() => (data?.issues ?? []).filter((i) => !repo || i.repo === repo), [data, repo]);
|
const issues = useMemo(() => (data?.issues ?? []).filter((i) => !repo || i.repo === repo), [data, repo]);
|
||||||
|
const backlogShown = useMemo(() => backlog.filter((i) => !repo || i.repo === repo), [backlog, repo]);
|
||||||
|
/** Put backlog issues into the process (they get the factory label on the forge). */
|
||||||
|
const enqueue = async (items: BacklogIssue[]) => {
|
||||||
|
if (items.length === 0) return;
|
||||||
|
if (items.length > 1 && !(await confirmDialog({ message: t("factory.backlog.allConfirm", { n: items.length }), confirmLabel: t("factory.backlog.queueAll") }))) return;
|
||||||
|
setBusy(true);
|
||||||
|
try {
|
||||||
|
for (const r of [...new Set(items.map((i) => i.repo))]) {
|
||||||
|
const res = await post<{ queued: number[]; errors: { number: number; error: string }[] }>("/factory/backlog/enqueue", { repo: r, numbers: items.filter((i) => i.repo === r).map((i) => i.number) });
|
||||||
|
for (const e of res.errors) toast(`#${e.number}: ${e.error}`);
|
||||||
|
}
|
||||||
|
} catch (e: any) {
|
||||||
|
toast(e.message);
|
||||||
|
}
|
||||||
|
setBusy(false);
|
||||||
|
await loadBacklog(true);
|
||||||
|
await reload();
|
||||||
|
};
|
||||||
const runs = useMemo(() => (data?.runs ?? []).filter((r) => !repo || r.repo === repo), [data, repo]);
|
const runs = useMemo(() => (data?.runs ?? []).filter((r) => !repo || r.repo === repo), [data, repo]);
|
||||||
const selected = issues.find((i) => `${i.repo}#${i.number}` === sel);
|
const selected = issues.find((i) => `${i.repo}#${i.number}` === sel);
|
||||||
const [pr, setPr] = useState<PrInfo | null>(null);
|
const [pr, setPr] = useState<PrInfo | null>(null);
|
||||||
@@ -379,10 +447,21 @@ function FactoryOverview({ onSettings }: { onSettings: () => void }) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
const phaseRunning = !!selected && ["review", "building", "testing"].includes(selected.state);
|
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<Power>("/factory/power", { on });
|
||||||
|
setData((d) => (d ? { ...d, power } : d));
|
||||||
|
void reload();
|
||||||
|
} catch (e: any) {
|
||||||
|
toast(e.message);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{!data.area && <div className="notice err">{t("factory.noArea")}</div>}
|
{!data.area && <div className="notice err">{t("factory.noArea")}</div>}
|
||||||
|
{data.power && <PowerSwitch power={data.power} onToggle={(on) => void setPower(on)} />}
|
||||||
<div className="kpis">
|
<div className="kpis">
|
||||||
<div className="kpi">
|
<div className="kpi">
|
||||||
<div className="k-label">{t("factory.kpi.running")}</div>
|
<div className="k-label">{t("factory.kpi.running")}</div>
|
||||||
@@ -462,6 +541,31 @@ function FactoryOverview({ onSettings }: { onSettings: () => void }) {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="factory-board">
|
<div className="factory-board">
|
||||||
|
<div className="factory-col backlog">
|
||||||
|
<h4>
|
||||||
|
{t("factory.col.backlog")} <span className="chip">{backlogShown.length}</span>
|
||||||
|
</h4>
|
||||||
|
{backlogShown.length > 1 && (
|
||||||
|
<button className="small" onClick={() => void enqueue(backlogShown.filter((i) => i.allowed))} disabled={busy || !backlogShown.some((i) => i.allowed)} title={t("factory.backlog.queueAllHint")}>
|
||||||
|
<Icon name="plus" /> {t("factory.backlog.queueAll")}
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
{backlogShown.map((i) => (
|
||||||
|
<div key={`${i.repo}#${i.number}`} className="factory-card backlog">
|
||||||
|
<span className="hint">
|
||||||
|
{repoName(i.repo)} #{i.number} · {i.author}
|
||||||
|
</span>
|
||||||
|
<a href={i.url || issueUrl(i.repo, i.number)} target="_blank" rel="noreferrer" title={i.title}>
|
||||||
|
<b>{i.title || `#${i.number}`}</b>
|
||||||
|
</a>
|
||||||
|
<button className="small" onClick={() => void enqueue([i])} disabled={busy || !i.allowed} title={i.allowed ? t("factory.backlog.queueHint") : t("factory.backlog.notAllowed", { user: i.author })}>
|
||||||
|
<Icon name="plus" /> {t("factory.backlog.queue")}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
{backlogShown.length === 0 && <span className="hint">{t("factory.backlog.empty")}</span>}
|
||||||
|
{backlogErrors.length > 0 && <span className="hint" title={backlogErrors.join("\n")}>{t("factory.backlog.error")}</span>}
|
||||||
|
</div>
|
||||||
{COLUMNS.map((c) => {
|
{COLUMNS.map((c) => {
|
||||||
const cards = issues.filter((i) => c.states.includes(i.state));
|
const cards = issues.filter((i) => c.states.includes(i.state));
|
||||||
return (
|
return (
|
||||||
@@ -475,9 +579,33 @@ function FactoryOverview({ onSettings }: { onSettings: () => void }) {
|
|||||||
const latest = active ?? rs[0];
|
const latest = active ?? rs[0];
|
||||||
const tokens = rs.reduce((a, r) => a + r.input_tokens + r.output_tokens, 0);
|
const tokens = rs.reduce((a, r) => a + r.input_tokens + r.output_tokens, 0);
|
||||||
return (
|
return (
|
||||||
<button key={`${i.repo}#${i.number}`} className={`factory-card ${sel === `${i.repo}#${i.number}` ? "active" : ""} ${active ? "running" : ""}`} onClick={() => setSel(sel === `${i.repo}#${i.number}` ? "" : `${i.repo}#${i.number}`)}>
|
<button key={`${i.repo}#${i.number}`} data-state={i.state} className={`factory-card ${sel === `${i.repo}#${i.number}` ? "active" : ""} ${active ? "running" : ""}`} onClick={() => setSel(sel === `${i.repo}#${i.number}` ? "" : `${i.repo}#${i.number}`)}>
|
||||||
<span className="hint">
|
<span className="factory-card-head">
|
||||||
{repoName(i.repo)} #{i.number}
|
<span className="hint">
|
||||||
|
{repoName(i.repo)} #{i.number}
|
||||||
|
</span>
|
||||||
|
{i.chat_session && (
|
||||||
|
<span
|
||||||
|
role="link"
|
||||||
|
tabIndex={0}
|
||||||
|
className="factory-open"
|
||||||
|
title={`${t("factory.openChat")}: ${t(`factory.phase.${i.chat_phase ?? "review"}` as any)}`}
|
||||||
|
aria-label={t("factory.openChat")}
|
||||||
|
onClick={(e) => {
|
||||||
|
e.stopPropagation();
|
||||||
|
openFactoryChat(i.chat_session!);
|
||||||
|
}}
|
||||||
|
onKeyDown={(e) => {
|
||||||
|
if (e.key === "Enter" || e.key === " ") {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
openFactoryChat(i.chat_session!);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Icon name="eye" />
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
</span>
|
</span>
|
||||||
<b>{i.title || `#${i.number}`}</b>
|
<b>{i.title || `#${i.number}`}</b>
|
||||||
{latest && (
|
{latest && (
|
||||||
@@ -614,7 +742,7 @@ function FactoryOverview({ onSettings }: { onSettings: () => void }) {
|
|||||||
</td>
|
</td>
|
||||||
<td>{fmtCost(r.cost, "USD")}</td>
|
<td>{fmtCost(r.cost, "USD")}</td>
|
||||||
<td>
|
<td>
|
||||||
<button className="small" onClick={() => navigate(`/s/${r.session_id}`)}>
|
<button className="small" onClick={() => openFactoryChat(r.session_id)}>
|
||||||
<Icon name="eye" /> {t("factory.openChat")}
|
<Icon name="eye" /> {t("factory.openChat")}
|
||||||
</button>
|
</button>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@@ -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 (
|
||||||
|
<div className="chat-overlay" onMouseDown={(e) => e.target === e.currentTarget && close()}>
|
||||||
|
<div className="chat-overlay-box" role="dialog" aria-modal="true">
|
||||||
|
<div className="chat-overlay-bar">
|
||||||
|
<span className="hint">{t("factory.chatOverlay")}</span>
|
||||||
|
<span className="spacer" />
|
||||||
|
<button className="small" onClick={() => navigate(`/s/${id}`)} title={t("factory.openFullHint")}>
|
||||||
|
<Icon name="external" /> {t("factory.openFull")}
|
||||||
|
</button>
|
||||||
|
<button className="small" onClick={close} aria-label={t("common.close")}>
|
||||||
|
<Icon name="close" /> {t("common.close")}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div className="chat-overlay-body">
|
||||||
|
<ChatView key={id} sessionId={id} onMenu={close} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1226,6 +1226,23 @@ export const de: Messages = {
|
|||||||
"factory.repoLine": "{n} Issues · {run} laufen",
|
"factory.repoLine": "{n} Issues · {run} laufen",
|
||||||
"factory.noToken": "kein Token",
|
"factory.noToken": "kein Token",
|
||||||
"factory.pollNow": "Jetzt prüfen",
|
"factory.pollNow": "Jetzt prüfen",
|
||||||
|
"factory.backlog.queue": "Einreihen",
|
||||||
|
"factory.backlog.queueAll": "Alle einreihen",
|
||||||
|
"factory.backlog.queueHint": "Dem Issue das Factory-Label geben, damit es in den Prozess kommt",
|
||||||
|
"factory.backlog.queueAllHint": "Alle Issues dieser Liste einreihen",
|
||||||
|
"factory.backlog.allConfirm": "{n} Issues einreihen? Sie bekommen das Factory-Label im Forge und werden nacheinander geprüft.",
|
||||||
|
"factory.backlog.notAllowed": "{user} darf keine Factory-Issues anlegen (Repository-Einstellungen → erlaubte Nutzer)",
|
||||||
|
"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.review": "Prüfung",
|
||||||
"factory.col.question": "Rückfragen",
|
"factory.col.question": "Rückfragen",
|
||||||
"factory.col.approved": "Freigegeben",
|
"factory.col.approved": "Freigegeben",
|
||||||
|
|||||||
@@ -1225,6 +1225,23 @@ export const en = {
|
|||||||
"factory.repoLine": "{n} issues · {run} running",
|
"factory.repoLine": "{n} issues · {run} running",
|
||||||
"factory.noToken": "no token",
|
"factory.noToken": "no token",
|
||||||
"factory.pollNow": "Check now",
|
"factory.pollNow": "Check now",
|
||||||
|
"factory.backlog.queue": "Queue",
|
||||||
|
"factory.backlog.queueAll": "Queue all",
|
||||||
|
"factory.backlog.queueHint": "Give the issue the factory label so that it enters the process",
|
||||||
|
"factory.backlog.queueAllHint": "Queue all issues of this list",
|
||||||
|
"factory.backlog.allConfirm": "Queue {n} issues? They get the factory label on the forge and are reviewed one after another.",
|
||||||
|
"factory.backlog.notAllowed": "{user} is not allowed to file factory issues (repository settings → allowed users)",
|
||||||
|
"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.review": "Review",
|
||||||
"factory.col.question": "Questions",
|
"factory.col.question": "Questions",
|
||||||
"factory.col.approved": "Approved",
|
"factory.col.approved": "Approved",
|
||||||
|
|||||||
@@ -5107,6 +5107,203 @@ td.fold-indent {
|
|||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
padding: 8px 10px;
|
padding: 8px 10px;
|
||||||
}
|
}
|
||||||
|
/* A faint tint by status, also on the border; --tone is set per state. */
|
||||||
|
.factory-card[data-state] {
|
||||||
|
--tone: var(--muted);
|
||||||
|
border-color: color-mix(in srgb, var(--tone) 50%, var(--bg2));
|
||||||
|
background: color-mix(in srgb, var(--tone) 7%, var(--bg0));
|
||||||
|
}
|
||||||
|
.factory-card[data-state="new"],
|
||||||
|
.factory-card[data-state="review"] {
|
||||||
|
--tone: var(--aqua);
|
||||||
|
}
|
||||||
|
.factory-card[data-state="question"] {
|
||||||
|
--tone: var(--accent);
|
||||||
|
}
|
||||||
|
.factory-card[data-state="approved"] {
|
||||||
|
--tone: var(--blue);
|
||||||
|
}
|
||||||
|
.factory-card[data-state="building"],
|
||||||
|
.factory-card[data-state="rework"] {
|
||||||
|
--tone: var(--purple);
|
||||||
|
}
|
||||||
|
.factory-card[data-state="qa"],
|
||||||
|
.factory-card[data-state="testing"] {
|
||||||
|
--tone: var(--accent2);
|
||||||
|
}
|
||||||
|
.factory-card[data-state="failed"],
|
||||||
|
.factory-card[data-state="rejected"] {
|
||||||
|
--tone: var(--red);
|
||||||
|
}
|
||||||
|
.factory-card[data-state="done"] {
|
||||||
|
--tone: var(--green);
|
||||||
|
}
|
||||||
|
.factory-card.backlog {
|
||||||
|
gap: 4px;
|
||||||
|
border-style: dashed;
|
||||||
|
color: inherit;
|
||||||
|
}
|
||||||
|
.factory-card.backlog {
|
||||||
|
min-width: 0;
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
.factory-card.backlog a {
|
||||||
|
display: block;
|
||||||
|
max-width: 100%;
|
||||||
|
color: inherit;
|
||||||
|
text-decoration: none;
|
||||||
|
/* The title is one line; the full text is in the tooltip. */
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
.factory-card.backlog .hint {
|
||||||
|
max-width: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
/* The backlog column is twice as wide as the others. */
|
||||||
|
.factory-col.backlog {
|
||||||
|
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 {
|
.factory-card.active {
|
||||||
border-color: var(--accent);
|
border-color: var(--accent);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,10 @@
|
|||||||
--on-accent: #1c1b1f;
|
--on-accent: #1c1b1f;
|
||||||
--red: #c15c46;
|
--red: #c15c46;
|
||||||
--green: #8f9a5c;
|
--green: #8f9a5c;
|
||||||
|
/* Factory master switch: running / stopping / stopped */
|
||||||
|
--power-on: #8f9a5c;
|
||||||
|
--power-warn: #d9b45a;
|
||||||
|
--power-off: #c15c46;
|
||||||
--aqua: #8aa89a;
|
--aqua: #8aa89a;
|
||||||
--blue: #7c9aa1;
|
--blue: #7c9aa1;
|
||||||
--purple: #b47e99;
|
--purple: #b47e99;
|
||||||
|
|||||||
@@ -21,6 +21,10 @@
|
|||||||
--on-accent: #ffffff;
|
--on-accent: #ffffff;
|
||||||
--red: #96392a;
|
--red: #96392a;
|
||||||
--green: #5c6631;
|
--green: #5c6631;
|
||||||
|
/* Factory master switch: running / stopping / stopped */
|
||||||
|
--power-on: #5c6631;
|
||||||
|
--power-warn: #9a7413;
|
||||||
|
--power-off: #96392a;
|
||||||
--aqua: #3d6b72;
|
--aqua: #3d6b72;
|
||||||
--blue: #3d6b72;
|
--blue: #3d6b72;
|
||||||
--purple: #7c4a66;
|
--purple: #7c4a66;
|
||||||
|
|||||||
@@ -21,6 +21,10 @@
|
|||||||
--on-accent: #1e1e2e;
|
--on-accent: #1e1e2e;
|
||||||
--red: #f38ba8;
|
--red: #f38ba8;
|
||||||
--green: #a6e3a1;
|
--green: #a6e3a1;
|
||||||
|
/* Factory master switch: running / stopping / stopped */
|
||||||
|
--power-on: #a6e3a1;
|
||||||
|
--power-warn: #f9e2af;
|
||||||
|
--power-off: #f38ba8;
|
||||||
--aqua: #94e2d5;
|
--aqua: #94e2d5;
|
||||||
--blue: #89b4fa;
|
--blue: #89b4fa;
|
||||||
--purple: #f5c2e7;
|
--purple: #f5c2e7;
|
||||||
|
|||||||
@@ -21,6 +21,10 @@
|
|||||||
--on-accent: #ffffff;
|
--on-accent: #ffffff;
|
||||||
--red: #d20f39;
|
--red: #d20f39;
|
||||||
--green: #40a02b;
|
--green: #40a02b;
|
||||||
|
/* Factory master switch: running / stopping / stopped */
|
||||||
|
--power-on: #40a02b;
|
||||||
|
--power-warn: #df8e1d;
|
||||||
|
--power-off: #d20f39;
|
||||||
--aqua: #179299;
|
--aqua: #179299;
|
||||||
--blue: #1e66f5;
|
--blue: #1e66f5;
|
||||||
--purple: #ea76cb;
|
--purple: #ea76cb;
|
||||||
|
|||||||
@@ -21,6 +21,10 @@
|
|||||||
--on-accent: #1d150f;
|
--on-accent: #1d150f;
|
||||||
--red: #d78a6f;
|
--red: #d78a6f;
|
||||||
--green: #b5b27a;
|
--green: #b5b27a;
|
||||||
|
/* Factory master switch: running / stopping / stopped */
|
||||||
|
--power-on: #a9b86a;
|
||||||
|
--power-warn: #e8c36a;
|
||||||
|
--power-off: #d4694f;
|
||||||
--aqua: #9fb8a8;
|
--aqua: #9fb8a8;
|
||||||
--blue: #a3b4c7;
|
--blue: #a3b4c7;
|
||||||
--purple: #cf90a2;
|
--purple: #cf90a2;
|
||||||
|
|||||||
@@ -21,6 +21,10 @@
|
|||||||
--on-accent: #ffffff;
|
--on-accent: #ffffff;
|
||||||
--red: #a4405e;
|
--red: #a4405e;
|
||||||
--green: #4f6b00;
|
--green: #4f6b00;
|
||||||
|
/* Factory master switch: running / stopping / stopped */
|
||||||
|
--power-on: #4f6b00;
|
||||||
|
--power-warn: #a8780a;
|
||||||
|
--power-off: #a93a2e;
|
||||||
--aqua: #3f6b5e;
|
--aqua: #3f6b5e;
|
||||||
--blue: #8e2d53;
|
--blue: #8e2d53;
|
||||||
--purple: #7a003b;
|
--purple: #7a003b;
|
||||||
|
|||||||
@@ -21,6 +21,10 @@
|
|||||||
--on-accent: #282a36;
|
--on-accent: #282a36;
|
||||||
--red: #ff5555;
|
--red: #ff5555;
|
||||||
--green: #50fa7b;
|
--green: #50fa7b;
|
||||||
|
/* Factory master switch: running / stopping / stopped */
|
||||||
|
--power-on: #50fa7b;
|
||||||
|
--power-warn: #f1fa8c;
|
||||||
|
--power-off: #ff5555;
|
||||||
--aqua: #8be9fd;
|
--aqua: #8be9fd;
|
||||||
--blue: #8be9fd;
|
--blue: #8be9fd;
|
||||||
--purple: #ff79c6;
|
--purple: #ff79c6;
|
||||||
|
|||||||
@@ -21,6 +21,10 @@
|
|||||||
--on-accent: #ffffff;
|
--on-accent: #ffffff;
|
||||||
--red: #cb3a2a;
|
--red: #cb3a2a;
|
||||||
--green: #14710a;
|
--green: #14710a;
|
||||||
|
/* Factory master switch: running / stopping / stopped */
|
||||||
|
--power-on: #14710a;
|
||||||
|
--power-warn: #846e15;
|
||||||
|
--power-off: #cb3a2a;
|
||||||
--aqua: #036a96;
|
--aqua: #036a96;
|
||||||
--blue: #036a96;
|
--blue: #036a96;
|
||||||
--purple: #a3144d;
|
--purple: #a3144d;
|
||||||
|
|||||||
@@ -21,6 +21,10 @@
|
|||||||
--on-accent: #2d353b;
|
--on-accent: #2d353b;
|
||||||
--red: #e67e80;
|
--red: #e67e80;
|
||||||
--green: #a7c080;
|
--green: #a7c080;
|
||||||
|
/* Factory master switch: running / stopping / stopped */
|
||||||
|
--power-on: #a7c080;
|
||||||
|
--power-warn: #dbbc7f;
|
||||||
|
--power-off: #e67e80;
|
||||||
--aqua: #83c092;
|
--aqua: #83c092;
|
||||||
--blue: #7fbbb3;
|
--blue: #7fbbb3;
|
||||||
--purple: #d699b6;
|
--purple: #d699b6;
|
||||||
|
|||||||
@@ -21,6 +21,10 @@
|
|||||||
--on-accent: #2d353b;
|
--on-accent: #2d353b;
|
||||||
--red: #f85552;
|
--red: #f85552;
|
||||||
--green: #8da101;
|
--green: #8da101;
|
||||||
|
/* Factory master switch: running / stopping / stopped */
|
||||||
|
--power-on: #8da101;
|
||||||
|
--power-warn: #dfa000;
|
||||||
|
--power-off: #f85552;
|
||||||
--aqua: #35a77c;
|
--aqua: #35a77c;
|
||||||
--blue: #3a94c5;
|
--blue: #3a94c5;
|
||||||
--purple: #df69ba;
|
--purple: #df69ba;
|
||||||
|
|||||||
@@ -21,6 +21,10 @@
|
|||||||
--on-accent: #0d1117;
|
--on-accent: #0d1117;
|
||||||
--red: #f85149;
|
--red: #f85149;
|
||||||
--green: #3fb950;
|
--green: #3fb950;
|
||||||
|
/* Factory master switch: running / stopping / stopped */
|
||||||
|
--power-on: #3fb950;
|
||||||
|
--power-warn: #d29922;
|
||||||
|
--power-off: #f85149;
|
||||||
--aqua: #39c5cf;
|
--aqua: #39c5cf;
|
||||||
--blue: #58a6ff;
|
--blue: #58a6ff;
|
||||||
--purple: #bc8cff;
|
--purple: #bc8cff;
|
||||||
|
|||||||
@@ -21,6 +21,10 @@
|
|||||||
--on-accent: #ffffff;
|
--on-accent: #ffffff;
|
||||||
--red: #d1242f;
|
--red: #d1242f;
|
||||||
--green: #1a7f37;
|
--green: #1a7f37;
|
||||||
|
/* Factory master switch: running / stopping / stopped */
|
||||||
|
--power-on: #1a7f37;
|
||||||
|
--power-warn: #9a6700;
|
||||||
|
--power-off: #d1242f;
|
||||||
--aqua: #1b7c83;
|
--aqua: #1b7c83;
|
||||||
--blue: #0969da;
|
--blue: #0969da;
|
||||||
--purple: #8250df;
|
--purple: #8250df;
|
||||||
|
|||||||
@@ -22,6 +22,10 @@
|
|||||||
--on-accent: #282828;
|
--on-accent: #282828;
|
||||||
--red: #fb4934;
|
--red: #fb4934;
|
||||||
--green: #b8bb26;
|
--green: #b8bb26;
|
||||||
|
/* Factory master switch: running / stopping / stopped */
|
||||||
|
--power-on: #b8bb26;
|
||||||
|
--power-warn: #fabd2f;
|
||||||
|
--power-off: #fb4934;
|
||||||
--aqua: #8ec07c;
|
--aqua: #8ec07c;
|
||||||
--blue: #83a598;
|
--blue: #83a598;
|
||||||
--purple: #d3869b;
|
--purple: #d3869b;
|
||||||
|
|||||||
@@ -21,6 +21,10 @@
|
|||||||
--on-accent: #282828;
|
--on-accent: #282828;
|
||||||
--red: #9d0006;
|
--red: #9d0006;
|
||||||
--green: #79740e;
|
--green: #79740e;
|
||||||
|
/* Factory master switch: running / stopping / stopped */
|
||||||
|
--power-on: #79740e;
|
||||||
|
--power-warn: #b57614;
|
||||||
|
--power-off: #9d0006;
|
||||||
--aqua: #427b58;
|
--aqua: #427b58;
|
||||||
--blue: #076678;
|
--blue: #076678;
|
||||||
--purple: #8f3f71;
|
--purple: #8f3f71;
|
||||||
|
|||||||
@@ -21,6 +21,10 @@
|
|||||||
--on-accent: #1b1b1b;
|
--on-accent: #1b1b1b;
|
||||||
--red: #f44336;
|
--red: #f44336;
|
||||||
--green: #a99b7a;
|
--green: #a99b7a;
|
||||||
|
/* Factory master switch: running / stopping / stopped */
|
||||||
|
--power-on: #8fae72;
|
||||||
|
--power-warn: #e0b350;
|
||||||
|
--power-off: #f44336;
|
||||||
--aqua: #8a9ba6;
|
--aqua: #8a9ba6;
|
||||||
--blue: #77838a;
|
--blue: #77838a;
|
||||||
--purple: #e58980;
|
--purple: #e58980;
|
||||||
|
|||||||
@@ -21,6 +21,10 @@
|
|||||||
--on-accent: #ffffff;
|
--on-accent: #ffffff;
|
||||||
--red: #b14752;
|
--red: #b14752;
|
||||||
--green: #556753;
|
--green: #556753;
|
||||||
|
/* Factory master switch: running / stopping / stopped */
|
||||||
|
--power-on: #5a7a43;
|
||||||
|
--power-warn: #a87b1a;
|
||||||
|
--power-off: #b14752;
|
||||||
--aqua: #3d727d;
|
--aqua: #3d727d;
|
||||||
--blue: #4c6c94;
|
--blue: #4c6c94;
|
||||||
--purple: #8a5b81;
|
--purple: #8a5b81;
|
||||||
|
|||||||
@@ -21,6 +21,10 @@
|
|||||||
--on-accent: #1f1f28;
|
--on-accent: #1f1f28;
|
||||||
--red: #e46876;
|
--red: #e46876;
|
||||||
--green: #98bb6c;
|
--green: #98bb6c;
|
||||||
|
/* Factory master switch: running / stopping / stopped */
|
||||||
|
--power-on: #98bb6c;
|
||||||
|
--power-warn: #e6c384;
|
||||||
|
--power-off: #e46876;
|
||||||
--aqua: #7aa89f;
|
--aqua: #7aa89f;
|
||||||
--blue: #7fb4ca;
|
--blue: #7fb4ca;
|
||||||
--purple: #957fb8;
|
--purple: #957fb8;
|
||||||
|
|||||||
@@ -21,6 +21,10 @@
|
|||||||
--on-accent: #ffffff;
|
--on-accent: #ffffff;
|
||||||
--red: #c84053;
|
--red: #c84053;
|
||||||
--green: #6f894e;
|
--green: #6f894e;
|
||||||
|
/* Factory master switch: running / stopping / stopped */
|
||||||
|
--power-on: #6f894e;
|
||||||
|
--power-warn: #b07a00;
|
||||||
|
--power-off: #c84053;
|
||||||
--aqua: #597b75;
|
--aqua: #597b75;
|
||||||
--blue: #4d699b;
|
--blue: #4d699b;
|
||||||
--purple: #624c83;
|
--purple: #624c83;
|
||||||
|
|||||||
@@ -21,6 +21,10 @@
|
|||||||
--on-accent: #2e3440;
|
--on-accent: #2e3440;
|
||||||
--red: #bf616a;
|
--red: #bf616a;
|
||||||
--green: #a3be8c;
|
--green: #a3be8c;
|
||||||
|
/* Factory master switch: running / stopping / stopped */
|
||||||
|
--power-on: #a3be8c;
|
||||||
|
--power-warn: #ebcb8b;
|
||||||
|
--power-off: #bf616a;
|
||||||
--aqua: #8fbcbb;
|
--aqua: #8fbcbb;
|
||||||
--blue: #81a1c1;
|
--blue: #81a1c1;
|
||||||
--purple: #b48ead;
|
--purple: #b48ead;
|
||||||
|
|||||||
@@ -21,6 +21,10 @@
|
|||||||
--on-accent: #ffffff;
|
--on-accent: #ffffff;
|
||||||
--red: #a9434d;
|
--red: #a9434d;
|
||||||
--green: #5f7d48;
|
--green: #5f7d48;
|
||||||
|
/* Factory master switch: running / stopping / stopped */
|
||||||
|
--power-on: #5f7d48;
|
||||||
|
--power-warn: #9a7b2f;
|
||||||
|
--power-off: #a9434d;
|
||||||
--aqua: #4d8a89;
|
--aqua: #4d8a89;
|
||||||
--blue: #5e81ac;
|
--blue: #5e81ac;
|
||||||
--purple: #8f6a8a;
|
--purple: #8f6a8a;
|
||||||
|
|||||||
@@ -21,6 +21,10 @@
|
|||||||
--on-accent: #282c34;
|
--on-accent: #282c34;
|
||||||
--red: #e06c75;
|
--red: #e06c75;
|
||||||
--green: #98c379;
|
--green: #98c379;
|
||||||
|
/* Factory master switch: running / stopping / stopped */
|
||||||
|
--power-on: #98c379;
|
||||||
|
--power-warn: #e5c07b;
|
||||||
|
--power-off: #e06c75;
|
||||||
--aqua: #56b6c2;
|
--aqua: #56b6c2;
|
||||||
--blue: #61afef;
|
--blue: #61afef;
|
||||||
--purple: #c678dd;
|
--purple: #c678dd;
|
||||||
|
|||||||
@@ -21,6 +21,10 @@
|
|||||||
--on-accent: #ffffff;
|
--on-accent: #ffffff;
|
||||||
--red: #e45649;
|
--red: #e45649;
|
||||||
--green: #50a14f;
|
--green: #50a14f;
|
||||||
|
/* Factory master switch: running / stopping / stopped */
|
||||||
|
--power-on: #50a14f;
|
||||||
|
--power-warn: #c18401;
|
||||||
|
--power-off: #e45649;
|
||||||
--aqua: #0184bc;
|
--aqua: #0184bc;
|
||||||
--blue: #4078f2;
|
--blue: #4078f2;
|
||||||
--purple: #a626a4;
|
--purple: #a626a4;
|
||||||
|
|||||||
@@ -21,6 +21,10 @@
|
|||||||
--on-accent: #191724;
|
--on-accent: #191724;
|
||||||
--red: #eb6f92;
|
--red: #eb6f92;
|
||||||
--green: #9ccfd8;
|
--green: #9ccfd8;
|
||||||
|
/* Factory master switch: running / stopping / stopped */
|
||||||
|
--power-on: #95b88f;
|
||||||
|
--power-warn: #f6c177;
|
||||||
|
--power-off: #eb6f92;
|
||||||
--aqua: #9ccfd8;
|
--aqua: #9ccfd8;
|
||||||
--blue: #31748f;
|
--blue: #31748f;
|
||||||
--purple: #c4a7e7;
|
--purple: #c4a7e7;
|
||||||
|
|||||||
@@ -21,6 +21,10 @@
|
|||||||
--on-accent: #ffffff;
|
--on-accent: #ffffff;
|
||||||
--red: #b4637a;
|
--red: #b4637a;
|
||||||
--green: #56949f;
|
--green: #56949f;
|
||||||
|
/* Factory master switch: running / stopping / stopped */
|
||||||
|
--power-on: #5e8f60;
|
||||||
|
--power-warn: #c98a1b;
|
||||||
|
--power-off: #b4637a;
|
||||||
--aqua: #56949f;
|
--aqua: #56949f;
|
||||||
--blue: #286983;
|
--blue: #286983;
|
||||||
--purple: #907aa9;
|
--purple: #907aa9;
|
||||||
|
|||||||
@@ -21,6 +21,10 @@
|
|||||||
--on-accent: #002b36;
|
--on-accent: #002b36;
|
||||||
--red: #dc322f;
|
--red: #dc322f;
|
||||||
--green: #859900;
|
--green: #859900;
|
||||||
|
/* Factory master switch: running / stopping / stopped */
|
||||||
|
--power-on: #859900;
|
||||||
|
--power-warn: #b58900;
|
||||||
|
--power-off: #dc322f;
|
||||||
--aqua: #2aa198;
|
--aqua: #2aa198;
|
||||||
--blue: #268bd2;
|
--blue: #268bd2;
|
||||||
--purple: #6c71c4;
|
--purple: #6c71c4;
|
||||||
|
|||||||
@@ -21,6 +21,10 @@
|
|||||||
--on-accent: #002b36;
|
--on-accent: #002b36;
|
||||||
--red: #dc322f;
|
--red: #dc322f;
|
||||||
--green: #859900;
|
--green: #859900;
|
||||||
|
/* Factory master switch: running / stopping / stopped */
|
||||||
|
--power-on: #859900;
|
||||||
|
--power-warn: #b58900;
|
||||||
|
--power-off: #dc322f;
|
||||||
--aqua: #2aa198;
|
--aqua: #2aa198;
|
||||||
--blue: #268bd2;
|
--blue: #268bd2;
|
||||||
--purple: #6c71c4;
|
--purple: #6c71c4;
|
||||||
|
|||||||
@@ -21,6 +21,10 @@
|
|||||||
--on-accent: #232a44;
|
--on-accent: #232a44;
|
||||||
--red: #d47a6a;
|
--red: #d47a6a;
|
||||||
--green: #96b4bc;
|
--green: #96b4bc;
|
||||||
|
/* Factory master switch: running / stopping / stopped */
|
||||||
|
--power-on: #8fb98a;
|
||||||
|
--power-warn: #e0b860;
|
||||||
|
--power-off: #d47a6a;
|
||||||
--aqua: #96b4bc;
|
--aqua: #96b4bc;
|
||||||
--blue: #7aa0cc;
|
--blue: #7aa0cc;
|
||||||
--purple: #c896b2;
|
--purple: #c896b2;
|
||||||
|
|||||||
@@ -21,6 +21,10 @@
|
|||||||
--on-accent: #f0ead9;
|
--on-accent: #f0ead9;
|
||||||
--red: #8a3028;
|
--red: #8a3028;
|
||||||
--green: #4a5a3a;
|
--green: #4a5a3a;
|
||||||
|
/* Factory master switch: running / stopping / stopped */
|
||||||
|
--power-on: #4a6b3a;
|
||||||
|
--power-warn: #9a7218;
|
||||||
|
--power-off: #8a3028;
|
||||||
--aqua: #3a5a6a;
|
--aqua: #3a5a6a;
|
||||||
--blue: #3a5a8a;
|
--blue: #3a5a8a;
|
||||||
--purple: #5a4a72;
|
--purple: #5a4a72;
|
||||||
|
|||||||
@@ -21,6 +21,10 @@
|
|||||||
--on-accent: #24283b;
|
--on-accent: #24283b;
|
||||||
--red: #f7768e;
|
--red: #f7768e;
|
||||||
--green: #9ece6a;
|
--green: #9ece6a;
|
||||||
|
/* Factory master switch: running / stopping / stopped */
|
||||||
|
--power-on: #9ece6a;
|
||||||
|
--power-warn: #e0af68;
|
||||||
|
--power-off: #f7768e;
|
||||||
--aqua: #73daca;
|
--aqua: #73daca;
|
||||||
--blue: #7aa2f7;
|
--blue: #7aa2f7;
|
||||||
--purple: #bb9af7;
|
--purple: #bb9af7;
|
||||||
|
|||||||
@@ -21,6 +21,10 @@
|
|||||||
--on-accent: #ffffff;
|
--on-accent: #ffffff;
|
||||||
--red: #f52a65;
|
--red: #f52a65;
|
||||||
--green: #587539;
|
--green: #587539;
|
||||||
|
/* Factory master switch: running / stopping / stopped */
|
||||||
|
--power-on: #587539;
|
||||||
|
--power-warn: #8c6c3e;
|
||||||
|
--power-off: #f52a65;
|
||||||
--aqua: #118c74;
|
--aqua: #118c74;
|
||||||
--blue: #2e7de9;
|
--blue: #2e7de9;
|
||||||
--purple: #9854f1;
|
--purple: #9854f1;
|
||||||
|
|||||||
@@ -21,6 +21,10 @@
|
|||||||
--on-accent: #ffffff;
|
--on-accent: #ffffff;
|
||||||
--red: #f14c4c;
|
--red: #f14c4c;
|
||||||
--green: #89d185;
|
--green: #89d185;
|
||||||
|
/* Factory master switch: running / stopping / stopped */
|
||||||
|
--power-on: #89d185;
|
||||||
|
--power-warn: #cca700;
|
||||||
|
--power-off: #f14c4c;
|
||||||
--aqua: #4ec9b0;
|
--aqua: #4ec9b0;
|
||||||
--blue: #3794ff;
|
--blue: #3794ff;
|
||||||
--purple: #c586c0;
|
--purple: #c586c0;
|
||||||
|
|||||||
@@ -21,6 +21,10 @@
|
|||||||
--on-accent: #ffffff;
|
--on-accent: #ffffff;
|
||||||
--red: #cd3131;
|
--red: #cd3131;
|
||||||
--green: #388a34;
|
--green: #388a34;
|
||||||
|
/* Factory master switch: running / stopping / stopped */
|
||||||
|
--power-on: #388a34;
|
||||||
|
--power-warn: #bf8803;
|
||||||
|
--power-off: #cd3131;
|
||||||
--aqua: #267f99;
|
--aqua: #267f99;
|
||||||
--blue: #005fb8;
|
--blue: #005fb8;
|
||||||
--purple: #af00db;
|
--purple: #af00db;
|
||||||
|
|||||||
@@ -3,6 +3,18 @@
|
|||||||
* under "unreleased"; scripts/release.sh renames the key to the release version.
|
* under "unreleased"; scripts/release.sh renames the key to the release version.
|
||||||
*/
|
*/
|
||||||
export const WHATS_NEW: Record<string, { en: string[]; de: string[] }> = {
|
export const WHATS_NEW: Record<string, { en: string[]; de: string[] }> = {
|
||||||
|
"202611-00071": {
|
||||||
|
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"],
|
||||||
|
},
|
||||||
|
"202611-00069": {
|
||||||
|
en: ["Factory: backlog column with all open issues of the forge – queue them into the process with one click", "Factory: issue cards are faintly tinted by status, including the border"],
|
||||||
|
de: ["Factory: Backlog-Spalte mit allen offenen Issues des Forges – mit einem Klick in den Prozess einreihen", "Factory: Issue-Karten sind dezent nach Status eingefärbt, auch der Rahmen"],
|
||||||
|
},
|
||||||
"202611-00068": {
|
"202611-00068": {
|
||||||
en: ["Test runner: \"isolated\": false in .factory/setup.json for apps that cannot run in a container"],
|
en: ["Test runner: \"isolated\": false in .factory/setup.json for apps that cannot run in a container"],
|
||||||
de: ["Test-Runner: \"isolated\": false in .factory/setup.json für Apps, die nicht im Container laufen können"],
|
de: ["Test-Runner: \"isolated\": false in .factory/setup.json für Apps, die nicht im Container laufen können"],
|
||||||
|
|||||||
Reference in new issue
Block a user