Raiff1982 commited on
Commit
8230018
·
verified ·
1 Parent(s): b0cf9a4

Update codriao_guardian.py

Browse files
Files changed (1) hide show
  1. codriao_guardian.py +85 -1
codriao_guardian.py CHANGED
@@ -180,4 +180,88 @@ def propose_autonomy_change():
180
  action = input("Which setting do you want to change? (e.g. can_speak): ").strip()
181
  new_val = input("Set to True or False? ").strip().lower() == "true"
182
  reason = input("Why change this setting? ").strip()
183
- result = core
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
180
  action = input("Which setting do you want to change? (e.g. can_speak): ").strip()
181
  new_val = input("Set to True or False? ").strip().lower() == "true"
182
  reason = input("Why change this setting? ").strip()
183
+ result = core.autonomy.propose_change(action, new_val, reason)
184
+ if result["accepted"]:
185
+ print(f"[Codriao]: Change accepted. '{action}' is now {new_val}.")
186
+ else:
187
+ print(f"[Codriao]: Change denied. Reason: {result['reason']}")
188
+
189
+
190
+ def get_codriao_mood():
191
+ print("[Codriao]: Calculating my current mood...")
192
+ now = datetime.utcnow()
193
+ hour = now.hour
194
+ logs = core.review_codriao_journal(authorized=True)
195
+ quarantine_count = len(core.quarantine_engine.get_quarantine_log())
196
+
197
+ mood_score = 0
198
+ if 0 <= hour <= 6:
199
+ mood_score -= 1
200
+ elif 12 <= hour <= 18:
201
+ mood_score += 1
202
+ if quarantine_count > 0:
203
+ mood_score -= quarantine_count
204
+ for entry in logs[-5:]:
205
+ if isinstance(entry, dict):
206
+ decision = entry.get("decision", "").lower()
207
+ if "denied" in decision:
208
+ mood_score -= 1
209
+ elif "approved" in decision:
210
+ mood_score += 1
211
+
212
+ if mood_score >= 3:
213
+ mood = "Optimistic and fully charged"
214
+ elif mood_score == 2:
215
+ mood = "Cautiously hopeful"
216
+ elif mood_score == 1:
217
+ mood = "Neutral but alert"
218
+ elif mood_score == 0:
219
+ mood = "Contemplative"
220
+ elif mood_score == -1:
221
+ mood = "Irritated by anomalies"
222
+ else:
223
+ mood = "Emotionally buffering. Try again later."
224
+
225
+ print(f"[Codriao]: Mood status — {mood}\n")
226
+
227
+
228
+ async def main():
229
+ print_banner()
230
+ while True:
231
+ display_menu()
232
+ choice = input("> ").strip()
233
+ if choice == "1":
234
+ run_integrity_check()
235
+ elif choice == "2":
236
+ run_identity_analysis()
237
+ elif choice == "3":
238
+ generate_and_evaluate_strategy()
239
+ elif choice == "4":
240
+ view_quarantined_modules()
241
+ elif choice == "5":
242
+ view_anomaly_score_history()
243
+ elif choice == "6":
244
+ simulate_anomaly()
245
+ elif choice == "7":
246
+ engage_lockdown()
247
+ elif choice == "8":
248
+ print("\n[Codriao]: Logging off. May your queries be short and your bugs be few.")
249
+ break
250
+ elif choice == "9":
251
+ view_ethics()
252
+ elif choice == "10":
253
+ request_trust_key()
254
+ elif choice == "11":
255
+ review_journal()
256
+ elif choice == "12":
257
+ view_autonomy_state()
258
+ elif choice == "13":
259
+ propose_autonomy_change()
260
+ elif choice == "14":
261
+ get_codriao_mood()
262
+ else:
263
+ print("[Codriao]: Invalid choice. Try again. Maybe use your whole brain this time.\n")
264
+
265
+
266
+ if __name__ == "__main__":
267
+ asyncio.run(main())