feat(mma): Complete Phase 7 implementation: MMA Dashboard, HITL Step Modal, and Memory Mutator
This commit is contained in:
33
gui_2.py
33
gui_2.py
@@ -111,6 +111,21 @@ class ConfirmDialog:
|
||||
return self._approved, self._script
|
||||
|
||||
|
||||
class MMAApprovalDialog:
|
||||
def __init__(self, ticket_id: str, payload: str):
|
||||
self._ticket_id = ticket_id
|
||||
self._payload = payload
|
||||
self._condition = threading.Condition()
|
||||
self._done = False
|
||||
self._approved = False
|
||||
|
||||
def wait(self) -> tuple[bool, str]:
|
||||
with self._condition:
|
||||
while not self._done:
|
||||
self._condition.wait(timeout=0.1)
|
||||
return self._approved, self._payload
|
||||
|
||||
|
||||
class App:
|
||||
"""The main ImGui interface orchestrator for Manual Slop."""
|
||||
|
||||
@@ -895,6 +910,12 @@ class App:
|
||||
elif cb in self._predefined_callbacks:
|
||||
self._predefined_callbacks[cb](*args)
|
||||
|
||||
elif action == "mma_step_approval":
|
||||
dlg = MMAApprovalDialog(task.get("ticket_id"), task.get("payload"))
|
||||
self._pending_mma_approval = task
|
||||
if "dialog_container" in task:
|
||||
task["dialog_container"][0] = dlg
|
||||
|
||||
except Exception as e:
|
||||
print(f"Error executing GUI task: {e}")
|
||||
|
||||
@@ -926,6 +947,18 @@ class App:
|
||||
else:
|
||||
print("[DEBUG] No pending dialog to reject")
|
||||
|
||||
def _handle_mma_respond(self, approved: bool, payload: str = None):
|
||||
if self._pending_mma_approval:
|
||||
dlg = self._pending_mma_approval.get("dialog_container", [None])[0]
|
||||
if dlg:
|
||||
with dlg._condition:
|
||||
dlg._approved = approved
|
||||
if payload is not None:
|
||||
dlg._payload = payload
|
||||
dlg._done = True
|
||||
dlg._condition.notify_all()
|
||||
self._pending_mma_approval = None
|
||||
|
||||
def _handle_approve_ask(self):
|
||||
"""Responds with approval for a pending /api/ask request."""
|
||||
if not self._ask_request_id: return
|
||||
|
||||
Reference in New Issue
Block a user