No-op compatibility facade for legacy structured preference storage.
| 13 | |
| 14 | |
| 15 | class PreferenceManager: |
| 16 | """No-op compatibility facade for legacy structured preference storage.""" |
| 17 | |
| 18 | def __init__(self, opc_home) -> None: |
| 19 | self.opc_home = opc_home |
| 20 | self.memory_store = MarkdownMemoryStore(opc_home) |
| 21 | |
| 22 | # --- Load --- |
| 23 | |
| 24 | def load_global(self) -> dict[str, Any]: |
| 25 | return self.memory_store.load_profile() |
| 26 | |
| 27 | def load_project(self, project_id: str) -> dict[str, Any]: |
| 28 | return self.memory_store.load_profile(project_id) |
| 29 | |
| 30 | def load_project_knowledge(self, project_id: str) -> dict[str, Any]: |
| 31 | profile = self.load_project(project_id) |
| 32 | knowledge = profile.get("project_knowledge", {}) |
| 33 | return knowledge if isinstance(knowledge, dict) else {} |
| 34 | |
| 35 | def load_merged(self, project_id: str | None = None) -> dict[str, Any]: |
| 36 | """Load and merge preferences with project overrides on top of global.""" |
| 37 | merged = self.load_global() |
| 38 | if project_id: |
| 39 | merged = self._deep_merge(merged, self.load_project(project_id)) |
| 40 | return merged |
| 41 | |
| 42 | # --- Save --- |
| 43 | |
| 44 | def save_global(self, prefs: dict[str, Any]) -> None: |
| 45 | self.memory_store.save_profile(prefs) |
| 46 | |
| 47 | def save_project(self, project_id: str, prefs: dict[str, Any]) -> None: |
| 48 | self.memory_store.save_profile(prefs, project_id) |
| 49 | |
| 50 | # --- Update (partial merge) --- |
| 51 | |
| 52 | def update_global(self, updates: dict[str, Any]) -> None: |
| 53 | _ = updates |
| 54 | |
| 55 | def update_project(self, project_id: str, updates: dict[str, Any]) -> None: |
| 56 | _ = (project_id, updates) |
| 57 | |
| 58 | def update_project_knowledge(self, project_id: str, updates: dict[str, Any]) -> None: |
| 59 | _ = (project_id, updates) |
| 60 | |
| 61 | def record_autonomy_feedback( |
| 62 | self, |
| 63 | action_name: str, |
| 64 | approved: bool, |
| 65 | project_id: str | None = None, |
| 66 | explicit: bool = False, |
| 67 | notes: str = "", |
| 68 | ) -> None: |
| 69 | _ = (action_name, approved, project_id, explicit, notes) |
| 70 | |
| 71 | def get_autonomy_preferences(self, project_id: str | None = None) -> dict[str, Any]: |
| 72 | _ = project_id |
no outgoing calls