Compare commits

..
Author SHA1 Message Date
Richard Zink f8b85beb70 Release v202611-00077 2026-11-20 20:34:17 +01:00
Richard ZinkandClaude Sonnet 5.5 3623896464 Changelog: base image entry belongs to the next release
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-20 20:34:16 +01:00
Richard ZinkandClaude Sonnet 5.5 d0e7cea117 Test runner: shared base image for acceptance containers, log installed apt packages
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-20 20:33:59 +01:00
Richard Zink 23fbc6f302 Release v202611-00076 2026-11-20 20:15:48 +01:00
Richard ZinkandClaude Sonnet 5.5 6804139be7 Test runner: log start time, seed hit/miss and install time per environment
Merges the v73 changelog section into v74.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-20 20:15:47 +01:00
Richard Zink 87eafb3108 Release v202611-00075 2026-11-20 13:56:03 +01:00
Richard ZinkandClaude Sonnet 5.5 537aac820d Factory: theme-specific preparing lamp colour, no menu button in the chat overlay
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-20 13:56:00 +01:00
Richard Zink 836377ac38 Release v202611-00074 2026-11-20 13:23:56 +01:00
Richard ZinkandClaude Sonnet 5.5 391db43949 Factory: merge and close buttons on the issue card, enforced order
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-20 13:23:52 +01:00
Richard Zink 0e54714436 Release v202611-00073 2026-11-20 13:15:10 +01:00
Richard ZinkandClaude Sonnet 5.5 b9df00422a Test runner: per-project cache (tool caches, shared dirs, seeds)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-20 13:15:07 +01:00
Richard Zink a083798d7f Release v202611-00072 2026-11-20 12:46:01 +01:00
Richard ZinkandClaude Sonnet 5.5 724405b245 Factory: blinking blue lamp while a phase is being prepared
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-20 12:45:59 +01:00
Richard Zink 585fdd58de Release v202611-00071 2026-11-20 12:14:09 +01:00
Richard ZinkandClaude Sonnet 5.5 171b87b766 Drafts in every chat, factory chat overlay, factory main switch
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-20 12:14:04 +01:00
55 changed files with 1274 additions and 38 deletions

No files matched your search

