Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.
Merge remote-tracking branch 'origin/main' into feat/agent-loop-steering
thinhlpg634f89fc55c1
diff --cc src-tauri/src/core/agent/loop.rsindex e3b8ce5a0,7a10f9446..5be96d8e0--- a/src-tauri/src/core/agent/loop.rs+++ b/src-tauri/src/core/agent/loop.rs@@@ -2991,39 -3006,10 +3211,11 @@@ mod testsjson!({ "role": "user", "content": "are you stuck?" }),];- // Before: the untouched history is rejected -- this is the wedge.+ // The orchestrator sanitizes the inbound history per turn, so the+ // strict upstream never sees the poison and the turn goes through in+ // one round trip -- the wedge this used to create is gone.let (tx, _rx) = mpsc::unbounded_channel();- let wedged = StrictModel {- calls: Default::default(),- };- let err = run_turn_cycle(- &tx,- &json!({}),- "m",- &[],- poisoned.clone(),- 8,- &mut SessionBudget::new(None),- &wedged,- &MockTool::default(),- crate::core::agent::plan::RunMode::Normal,- None,- None,- None,- )- .await;- assert!(- err.is_err_and(|e| e.contains("422")),- "unsanitized poisoned history must be rejected, reproducing the wedge"- );-- // After: the same history, through the sanitizer the orchestrator runs- // on every inbound request, is accepted and the turn completes.- let mut healed_history = poisoned;- assert_eq!(drop_malformed_tool_calls(&mut healed_history), 1);- assert_eq!(repair_dangling_tool_calls(&mut healed_history), 0);+- let (tx2, _rx2) = mpsc::unbounded_channel();let healed = StrictModel {calls: Default::default(),};diff --cc src-tauri/src/core/cli/tui.rsindex a20060371,b1b49e195..324947e2d--- a/src-tauri/src/core/cli/tui.rs+++ b/src-tauri/src/core/cli/tui.rs@@@ -15664,32 -16356,34 +16455,35 @@@ mod testsstd::sync::Arc::new(tokio::sync::Mutex::new(std::collections::HashMap::new()))}use super::journal::{self, DisplayEntry};- use super::SessionLimits;+ use super::{cancel_command, next_event, RunEvent, SessionLimits, SteeringRequest};+ use tokio::sync::mpsc;use super::{age_closed_todos, alt_scroll_restore, alt_scroll_save_off, answer_without_reasoning,- apply_resume, apply_stream_event, assistant_is_awaiting_user_answer, assistant_runs,- autoscroll_selection, await_branch_poll, backgrounded_job_id, brand, build_user_message,- clipboard_path, compact_tokens, diff_lines, drain_stream_events, estimate_token_count,- finish_account_login, finish_compaction, finish_login, finish_plugin_install,- finish_tokamak_login, finish_update_install, group_detail_lines, group_summary,+ apply_repaint, apply_resume, apply_stream_event, assistant_is_awaiting_user_answer,+ assistant_runs, autoscroll_selection, await_branch_poll, backgrounded_job_id, brand,+ build_user_message, clipboard_path, compact_tokens, context_lines, diff_lines,+ drain_stream_events, estimate_token_count, finish_account_login, finish_compaction,+ finish_context_report, finish_login, finish_plugin_install, finish_tokamak_login,+ finish_update_install, format_tokens, group_detail_lines, group_summary,handle_ask_key, handle_ask_mouse, handle_key, handle_mouse, header_spans, image_mime,- image_mime_of, input_content_lines, load_first_file_image, load_image_file, message_text,- note_update, open_config_screen, open_rewind_picker, pairs_to_str, parse_command,- partial_json_field, provider_label_for_model, rebuild_recall, replay_display_log,- restore_goal, restore_run_mode, restore_todos, resume_hint, rewind_to, route_paste_event,- row_width, run_command, running_group_rows, selection_text, spans_width, spawn_branch_poll,- split_reasoning, starting_call_lines, startup_modes, strip_system_xml_tags,- subagent_activity, subagent_name_from_run_id, summarize_result, sync_output_for,- thinking_open, tilde_path, tokens_per_second, tool_activity, tool_finished,- transcript_top_padding, unescape_partial_json_string, user_content_parts, wave_sweep_line,- with_wave_glyph, without_think_tags, App, CompactKind, CurrentRun, McpField, McpPrompt,- Pending, PendingImage, PickerKind, ProviderField, ReasoningSeg, ResumeTarget, Row, RowKind,- Selection, SelectionMode, SnapshotJob, Status, AGENT_SETTINGS, ALT_SCROLL_RESTORE,- ALT_SCROLL_SAVE_OFF, COPY_NOTICE, DIFF_ADD_BG, DIFF_DEL_BG, DIFF_MAX_ROWS,- DIFF_PREVIEW_MAX_ROWS, KEY_BINDINGS, KITTY_KEYS_OFF, KITTY_KEYS_ON, MAX_IMAGE_BYTES,- MAX_OVERFLOW_RETRIES, MOUSE_TRACK_ON, PROVIDERS_SETTINGS_ROW, SLASH_COMMANDS, SPINNER,- SPINNER_ADVANCE_MS, THINKING_WORDS, WORKING_WORDS,+ image_mime_of, input_content_lines, load_first_file_image, load_image_file,+ message_text, note_update, open_config_screen, open_rewind_picker, pairs_to_str,+ parse_command, partial_json_field, provider_label_for_model, rebuild_recall,+ replay_display_log, restore_goal, restore_run_mode, restore_todos, resume_hint,+ rewind_to, route_paste_event, row_width, run_command,+ running_group_rows, selection_text, spans_width, spawn_branch_poll, split_reasoning,+ starting_call_lines, startup_modes, strip_system_xml_tags, subagent_activity,+ subagent_name_from_run_id, summarize_result, sync_output_for, thinking_open,+ tilde_path, tokens_per_second, tool_activity, tool_finished, transcript_top_padding,+ unescape_partial_json_string, user_content_parts, wave_sweep_line, with_wave_glyph,+ without_think_tags, App, CompactKind, ContextReport, ContextSegment,+ ContextView, CurrentRun, McpField, McpPrompt, Pending, PendingImage, PickerKind,+ ProviderField, ReasoningSeg, ResumeTarget, Row, RowKind, Selection, SelectionMode,+ SnapshotJob, Status, AGENT_SETTINGS, ALT_SCROLL_RESTORE, ALT_SCROLL_SAVE_OFF, COPY_NOTICE,+ DIFF_ADD_BG, DIFF_DEL_BG, DIFF_MAX_ROWS, DIFF_PREVIEW_MAX_ROWS, KEY_BINDINGS,+ KITTY_KEYS_OFF, KITTY_KEYS_ON, MAX_IMAGE_BYTES, MAX_OVERFLOW_RETRIES, MOUSE_TRACK_ON,+ PROVIDERS_SETTINGS_ROW, SLASH_COMMANDS, SPINNER, SPINNER_ADVANCE_MS, THINKING_WORDS,+ WORKING_WORDS,};use crate::core::agent::events::{StreamEvent, Usage};use crate::core::agent::r#loop::PermissionRegistry;