[Feature and Refactor] Refactor the core-loop and TUI#14
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces adaptive context governance, progressive context disclosure, and a unified action approval framework to the LeapFlow runtime. Key updates include the addition of a DisclosurePlanner to progressively disclose tool schemas and memory, a ContextGovernanceController to manage exploration limits, and an ApprovalOrchestrator to coordinate structured action approvals (such as shell commands and file writes) across both in-process and daemon-backed sessions. The TUI has been significantly enhanced with a native ApprovalModal, a reconnectable _DaemonRuntimeBridge, safe paste compaction, and improved command queueing (supporting /cancel, /skip, /pause, /resume, /queue, and /drop). Additionally, built-in gateway adapters (DingTalk, Feishu, Telegram, Webhook, API Server) were refactored to use lightweight, dependency-free HTTP helpers, and user-customizable shortcuts were removed. I have reviewed the changes and have no feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Root cause: the modal's height budget calculation went negative when there were 6 choices (fixed_count=13 > min_height=10), causing _preserve_frame_and_choices to slice out all middle content. Fix: - Remove complex height-based truncation from ApprovalModal.fragments() - Use static content caps (_DETAIL_LINES=3, _REASON_LINES=2) instead - Let the prompt_toolkit Window handle clipping via dont_extend_height - Add line_count() for dynamic Window height sizing - Add bottom=2 to Float constraint to prevent status bar overlap - All content sections now always render: summary, detail, reason, keyboard hints, and all choice options Co-authored-by: Cursor <cursoragent@cursor.com>
LeapFlow Runtime Enhancements
⚙️ Core Runtime & Context Governance
ContextGovernanceControllerto dynamically manage and enforce exploration limits.DisclosurePlannerto progressively reveal tool schemas and memory states as needed, optimizing token usage and focus.ApprovalOrchestratorto coordinate structured approvals (e.g., shell commands, file writes) seamlessly across both in-process and daemon-backed sessions.💻 TUI & User Experience
ApprovalModaldirectly into the TUI for smoother, safer interaction loops._DaemonRuntimeBridgeto ensure persistent connectivity with background sessions./cancel,/skip,/pause,/resume,/queue, and/drop.🌐 Gateway & Integration Refactoring
🧹 Deprecations & Cleanups