conductor(checkpoint): Checkpoint end of Phase 3 - Discussion & Context Structure Mutation
This commit is contained in:
+21
-1
@@ -403,7 +403,9 @@ class AppController:
|
||||
'ui_separate_tier4': 'ui_separate_tier4',
|
||||
'show_text_viewer': 'show_text_viewer',
|
||||
'text_viewer_title': 'text_viewer_title',
|
||||
'text_viewer_type': 'text_viewer_type'
|
||||
'text_viewer_type': 'text_viewer_type',
|
||||
'disc_entries': 'disc_entries',
|
||||
'ui_file_paths': 'ui_file_paths'
|
||||
}
|
||||
self._gettable_fields = dict(self._settable_fields)
|
||||
self._gettable_fields.update({
|
||||
@@ -575,6 +577,24 @@ class AppController:
|
||||
except:
|
||||
pass
|
||||
|
||||
@property
|
||||
def ui_file_paths(self) -> list[str]:
|
||||
return [f.path if hasattr(f, 'path') else str(f) for f in self.files]
|
||||
|
||||
@ui_file_paths.setter
|
||||
def ui_file_paths(self, value: list[str]) -> None:
|
||||
old_files = {f.path: f for f in self.files if hasattr(f, 'path')}
|
||||
new_files = []
|
||||
import time
|
||||
now = time.time()
|
||||
for p in value:
|
||||
if p in old_files:
|
||||
new_files.append(old_files[p])
|
||||
else:
|
||||
from src import models
|
||||
new_files.append(models.FileItem(path=p, injected_at=now))
|
||||
self.files = new_files
|
||||
|
||||
@property
|
||||
def operations_live_indicator(self) -> bool:
|
||||
return not self.is_viewing_prior_session
|
||||
|
||||
+26
-7
@@ -346,19 +346,27 @@ class App:
|
||||
self._is_applying_snapshot = False
|
||||
|
||||
def _handle_undo(self) -> None:
|
||||
sys.stderr.write(f"[DEBUG History] _handle_undo called. can_undo={self.history.can_undo}\n")
|
||||
sys.stderr.flush()
|
||||
if not self.history.can_undo:
|
||||
return
|
||||
current = self._take_snapshot()
|
||||
entry = self.history.undo(current, "Undo Action")
|
||||
if entry:
|
||||
sys.stderr.write(f"[DEBUG History] Undoing to: {entry.description}\n")
|
||||
sys.stderr.flush()
|
||||
self._apply_snapshot(entry.state)
|
||||
|
||||
def _handle_redo(self) -> None:
|
||||
sys.stderr.write(f"[DEBUG History] _handle_redo called. can_redo={self.history.can_redo}\n")
|
||||
sys.stderr.flush()
|
||||
if not self.history.can_redo:
|
||||
return
|
||||
current = self._take_snapshot()
|
||||
entry = self.history.redo(current, "Redo Action")
|
||||
if entry:
|
||||
sys.stderr.write(f"[DEBUG History] Redoing to: {entry.description}\n")
|
||||
sys.stderr.flush()
|
||||
self._apply_snapshot(entry.state)
|
||||
|
||||
def shutdown(self) -> None:
|
||||
@@ -400,6 +408,8 @@ class App:
|
||||
|
||||
@ui_file_paths.setter
|
||||
def ui_file_paths(self, paths: list[str]) -> None:
|
||||
sys.stderr.write(f"[DEBUG] Setting ui_file_paths to: {paths}\n")
|
||||
sys.stderr.flush()
|
||||
old_files = {f.path: f for f in self.files if hasattr(f, 'path')}
|
||||
new_files = []
|
||||
now = time.time()
|
||||
@@ -407,6 +417,7 @@ class App:
|
||||
if p in old_files:
|
||||
new_files.append(old_files[p])
|
||||
else:
|
||||
from src import models
|
||||
new_files.append(models.FileItem(path=p, injected_at=now))
|
||||
self.files = new_files
|
||||
|
||||
@@ -1210,9 +1221,10 @@ class App:
|
||||
if self.perf_profiling_enabled: self.perf_monitor.end_component("_gui_func")
|
||||
|
||||
def _handle_history_logic(self) -> None:
|
||||
if self._is_applying_snapshot:
|
||||
return
|
||||
|
||||
# Skip history tracking only during active AI thinking/tool execution
|
||||
is_thinking = self.ai_status in ["sending...", "streaming...", "running powershell...", "fetching url...", "searching web..."]
|
||||
if self._is_applying_snapshot or is_thinking:
|
||||
return
|
||||
io = imgui.get_io()
|
||||
|
||||
# 1. Hotkey handling (Undo: Ctrl+Z, Redo: Ctrl+Y or Ctrl+Shift+Z)
|
||||
@@ -1241,19 +1253,27 @@ class App:
|
||||
current.global_system_prompt != self._last_ui_snapshot.global_system_prompt or
|
||||
current.base_system_prompt != self._last_ui_snapshot.base_system_prompt or
|
||||
current.use_default_base_prompt != self._last_ui_snapshot.use_default_base_prompt or
|
||||
current.temperature != self._last_ui_snapshot.temperature or
|
||||
current.top_p != self._last_ui_snapshot.top_p or
|
||||
abs(current.temperature - self._last_ui_snapshot.temperature) > 1e-5 or
|
||||
abs(current.top_p - self._last_ui_snapshot.top_p) > 1e-5 or
|
||||
current.max_tokens != self._last_ui_snapshot.max_tokens or
|
||||
current.auto_add_history != self._last_ui_snapshot.auto_add_history or
|
||||
len(current.disc_entries) != len(self._last_ui_snapshot.disc_entries)
|
||||
len(current.disc_entries) != len(self._last_ui_snapshot.disc_entries) or
|
||||
len(current.files) != len(self._last_ui_snapshot.files) or
|
||||
len(current.screenshots) != len(self._last_ui_snapshot.screenshots)
|
||||
)
|
||||
|
||||
if not changed and len(current.disc_entries) > 0:
|
||||
if current.disc_entries[-1].get('content') != self._last_ui_snapshot.disc_entries[-1].get('content'):
|
||||
changed = True
|
||||
|
||||
if changed:
|
||||
if not self._pending_snapshot:
|
||||
self._pending_snapshot = True
|
||||
self._snapshot_timer = time.time()
|
||||
# Capture state BEFORE current change
|
||||
self._state_to_push = self._last_ui_snapshot
|
||||
else:
|
||||
# Reset timer for settle debounce
|
||||
self._snapshot_timer = time.time()
|
||||
|
||||
self._last_ui_snapshot = current
|
||||
@@ -1266,7 +1286,6 @@ class App:
|
||||
def _render_base_prompt_diff_modal(self) -> None:
|
||||
if not getattr(self.controller, "_show_base_prompt_diff_modal", False):
|
||||
return
|
||||
|
||||
imgui.open_popup("Base Prompt Diff")
|
||||
if imgui.begin_popup_modal("Base Prompt Diff", True, imgui.WindowFlags_.always_auto_resize)[0]:
|
||||
imgui.text_colored(C_IN, "Difference between Default and Custom Base System Prompt")
|
||||
|
||||
Reference in New Issue
Block a user