diff --git a/apps/craft-anything-cli/src/ai_cmd.rs b/apps/craft-anything-cli/src/ai_cmd.rs index 130626c28..049da130e 100644 --- a/apps/craft-anything-cli/src/ai_cmd.rs +++ b/apps/craft-anything-cli/src/ai_cmd.rs @@ -91,8 +91,10 @@ pub enum AiCommand { #[arg(long, conflicts_with_all = ["model", "thinking"])] default: bool, }, - /// Set how hard a Claude backend thinks (the Claude API or Claude Code): low, medium, high, - /// xhigh or max, or `default` for the usual level; leave it out to see the level and choices. + /// Set how hard a backend thinks: low, medium, high, xhigh or max for the Claude API or Claude + /// Code; none, minimal, low, medium, high or xhigh for an OpenAI-style API (Gemini: minimal + /// to high), which is sent no + /// level until one is set. `default` goes back to the usual; leave it out to see the choices. Effort { name: String, level: Option }, /// Send a tiny request and report latency. Test { name: String }, @@ -374,16 +376,18 @@ pub fn ai(cli: &Cli, c: &AiCommand, f: Format) -> u8 { return fail(&ToolError::invalid(format!("No AI backend named {name:?}")).with_remediation("See `craft-anything-cli ai list`."), f); }; let options = hub.options(); - match craft_anything_ai::effort_in_use(&b, options.get(name)) { - Some(effort) => { - let levels: Vec<&str> = Effort::ALL.iter().map(|e| e.as_str()).collect(); - emit(&json!({"name": name, "effort": effort.as_str(), "levels": levels}), f); - 0 - } - None => fail( - &ToolError::invalid(format!("{name} doesn't take an effort level.")).with_remediation("Effort is for the Claude API and Claude Code."), + match craft_anything_ai::effort_levels(&b) { + [] => fail( + &ToolError::invalid(format!("{name} doesn't take an effort level.")) + .with_remediation("Effort is for the Claude API, Claude Code and OpenAI-style APIs."), f, ), + levels => { + let effort = craft_anything_ai::effort_in_use(&b, options.get(name)).map_or("default", Effort::as_str); + let levels: Vec<&str> = levels.iter().map(|e| e.as_str()).collect(); + emit(&json!({"name": name, "effort": effort, "levels": levels}), f); + 0 + } } } AiCommand::Effort { name, level: Some(level) } => { @@ -392,7 +396,8 @@ pub fn ai(cli: &Cli, c: &AiCommand, f: Format) -> u8 { l => match Effort::parse(l) { Some(e) => Some(e), None => { - let e = ToolError::invalid(format!("{l:?} isn't an effort level.")).with_remediation("Use low, medium, high, xhigh, max or default."); + let e = ToolError::invalid(format!("{l:?} isn't an effort level.")) + .with_remediation("Use none, minimal, low, medium, high, xhigh, max or default."); return fail(&e, f); } }, diff --git a/crates/ai/src/agent.rs b/crates/ai/src/agent.rs index 57fb51957..c646e258a 100644 --- a/crates/ai/src/agent.rs +++ b/crates/ai/src/agent.rs @@ -473,8 +473,6 @@ impl AgentLoop { if let Some(text) = text { context::push_user_text(&mut self.history, text); } - let configured = self.chain.get(self.current).and_then(|s| s.effort); - let effort = prompt::choose_effort(configured); let max_turns = self.chain.get(self.current).map(|s| s.max_turns).unwrap_or(DEFAULT_MAX_TURNS).max(1); let mut msg_usage = Usage::default(); let mut msg_cost: Option = Some(0.0); @@ -496,7 +494,7 @@ impl AgentLoop { turns += 1; // Ask the server for its window before choosing the tools, so Auto chooses from it. self.ask_window(); - let Some(result) = self.one_turn(effort, &mut msg_usage, &mut msg_cost) else { break }; + let Some(result) = self.one_turn(&mut msg_usage, &mut msg_cost) else { break }; self.last_input = result.usage.input_tokens + result.usage.cache_read_tokens + result.usage.cache_write_tokens; self.last_history_estimate = context::estimate_tokens(&self.history).max(1); let (slot_name, local, model_id) = match self.chain.get(self.current) { @@ -516,7 +514,7 @@ impl AgentLoop { "backend": slot_name, "model": model_id, "input_tokens": result.usage.input_tokens, "output_tokens": result.usage.output_tokens, "cache_read_tokens": result.usage.cache_read_tokens, "cache_write_tokens": result.usage.cache_write_tokens, "cost_usd": cost, "stop_reason": result.stop.as_str(), - "effort": effort.as_str(), + "effort": self.effort().as_str(), }), ); let uses = result.message.tool_uses(); @@ -721,8 +719,14 @@ impl AgentLoop { (self.system.clone().unwrap_or_default(), self.tool_defs()) } + /// The effort the chain position in use was set to: a fallback is sent its own, not the + /// failed backend's (an OpenAI-style API would refuse Claude's `max`, #1813). + fn effort(&self) -> Effort { + prompt::choose_effort(self.chain.get(self.current).and_then(|s| s.effort)) + } + /// One model call, falling back along the chain when a backend fails before producing output. - fn one_turn(&mut self, effort: Effort, msg_usage: &mut Usage, msg_cost: &mut Option) -> Option { + fn one_turn(&mut self, msg_usage: &mut Usage, msg_cost: &mut Option) -> Option { // Chain positions already fitted to a window their server reported: each is asked once more. let mut refitted = BTreeSet::new(); loop { @@ -742,7 +746,7 @@ impl AgentLoop { let events = self.events.clone(); let mut produced = false; let stop = self.stop.clone(); - let req = TurnRequest { system, messages: &self.history, tools, effort, max_tokens: crate::anthropic::MAX_TOKENS }; + let req = TurnRequest { system, messages: &self.history, tools, effort: self.effort(), max_tokens: crate::anthropic::MAX_TOKENS }; let slot = self.chain.get_mut(self.current)?; let r = slot.model.turn( &req, @@ -2255,6 +2259,55 @@ pub(crate) mod tests { assert!(!c.is_busy() || c.poll().is_empty()); } + /// A fallback is sent the effort it was set to, not the failed backend's (#1813: Claude's + /// `max` would reach an OpenAI-style API that refuses it). + #[test] + fn a_fallback_is_sent_its_own_effort() { + struct Efforts { + reply: Result, + seen: Arc>>, + } + impl ChatModel for Efforts { + fn turn(&mut self, req: &TurnRequest<'_>, _: &mut dyn FnMut(Delta), _: &Stop) -> Result { + self.seen.lock().unwrap().push(req.effort); + self.reply.clone() + } + fn model(&self) -> String { + "efforts".into() + } + } + let host = Arc::new(FakeHost { calls: Mutex::default(), journal: Mutex::default() }); + let (first, second) = (Arc::default(), Arc::default()); + let failing = Efforts { reply: Err(ToolError::new(ErrorCode::EngineMissing, "down")), seen: Arc::clone(&first) }; + let answering = Efforts { reply: turn(vec![Block::Text { text: "ok".into() }], StopReason::EndTurn), seen: Arc::clone(&second) }; + let chain = vec![ + ModelSlot { + name: "A".into(), + model: Box::new(failing), + local: false, + effort: Some(Effort::Max), + max_turns: 5, + context_tokens: 0, + tools: Default::default(), + }, + ModelSlot { + name: "B".into(), + model: Box::new(answering), + local: false, + effort: Some(Effort::Minimal), + max_turns: 5, + context_tokens: 0, + tools: Default::default(), + }, + ]; + let mut c = ApiConversation::start(host, chain, LoopConfig::default()).unwrap(); + c.send("q"); + let ev = drain_until_done(&mut c, |_, _| {}); + assert!(matches!(ev.last(), Some(AgentEvent::TurnDone { backend, .. }) if backend == "B")); + assert_eq!(*first.lock().unwrap(), [Effort::Max]); + assert_eq!(*second.lock().unwrap(), [Effort::Minimal]); + } + #[test] fn compaction_keeps_small_results_and_previews_large_ones() { use craft_anything_evidence::{Environment, EvidenceBuilder, Subject}; diff --git a/crates/ai/src/config.rs b/crates/ai/src/config.rs index 46f2af69a..fd1931a22 100644 --- a/crates/ai/src/config.rs +++ b/crates/ai/src/config.rs @@ -105,7 +105,9 @@ impl ToolList { #[serde(default)] pub struct BackendOptions { /// Thinking depth (`low`/`medium`/`high`/`xhigh`/`max`) for the Claude API and Claude Code; - /// `high` unless set. A model without the level gets the nearest one below it. + /// `high` unless set. A model without the level gets the nearest one below it. For an + /// OpenAI-style API, `none` to `xhigh` (Gemini: `minimal` to `high`), sent as its reasoning + /// level only when set. #[serde(skip_serializing_if = "Option::is_none")] pub effort: Option, /// Anthropic server-side fallbacks (default on). diff --git a/crates/ai/src/lib.rs b/crates/ai/src/lib.rs index 77ecb2598..23b85c90f 100644 --- a/crates/ai/src/lib.rs +++ b/crates/ai/src/lib.rs @@ -203,15 +203,37 @@ fn opencode_go_models_base(base: &str) -> String { } } -/// The effort an AI thinks at, when it can be chosen (Settings → AI): the Claude API and Claude -/// Code, which take every level in [`Effort::ALL`]. `None` for the others, which don't use it. +/// The reasoning levels OpenAI's API takes, which OpenAI-compatible services follow. +pub const OPENAI_EFFORTS: [Effort; 6] = [Effort::None, Effort::Minimal, Effort::Low, Effort::Medium, Effort::High, Effort::Xhigh]; + +/// The levels every Gemini model takes through its OpenAI-compatible API: `xhigh` is for one +/// model only, and `none` can't turn reasoning off on 2.5 Pro, 3 or 4 (Google's OpenAI +/// compatibility page). shortcut: not per model, so a model's extra level isn't offered; +/// add a per-model table if someone needs `none` or `xhigh` on Gemini. +pub const GEMINI_EFFORTS: [Effort; 4] = [Effort::Minimal, Effort::Low, Effort::Medium, Effort::High]; + +/// The effort levels an AI can be set to (Settings → AI): every Claude level for the Claude API +/// and Claude Code, OpenAI's for the OpenAI-style APIs (#1813), none for the others. +pub fn effort_levels(config: &BackendConfig) -> &'static [Effort] { + match config.kind { + BackendKind::Anthropic => &Effort::ALL, + BackendKind::AgentCli if config.model == "claude-code" => &Effort::ALL, + BackendKind::Gemini => &GEMINI_EFFORTS, + BackendKind::Openai | BackendKind::Openrouter | BackendKind::OpenaiCompatible => &OPENAI_EFFORTS, + BackendKind::AgentCli => &[], + } +} + +/// The effort an AI thinks at: for Claude, the chosen level or high; for an OpenAI-style API, +/// the chosen level, since not every model there takes one, so nothing is sent until it's +/// chosen. `None` when no level is sent. pub fn effort_in_use(config: &BackendConfig, options: Option<&BackendOptions>) -> Option { - let claude = match config.kind { - BackendKind::Anthropic => true, - BackendKind::AgentCli => config.model == "claude-code", - _ => false, - }; - claude.then(|| prompt::choose_effort(options.and_then(|o| o.effort))) + let chosen = options.and_then(|o| o.effort); + match effort_levels(config) { + [] => None, + levels if levels == Effort::ALL => Some(prompt::choose_effort(chosen)), + levels => chosen.filter(|e| levels.contains(e)), + } } /// The model an AI uses, when it can be chosen (Settings → AI, #123): an API's own, or the one @@ -753,13 +775,18 @@ impl AiHub { Ok(true) } - /// How hard a backend thinks (`None`: the usual level again). Only the Claude API and Claude - /// Code take one ([`effort_in_use`]). Returns false when there was no such backend. + /// How hard a backend thinks (`None`: the usual level again). Only the levels in + /// [`effort_levels`] are taken. Returns false when there was no such backend. pub fn set_effort(&self, name: &str, effort: Option) -> Result { let mut cfg = self.config_to_change()?; let Some(b) = cfg.backends.iter_mut().find(|b| b.config.name == name) else { return Ok(false) }; - if effort.is_some() && effort_in_use(&b.config, Some(&b.options)).is_none() { - return Err(ToolError::invalid(format!("{name} doesn't take an effort level.")).with_remediation("Effort is for the Claude API and Claude Code.")); + let levels = effort_levels(&b.config); + if let Some(e) = effort.filter(|e| !levels.contains(e)) { + let fix = match levels { + [] => "Effort is for the Claude API, Claude Code and OpenAI-style APIs.".to_string(), + levels => format!("Use one of: {}.", levels.iter().map(|l| l.as_str()).collect::>().join(", ")), + }; + return Err(ToolError::invalid(format!("{name} doesn't take the effort level {}.", e.as_str())).with_remediation(fix)); } b.options.effort = effort; self.save_config(&cfg)?; @@ -1001,8 +1028,10 @@ impl AiHub { // large context and a bill, as any other cloud API (#374). let local = c.kind == BackendKind::OpenaiCompatible && base.is_none_or(detect::on_this_network); let limit = stream_limit(&e.options); + let sends_effort = effort_in_use(c, Some(&e.options)).is_some(); let with_limit = |mut o: openai::OpenAi| { o.stream_limit = limit; + o.sends_effort = sends_effort; Box::new(o) as Box }; let model: Box = match c.kind { @@ -1203,7 +1232,9 @@ impl AiHub { .name("ai-test".into()) .spawn(move || { let msgs = req_parts(); - let r = slot.model.turn(&req_owned(&msgs), &mut |_| {}, &stop).map(|r| (r, slot.model.model())); + // The level the AI is set to, so the test sends what its conversations will. + let req = TurnRequest { effort: prompt::choose_effort(slot.effort), ..req_owned(&msgs) }; + let r = slot.model.turn(&req, &mut |_| {}, &stop).map(|r| (r, slot.model.model())); let _ = tx.send(r); }) .map_err(|e| ToolError::internal(e.to_string()))?; diff --git a/crates/ai/src/openai.rs b/crates/ai/src/openai.rs index 267390022..ddd19e85f 100644 --- a/crates/ai/src/openai.rs +++ b/crates/ai/src/openai.rs @@ -80,6 +80,9 @@ pub struct OpenAi { pub asks_window: bool, /// The longest answer to ask for, once OpenRouter has said the key can't afford more (#1213). pub answer_cap: Option, + /// Send the request's effort as the reasoning level: only once the person chose one, since + /// a model that doesn't reason may refuse the field (#1813). + pub sends_effort: bool, /// A server on this computer or its network, asked for its window in its own ways too; any /// other is asked only through its model list. pub on_this_network: bool, @@ -118,6 +121,7 @@ impl OpenAi { openrouter: false, stream_limit: None, answer_cap: None, + sends_effort: false, asks_window: false, on_this_network: false, } @@ -176,6 +180,14 @@ impl OpenAi { if let (Some(cap), Some(o)) = (self.answer_cap, body.as_object_mut()) { o.insert("max_tokens".into(), json!(cap)); } + if let (true, Some(o)) = (self.sends_effort, body.as_object_mut()) { + // OpenRouter's own field, which it maps to each provider's. + if self.openrouter { + o.insert("reasoning".into(), json!({"effort": req.effort.as_str()})); + } else { + o.insert("reasoning_effort".into(), json!(req.effort.as_str())); + } + } if !self.react && !req.tools.is_empty() && let Some(o) = body.as_object_mut() diff --git a/crates/ai/src/tests.rs b/crates/ai/src/tests.rs index c9403c034..1a61e0e65 100644 --- a/crates/ai/src/tests.rs +++ b/crates/ai/src/tests.rs @@ -681,6 +681,42 @@ fn a_claude_ais_effort_is_changed() { assert!(!h.set_effort("Nobody", Some(Effort::Low)).unwrap()); } +/// #1813: an OpenAI-style API is sent a reasoning level only once the person chooses one, and +/// only one of OpenAI's levels; OpenRouter gets it in its own field. +#[test] +fn an_openai_style_ais_effort_is_sent_only_once_chosen() { + use crate::model::{Msg, Stop, TurnRequest}; + let reply = || (200, "text/event-stream", chat_sse(&[json!({"choices":[{"delta":{"content":"hi"},"finish_reason":"stop"}]})])); + for (kind, field) in [(BackendKind::OpenaiCompatible, "/reasoning_effort"), (BackendKind::Openrouter, "/reasoning/effort")] { + let (h, _d) = hub(); + let (url, seen) = mock(vec![reply(), reply()]); + let config = BackendConfig { name: "Box".into(), kind, model: "m".into(), base_url: Some(url), ssh_host: None, enabled: true }; + h.add_backend(config, Some("k".into())).unwrap(); + let ask = |h: &AiHub| { + let mut slot = h.build_model(&h.entry("Box").unwrap()).unwrap(); + let messages = [Msg::user_text("hi")]; + let request = TurnRequest { system: "S", messages: &messages, tools: &[], effort: prompt::choose_effort(slot.effort), max_tokens: 100 }; + slot.model.turn(&request, &mut |_| {}, &Stop::default()).unwrap(); + }; + let effort = |h: &AiHub| crate::effort_in_use(&h.entry("Box").unwrap().config, h.options().get("Box")); + assert_eq!(effort(&h), None, "nothing is sent until it's chosen"); + ask(&h); + assert!(h.set_effort("Box", Some(Effort::Max)).is_err(), "max isn't one of OpenAI's levels"); + assert!(h.set_effort("Box", Some(Effort::Minimal)).unwrap()); + assert_eq!(effort(&h), Some(Effort::Minimal)); + ask(&h); + let seen = seen.lock().unwrap(); + assert!(seen[0].body.get("reasoning_effort").is_none() && seen[0].body.get("reasoning").is_none(), "{}", seen[0].body); + assert_eq!(seen[1].body.pointer(field), Some(&json!("minimal")), "{}", seen[1].body); + drop(seen); + assert!(h.set_effort("Box", None).unwrap()); + assert_eq!(effort(&h), None); + } + // Gemini is offered only the levels every Gemini model takes. + let gemini = BackendConfig { name: "G".into(), kind: BackendKind::Gemini, model: "gemini-2.5-pro".into(), base_url: None, ssh_host: None, enabled: true }; + assert_eq!(crate::effort_levels(&gemini), [Effort::Minimal, Effort::Low, Effort::Medium, Effort::High]); +} + #[test] fn copilot_uses_shared_selection_and_rejects_failed_discovery_without_saving() { let (hub, _directory) = hub(); diff --git a/crates/ui-egui/src/builders.rs b/crates/ui-egui/src/builders.rs index f0ec92207..91bbeec8b 100644 --- a/crates/ui-egui/src/builders.rs +++ b/crates/ui-egui/src/builders.rs @@ -288,11 +288,11 @@ impl CraftApp { }); } - /// How hard a Claude AI thinks from now on. - pub fn set_effort(&mut self, name: &str, effort: craft_anything_ai::Effort) { + /// How hard an AI thinks from now on (`None`: its usual level). + pub fn set_effort(&mut self, name: &str, effort: Option) { let (hub, name) = (self.hub.clone(), name.to_string()); self.jobs.spawn(tr("Change how hard an AI thinks"), false, move |_| { - hub.set_effort(&name, Some(effort)).map_err(|e| e.message)?; + hub.set_effort(&name, effort).map_err(|e| e.message)?; Ok(crate::backends(&hub)) }); } diff --git a/crates/ui-egui/src/settings_ui.rs b/crates/ui-egui/src/settings_ui.rs index d9a0936e3..b59de8767 100644 --- a/crates/ui-egui/src/settings_ui.rs +++ b/crates/ui-egui/src/settings_ui.rs @@ -426,8 +426,9 @@ fn ai(app: &mut CraftApp, ui: &mut Ui) { } ui.add_space(4.0); } - // How hard it thinks: the Claude API and Claude Code take every Claude level. + // How hard it thinks: every Claude level for Claude, OpenAI's for the OpenAI-style APIs. let effort = craft_anything_ai::effort_in_use(b, app.backend_options.get(&b.name)); + let effort_levels = craft_anything_ai::effort_levels(b); if b.kind == BackendKind::AgentCli && b.ssh_host.as_deref().is_some_and(|h| !h.trim().is_empty()) { let id = egui::Id::new(("remote-agent-program", &b.name)); let mut program = ui @@ -513,11 +514,14 @@ fn ai(app: &mut CraftApp, ui: &mut Ui) { } } } - if let Some(current) = effort { + if !effort_levels.is_empty() { ui.label(RichText::new(tr("Effort:")).color(t.text_faint).size(theme::CAPTION)); - egui::ComboBox::from_id_salt(("effort", &b.name)).icon(widgets::combo_icon).selected_text(current.as_str()).show_ui(ui, |ui| { - for e in craft_anything_ai::Effort::ALL { - if ui.selectable_label(e == current, e.as_str()).clicked() && e != current { + let shown = effort.map_or("default", craft_anything_ai::Effort::as_str); + egui::ComboBox::from_id_salt(("effort", &b.name)).icon(widgets::combo_icon).selected_text(shown).show_ui(ui, |ui| { + // Claude always has a level; an OpenAI-style API is sent none until one is chosen. + let unset = (effort_levels != craft_anything_ai::Effort::ALL).then_some(None); + for e in unset.into_iter().chain(effort_levels.iter().map(|&e| Some(e))) { + if ui.selectable_label(e == effort, e.map_or("default", craft_anything_ai::Effort::as_str)).clicked() && e != effort { chosen_effort = Some((b.name.clone(), e)); } } diff --git a/crates/ui-egui/tests/headless_parity.rs b/crates/ui-egui/tests/headless_parity.rs index d299be642..1793f34d2 100644 --- a/crates/ui-egui/tests/headless_parity.rs +++ b/crates/ui-egui/tests/headless_parity.rs @@ -117,7 +117,7 @@ const ACTIONS: &[Action] = &[ a("remove_backend_key", "forget an API key saved in the app", Cli("ai key --forget")), a("pick_model", "list the models an AI can use", Cli("ai model ")), a("set_model", "change the model an AI uses", Cli("ai model ")), - a("set_effort", "change how hard a Claude AI thinks", Cli("ai effort ")), + a("set_effort", "change how hard an AI thinks", Cli("ai effort ")), a("pick_agent_model", "list an agent's visible models and thinking depths", Tool(&["ai_models_list"])), a("reload_agent_model", "reload model-specific thinking choices", Tool(&["ai_models_list"])), a("set_agent_model", "choose an agent's model and thinking depth", Tool(&["ai_model_set"])), diff --git a/crates/ui-egui/tests/smoke.rs b/crates/ui-egui/tests/smoke.rs index 7838ce870..3d6b6a9f0 100644 --- a/crates/ui-egui/tests/smoke.rs +++ b/crates/ui-egui/tests/smoke.rs @@ -1517,6 +1517,42 @@ fn a_claude_ais_effort_is_set_in_settings() { h.get_by_value("max"); } +/// #1813: an OpenAI-compatible AI has an effort setting too, showing "default" (nothing sent) +/// until a level is chosen, and back again. +#[test] +fn an_openai_compatible_ais_effort_is_set_in_settings() { + use craft_anything_ai::{BackendConfig, BackendKind, Effort}; + let mut h = harness(|| { + let a = demo::app(demo::engine(Mode::Experienced, true)); + let cfg = BackendConfig { + name: "Box".into(), + kind: BackendKind::OpenaiCompatible, + model: "m".into(), + base_url: Some("http://127.0.0.1:0/v1".into()), + ssh_host: None, + enabled: true, + }; + a.hub.add_backend(cfg, None).unwrap(); + a + }); + h.state_mut().refresh_backends(); + assert!(wait(&mut h, |a| a.backends.iter().any(|b| b.name == "Box"))); + h.state_mut().state.settings_open = true; + h.state_mut().state.settings_tab = craft_anything_ui_egui::state::SettingsTab::Ai; + h.run_steps(2); + h.get_by_label("Effort:"); + h.get_by_value("default").click(); + h.run(); + assert!(h.query_by_label("max").is_none(), "only OpenAI's levels"); + h.get_by_label("xhigh").click(); + assert!(wait(&mut h, |a| a.backend_options.get("Box").and_then(|o| o.effort) == Some(Effort::Xhigh))); + h.run_steps(2); + h.get_by_value("xhigh").click(); + h.run(); + h.get_by_label("default").click(); + assert!(wait(&mut h, |a| a.backend_options.get("Box").and_then(|o| o.effort).is_none())); +} + /// The picker exposes only the chosen model's depths and clears an old depth when changing models. #[test] fn opencode_picker_offers_only_the_selected_models_thinking_depths() { diff --git a/docs/ROADMAP.md b/docs/ROADMAP.md index 66e13e2cc..97f493191 100644 --- a/docs/ROADMAP.md +++ b/docs/ROADMAP.md @@ -1609,6 +1609,10 @@ Gaps found while using the app for real projects. folder itself, so outside the app there was nothing to run (#1590): the builder writes app/README.md saying how to build it and which folder to serve — claimed: justinjohn0306, branch bugfix/r2.9-site-readme-how-to-run +- [x] An OpenAI-compatible, OpenAI, OpenRouter or Gemini AI has no effort setting, and nothing asks it + to think harder (#1813): Settings → AI and `ai effort` offer its reasoning levels, sent + only once the person picks one + — claimed: justinjohn0306, branch bugfix/r2.9-api-reasoning-effort ### R2.10 Pinned builds Owner: maintainers · Status: in progress diff --git a/docs/STATUS.md b/docs/STATUS.md index af925545a..d74939b1f 100644 --- a/docs/STATUS.md +++ b/docs/STATUS.md @@ -365,7 +365,7 @@ coverage and secrets passed. The companion CLI was built with locked dependencie | WebAssembly tag interfaces | `formats_wasm_compare` resolves retained imported and defined tag exports to their declared parameter types. Identical unresolved or invalid diagnostics may still count as unchanged; those counts do not establish interface compatibility, and invalid/partial limitations remain present | Synthetic core modules with tag changes and re-exports, mixed index spaces, import/tag limits, and missing or non-function type references; formats and engine tests. No real module corpus or WebAssembly execution was used for this correction | | Questions and approvals | A file inbox per project; `core_person_ask`, `core_action_approve` and MCP consent requests become cards in the app | Cross-handle round-trip tests, a full approval round trip through the engine | | Runtime assets in pinned builds | Settings → Builds shows the total bytes copied when the listed builds were pinned, excluding files shared with a project. Frozen and light pins, size estimates and project copies keep runtime files in `obj` folders. An `obj` directory beside a regular C#, F# or Visual Basic project file is still recognised as compiler output; ambiguous folders are retained. New pins record the direct-launch program relative to the copy so a newer helper cannot replace it; older pins retain discovery behavior | Synthetic filesystem tests cover both pin modes, model bytes, compiler-output controls and project duplication. A Linux tool-level regression starts temporary scripts through `project_pin_open`, with a newer `Build/obj/helper`, and verifies the originally selected program and its output; a missing recorded program is refused. No real pinned application was launched for this correction | -| Desktop app | Simple mode: sidebar with New project and the project history (kept across restarts); New project makes something, works on a project the person already has (Work on my project: its folder's files are the app, edited in place without a question, and the project takes the folder's name), or just looks inside an app or file, a website or a game's files; a Game files screen (a game's archives; pictures from Unreal paks, Unity .assets files and Unity bundles saved as PNG after the person confirms they may unpack the game; uncompressed textures and the block formats DXT1, DXT5 and BC4–BC7), make prompt with picture attachments (picked, dropped, or pasted with Ctrl+V, shown as picture tiles) and, for anything recreated, a Clean room / Deep choice (also in the title bar; in Clean room, Just look inside, Game files, opening a file and the workbench ask for Deep mode instead), project screen (steps with the time spent and the AI cost and tokens of every build, plus each question's own cost, saved in the project's usage.json by the run or question tool (a coding agent's figure is shown as an estimate at API prices, not the bill; a question answered from a fork of the builder's session costs what it added since the builder's last turn), what the build is on now and its activity as it arrives (kept in `build-activity.log`), pinned builder checklist (its X folds it away between builds, kept in the project, `project_plan_fold`; a later run's checklist shows again; its steps scroll past a height set by dragging the divider above it, or with Up and Down, kept across restarts, #826), feed (each message and answer has a copy button, shown on hover or keyboard focus, #825), question and approval cards, a Continue card when a build was paused or stopped part-way (the app or computer closed; the project shows Interrupted) that carries on the builder's own session instead of starting over, and "It's done" beside Continue or Try again to keep the build as it is (`project_build_finish`), checks with screenshots and the requirements not met yet, the builder's open questions, preview, play, folder, follow-ups while it builds, which Claude Code takes at its next step; Up in the prompt box takes back the last note still waiting). Projects can start in a folder the person picks, whose files are either the app, edited in place (its stack read from those files unless the request names another, and, with nothing to recreate, judged by its own build and tests, whatever it's written in), or material to start from (asked, or the answer remembered in Settings), and are listed from any number of folders (`project_folders`, `project_list`, `rebuild --project-folder`). A folder that already holds a project is attached, keeping its saved target, builder, asset budget, asset setting and stack, and the typed request is a follow-up; the run uses that saved builder, keeps a live feed when the project is already building, and records the request in the feed when it starts; new-project-only choices are refused. Make says which AI builds ("Built by": automatic, or any AI that can build, by name); a pick stays with the project and builds its later changes. With nothing to build with, Start offers the coding agents found on the computer. Settings → AI turns an AI off or removes it, and sets how hard the Claude API or Claude Code thinks (every Claude level, low to max; also `ai effort` in the CLI). Each Claude Code AI can keep its sign-in in a folder of its own (its `CLAUDE_CONFIG_DIR`, so its own account; `ai folder` in the CLI, a folder on that computer over SSH), used for its runs, its sign-in check and its kept session, and Add another adds a second Claude Code for a second account. In the prompt box, Up at the very start and Down at the very end go through earlier prompts when no note is waiting. Questions about a build ("Just ask" under the prompt box, or a message starting with `/btw`, the first slash command; `rebuild_question_ask`) are answered in the conversation, where each folds away and is kept in the project, without a build or a round and changing nothing (the next message or a note tells the builder the latest few as background, a Clean room build only those asked in Clean room): Claude Code answers from a read-only copy of the builder's own session. When the project's builder is an agent that can't be held to reading (Codex, OpenCode…), the ask box says so before anything is sent, and a question stays in the box (#1695). Under each project's prompt box, "Builder's questions: Ask me / Decide yourself" chooses whether the builder's questions come to the person as cards or are decided by the builder, which says what it chose (`project_questions_set`; the default is in Settings and follows Auto mode until picked). Projects can be renamed, duplicated and deleted (right-click in the sidebar, or the project's page; a delete keeps the person's own files). A build can be pinned (Pin this build on its page, or `project_pin_*` from the CLI and MCP): a frozen copy in the project's pinned/ folder (the default) or a light one that shares dependencies and media with the project through hard links (each one's size shown first), opened from the sidebar's collapsible Pinned section (icons with a running dot when folded); a pin or Play runs once per folder unless another copy is asked for, and a start that quits at once says so with its last output. Typed drafts survive a restart. In a narrow window the sidebar folds to icons and the project's details move above its feed; messages float over the screen and errors stay until dismissed. Advanced mode: workbench with every panel wired to real tools, as a screen beside the projects (builds and their questions stay a click away). On macOS the menu bar has the app's actions (open, new project, settings, Simple / Advanced, Clean room / Deep, the command palette, help) with the usual shortcuts | UI unit and smoke tests (egui_kittest), offscreen snapshots of every screen; the CLI, `rebuild_start` and UI attach regressions | +| Desktop app | Simple mode: sidebar with New project and the project history (kept across restarts); New project makes something, works on a project the person already has (Work on my project: its folder's files are the app, edited in place without a question, and the project takes the folder's name), or just looks inside an app or file, a website or a game's files; a Game files screen (a game's archives; pictures from Unreal paks, Unity .assets files and Unity bundles saved as PNG after the person confirms they may unpack the game; uncompressed textures and the block formats DXT1, DXT5 and BC4–BC7), make prompt with picture attachments (picked, dropped, or pasted with Ctrl+V, shown as picture tiles) and, for anything recreated, a Clean room / Deep choice (also in the title bar; in Clean room, Just look inside, Game files, opening a file and the workbench ask for Deep mode instead), project screen (steps with the time spent and the AI cost and tokens of every build, plus each question's own cost, saved in the project's usage.json by the run or question tool (a coding agent's figure is shown as an estimate at API prices, not the bill; a question answered from a fork of the builder's session costs what it added since the builder's last turn), what the build is on now and its activity as it arrives (kept in `build-activity.log`), pinned builder checklist (its X folds it away between builds, kept in the project, `project_plan_fold`; a later run's checklist shows again; its steps scroll past a height set by dragging the divider above it, or with Up and Down, kept across restarts, #826), feed (each message and answer has a copy button, shown on hover or keyboard focus, #825), question and approval cards, a Continue card when a build was paused or stopped part-way (the app or computer closed; the project shows Interrupted) that carries on the builder's own session instead of starting over, and "It's done" beside Continue or Try again to keep the build as it is (`project_build_finish`), checks with screenshots and the requirements not met yet, the builder's open questions, preview, play, folder, follow-ups while it builds, which Claude Code takes at its next step; Up in the prompt box takes back the last note still waiting). Projects can start in a folder the person picks, whose files are either the app, edited in place (its stack read from those files unless the request names another, and, with nothing to recreate, judged by its own build and tests, whatever it's written in), or material to start from (asked, or the answer remembered in Settings), and are listed from any number of folders (`project_folders`, `project_list`, `rebuild --project-folder`). A folder that already holds a project is attached, keeping its saved target, builder, asset budget, asset setting and stack, and the typed request is a follow-up; the run uses that saved builder, keeps a live feed when the project is already building, and records the request in the feed when it starts; new-project-only choices are refused. Make says which AI builds ("Built by": automatic, or any AI that can build, by name); a pick stays with the project and builds its later changes. With nothing to build with, Start offers the coding agents found on the computer. Settings → AI turns an AI off or removes it, and sets how hard the Claude API or Claude Code thinks (every Claude level, low to max; also `ai effort` in the CLI), or an OpenAI, OpenRouter, Gemini or OpenAI-compatible AI (OpenAI's levels, none to xhigh, or for Gemini minimal to high, which every Gemini model takes; sent as `reasoning_effort`, or OpenRouter's `reasoning.effort`, only once one is chosen, #1813). Each Claude Code AI can keep its sign-in in a folder of its own (its `CLAUDE_CONFIG_DIR`, so its own account; `ai folder` in the CLI, a folder on that computer over SSH), used for its runs, its sign-in check and its kept session, and Add another adds a second Claude Code for a second account. In the prompt box, Up at the very start and Down at the very end go through earlier prompts when no note is waiting. Questions about a build ("Just ask" under the prompt box, or a message starting with `/btw`, the first slash command; `rebuild_question_ask`) are answered in the conversation, where each folds away and is kept in the project, without a build or a round and changing nothing (the next message or a note tells the builder the latest few as background, a Clean room build only those asked in Clean room): Claude Code answers from a read-only copy of the builder's own session. When the project's builder is an agent that can't be held to reading (Codex, OpenCode…), the ask box says so before anything is sent, and a question stays in the box (#1695). Under each project's prompt box, "Builder's questions: Ask me / Decide yourself" chooses whether the builder's questions come to the person as cards or are decided by the builder, which says what it chose (`project_questions_set`; the default is in Settings and follows Auto mode until picked). Projects can be renamed, duplicated and deleted (right-click in the sidebar, or the project's page; a delete keeps the person's own files). A build can be pinned (Pin this build on its page, or `project_pin_*` from the CLI and MCP): a frozen copy in the project's pinned/ folder (the default) or a light one that shares dependencies and media with the project through hard links (each one's size shown first), opened from the sidebar's collapsible Pinned section (icons with a running dot when folded); a pin or Play runs once per folder unless another copy is asked for, and a start that quits at once says so with its last output. Typed drafts survive a restart. In a narrow window the sidebar folds to icons and the project's details move above its feed; messages float over the screen and errors stay until dismissed. Advanced mode: workbench with every panel wired to real tools, as a screen beside the projects (builds and their questions stay a click away). On macOS the menu bar has the app's actions (open, new project, settings, Simple / Advanced, Clean room / Deep, the command palette, help) with the usual shortcuts | UI unit and smoke tests (egui_kittest), offscreen snapshots of every screen; the CLI, `rebuild_start` and UI attach regressions | | Waiting notes in the project feed | Notes waiting for the builder scroll with the conversation above the live activity, so a long note leaves the activity and prompt box reachable. | UI regression for a long note during a simulated build | | CLI | Every tool, `--deep` or `--clean-room` for one run (never saved), `rebuild` (including `--continue-in`, `--resume` to carry on a stopped build, and `--project-folder`, which attaches a folder that already holds a project and sends the request as its follow-up), `mcp` (`--inbox`, `--restricted`, `--allow-web`, `--allow-capture`), `ai`, `setup`, `doctor`, `report` | CLI integration tests | | SQLite database files (`db_sqlite_show`) | A rowid alias column (`INTEGER PRIMARY KEY`, including the table-constraint form) shows the rowid; `DESC`, non-`INTEGER` and composite keys keep their stored values; a VIRTUAL generated column, which SQLite computes when a row is read and never stores, shows as not read, and the columns after it keep their own values; a whole number in a REAL, FLOAT or DOUBLE column, which SQLite stores as an integer, reads as a REAL, as SQLite returns it; a missing TEXT field with a separated decimal default retains its literal spelling after separators are removed | Hand-built fixtures; generated files compared with the official SQLite library |