prashantmatlani commited on
Commit
5fabd70
·
1 Parent(s): d6859b3

updated dream mode

Browse files
Files changed (1) hide show
  1. app.py +19 -7
app.py CHANGED
@@ -212,21 +212,33 @@ with gr.Blocks() as demo:
212
  # A hidden internal string tracking state to isolate the raw proposal across loops
213
  active_proposal_state = gr.State("")
214
 
 
215
  def run_background_dream_cycle():
216
- """Triggers the non-destructive reflection loop and reveals the confirmation buttons."""
217
- yield gr.update(value="◌ _Cognitive pipeline active: Running simulation audit on core_logic.py..._"), gr.update(visible=False), ""
 
 
 
 
 
 
 
 
 
218
 
 
219
  from dream_agent import execute_dream_reflection
220
  raw_proposal = execute_dream_reflection(target_file="core_logic.py")
221
 
222
- # Clean up XML tags from the markdown display presentation so it reads cleanly to the user
223
- user_report_view = raw_proposal.replace("<proposed_patch>", "```python\n[PROPOSED SOURCE CODE CHANGES]").replace("</proposed_patch>", "\n```")
224
 
 
225
  yield (
226
  gr.update(value="🟢 **Simulation Audit Complete.** Review proposal below before authorizing deployment."),
227
- gr.update(visible=True), # Reveal the action validation confirmation buttons
228
- user_report_view, # Send text report to the markdown viewing element
229
- raw_proposal # Lock raw payload text into state memory buffer
230
  )
231
 
232
  def commit_authorized_dream_patch(proposal_buffer):
 
212
  # A hidden internal string tracking state to isolate the raw proposal across loops
213
  active_proposal_state = gr.State("")
214
 
215
+ # ==================== COGNITIVE DREAM AGENT FUNCTIONS ====================
216
  def run_background_dream_cycle():
217
+ """
218
+ Triggers simulation audit and updates the visibility layers of the UI components safely.
219
+ Balanced explicitly to ensure every yield track perfectly populates all 4 output channels.
220
+ """
221
+ # STEP 1: Stream Loading States (Now cleanly providing all 4 required positions)
222
+ yield (
223
+ gr.update(value="◌ _Cognitive pipeline active: Running simulation audit on core_logic.py..._"),
224
+ gr.update(visible=False),
225
+ "", # Clears proposal_display layout
226
+ "" # Clears active_proposal_state memory buffer
227
+ )
228
 
229
+ # STEP 2: Execute background simulation run
230
  from dream_agent import execute_dream_reflection
231
  raw_proposal = execute_dream_reflection(target_file="core_logic.py")
232
 
233
+ # Format XML tags into clear, readable Markdown blocks for your review window
234
+ user_report_view = raw_proposal.replace("<proposed_patch>", "\n```python\n# === PROPOSED ECOSYSTEM SOURCE PATCH ===\n").replace("</proposed_patch>", "\n```")
235
 
236
+ # STEP 3: Stream Final Production Payload (All 4 positions accounted for)
237
  yield (
238
  gr.update(value="🟢 **Simulation Audit Complete.** Review proposal below before authorizing deployment."),
239
+ gr.update(visible=True), # Reveal the gated validation box panel container
240
+ user_report_view, # Populate report display markdown layout canvas
241
+ raw_proposal # Lock raw text securely inside internal memory state component
242
  )
243
 
244
  def commit_authorized_dream_patch(proposal_buffer):