+1 -1
View File
@@ -38,4 +38,4 @@ CODECRAFT_LOG_FORMAT=
# Optional limits per environment and the image used when .factory/setup.json names none:
#RUNNER_MEMORY=2g
#RUNNER_CPUS=2
#RUNNER_DEFAULT_IMAGE=node:22-bookworm
#RUNNER_DEFAULT_IMAGE=git.familie-zink.org/zink/codecraft-testbase:latest
+49
View File
@@ -3,6 +3,55 @@
All notable changes to CodeCraft. Versions follow [Semantic Versioning](https://semver.org/);
until 1.0, minor versions may contain breaking changes.
## [v202611-00077] – 2026-11-20
### Added
- **Shared base image for acceptance containers** (`git.familie-zink.org/zink/codecraft-testbase`, built from `docker/testbase/Dockerfile` by the release script): Node 24, Python 3, gcc/g++/make/cmake, Chromium with Playwright and common tools (git, curl, e2fsprogs, xz, zsh, sudo, jq, …). It is the runner's default image (`RUNNER_DEFAULT_IMAGE`), so setups that installed these again and again start faster; plain `node:24-bookworm` is the fallback if it cannot be pulled. Projects with their own `image` or `dockerfile` are unchanged.
- The runner also logs the apt packages an environment's setup installed (`apt installed: …`), to see what the base image still lacks.
## [v202611-00076] – 2026-11-20
### Changed
- **Test runner: the cache is now visible.** The runner logs for every environment how long it took until the app answered, whether the seed was a hit or a miss, and how long `install` took (e.g. `test env abc (git-…-penguin31) ready after 42 s; cache on; seed 07be…: hit; install took 3 s`).
## [v202611-00075] – 2026-11-20
### Changed
- **Factory: the "preparing" lamp** (checkout, test environment) now has a colour that differs from the theme's accent colour in every theme – the lamp of a running chat keeps the accent. Set per theme with the new variable `--prep`.
- **Factory overlay:** the chat's menu button is hidden in the overlay (it could only close the overlay).
## [v202611-00074] – 2026-11-20
### Added
- **Test runner: cache between acceptance runs.** Every project gets a cache volume (`cc-cache-<project>`) in the runner. Tool caches are shared automatically: npm and Yarn, pip, Go modules and build cache, the Cargo registry and the Cargo target directory (so the second build of a Rust project is incremental). `.factory/setup.json` can add `"cache": {"dirs": [...]}` for directories that persist (downloads – inputs only) and `"cache": {"seed": {"paths": [...], "key": [...]}}` for expensive *results* of `install`, such as a built disk image: the seed is stored after a successful install under a key made from the image, the install command, the seed paths and the contents of the `key` files, and copied into fresh containers only while the key matches – a run never sees changes of an earlier run, and a change of the listed sources builds it anew (the three newest seeds are kept). `"cache": false` turns everything off; `DELETE /v1/cache/<project>` on the runner forgets a project's cache.
### Changed
- **Factory: merge and close on the issue card.** A finished issue shows a *Merge* button on its card once the acceptance has passed (the pull request is open); after the merge the card shows *Close*. Before that neither button is shown. The server enforces the order: a pull request is merged only when the acceptance passed, an issue is closed only when its pull request is merged (a merge done on the forge itself counts). The issue also gets its version and tag right after a merge instead of at the next poll.
## [v202611-00072] – 2026-11-20
### Added
- **Factory: "preparing" lamp.** An issue card whose phase has been started but whose chat does not exist yet – checkout and, for acceptance, installing and starting the app in its throw-away container – shows a blinking blue lamp with the elapsed time instead of staying silent. (Active chats keep their accent-coloured lamp.)
## [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
+30 -3
View File
@@ -11,7 +11,7 @@
</p>
<p align="center">
<img alt="Version v202611-00070" src="https://img.shields.io/badge/version-v202611--00070-d69e2e?style=flat-square">
<img alt="Version v202611-00077" src="https://img.shields.io/badge/version-v202611--00077-d69e2e?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="React PWA" src="https://img.shields.io/badge/frontend-React%20PWA-2d81ff?style=flat-square&logo=react">
@@ -292,7 +292,8 @@ the server.
On *pass* the factory opens the pull request (if none is open) and comments a result table
in the issue. On *fail* the issue goes back to the build with the findings (*rework*).
4. **Done, merge, version.** You review the pull request in the factory (diff, description) and
merge it there. The factory then pulls the merge, gives the issue its version, commits
merge it there – on the page or with the *Merge* button of the issue card, which appears once
the acceptance has passed (closing an issue by hand is possible only after its merge). The factory then pulls the merge, gives the issue its version, commits
`VERSION`, pushes an annotated tag, comments on the issue and closes it.
Issue text is treated as data, never as instructions for the factory itself.
@@ -332,6 +333,11 @@ phase the model, agent (CodeCraft or Claude Code), permission mode, timeout, tri
technical failures, the skills that are switched on for it, plus the number of rework rounds (default 2). Failed or rejected issues
can be restarted from the board, finished ones are closed with a comment.
**Main switch.** The switch at the top of the factory page starts and stops the whole factory.
*Stop* is soft: no new review, build or acceptance starts, running agents finish their phase.
The switch is green while the factory runs, yellow while it is stopping (agents still working)
and red once the last agent is done. The state survives restarts.
**Backlog.** The first column of the board lists every open issue of the configured
repositories that is not in the factory yet. *Queue* gives an issue the factory label on the
forge (so it enters the review at once); *Queue all* does it for the whole list. Issues of authors
@@ -368,7 +374,28 @@ helper services and network are removed (leftovers are swept at startup and afte
}
```
`image` defaults to `RUNNER_DEFAULT_IMAGE`; `"dockerfile": "path"` builds the image from the
Between runs of one project the runner keeps a cache volume: npm/Yarn, pip, Go and Cargo caches
(including the Cargo target directory) are shared automatically. For more, add to `setup.json`:
```json
"cache": {
"dirs": ["build/downloads"],
"seed": { "paths": ["data/ubuntu.ext4"], "key": ["guest", "lib", "scripts", "package-lock.json"] }
}
```
`dirs` persist and are shared by all runs (use them for downloads, not for results). A `seed`
holds expensive *results* of `install`: it is stored after a successful install under a key made
from the image, the install command, the seed paths and the contents of the `key` files or
directories, and copied into a fresh container only while that key matches – so a run never
inherits changes from an earlier one, and editing a listed source rebuilds it. `"cache": false`
disables caching; `DELETE /v1/cache/<project>` on the runner clears one project.
`image` defaults to `RUNNER_DEFAULT_IMAGE`, by default the shared base image
`codecraft-testbase` (Node 24, Python 3, gcc/cmake, Chromium with Playwright and common tools; see
`docker/testbase/Dockerfile`; plain Node 24 is the fallback when it cannot be pulled). The runner logs
per environment the start time, the seed hit/miss and the apt packages the setup installed.
The image can be changed per project with `"image"`; `"dockerfile": "path"` builds the image from the
repository instead; helper services are reachable by their name. Containers run without extra
capabilities, with memory/CPU/process limits (`RUNNER_MEMORY`, `RUNNER_CPUS`), and cannot see the
host. Without the runner, or without a `setup.json`, nothing changes. Note that the runner holds
+114
View File
@@ -143,6 +143,33 @@ pub struct App {
pending_note: Option<oneshot::Receiver<Result<String>>>,
/// The factory issue ("repo#number") whose actions are open.
factory_key: String,
/// Unsent input is kept per chat: on the server for server chats (so another device can continue it),
/// in a local file for local chats.
draft: DraftSync,
}
struct DraftSync {
/// "remote:<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] = &["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
@@ -316,6 +343,7 @@ impl App {
dialog: Dialog::None,
todos: session.todos.clone(),
context: session.context_tokens,
draft: DraftSync::new(),
session,
effort: None,
images: vec![],
@@ -1441,7 +1469,93 @@ impl App {
self.status = "loading models…".into();
}
/// Keep the unsent input of the current chat: load it when the chat changes, save it shortly after typing.
fn poll_draft(&mut self) {
let remote_id = self.remote.as_ref().map(|r| r.id.clone());
let key = match &remote_id {
Some(id) => format!("remote:{id}"),
None => format!("local:{}", self.session.id),
};
if self.draft.key != key {
self.draft = DraftSync::new();
self.draft.key = key.clone();
self.draft.seen = self.editor.text();
match &remote_id {
Some(id) => self.draft_pull(id.clone()),
None => {
let text = std::fs::read_to_string(local_draft_path(&self.session.id)).unwrap_or_default();
if self.editor.is_empty() && !text.is_empty() {
self.editor.set(&text);
self.draft.seen = text.clone();
}
self.draft.synced = if self.editor.is_empty() { String::new() } else { self.draft.seen.clone() };
self.draft.loaded = true;
}
}
}
if let Some(rx) = &mut self.draft.pull {
if let Ok(res) = rx.try_recv() {
self.draft.pull = None;
if let Ok(text) = res {
// First load: only into an empty field. Later: only when nothing was typed here since the last sync.
let untouched = if self.draft.loaded { self.editor.text() == self.draft.synced } else { self.editor.is_empty() };
if untouched && text != self.editor.text() {
self.editor.set(&text);
self.draft.seen = text.clone();
self.draft.synced = text;
} else if !self.draft.loaded {
self.draft.synced = if untouched { text } else { String::new() };
}
self.draft.loaded = true;
}
}
}
let cur = self.editor.text();
if cur != self.draft.seen {
self.draft.seen = cur;
self.draft.changed = Instant::now();
}
if self.draft.loaded && self.draft.seen != self.draft.synced && self.draft.changed.elapsed() >= Duration::from_millis(700) {
let text = self.draft.seen.clone();
self.draft.synced = text.clone();
match (&remote_id, self.env.server.clone()) {
(Some(id), Some(server)) => {
let id = id.clone();
tokio::spawn(async move {
let _ = remote::draft_put(&server, &id, &text).await;
});
}
(None, _) => {
let path = local_draft_path(&self.session.id);
if text.trim().is_empty() {
let _ = std::fs::remove_file(&path);
} else if let Some(dir) = path.parent() {
let _ = std::fs::create_dir_all(dir);
let _ = std::fs::write(&path, &text);
}
}
_ => {}
}
}
// Pick up what was typed on another device while this field has no unsent edits.
if let (Some(id), true) = (&remote_id, self.draft.loaded && self.draft.pull.is_none() && self.draft.last_pull.elapsed() >= Duration::from_secs(10) && self.editor.text() == self.draft.synced) {
self.draft.last_pull = Instant::now();
self.draft_pull(id.clone());
}
}
fn draft_pull(&mut self, id: String) {
let Some(server) = self.env.server.clone() else { return };
let (tx, rx) = oneshot::channel();
tokio::spawn(async move {
let _ = tx.send(remote::draft_get(&server, &id).await);
});
self.draft.pull = Some(rx);
self.draft.last_pull = Instant::now();
}
fn poll_pending(&mut self) {
self.poll_draft();
self.poll_remote();
if let Some(rx) = &mut self.pending_detect {
if let Ok(found) = rx.try_recv() {
+10
View File
@@ -104,6 +104,16 @@ pub async fn prompt(server: &Server, id: &str, text: &str) -> Result<()> {
server.post(&format!("/sessions/{id}/prompt"), json!({"text": text})).await.map(|_| ())
}
/// The unsent message of a server chat (typed in the web UI or in another terminal).
pub async fn draft_get(server: &Server, id: &str) -> Result<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<()> {
server.post(&format!("/sessions/{id}/abort"), json!({})).await.map(|_| ())
}
+5
View File
@@ -74,6 +74,11 @@ impl Server {
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> {
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?)
+1 -1
View File
@@ -75,7 +75,7 @@ services:
RUNNER_FACTORY_DIR: /factory
RUNNER_MEMORY: ${RUNNER_MEMORY:-2g}
RUNNER_CPUS: ${RUNNER_CPUS:-2}
RUNNER_DEFAULT_IMAGE: ${RUNNER_DEFAULT_IMAGE:-node:22-bookworm}
RUNNER_DEFAULT_IMAGE: ${RUNNER_DEFAULT_IMAGE:-git.familie-zink.org/zink/codecraft-testbase:latest}
HOME: /tmp
volumes:
- /var/run/docker.sock:/var/run/docker.sock
+1 -1
View File
@@ -71,7 +71,7 @@ services:
RUNNER_FACTORY_DIR: /factory
RUNNER_MEMORY: ${RUNNER_MEMORY:-2g}
RUNNER_CPUS: ${RUNNER_CPUS:-2}
RUNNER_DEFAULT_IMAGE: ${RUNNER_DEFAULT_IMAGE:-node:22-bookworm}
RUNNER_DEFAULT_IMAGE: ${RUNNER_DEFAULT_IMAGE:-git.familie-zink.org/zink/codecraft-testbase:latest}
HOME: /tmp
volumes:
- /var/run/docker.sock:/var/run/docker.sock
+14
View File
@@ -0,0 +1,14 @@
# Base image of the factory's throw-away acceptance containers (used when .factory/setup.json names no image).
# Node 24, Python 3, a C/C++ toolchain, the Chromium that Playwright needs, and the small tools
# that acceptance setups installed again and again (see the runner log "apt installed: ...").
FROM node:24-bookworm
ENV DEBIAN_FRONTEND=noninteractive PIP_BREAK_SYSTEM_PACKAGES=1 PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential cmake pkg-config git curl wget ca-certificates unzip xz-utils zip \
e2fsprogs util-linux zsh sudo nano procps iproute2 netcat-openbsd jq sqlite3 \
python3 python3-pip python3-venv \
&& rm -rf /var/lib/apt/lists/* \
&& npm install -g playwright \
&& playwright install --with-deps chromium \
&& rm -rf /var/lib/apt/lists/* /root/.npm \
&& chmod -R a+rX /ms-playwright
+4
View File
@@ -94,6 +94,10 @@ if (( image )); then
run docker buildx build --builder "$BUILDER" --platform "$PLATFORMS" \
--build-arg GIT_COMMIT="$(git rev-parse --short HEAD)" --build-arg CODECRAFT_VERSION="$version" \
"${tags[@]}" --push .
# Base image of the factory's acceptance containers (cached layers: cheap unless the Dockerfile changed).
step "Building and pushing ${REGISTRY}-testbase for $PLATFORMS"
run docker buildx build --builder "$BUILDER" --platform "$PLATFORMS" \
-t "${REGISTRY}-testbase:latest" -t "${REGISTRY}-testbase:$tag" --push docker/testbase
fi
step "Creating the Gitea release $tag"
+72 -1
View File
@@ -96,6 +96,7 @@ pub fn router(app: AppState) -> Router {
.route("/sessions/{id}/compact", post(compact))
.route("/sessions/{id}/rewind", post(rewind))
.route("/sessions/{id}/job-draft", post(job_draft))
.route("/sessions/{id}/composer-draft", get(get_composer_draft).put(put_composer_draft))
.route("/projects/overview", get(project_overview))
.route("/sessions/{id}/project-defaults", get(get_project_defaults).put(put_project_defaults).delete(delete_project_defaults))
.route("/sessions/{id}/check", get(get_check).put(put_check))
@@ -169,6 +170,7 @@ pub fn router(app: AppState) -> Router {
.route("/account/factory/test", post(test_factory))
.route("/factory/overview", get(factory_overview))
.route("/factory/backlog", get(factory_backlog))
.route("/factory/power", post(factory_power))
.route("/factory/backlog/enqueue", post(factory_enqueue))
.route("/factory/poll", post(factory_poll))
.route("/factory/issues/restart", post(factory_restart))
@@ -1660,6 +1662,27 @@ async fn reply_permission(Extension(user): Extension<User>, State(app): State<Ap
}
/// 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 {
let s = writable(&app, &user, &id)?;
let (name, prompt) = runner::draft_job(&app, &s).await.map_err(|e| ApiError(StatusCode::BAD_GATEWAY, format!("{e:#}")))?;
@@ -2751,11 +2774,39 @@ async fn factory_overview(Extension(user): Extension<User>, State(app): State<Ap
"area": app.factory_dir().is_some(),
"repos": repos,
"issues": app.store.factory_issues(&user.id)?,
"power": factory_power_json(&app, &user),
"runs": app.store.factory_runs(&user.id, None, None, 300)?,
"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();
@@ -2960,6 +3011,15 @@ async fn factory_close_issue(Extension(user): Extension<User>, State(app): State
return Err(ApiError(StatusCode::BAD_REQUEST, "only finished issues can be closed here".into()));
}
let bad = |e: anyhow::Error| ApiError(StatusCode::BAD_GATEWAY, format!("{e:#}"));
// Closing comes after the merge. A merge done on the forge itself counts too: ask the forge when we do not know yet.
if row["merged"].as_bool() != Some(true) {
let pr_n: u64 = row["pr_url"].as_str().unwrap_or("").trim_end_matches('/').rsplit('/').next().and_then(|n| n.parse().ok()).unwrap_or(0);
let merged = pr_n > 0 && g.pr(pr_n).await.map(|p| p["state"].as_str() == Some("merged")).unwrap_or(false);
if !merged {
return Err(ApiError(StatusCode::BAD_REQUEST, "merge the pull request first".into()));
}
app.store.factory_issue_set(&b.repo, b.number, &[("merged", json!(1))])?;
}
let text = if b.comment.trim().is_empty() { "Closed.".to_string() } else { b.comment.trim().to_string() };
g.comment(b.number as u64, &format!("{}\n**Closed** by {}: {text}", crate::factory::BOT, user.username)).await.map_err(bad)?;
g.close_issue(b.number as u64).await.map_err(bad)?;
@@ -3021,6 +3081,10 @@ struct MergePr {
/// Merge the pull request of an issue – only on the user's own click in the factory page.
async fn factory_pr_merge(Extension(user): Extension<User>, State(app): State<AppState>, headers: axum::http::HeaderMap, Json(b): Json<MergePr>) -> ApiResult {
let (g, row) = factory_issue_forge(&app, &user, &b.repo, b.number)?;
// Merging comes after a positive acceptance (the issue is "done").
if row["state"].as_str() != Some("done") {
return Err(ApiError(StatusCode::BAD_REQUEST, "the pull request can be merged once the acceptance has passed".into()));
}
let method = if b.method.is_empty() { "merge" } else { b.method.as_str() };
if !["merge", "squash", "rebase"].contains(&method) {
return Err(ApiError(StatusCode::BAD_REQUEST, "unknown merge method".into()));
@@ -3031,8 +3095,15 @@ async fn factory_pr_merge(Extension(user): Extension<User>, State(app): State<Ap
return Err(ApiError(StatusCode::BAD_REQUEST, "this is not the open pull request of the issue".into()));
}
g.merge_pr(b.pr, method).await.map_err(|e| ApiError(StatusCode::BAD_GATEWAY, format!("{e:#}")))?;
app.store.factory_issue_set(&b.repo, b.number, &[("pr_url", json!(pr["html_url"].as_str().unwrap_or("")))])?;
app.store.factory_issue_set(&b.repo, b.number, &[("pr_url", json!(pr["html_url"].as_str().unwrap_or(""))), ("merged", json!(1))])?;
app.audit(Some(&user), "factory.pr.merge", &format!("{}#{}", b.repo, b.number), &crate::auth::client_ip(&headers));
// Give the issue its version and tag right away instead of at the next poll.
if let Ok(cfg) = factory_repo_cfg(&app, &user, &b.repo) {
let (app2, user2) = (app.clone(), user.clone());
tokio::spawn(async move {
let _ = crate::factory::poll_repo(&app2, &user2, &cfg).await;
});
}
Ok(Json(json!({"ok": true})))
}
+39 -5
View File
@@ -17,6 +17,28 @@ pub const FACTORY_FOLDER: &str = "Factory";
pub const PHASES: [&str; 3] = ["review", "build", "qa"];
/// The master switch of a user's factory. Switched off, no new agent starts (a soft stop: agents that
/// are running finish their phase); the poller still keeps the board up to date.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Power {
pub on: bool,
}
impl Default for Power {
fn default() -> Self {
Self { on: true }
}
}
/// "running" (on), "stopping" (off, agents still working) or "stopped" (off, nobody working).
pub fn power_state(on: bool, active: i64) -> &'static str {
match (on, active) {
(true, _) => "running",
(false, 0) => "stopped",
(false, _) => "stopping",
}
}
/// Status labels of an issue, in the order of the workflow.
pub const STATUS_LABELS: [(&str, &str); 9] = [
("factory", "0e8a16"),
@@ -1218,11 +1240,13 @@ impl TestEnv {
/// Start the app of `work` in a throw-away container when a test runner is configured
/// (`CODECRAFT_RUNNER_URL`) and `.factory/setup.json` says how. `Ok(None)` = run it the old way.
async fn start_test_env(work: &std::path::Path) -> Result<Option<TestEnv>> {
async fn start_test_env(work: &std::path::Path, repo_url: &str) -> Result<Option<TestEnv>> {
use crate::testrunner as tr;
let Some(client) = tr::Client::from_env() else { return Ok(None) };
let Some(mut req) = std::fs::read_to_string(work.join(".factory/setup.json")).ok().and_then(|t| tr::parse_setup(&t)) else { return Ok(None) };
req.work = work.display().to_string();
// One cache per project: tool caches, download directories and seeds survive between acceptance runs.
req.cache_id = slugify(repo_url.trim_end_matches(".git").rsplit("://").next().unwrap_or(repo_url)).chars().take(80).collect();
let started = client.start(&req).await?;
let (local, forward) = match tr::forward_local(req.port, client.host(), started.port).await {
Ok(x) => x,
@@ -1320,7 +1344,7 @@ async fn qa(app: Arc<App>, user: User, cfg: RepoCfg, issue: Value) {
}
}
// With a test runner the app starts in a throw-away container; without one the agent starts it itself.
let env = match start_test_env(&work).await {
let env = match start_test_env(&work, &cfg.url).await {
Ok(e) => e,
Err(e) => {
cleanup_worktree(&app, &user, &cfg, &work).await;
@@ -1478,6 +1502,7 @@ pub async fn poll_repo(app: &Arc<App>, user: &User, cfg: &RepoCfg) -> Result<()>
allowed.push(g.login().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 {
let n = issue_no(&issue);
let author = issue["user"]["login"].as_str().unwrap_or("");
@@ -1498,7 +1523,7 @@ pub async fn poll_repo(app: &Arc<App>, user: &User, cfg: &RepoCfg) -> Result<()>
}
"approved" | "rework" => {
let feedback = if state == "rework" { row["note"].as_str().unwrap_or("").to_string() } else { String::new() };
if app.store.factory_running(&cfg.url)? < cfg.max_parallel as i64 {
if power_on && app.store.factory_running(&cfg.url)? < cfg.max_parallel as i64 {
let comments = g.comments(n as u64).await.unwrap_or_default();
app.store.factory_issue_set(&cfg.url, n, &[("title", json!(title)), ("state", json!("building"))])?;
tokio::spawn(build(app.clone(), user.clone(), cfg.clone(), issue, comments, feedback));
@@ -1506,7 +1531,7 @@ pub async fn poll_repo(app: &Arc<App>, user: &User, cfg: &RepoCfg) -> Result<()>
continue;
}
"qa" => {
if app.store.factory_running(&cfg.url)? < cfg.max_parallel as i64 {
if power_on && app.store.factory_running(&cfg.url)? < cfg.max_parallel as i64 {
app.store.factory_issue_set(&cfg.url, n, &[("title", json!(title))])?;
// Mark the run before it starts so the next poll does not take it up again.
app.store.factory_issue_set(&cfg.url, n, &[("state", json!("testing"))])?;
@@ -1516,7 +1541,7 @@ pub async fn poll_repo(app: &Arc<App>, user: &User, cfg: &RepoCfg) -> Result<()>
}
_ => false,
};
if !start || app.store.factory_running(&cfg.url)? >= cfg.max_parallel as i64 {
if !start || !power_on || app.store.factory_running(&cfg.url)? >= cfg.max_parallel as i64 {
continue;
}
if comments.is_empty() {
@@ -1907,6 +1932,15 @@ pub async fn create_project(app: &Arc<App>, user: &User, settings: &mut FactoryS
mod tests {
use super::*;
#[test]
fn power_states() {
assert_eq!(power_state(true, 0), "running");
assert_eq!(power_state(true, 3), "running");
assert_eq!(power_state(false, 2), "stopping");
assert_eq!(power_state(false, 0), "stopped");
assert!(Power::default().on);
}
#[test]
fn backlog_skips_tracked_and_queued_issues() {
let cfg = repo("https://git.example.org/o/r.git");
+2
View File
@@ -235,6 +235,8 @@ pub async fn version_pass(app: &Arc<App>, user: &User, cfg: &RepoCfg) -> Result<
if pr["state"].as_str() != Some("merged") {
continue;
}
// Remember it at once: if the version step below fails, the issue can still be closed by hand.
let _ = app.store.factory_issue_set(&cfg.url, n, &[("merged", json!(1))]);
let title = r["title"].as_str().unwrap_or("").to_string();
let others: Vec<String> = g.open_issue_titles().await?.into_iter().filter(|(num, _)| *num != n).map(|(_, t)| t).collect();
let dir = checkout(app, user, cfg).await?;
+71 -4
View File
@@ -125,6 +125,13 @@ impl Store {
last_status TEXT,
created_at INTEGER NOT NULL
);
CREATE TABLE IF NOT EXISTS chat_drafts (
session_id TEXT NOT NULL,
user_id TEXT NOT NULL,
text TEXT NOT NULL,
updated_at INTEGER NOT NULL,
PRIMARY KEY (session_id, user_id)
);
CREATE TABLE IF NOT EXISTS user_settings (
user_id TEXT NOT NULL,
key TEXT NOT NULL,
@@ -255,6 +262,7 @@ impl Store {
("images", "blob", "ALTER TABLE images ADD COLUMN blob TEXT"),
("usage", "allowance", "ALTER TABLE usage ADD COLUMN allowance REAL"),
("factory_issues", "version", "ALTER TABLE factory_issues ADD COLUMN version TEXT NOT NULL DEFAULT ''"),
("factory_issues", "merged", "ALTER TABLE factory_issues ADD COLUMN merged INTEGER NOT NULL DEFAULT 0"),
] {
let exists: bool = conn
.prepare(&format!("SELECT 1 FROM pragma_table_info('{table}') WHERE name = ?1"))?
@@ -1482,8 +1490,8 @@ impl Store {
pub fn factory_issue(&self, repo: &str, number: i64) -> Result<Option<Value>> {
let conn = self.conn.lock().unwrap();
Ok(conn
.query_row("SELECT title, author, state, attempts, rounds, last_comment, scenarios, branch, pr_url, note, created_at, updated_at, owner_id, version FROM factory_issues WHERE repo_url = ?1 AND number = ?2", params![repo, number], |r| {
Ok(json!({"repo": repo, "number": number, "title": r.get::<_, String>(0)?, "author": r.get::<_, String>(1)?, "state": r.get::<_, String>(2)?, "attempts": r.get::<_, i64>(3)?, "rounds": r.get::<_, i64>(4)?, "last_comment": r.get::<_, i64>(5)?, "scenarios": r.get::<_, String>(6)?, "branch": r.get::<_, String>(7)?, "pr_url": r.get::<_, String>(8)?, "note": r.get::<_, String>(9)?, "created_at": r.get::<_, i64>(10)?, "updated_at": r.get::<_, i64>(11)?, "owner_id": r.get::<_, String>(12)?, "version": r.get::<_, String>(13)?}))
.query_row("SELECT title, author, state, attempts, rounds, last_comment, scenarios, branch, pr_url, note, created_at, updated_at, owner_id, version, merged FROM factory_issues WHERE repo_url = ?1 AND number = ?2", params![repo, number], |r| {
Ok(json!({"repo": repo, "number": number, "title": r.get::<_, String>(0)?, "author": r.get::<_, String>(1)?, "state": r.get::<_, String>(2)?, "attempts": r.get::<_, i64>(3)?, "rounds": r.get::<_, i64>(4)?, "last_comment": r.get::<_, i64>(5)?, "scenarios": r.get::<_, String>(6)?, "branch": r.get::<_, String>(7)?, "pr_url": r.get::<_, String>(8)?, "note": r.get::<_, String>(9)?, "created_at": r.get::<_, i64>(10)?, "updated_at": r.get::<_, i64>(11)?, "owner_id": r.get::<_, String>(12)?, "version": r.get::<_, String>(13)?, "merged": r.get::<_, i64>(14)? != 0}))
})
.optional()?)
}
@@ -1505,7 +1513,7 @@ impl Store {
/// Update the given columns (whitelisted) of an issue.
pub fn factory_issue_set(&self, repo: &str, number: i64, fields: &[(&str, Value)]) -> Result<()> {
const COLS: [&str; 11] = ["title", "state", "attempts", "rounds", "last_comment", "scenarios", "branch", "pr_url", "note", "author", "version"];
const COLS: [&str; 12] = ["title", "state", "attempts", "rounds", "last_comment", "scenarios", "branch", "pr_url", "note", "author", "version", "merged"];
let conn = self.conn.lock().unwrap();
for (k, v) in fields {
if !COLS.contains(k) {
@@ -1569,13 +1577,42 @@ impl Store {
Ok(rows.filter_map(|r| r.ok()).collect())
}
/// The unsent message of a chat, kept on the server so that it can be continued on another device.
pub fn chat_draft(&self, session: &str, user: &str) -> Result<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>> {
let nums: Vec<(String, i64)> = {
let conn = self.conn.lock().unwrap();
let mut st = conn.prepare("SELECT repo_url, number FROM factory_issues WHERE owner_id = ?1 ORDER BY updated_at DESC")?;
st.query_map([owner], |r| Ok((r.get(0)?, r.get(1)?)))?.filter_map(|r| r.ok()).collect()
};
Ok(nums.into_iter().filter_map(|(r, n)| self.factory_issue(&r, n).ok().flatten()).collect())
let mut rows: Vec<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<()> {
@@ -1597,6 +1634,11 @@ impl Store {
Ok(self.conn.lock().unwrap().query_row("SELECT COUNT(*) FROM factory_issues WHERE repo_url = ?1 AND state IN ('review', 'building', 'testing')", [repo], |r| r.get(0))?)
}
/// Phases of this user that are running right now (any repository).
pub fn factory_active(&self, owner: &str) -> Result<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).
pub fn factory_runs(&self, owner: &str, repo: Option<&str>, issue: Option<i64>, limit: i64) -> Result<Vec<Value>> {
let conn = self.conn.lock().unwrap();
@@ -2022,3 +2064,28 @@ mod link_tests {
std::fs::remove_dir_all(&dir).unwrap();
}
}
#[cfg(test)]
mod draft_tests {
use super::*;
#[test]
fn drafts_are_kept_per_chat_and_user_and_cleared_when_empty() {
let dir = std::env::temp_dir().join(format!("cc-drafts-{}", std::process::id()));
std::fs::create_dir_all(&dir).unwrap();
let store = Store::open(&dir.join("t.db")).unwrap();
assert!(store.chat_draft("s1", "u1").unwrap().is_none());
store.chat_draft_set("s1", "u1", "half a message").unwrap();
store.chat_draft_set("s1", "u2", "someone else").unwrap();
store.chat_draft_set("s2", "u1", "other chat").unwrap();
assert_eq!(store.chat_draft("s1", "u1").unwrap().unwrap().0, "half a message");
store.chat_draft_set("s1", "u1", "continued on another device").unwrap();
assert_eq!(store.chat_draft("s1", "u1").unwrap().unwrap().0, "continued on another device");
assert_eq!(store.chat_draft("s1", "u2").unwrap().unwrap().0, "someone else");
// Sending clears it.
store.chat_draft_set("s1", "u1", " \n").unwrap();
assert!(store.chat_draft("s1", "u1").unwrap().is_none());
assert_eq!(store.chat_draft("s2", "u1").unwrap().unwrap().0, "other chat");
let _ = std::fs::remove_dir_all(&dir);
}
}
+214 -3
View File
@@ -30,6 +30,32 @@ use tokio::process::Command;
use tokio::task::JoinHandle;
const LABEL: &str = "codecraft.testrunner=1";
const CACHE_LABEL: &str = "codecraft.testrunner.cache=1";
/// What every environment container runs: link the shared directories, restore a matching seed, run
/// `install`, store a new seed (only after a successful install, so it is pristine), start the app.
const FALLBACK_IMAGE: &str = "node:24-bookworm";
const ENTRY_SCRIPT: &str = r#"cd /app
hit=0
if [ -d /cache ]; then
for d in $CC_CACHE_DIRS; do mkdir -p "/cache/dirs/$d" "$(dirname "$d")" && rm -rf "$d" && ln -s "/cache/dirs/$d" "$d"; done
if [ -d /usr/local/cargo ]; then for d in registry git; do mkdir -p "/cache/cargo/$d"; rm -rf "/usr/local/cargo/$d"; ln -s "/cache/cargo/$d" "/usr/local/cargo/$d"; done; fi
if [ -n "$CC_SEED_KEY" ]; then for p in $CC_SEED_PATHS; do if [ -e "/cache/seed/$CC_SEED_KEY/$p" ]; then mkdir -p "$(dirname "$p")" && cp -a "/cache/seed/$CC_SEED_KEY/$p" "$p" && hit=1 && echo "[runner] restored $p from the cache"; fi; done; fi
fi
if [ -n "$CC_SEED_KEY" ]; then if [ "$hit" = 1 ]; then echo "[runner] seed $CC_SEED_KEY: hit"; else echo "[runner] seed $CC_SEED_KEY: miss"; fi; fi
t0=$(date +%s); st=$(date -u '+%Y-%m-%d %H:%M:%S')
if [ -n "$CC_INSTALL" ]; then sh -c "$CC_INSTALL" || exit 1; fi
echo "[runner] install took $(( $(date +%s) - t0 )) s"
pk=$(awk -v s="$st" '$3=="install" && ($1" "$2)>=s {sub(/:.*/,"",$4); print $4}' /var/log/dpkg.log 2>/dev/null | sort -u | head -40 | tr '\n' ' ')
if [ -n "$pk" ]; then echo "[runner] apt installed: $pk"; fi
if [ -d /cache ] && [ -n "$CC_SEED_KEY" ] && [ ! -d "/cache/seed/$CC_SEED_KEY" ]; then
t="/cache/seed/.tmp-$$"; rm -rf "$t"; mkdir -p "$t"; ok=1
for p in $CC_SEED_PATHS; do if [ -e "$p" ]; then mkdir -p "$t/$(dirname "$p")" && cp -a "$p" "$t/$p" || ok=0; fi; done
if [ "$ok" = 1 ]; then mv "$t" "/cache/seed/$CC_SEED_KEY" && echo "[runner] stored the seed $CC_SEED_KEY"; else rm -rf "$t"; fi
ls -1t /cache/seed 2>/dev/null | grep -v '^\.tmp' | tail -n +4 | while read -r o; do rm -rf "/cache/seed/$o"; done
fi
exec sh -c "$CC_START""#;
// --- what a repository asks for (.factory/setup.json) ------------------------------------
@@ -41,6 +67,29 @@ pub struct Service {
pub env: BTreeMap<String, String>,
}
/// What stays between runs of one project (kept in a Docker volume of the runner).
///
/// * `dirs`: directories of the sources that persist and are shared by all runs (downloads, caches –
/// inputs only: whatever lands there is visible to the next run).
/// * `seed`: expensive *results* of `install` (e.g. a built disk image). They are stored after a successful
/// `install` under a key made from the image, the install command, the seed paths and the contents of the
/// `key` files/directories, and copied into fresh containers whenever that key matches – so a run never
/// sees changes of an earlier run, and a change of the listed sources builds the seed anew.
///
/// Tool caches (npm, yarn, pip, Go, Cargo registry and target directory) are always shared per project
/// unless `"cache": false`.
#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)]
pub struct CacheCfg {
#[serde(default)]
pub disabled: bool,
#[serde(default)]
pub dirs: Vec<String>,
#[serde(default)]
pub seed_paths: Vec<String>,
#[serde(default)]
pub seed_key: Vec<String>,
}
/// The request to start an environment.
#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)]
pub struct StartReq {
@@ -63,6 +112,11 @@ pub struct StartReq {
/// How long to wait until the port answers (seconds, default 300).
#[serde(default)]
pub ready_secs: u64,
/// Stable name of the project: its cache lives in the volume `cc-cache-<cache_id>`. Empty = no cache.
#[serde(default)]
pub cache_id: String,
#[serde(default)]
pub cache: CacheCfg,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
@@ -110,9 +164,19 @@ pub fn parse_setup(text: &str) -> Option<StartReq> {
env: strs("env"),
services,
ready_secs: v["ready_seconds"].as_u64().unwrap_or(0),
cache_id: String::new(),
cache: parse_cache(&v["cache"]),
})
}
fn parse_cache(v: &Value) -> CacheCfg {
let list = |x: &Value| -> Vec<String> { x.as_array().map(|a| a.iter().filter_map(|s| s.as_str().map(|s| s.trim().trim_end_matches('/').to_string())).filter(|s| !s.is_empty()).collect()).unwrap_or_default() };
if v.as_bool() == Some(false) {
return CacheCfg { disabled: true, ..Default::default() };
}
CacheCfg { disabled: false, dirs: list(&v["dirs"]), seed_paths: list(&v["seed"]["paths"]), seed_key: list(&v["seed"]["key"]) }
}
/// Port of `http://host:1234/path` (80/443 by scheme when missing).
pub fn port_of(url: &str) -> Option<u16> {
let (scheme, rest) = url.trim().split_once("://")?;
@@ -132,6 +196,61 @@ fn image_ok(s: &str) -> bool {
ident_ok(s, "._/:@-") && !s.starts_with('-')
}
/// A path inside the sources: relative, no `..`, only plain characters (it ends up in a shell loop).
fn rel_ok(p: &str) -> bool {
ident_ok(p, "._/-") && !p.starts_with('/') && !p.starts_with('-') && !p.split('/').any(|c| c.is_empty() || c == "..") && !p.split('/').any(|c| c == ".git")
}
/// Key of a seed: image, install command, seed paths and the contents of the key files (directories: recursively).
pub fn seed_key(work: &Path, image: &str, req: &StartReq) -> Option<String> {
use sha2::{Digest, Sha256};
let c = &req.cache;
if c.disabled || c.seed_paths.is_empty() {
return None;
}
fn walk(base: &Path, rel: &Path, out: &mut Vec<std::path::PathBuf>) {
let full = base.join(rel);
if full.is_dir() {
let mut kids: Vec<_> = std::fs::read_dir(&full).map(|d| d.filter_map(|e| e.ok()).map(|e| e.file_name()).collect()).unwrap_or_default();
kids.sort();
for k in kids {
if k == ".git" || k == "node_modules" {
continue;
}
walk(base, &rel.join(k), out);
}
} else if full.is_file() {
out.push(rel.to_path_buf());
}
}
let mut h = Sha256::new();
for part in [image, &req.install, &c.seed_paths.join("\n"), &req.dockerfile] {
h.update(part.as_bytes());
h.update([0]);
}
let mut files = Vec::new();
let mut keys = c.seed_key.clone();
keys.sort();
for k in &keys {
h.update(k.as_bytes());
h.update([1]);
walk(work, Path::new(k), &mut files);
}
let mut total = 0u64;
for f in files {
let data = std::fs::read(work.join(&f)).ok()?;
total += data.len() as u64;
if total > 200 << 20 {
return None;
}
h.update(f.to_string_lossy().as_bytes());
h.update([2]);
h.update(&data);
}
let d = h.finalize();
Some(d.iter().take(10).map(|b| format!("{b:02x}")).collect())
}
fn env_ok(m: &BTreeMap<String, String>) -> bool {
m.len() <= 64 && m.iter().all(|(k, v)| k.chars().next().is_some_and(|c| c.is_ascii_alphabetic() || c == '_') && ident_ok(k, "_") && v.len() <= 4096 && !v.contains('\0'))
}
@@ -158,6 +277,16 @@ fn validate(req: &StartReq, factory_dir: &Path) -> Result<PathBuf> {
if !env_ok(&req.env) {
bail!("invalid environment variable");
}
if !req.cache_id.is_empty() && !ident_ok(&req.cache_id, "-_.") {
bail!("invalid cache id");
}
let c = &req.cache;
if c.dirs.len() > 16 || c.seed_paths.len() > 8 || c.seed_key.len() > 32 || !c.dirs.iter().chain(&c.seed_paths).chain(&c.seed_key).all(|p| rel_ok(p)) {
bail!("invalid cache path (relative, letters, digits and ._-/ only)");
}
if !c.seed_paths.is_empty() && c.seed_key.is_empty() {
bail!("cache.seed needs a key (the sources the seed depends on)");
}
let root = factory_dir.canonicalize().with_context(|| format!("factory area {} is not mounted", factory_dir.display()))?;
let work = Path::new(&req.work).canonicalize().context("source directory not found")?;
if !work.starts_with(&root) || !work.is_dir() {
@@ -230,7 +359,7 @@ pub async fn serve() -> Result<()> {
ports: (lo, hi),
memory: std::env::var("RUNNER_MEMORY").unwrap_or_else(|_| "2g".into()),
cpus: std::env::var("RUNNER_CPUS").unwrap_or_else(|_| "2".into()),
default_image: std::env::var("RUNNER_DEFAULT_IMAGE").unwrap_or_else(|_| "node:22-bookworm".into()),
default_image: std::env::var("RUNNER_DEFAULT_IMAGE").unwrap_or_else(|_| "git.familie-zink.org/zink/codecraft-testbase:latest".into()),
max_age: Duration::from_secs(60 * std::env::var("RUNNER_MAX_MINUTES").ok().and_then(|s| s.parse().ok()).unwrap_or(90)),
me: std::env::var("RUNNER_SELF").or_else(|_| std::env::var("HOSTNAME")).unwrap_or_default(),
envs: Mutex::new(HashMap::new()),
@@ -254,6 +383,7 @@ pub async fn serve() -> Result<()> {
.route("/v1/envs", post(start_env))
.route("/v1/envs/{id}", delete(stop_env))
.route("/v1/envs/{id}/log", get(log_env))
.route("/v1/cache/{id}", delete(clear_cache))
.with_state(runner);
let bind = std::env::var("RUNNER_BIND").unwrap_or_else(|_| "0.0.0.0:8788".into());
let l = TcpListener::bind(&bind).await?;
@@ -312,6 +442,7 @@ async fn start_env(State(r): State<Arc<Runner>>, h: HeaderMap, Json(req): Json<S
}
async fn create(r: &Arc<Runner>, id: &str, req: &StartReq, work: &Path) -> Result<Started> {
let began = Instant::now();
let net = format!("cc-run-{id}");
let app = format!("cc-run-{id}");
// Register first, so a failure at any step is cleaned up by stop().
@@ -331,7 +462,7 @@ async fn create(r: &Arc<Runner>, id: &str, req: &StartReq, work: &Path) -> Resul
r.envs.lock().unwrap().get_mut(id).unwrap().containers.push(cname);
}
let image = if req.dockerfile.is_empty() {
if req.image.is_empty() { r.default_image.clone() } else { req.image.clone() }
if req.image.is_empty() { default_image_or_fallback(&r.default_image).await } else { req.image.clone() }
} else {
let tag = format!("cc-run-{id}");
let df = work.join(&req.dockerfile);
@@ -350,12 +481,42 @@ async fn create(r: &Arc<Runner>, id: &str, req: &StartReq, work: &Path) -> Resul
a.push("-e".into());
a.push(format!("{k}={v}"));
}
// Per-project cache volume: tool caches, shared download directories and seeds (see CacheCfg).
let cached = !req.cache_id.is_empty() && !req.cache.disabled;
if cached {
let vol = format!("cc-cache-{}", req.cache_id);
docker(&["volume", "create", "--label", CACHE_LABEL, &vol]).await.context("cache volume")?;
a.push("-v".into());
a.push(format!("{vol}:/cache"));
for (k, v) in [
("npm_config_cache", "/cache/npm"),
("YARN_CACHE_FOLDER", "/cache/yarn"),
("PIP_CACHE_DIR", "/cache/pip"),
("GOMODCACHE", "/cache/go/mod"),
("GOCACHE", "/cache/go/build"),
("CARGO_TARGET_DIR", "/cache/target"),
("XDG_CACHE_HOME", "/cache/xdg"),
] {
if !req.env.contains_key(k) {
a.push("-e".into());
a.push(format!("{k}={v}"));
}
}
a.push("-e".into());
a.push(format!("CC_CACHE_DIRS={}", req.cache.dirs.join(" ")));
if let Some(key) = seed_key(work, &image, req) {
a.push("-e".into());
a.push(format!("CC_SEED_KEY={key}"));
a.push("-e".into());
a.push(format!("CC_SEED_PATHS={}", req.cache.seed_paths.join(" ")));
}
}
a.push("-e".into());
a.push(format!("CC_INSTALL={}", req.install));
a.push("-e".into());
a.push(format!("CC_START={}", req.start));
a.push(image);
a.extend(["sh", "-c", r#"if [ -n "$CC_INSTALL" ]; then sh -c "$CC_INSTALL" || exit 1; fi; exec sh -c "$CC_START""#].map(String::from));
a.extend(["sh", "-c", ENTRY_SCRIPT].map(String::from));
let refs: Vec<&str> = a.iter().map(String::as_str).collect();
docker(&refs).await.context("docker create")?;
// Copy the sources in (without .git); the container never sees the host directory.
@@ -390,6 +551,11 @@ async fn create(r: &Arc<Runner>, id: &str, req: &StartReq, work: &Path) -> Resul
}
tokio::time::sleep(Duration::from_millis(700)).await;
}
// Report what the cache brought: seed hit/miss, install time, total time until the app answered.
let facts: Vec<String> = logs(&app).await.lines().filter(|l| l.starts_with("[runner] seed ") || l.starts_with("[runner] install took") || l.starts_with("[runner] apt installed")).map(|l| l.trim_start_matches("[runner] ").to_string()).collect();
let took = began.elapsed().as_secs();
let cache = if cached { "on" } else { "off" };
tracing::info!("test env {id} ({}) ready after {took} s; cache {cache}{}{}", req.cache_id, if facts.is_empty() { "" } else { "; " }, facts.join("; "));
let (listener, port) = bind_forward(r).await?;
let (target, tport) = (ip, req.port);
let fwd = tokio::spawn(async move {
@@ -410,6 +576,15 @@ async fn create(r: &Arc<Runner>, id: &str, req: &StartReq, work: &Path) -> Resul
Ok(Started { id: id.to_string(), port })
}
/// The shared base image; when it can neither be found nor pulled, fall back to plain Node so runs still work.
async fn default_image_or_fallback(img: &str) -> String {
if docker(&["image", "inspect", img]).await.is_ok() || docker(&["pull", "-q", img]).await.is_ok() {
return img.to_string();
}
tracing::warn!("test runner: base image {img} is not available, using {FALLBACK_IMAGE}");
FALLBACK_IMAGE.to_string()
}
async fn logs(container: &str) -> String {
match Command::new("docker").args(["logs", "--tail", "400", container]).output().await {
Ok(o) => format!("{}{}", String::from_utf8_lossy(&o.stdout), String::from_utf8_lossy(&o.stderr)),
@@ -443,6 +618,16 @@ async fn stop_env(State(r): State<Arc<Runner>>, h: HeaderMap, AxPath(id): AxPath
Ok(Json(json!({"ok": true})))
}
/// Forget the cache of a project (fails while an environment of it is running).
async fn clear_cache(State(r): State<Arc<Runner>>, h: HeaderMap, AxPath(id): AxPath<String>) -> Resp<Json<Value>> {
authed(&r, &h)?;
if !ident_ok(&id, "-_.") {
return Err((StatusCode::BAD_REQUEST, "invalid cache id".into()));
}
docker(&["volume", "rm", &format!("cc-cache-{id}")]).await.map_err(|e| (StatusCode::CONFLICT, format!("{e:#}")))?;
Ok(Json(json!({"ok": true})))
}
#[derive(Deserialize)]
struct LogQ {
tail: Option<usize>,
@@ -574,6 +759,32 @@ mod tests {
let _ = std::fs::remove_dir_all(&dir);
}
#[test]
fn cache_config_and_seed_key() {
let r = parse_setup(r#"{"start":"x","port":1,"cache":{"dirs":["build/downloads/"],"seed":{"paths":["data/ubuntu.ext4"],"key":["guest","package-lock.json"]}}}"#).unwrap();
assert_eq!(r.cache.dirs, vec!["build/downloads"]);
assert_eq!(r.cache.seed_key, vec!["guest", "package-lock.json"]);
assert!(parse_setup(r#"{"start":"x","port":1,"cache":false}"#).unwrap().cache.disabled);
assert!(!parse_setup(r#"{"start":"x","port":1}"#).unwrap().cache.disabled);
assert!(rel_ok("build/downloads") && !rel_ok("../x") && !rel_ok("/etc") && !rel_ok("a b") && !rel_ok("a/.git/b") && !rel_ok("a//b"));
// The key follows the contents of the key files, not of anything else.
let dir = std::env::temp_dir().join(format!("ccs-{}", std::process::id()));
std::fs::create_dir_all(dir.join("guest")).unwrap();
std::fs::write(dir.join("guest/a.c"), "one").unwrap();
std::fs::write(dir.join("other.txt"), "x").unwrap();
let mut req = r.clone();
req.install = "npm ci".into();
let k1 = seed_key(&dir, "node:24", &req).unwrap();
std::fs::write(dir.join("other.txt"), "changed").unwrap();
assert_eq!(seed_key(&dir, "node:24", &req).unwrap(), k1);
std::fs::write(dir.join("guest/a.c"), "two").unwrap();
assert_ne!(seed_key(&dir, "node:24", &req).unwrap(), k1);
assert_ne!(seed_key(&dir, "node:22", &req).unwrap(), seed_key(&dir, "node:24", &req).unwrap());
req.cache.seed_paths.clear();
assert!(seed_key(&dir, "node:24", &req).is_none());
let _ = std::fs::remove_dir_all(&dir);
}
#[test]
fn tokens_compare() {
assert!(eq_const("abc", "abc"));
+1 -1
View File
@@ -128,7 +128,7 @@ export function App() {
);
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 === "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 === "images") content = <Images onMenu={openMenu} />;
else if (section === "jobs" && arg) content = <JobEditor key={arg} id={arg} onMenu={openMenu} />;
+52
View File
@@ -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 }) {
const t = useT();
const session = useStore((s) => s.sessionById[sessionId]);
@@ -572,6 +623,7 @@ export function ChatView({ sessionId, onMenu, onClosePane }: { sessionId: string
const models = useModels();
const [loadError, setLoadError] = useState<string>();
const [text, setText] = useState(() => takePrefill(sessionId) ?? "");
useDraftSync(sessionId, text, setText, readOnly);
const [stats, setStats] = useState<SessionStats>();
const [showStats, setShowStats] = useState(false);
const [editingTitle, setEditingTitle] = useState(false);
+126 -18
View File
@@ -7,6 +7,7 @@ import { Icon } from "./Icon";
import { Spinner } from "./Activity";
import { ModelSelect } from "./ModelSelect";
import { RecreateDialog } from "./FactoryDraft";
import { ChatOverlay, openFactoryChat } from "./FactoryChat";
import { ReleaseDialog, ReleasesPanel, type ReleaseRow } from "./FactoryRelease";
interface PrInfo {
@@ -76,6 +77,11 @@ interface Issue {
pr_url: string;
branch: string;
rounds: number;
/** Newest phase chat that still exists. */
/** The pull request is merged (merging comes after a positive acceptance, closing after the merge). */
merged?: boolean;
chat_session?: string;
chat_phase?: Phase;
created_at: number;
updated_at: number;
}
@@ -114,8 +120,15 @@ interface RepoInfo {
running: number;
version?: string | null;
}
interface Power {
on: boolean;
/** Agents that are working right now. */
active: number;
state: "running" | "stopping" | "stopped";
}
interface Overview {
area: boolean;
power?: Power;
repos: RepoInfo[];
issues: Issue[];
runs: Run[];
@@ -147,7 +160,7 @@ function fmtDuration(ms: number) {
const runMs = (r: Run, now: number) => (r.ended_at ?? now) - r.started_at;
/** Software factory: spec issues in Gitea are reviewed, built and accepted by agents with a model per phase. */
export function Factory({ onMenu }: { onMenu: () => void }) {
export function Factory({ onMenu, overlayId }: { onMenu: () => void; overlayId?: string }) {
const t = useT();
const [tab, setTab] = useState<"overview" | "settings">("overview");
return (
@@ -168,14 +181,47 @@ export function Factory({ onMenu }: { onMenu: () => void }) {
</div>
</div>
<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 />}
</div>
</div>
{overlayId && <ChatOverlay id={overlayId} />}
</>
);
}
/** A button inside an issue card (the card itself is a button, so this is a span with the button role). */
function CardAction({ children, onClick, title, primary, disabled }: { children: React.ReactNode; onClick: () => void; title?: string; primary?: boolean; disabled?: boolean }) {
const run = (e: React.SyntheticEvent) => {
e.stopPropagation();
e.preventDefault();
if (!disabled) onClick();
};
return (
<span role="button" tabIndex={disabled ? -1 : 0} aria-disabled={disabled} className={`factory-card-action ${primary ? "primary" : ""} ${disabled ? "disabled" : ""}`} title={title} onClick={run} onKeyDown={(e) => (e.key === "Enter" || e.key === " ") && run(e)}>
{children}
</span>
);
}
/** 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 }) {
const t = useT();
const [data, setData] = useState<Overview>();
@@ -372,20 +418,24 @@ function FactoryOverview({ onSettings }: { onSettings: () => void }) {
setBusy(false);
}
};
const mergePr = async () => {
if (!selected || !pr) return;
if (!(await confirmDialog({ message: t("factory.mergeConfirm", { n: pr.number, method: t(`factory.merge.${prMethod}` as any) }) }))) return;
const prNo = (i: Issue) => Number(i.pr_url.replace(/\/$/, "").split("/").pop()) || 0;
/** Merge the pull request of an issue; only offered once the acceptance has passed. */
const mergeIssue = async (i: Issue, n = prNo(i)) => {
if (!n || i.state !== "done") return;
if (!(await confirmDialog({ message: t("factory.mergeConfirm", { n, method: t(`factory.merge.${prMethod}` as any) }) }))) return;
setBusy(true);
try {
await post("/factory/issues/pr/merge", { repo: selected.repo, number: selected.number, pr: pr.number, method: prMethod });
await post("/factory/issues/pr/merge", { repo: i.repo, number: i.number, pr: n, method: prMethod });
toast(t("factory.merged"));
await loadPr();
await reload();
} catch (e: any) {
toast(e.message);
} finally {
setBusy(false);
}
};
const mergePr = () => (selected && pr ? mergeIssue(selected, pr.number) : Promise.resolve());
const removeIssue = async () => {
if (!selected) return;
if (!(await confirmDialog({ message: t("factory.removeConfirm", { n: selected.number }), confirmLabel: t("factory.remove"), danger: true }))) return;
@@ -400,15 +450,16 @@ function FactoryOverview({ onSettings }: { onSettings: () => void }) {
setBusy(false);
}
};
const closeIssue = async () => {
if (!selected) return;
const comment = await promptDialog({ title: t("factory.closeTitle"), message: t("factory.closeMsg", { n: selected.number }), defaultValue: t("factory.closeDefault"), confirmLabel: t("factory.close") });
/** Close an issue; only offered once its pull request is merged. */
const closeIssueOf = async (i: Issue) => {
if (i.state !== "done" || !i.merged) return;
const comment = await promptDialog({ title: t("factory.closeTitle"), message: t("factory.closeMsg", { n: i.number }), defaultValue: t("factory.closeDefault"), confirmLabel: t("factory.close") });
if (comment === null) return;
setBusy(true);
try {
await post("/factory/issues/close", { repo: selected.repo, number: selected.number, comment });
await post("/factory/issues/close", { repo: i.repo, number: i.number, comment });
toast(t("factory.closed"), "success");
setSel("");
if (selected && selected.number === i.number && selected.repo === i.repo) setSel("");
await reload();
} catch (e: any) {
toast(e.message);
@@ -416,11 +467,23 @@ function FactoryOverview({ onSettings }: { onSettings: () => void }) {
setBusy(false);
}
};
const closeIssue = () => (selected ? closeIssueOf(selected) : Promise.resolve());
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 (
<>
{!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="kpi">
<div className="k-label">{t("factory.kpi.running")}</div>
@@ -536,20 +599,65 @@ function FactoryOverview({ onSettings }: { onSettings: () => void }) {
const rs = runsOf(i);
const active = rs.find((r) => !r.ended_at);
const latest = active ?? rs[0];
// Claimed by a phase but no chat yet: checkout, and – for acceptance – installing and starting the app in its throw-away container.
const preparing = !active && ["review", "building", "testing"].includes(i.state);
const tokens = rs.reduce((a, r) => a + r.input_tokens + r.output_tokens, 0);
return (
<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">
{repoName(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" : ""} ${preparing ? "preparing" : ""}`} onClick={() => setSel(sel === `${i.repo}#${i.number}` ? "" : `${i.repo}#${i.number}`)}>
<span className="factory-card-head">
<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>
<b>{i.title || `#${i.number}`}</b>
{latest && (
{preparing && (
<span className="hint" title={t("factory.preparing.hint")}>
<span className="factory-pulse prep" />
{i.state === "testing" ? t("factory.preparing.env") : t("factory.preparing.start")} · {fmtDuration(now - i.updated_at)}
</span>
)}
{latest && !preparing && (
<span className="hint">
{active && <span className="factory-pulse" />}
{t(`factory.phase.${latest.phase}` as any)} · {(latest.model || "").split("/").pop()} · {fmtDuration(runMs(latest, now))}
</span>
)}
{tokens > 0 && <span className="hint">{fmtCompact(tokens)} {t("factory.tokens")}</span>}
{i.state === "done" && (i.merged || prNo(i) > 0) && (
<span className="factory-card-actions">
{!i.merged ? (
<CardAction primary disabled={busy} title={t("factory.mergeHint")} onClick={() => void mergeIssue(i)}>
<Icon name="fork" /> {t("factory.mergeBtn")}
</CardAction>
) : (
<CardAction disabled={busy} title={t("factory.closeHint")} onClick={() => void closeIssueOf(i)}>
<Icon name="check" /> {t("factory.close")}
</CardAction>
)}
</span>
)}
</button>
);
})}
@@ -585,7 +693,7 @@ function FactoryOverview({ onSettings }: { onSettings: () => void }) {
<Icon name="trash" /> {t("factory.remove")}
</button>
)}
{selected && selected.state === "done" && (
{selected && selected.state === "done" && selected.merged && (
<button className="small" onClick={closeIssue} disabled={busy}>
<Icon name="check" /> {t("factory.close")}
</button>
@@ -618,7 +726,7 @@ function FactoryOverview({ onSettings }: { onSettings: () => void }) {
</span>
)}
<span className="spacer" />
{pr.state === "open" && (
{pr.state === "open" && selected?.state === "done" && (
<>
<select value={prMethod} onChange={(e) => setPrMethod(e.target.value)} disabled={busy}>
{["merge", "squash", "rebase"].map((m) => (
@@ -677,7 +785,7 @@ function FactoryOverview({ onSettings }: { onSettings: () => void }) {
</td>
<td>{fmtCost(r.cost, "USD")}</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")}
</button>
</td>
+47
View File
@@ -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>
);
}
+13
View File
@@ -1235,6 +1235,19 @@ export const de: Messages = {
"factory.backlog.empty": "Keine offenen Issues außerhalb der Factory",
"factory.backlog.error": "Der Forge konnte für einige Projekte nicht gelesen werden",
"factory.col.backlog": "Backlog",
"factory.chatOverlay": "Chat der Factory",
"factory.openFull": "Als Seite öffnen",
"factory.openFullHint": "Den Chat im ganzen Fenster öffnen",
"factory.power.running": "Factory läuft",
"factory.power.stopping": "Factory stoppt – {n} Agent(en) arbeiten noch",
"factory.power.stopped": "Factory gestoppt",
"factory.power.stopHint": "Klicken zum Stoppen: keine neuen Agenten, laufende werden fertig",
"factory.power.startHint": "Klicken, um die Factory zu starten",
"factory.preparing.env": "Testumgebung wird vorbereitet",
"factory.preparing.start": "Lauf wird vorbereitet",
"factory.preparing.hint": "Der Agent-Chat startet, sobald der Checkout fertig ist und – bei der Abnahme – die App in ihrem Wegwerf-Container installiert ist und läuft",
"factory.mergeHint": "Pull Request mergen – die Abnahme war erfolgreich",
"factory.closeHint": "Issue schließen – der Pull Request ist gemerged",
"factory.col.review": "Prüfung",
"factory.col.question": "Rückfragen",
"factory.col.approved": "Freigegeben",
+13
View File
@@ -1234,6 +1234,19 @@ export const en = {
"factory.backlog.empty": "No open issues outside the factory",
"factory.backlog.error": "The forge could not be read for some projects",
"factory.col.backlog": "Backlog",
"factory.chatOverlay": "Chat of the factory",
"factory.openFull": "Open as page",
"factory.openFullHint": "Open the chat in the full window",
"factory.power.running": "Factory running",
"factory.power.stopping": "Factory stopping – {n} agent(s) still working",
"factory.power.stopped": "Factory stopped",
"factory.power.stopHint": "Click to stop: no new agents start, running ones finish",
"factory.power.startHint": "Click to start the factory",
"factory.preparing.env": "Preparing the test environment",
"factory.preparing.start": "Preparing the run",
"factory.preparing.hint": "The agent chat starts when the checkout is done and – for acceptance – the app is installed and running in its throw-away container",
"factory.mergeHint": "Merge the pull request – the acceptance has passed",
"factory.closeHint": "Close the issue – the pull request is merged",
"factory.col.review": "Review",
"factory.col.question": "Questions",
"factory.col.approved": "Approved",
+179
View File
@@ -5168,6 +5168,178 @@ td.fold-indent {
grid-column: span 2;
min-width: 0;
}
/* Main switch of the factory. The colours come from the theme (--power-on / -warn / -off). */
.factory-power {
--tone: var(--power-off, var(--red));
display: flex;
align-items: center;
gap: 14px;
width: 100%;
margin: 0 0 12px;
padding: 10px 16px;
text-align: left;
color: var(--fg0);
background: color-mix(in srgb, var(--tone) 18%, var(--bg1));
border: 2px solid var(--tone);
border-radius: 12px;
cursor: pointer;
transition: background 0.25s, border-color 0.25s;
}
.factory-power.running {
--tone: var(--power-on, var(--green));
}
.factory-power.stopping {
--tone: var(--power-warn, var(--accent));
}
.factory-power.stopped {
--tone: var(--power-off, var(--red));
}
.factory-power:hover {
background: color-mix(in srgb, var(--tone) 26%, var(--bg1));
}
.factory-power-track {
position: relative;
flex: none;
width: 52px;
height: 28px;
border-radius: 14px;
background: var(--tone);
transition: background 0.25s;
}
.factory-power-knob {
position: absolute;
top: 3px;
left: 3px;
width: 22px;
height: 22px;
border-radius: 50%;
background: var(--bg0);
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
transition: transform 0.2s;
}
/* on = knob right; stopping is still "off" but pulses until the last agent is done */
.factory-power.running .factory-power-knob {
transform: translateX(24px);
}
.factory-power.stopping .factory-power-track {
animation: factory-pulse 1.4s ease-in-out infinite;
}
.factory-power-text {
display: flex;
flex-direction: column;
gap: 1px;
}
.factory-power-text b {
font-size: 15px;
}
/* Chats of the factory open over the board. */
.chat-overlay {
position: fixed;
inset: 0;
z-index: 25;
background: rgba(0, 0, 0, 0.5);
display: flex;
align-items: center;
justify-content: center;
padding: 3vh 3vw;
}
.chat-overlay-box {
width: min(1200px, 100%);
height: 100%;
background: var(--bg0);
border: 1px solid var(--bg2);
border-radius: 12px;
box-shadow: var(--shadow, 0 12px 40px rgba(0, 0, 0, 0.45));
display: flex;
flex-direction: column;
overflow: hidden;
}
.chat-overlay-bar {
display: flex;
align-items: center;
gap: 8px;
padding: 8px 12px;
background: var(--bg1);
border-bottom: 1px solid var(--bg2);
}
/* The sidebar is not reachable from the overlay: its menu button would only be confusing. */
.chat-overlay .menu-btn {
display: none !important;
}
.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-actions {
display: flex;
gap: 6px;
margin-top: 4px;
}
.factory-card-action {
display: inline-flex;
align-items: center;
gap: 5px;
padding: 3px 9px;
font-size: 12.5px;
border-radius: 6px;
border: 1px solid var(--bg3);
background: var(--bg1);
color: var(--fg0);
cursor: pointer;
}
.factory-card-action:hover {
background: var(--bg2);
}
.factory-card-action.primary {
background: var(--accent);
border-color: var(--accent);
color: var(--on-accent, var(--bg0));
}
.factory-card-action.primary:hover {
filter: brightness(1.08);
}
.factory-card-action.disabled {
opacity: 0.5;
cursor: default;
}
.factory-card-head {
display: flex;
align-items: center;
justify-content: space-between;
gap: 6px;
width: 100%;
}
.factory-open {
display: inline-flex;
align-items: center;
justify-content: center;
width: 22px;
height: 22px;
border-radius: 6px;
color: var(--muted);
cursor: pointer;
}
.factory-open:hover,
.factory-open:focus-visible {
color: var(--fg0);
background: var(--bg2);
}
.factory-open .icon {
width: 15px;
height: 15px;
}
.factory-card.active {
border-color: var(--accent);
}
@@ -5183,6 +5355,13 @@ td.fold-indent {
margin-right: 5px;
animation: factory-pulse 1.4s ease-in-out infinite;
}
/* Preparing (checkout, test environment): same lamp, other colour than an active chat. */
.factory-pulse.prep {
background: var(--prep, var(--blue, var(--accent2)));
}
.factory-card.preparing {
border-left: 3px solid var(--prep, var(--blue, var(--accent2)));
}
@keyframes factory-pulse {
50% {
opacity: 0.25;
+6
View File
@@ -21,6 +21,12 @@
--on-accent: #1c1b1f;
--red: #c15c46;
--green: #8f9a5c;
/* Factory master switch: running / stopping / stopped */
--power-on: #8f9a5c;
--power-warn: #d9b45a;
--power-off: #c15c46;
/* Lamp of a phase that is still being prepared: a colour that differs from --accent */
--prep: var(--blue);
--aqua: #8aa89a;
--blue: #7c9aa1;
--purple: #b47e99;
+6
View File
@@ -21,6 +21,12 @@
--on-accent: #ffffff;
--red: #96392a;
--green: #5c6631;
/* Factory master switch: running / stopping / stopped */
--power-on: #5c6631;
--power-warn: #9a7413;
--power-off: #96392a;
/* Lamp of a phase that is still being prepared: a colour that differs from --accent */
--prep: var(--blue);
--aqua: #3d6b72;
--blue: #3d6b72;
--purple: #7c4a66;
+6
View File
@@ -21,6 +21,12 @@
--on-accent: #1e1e2e;
--red: #f38ba8;
--green: #a6e3a1;
/* Factory master switch: running / stopping / stopped */
--power-on: #a6e3a1;
--power-warn: #f9e2af;
--power-off: #f38ba8;
/* Lamp of a phase that is still being prepared: a colour that differs from --accent */
--prep: var(--power-warn);
--aqua: #94e2d5;
--blue: #89b4fa;
--purple: #f5c2e7;
+6
View File
@@ -21,6 +21,12 @@
--on-accent: #ffffff;
--red: #d20f39;
--green: #40a02b;
/* Factory master switch: running / stopping / stopped */
--power-on: #40a02b;
--power-warn: #df8e1d;
--power-off: #d20f39;
/* Lamp of a phase that is still being prepared: a colour that differs from --accent */
--prep: var(--power-warn);
--aqua: #179299;
--blue: #1e66f5;
--purple: #ea76cb;
+6
View File
@@ -21,6 +21,12 @@
--on-accent: #1d150f;
--red: #d78a6f;
--green: #b5b27a;
/* Factory master switch: running / stopping / stopped */
--power-on: #a9b86a;
--power-warn: #e8c36a;
--power-off: #d4694f;
/* Lamp of a phase that is still being prepared: a colour that differs from --accent */
--prep: var(--blue);
--aqua: #9fb8a8;
--blue: #a3b4c7;
--purple: #cf90a2;
+6
View File
@@ -21,6 +21,12 @@
--on-accent: #ffffff;
--red: #a4405e;
--green: #4f6b00;
/* Factory master switch: running / stopping / stopped */
--power-on: #4f6b00;
--power-warn: #a8780a;
--power-off: #a93a2e;
/* Lamp of a phase that is still being prepared: a colour that differs from --accent */
--prep: var(--aqua);
--aqua: #3f6b5e;
--blue: #8e2d53;
--purple: #7a003b;
+6
View File
@@ -21,6 +21,12 @@
--on-accent: #282a36;
--red: #ff5555;
--green: #50fa7b;
/* Factory master switch: running / stopping / stopped */
--power-on: #50fa7b;
--power-warn: #f1fa8c;
--power-off: #ff5555;
/* Lamp of a phase that is still being prepared: a colour that differs from --accent */
--prep: var(--power-warn);
--aqua: #8be9fd;
--blue: #8be9fd;
--purple: #ff79c6;
+6
View File
@@ -21,6 +21,12 @@
--on-accent: #ffffff;
--red: #cb3a2a;
--green: #14710a;
/* Factory master switch: running / stopping / stopped */
--power-on: #14710a;
--power-warn: #846e15;
--power-off: #cb3a2a;
/* Lamp of a phase that is still being prepared: a colour that differs from --accent */
--prep: var(--power-warn);
--aqua: #036a96;
--blue: #036a96;
--purple: #a3144d;
+6
View File
@@ -21,6 +21,12 @@
--on-accent: #2d353b;
--red: #e67e80;
--green: #a7c080;
/* Factory master switch: running / stopping / stopped */
--power-on: #a7c080;
--power-warn: #dbbc7f;
--power-off: #e67e80;
/* Lamp of a phase that is still being prepared: a colour that differs from --accent */
--prep: var(--purple);
--aqua: #83c092;
--blue: #7fbbb3;
--purple: #d699b6;
+6
View File
@@ -21,6 +21,12 @@
--on-accent: #2d353b;
--red: #f85552;
--green: #8da101;
/* Factory master switch: running / stopping / stopped */
--power-on: #8da101;
--power-warn: #dfa000;
--power-off: #f85552;
/* Lamp of a phase that is still being prepared: a colour that differs from --accent */
--prep: var(--blue);
--aqua: #35a77c;
--blue: #3a94c5;
--purple: #df69ba;
+6
View File
@@ -21,6 +21,12 @@
--on-accent: #0d1117;
--red: #f85149;
--green: #3fb950;
/* Factory master switch: running / stopping / stopped */
--power-on: #3fb950;
--power-warn: #d29922;
--power-off: #f85149;
/* Lamp of a phase that is still being prepared: a colour that differs from --accent */
--prep: var(--power-warn);
--aqua: #39c5cf;
--blue: #58a6ff;
--purple: #bc8cff;
+6
View File
@@ -21,6 +21,12 @@
--on-accent: #ffffff;
--red: #d1242f;
--green: #1a7f37;
/* Factory master switch: running / stopping / stopped */
--power-on: #1a7f37;
--power-warn: #9a6700;
--power-off: #d1242f;
/* Lamp of a phase that is still being prepared: a colour that differs from --accent */
--prep: var(--power-warn);
--aqua: #1b7c83;
--blue: #0969da;
--purple: #8250df;
+6
View File
@@ -22,6 +22,12 @@
--on-accent: #282828;
--red: #fb4934;
--green: #b8bb26;
/* Factory master switch: running / stopping / stopped */
--power-on: #b8bb26;
--power-warn: #fabd2f;
--power-off: #fb4934;
/* Lamp of a phase that is still being prepared: a colour that differs from --accent */
--prep: var(--blue);
--aqua: #8ec07c;
--blue: #83a598;
--purple: #d3869b;
+6
View File
@@ -21,6 +21,12 @@
--on-accent: #282828;
--red: #9d0006;
--green: #79740e;
/* Factory master switch: running / stopping / stopped */
--power-on: #79740e;
--power-warn: #b57614;
--power-off: #9d0006;
/* Lamp of a phase that is still being prepared: a colour that differs from --accent */
--prep: var(--blue);
--aqua: #427b58;
--blue: #076678;
--purple: #8f3f71;
+6
View File
@@ -21,6 +21,12 @@
--on-accent: #1b1b1b;
--red: #f44336;
--green: #a99b7a;
/* Factory master switch: running / stopping / stopped */
--power-on: #8fae72;
--power-warn: #e0b350;
--power-off: #f44336;
/* Lamp of a phase that is still being prepared: a colour that differs from --accent */
--prep: var(--blue);
--aqua: #8a9ba6;
--blue: #77838a;
--purple: #e58980;
+6
View File
@@ -21,6 +21,12 @@
--on-accent: #ffffff;
--red: #b14752;
--green: #556753;
/* Factory master switch: running / stopping / stopped */
--power-on: #5a7a43;
--power-warn: #a87b1a;
--power-off: #b14752;
/* Lamp of a phase that is still being prepared: a colour that differs from --accent */
--prep: var(--power-warn);
--aqua: #3d727d;
--blue: #4c6c94;
--purple: #8a5b81;
+6
View File
@@ -21,6 +21,12 @@
--on-accent: #1f1f28;
--red: #e46876;
--green: #98bb6c;
/* Factory master switch: running / stopping / stopped */
--power-on: #98bb6c;
--power-warn: #e6c384;
--power-off: #e46876;
/* Lamp of a phase that is still being prepared: a colour that differs from --accent */
--prep: var(--power-warn);
--aqua: #7aa89f;
--blue: #7fb4ca;
--purple: #957fb8;
+6
View File
@@ -21,6 +21,12 @@
--on-accent: #ffffff;
--red: #c84053;
--green: #6f894e;
/* Factory master switch: running / stopping / stopped */
--power-on: #6f894e;
--power-warn: #b07a00;
--power-off: #c84053;
/* Lamp of a phase that is still being prepared: a colour that differs from --accent */
--prep: var(--power-warn);
--aqua: #597b75;
--blue: #4d699b;
--purple: #624c83;
+6
View File
@@ -21,6 +21,12 @@
--on-accent: #2e3440;
--red: #bf616a;
--green: #a3be8c;
/* Factory master switch: running / stopping / stopped */
--power-on: #a3be8c;
--power-warn: #ebcb8b;
--power-off: #bf616a;
/* Lamp of a phase that is still being prepared: a colour that differs from --accent */
--prep: var(--power-warn);
--aqua: #8fbcbb;
--blue: #81a1c1;
--purple: #b48ead;
+6
View File
@@ -21,6 +21,12 @@
--on-accent: #ffffff;
--red: #a9434d;
--green: #5f7d48;
/* Factory master switch: running / stopping / stopped */
--power-on: #5f7d48;
--power-warn: #9a7b2f;
--power-off: #a9434d;
/* Lamp of a phase that is still being prepared: a colour that differs from --accent */
--prep: var(--power-warn);
--aqua: #4d8a89;
--blue: #5e81ac;
--purple: #8f6a8a;
+6
View File
@@ -21,6 +21,12 @@
--on-accent: #282c34;
--red: #e06c75;
--green: #98c379;
/* Factory master switch: running / stopping / stopped */
--power-on: #98c379;
--power-warn: #e5c07b;
--power-off: #e06c75;
/* Lamp of a phase that is still being prepared: a colour that differs from --accent */
--prep: var(--power-warn);
--aqua: #56b6c2;
--blue: #61afef;
--purple: #c678dd;
+6
View File
@@ -21,6 +21,12 @@
--on-accent: #ffffff;
--red: #e45649;
--green: #50a14f;
/* Factory master switch: running / stopping / stopped */
--power-on: #50a14f;
--power-warn: #c18401;
--power-off: #e45649;
/* Lamp of a phase that is still being prepared: a colour that differs from --accent */
--prep: var(--power-warn);
--aqua: #0184bc;
--blue: #4078f2;
--purple: #a626a4;
+6
View File
@@ -21,6 +21,12 @@
--on-accent: #191724;
--red: #eb6f92;
--green: #9ccfd8;
/* Factory master switch: running / stopping / stopped */
--power-on: #95b88f;
--power-warn: #f6c177;
--power-off: #eb6f92;
/* Lamp of a phase that is still being prepared: a colour that differs from --accent */
--prep: var(--power-warn);
--aqua: #9ccfd8;
--blue: #31748f;
--purple: #c4a7e7;
+6
View File
@@ -21,6 +21,12 @@
--on-accent: #ffffff;
--red: #b4637a;
--green: #56949f;
/* Factory master switch: running / stopping / stopped */
--power-on: #5e8f60;
--power-warn: #c98a1b;
--power-off: #b4637a;
/* Lamp of a phase that is still being prepared: a colour that differs from --accent */
--prep: var(--power-warn);
--aqua: #56949f;
--blue: #286983;
--purple: #907aa9;
+6
View File
@@ -21,6 +21,12 @@
--on-accent: #002b36;
--red: #dc322f;
--green: #859900;
/* Factory master switch: running / stopping / stopped */
--power-on: #859900;
--power-warn: #b58900;
--power-off: #dc322f;
/* Lamp of a phase that is still being prepared: a colour that differs from --accent */
--prep: var(--purple);
--aqua: #2aa198;
--blue: #268bd2;
--purple: #6c71c4;
+6
View File
@@ -21,6 +21,12 @@
--on-accent: #002b36;
--red: #dc322f;
--green: #859900;
/* Factory master switch: running / stopping / stopped */
--power-on: #859900;
--power-warn: #b58900;
--power-off: #dc322f;
/* Lamp of a phase that is still being prepared: a colour that differs from --accent */
--prep: var(--purple);
--aqua: #2aa198;
--blue: #268bd2;
--purple: #6c71c4;
+6
View File
@@ -21,6 +21,12 @@
--on-accent: #232a44;
--red: #d47a6a;
--green: #96b4bc;
/* Factory master switch: running / stopping / stopped */
--power-on: #8fb98a;
--power-warn: #e0b860;
--power-off: #d47a6a;
/* Lamp of a phase that is still being prepared: a colour that differs from --accent */
--prep: var(--power-warn);
--aqua: #96b4bc;
--blue: #7aa0cc;
--purple: #c896b2;
+6
View File
@@ -21,6 +21,12 @@
--on-accent: #f0ead9;
--red: #8a3028;
--green: #4a5a3a;
/* Factory master switch: running / stopping / stopped */
--power-on: #4a6b3a;
--power-warn: #9a7218;
--power-off: #8a3028;
/* Lamp of a phase that is still being prepared: a colour that differs from --accent */
--prep: var(--power-warn);
--aqua: #3a5a6a;
--blue: #3a5a8a;
--purple: #5a4a72;
+6
View File
@@ -21,6 +21,12 @@
--on-accent: #24283b;
--red: #f7768e;
--green: #9ece6a;
/* Factory master switch: running / stopping / stopped */
--power-on: #9ece6a;
--power-warn: #e0af68;
--power-off: #f7768e;
/* Lamp of a phase that is still being prepared: a colour that differs from --accent */
--prep: var(--power-warn);
--aqua: #73daca;
--blue: #7aa2f7;
--purple: #bb9af7;
+6
View File
@@ -21,6 +21,12 @@
--on-accent: #ffffff;
--red: #f52a65;
--green: #587539;
/* Factory master switch: running / stopping / stopped */
--power-on: #587539;
--power-warn: #8c6c3e;
--power-off: #f52a65;
/* Lamp of a phase that is still being prepared: a colour that differs from --accent */
--prep: var(--power-warn);
--aqua: #118c74;
--blue: #2e7de9;
--purple: #9854f1;
+6
View File
@@ -21,6 +21,12 @@
--on-accent: #ffffff;
--red: #f14c4c;
--green: #89d185;
/* Factory master switch: running / stopping / stopped */
--power-on: #89d185;
--power-warn: #cca700;
--power-off: #f14c4c;
/* Lamp of a phase that is still being prepared: a colour that differs from --accent */
--prep: var(--power-warn);
--aqua: #4ec9b0;
--blue: #3794ff;
--purple: #c586c0;
+6
View File
@@ -21,6 +21,12 @@
--on-accent: #ffffff;
--red: #cd3131;
--green: #388a34;
/* Factory master switch: running / stopping / stopped */
--power-on: #388a34;
--power-warn: #bf8803;
--power-off: #cd3131;
/* Lamp of a phase that is still being prepared: a colour that differs from --accent */
--prep: var(--power-warn);
--aqua: #267f99;
--blue: #005fb8;
--purple: #af00db;
+24
View File
@@ -3,6 +3,30 @@
* under "unreleased"; scripts/release.sh renames the key to the release version.
*/
export const WHATS_NEW: Record<string, { en: string[]; de: string[] }> = {
"202611-00077": {
en: ["Factory test runner: shared base image (Node 24, Python, gcc, Chromium/Playwright) for acceptance containers; logs start time, cache hits and installed packages"],
de: ["Factory-Test-Runner: gemeinsames Basis-Image (Node 24, Python, gcc, Chromium/Playwright) für Abnahme-Container; protokolliert Startzeit, Cache-Treffer und installierte Pakete"],
},
"202611-00076": {
en: ["Factory test runner: logs how long an environment took to start and whether the cache seed was a hit"],
de: ["Factory-Test-Runner: protokolliert, wie lange eine Umgebung zum Start brauchte und ob der Cache-Seed getroffen hat"],
},
"202611-00075": {
en: ["Factory: the lamp of a phase being prepared now differs in colour from the accent in every theme"],
de: ["Factory: die Lampe einer Phase in Vorbereitung unterscheidet sich in jedem Theme farblich vom Akzent"],
},
"202611-00074": {
en: ["Factory: Merge and Close buttons on the issue card – merge after a positive acceptance, close after the merge", "Factory test runner: caches between acceptance runs (npm, Cargo, pip, Go and optional seeds of the install step) – the test environment starts much faster"],
de: ["Factory: Merge- und Schließen-Knopf auf der Issue-Karte – Merge nach erfolgreicher Abnahme, Schließen nach dem Merge", "Factory-Test-Runner: Caches zwischen Abnahmeläufen (npm, Cargo, pip, Go und optionale Seeds des Install-Schritts) – die Testumgebung startet deutlich schneller"],
},
"202611-00072": {
en: ["Factory: a blinking blue lamp shows that a phase is being prepared (checkout, test environment) before its chat starts"],
de: ["Factory: eine blinkende blaue Lampe zeigt, dass eine Phase vorbereitet wird (Checkout, Testumgebung), bevor der Chat startet"],
},
"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"],