overcode 0.1.0__py3-none-any.whl → 0.1.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
overcode/daemon_state.py DELETED
@@ -1,113 +0,0 @@
1
- """
2
- Daemon state management.
3
-
4
- Tracks and persists daemon state for communication with the TUI.
5
- """
6
-
7
- import json
8
- from dataclasses import dataclass, field
9
- from datetime import datetime
10
- from pathlib import Path
11
- from typing import Optional
12
-
13
- from .settings import PATHS, DAEMON
14
-
15
-
16
- # Daemon operation modes
17
- MODE_OFF = "off" # Daemon not running
18
- MODE_MONITOR = "monitor" # Track stats/state but never launch supervisor claude
19
- MODE_SUPERVISE = "supervise" # Full supervision (monitor + launch claude when needed)
20
-
21
-
22
- @dataclass
23
- class DaemonState:
24
- """Tracks daemon state for TUI display.
25
-
26
- This class is used by:
27
- - The daemon to persist its current state
28
- - The TUI to read and display daemon status
29
- """
30
-
31
- loop_count: int = 0
32
- current_interval: int = field(default_factory=lambda: DAEMON.interval_fast)
33
- last_loop_time: Optional[datetime] = None
34
- started_at: Optional[datetime] = None
35
- status: str = "starting" # starting, active, idle, sleeping, waiting, supervising, no_agents, stopped
36
- last_activity: Optional[datetime] = None
37
- daemon_claude_launches: int = 0
38
- mode: str = MODE_SUPERVISE # off, monitor, supervise
39
-
40
- def to_dict(self) -> dict:
41
- """Convert state to dictionary for JSON serialization."""
42
- return {
43
- "loop_count": self.loop_count,
44
- "current_interval": self.current_interval,
45
- "last_loop_time": self.last_loop_time.isoformat() if self.last_loop_time else None,
46
- "started_at": self.started_at.isoformat() if self.started_at else None,
47
- "status": self.status,
48
- "last_activity": self.last_activity.isoformat() if self.last_activity else None,
49
- "daemon_claude_launches": self.daemon_claude_launches,
50
- "mode": self.mode,
51
- }
52
-
53
- @classmethod
54
- def from_dict(cls, data: dict) -> "DaemonState":
55
- """Create state from dictionary."""
56
- state = cls()
57
- state.loop_count = data.get("loop_count", 0)
58
- state.current_interval = data.get("current_interval", DAEMON.interval_fast)
59
- state.status = data.get("status", "unknown")
60
- state.daemon_claude_launches = data.get("daemon_claude_launches", 0)
61
- state.mode = data.get("mode", MODE_SUPERVISE)
62
-
63
- if data.get("last_loop_time"):
64
- state.last_loop_time = datetime.fromisoformat(data["last_loop_time"])
65
- if data.get("started_at"):
66
- state.started_at = datetime.fromisoformat(data["started_at"])
67
- if data.get("last_activity"):
68
- state.last_activity = datetime.fromisoformat(data["last_activity"])
69
-
70
- return state
71
-
72
- def save(self, state_file: Optional[Path] = None) -> None:
73
- """Save state to file for TUI to read.
74
-
75
- Args:
76
- state_file: Optional path override (for testing)
77
- """
78
- path = state_file or PATHS.daemon_state
79
- path.parent.mkdir(parents=True, exist_ok=True)
80
- with open(path, 'w') as f:
81
- json.dump(self.to_dict(), f, indent=2)
82
-
83
- @classmethod
84
- def load(cls, state_file: Optional[Path] = None) -> Optional["DaemonState"]:
85
- """Load state from file (used by TUI).
86
-
87
- Args:
88
- state_file: Optional path override (for testing)
89
-
90
- Returns:
91
- DaemonState if file exists and is valid, None otherwise
92
- """
93
- path = state_file or PATHS.daemon_state
94
- if not path.exists():
95
- return None
96
-
97
- try:
98
- with open(path) as f:
99
- data = json.load(f)
100
- return cls.from_dict(data)
101
- except (json.JSONDecodeError, KeyError, ValueError):
102
- return None
103
-
104
-
105
- def get_daemon_state() -> Optional[DaemonState]:
106
- """Get the current daemon state from file.
107
-
108
- Convenience function for TUI and other consumers.
109
-
110
- Returns:
111
- DaemonState if daemon is running and state file exists, None otherwise
112
- """
113
- return DaemonState.load()
@@ -1,43 +0,0 @@
1
- overcode/__init__.py,sha256=Khx1HKL81_NJYG9NMD-4uvzAFsJr4Te7jevga6MJ_Sk,100
2
- overcode/cli.py,sha256=2b4NXrhW6FNaQsZdus4PoqGICEfd72Kv2V4wtPDDO6s,28674
3
- overcode/config.py,sha256=azKI2wEeJgw7p5FjEqdJ8AJsE4_kMMY5pkBSsHxOb-E,1762
4
- overcode/daemon.py,sha256=urH0zHhPpuzf-Q_khDo6haJ0lkizaDYIGa7pabVllYA,47794
5
- overcode/daemon_claude_skill.md,sha256=74OoUARhconOTmfWQaHaDbWEPc7wZeywVNb6fIIuELE,5177
6
- overcode/daemon_state.py,sha256=jpvCZbe-rGGsN7AeuL_eKWhSDDdHf2LaoE2OlEj83Ig,3922
7
- overcode/data_export.py,sha256=ZnPXZVh6WI1lzLz51dZIK6fYMXy9CyJsVAglmUQMNKo,8220
8
- overcode/dependency_check.py,sha256=dAAtKigrAJTnED9_nyZGP39wR56wNJ6bD84iKrQkIMQ,6162
9
- overcode/exceptions.py,sha256=_H-GtmDRuZQ1Fucbq6_T-4tmC9C706F18poqDs6q1Kw,4795
10
- overcode/history_reader.py,sha256=DYTG447nAmRHcfVmWW4FTEdra0GQ2Z5OsgFTQVhrjeE,14038
11
- overcode/implementations.py,sha256=oY8cFjzO_Uqzteczn_p4PFcAsN2Zki9a22vuaCTkjL0,7470
12
- overcode/interfaces.py,sha256=txVkMHHhQl7dpsBS2jx7sR-BHwKiqlAj-YRw7pFkZdg,1101
13
- overcode/launcher.py,sha256=DJ0gEF9ksRn68naNK7DdL4EWwVEpOD8nUcAogebNG9I,16018
14
- overcode/logging_config.py,sha256=BuioELKEdfx_amx35sVIdR1tyf2nbhfmOPLp5778lcs,5755
15
- overcode/mocks.py,sha256=VA9BLNrbqjDJtohfru-ytpdUGqIVamS8wrvbTZZf2fc,5118
16
- overcode/monitor_daemon.py,sha256=ThdGrhBcpK8BaCuPWmdj8p7DmT69MRtA5VUpa2hCvRA,29665
17
- overcode/monitor_daemon_state.py,sha256=wD7f2BuS6d7BUS66BtGBevhv_IU3fp9x_4omhV78arE,14856
18
- overcode/pid_utils.py,sha256=3mAv3f_2cI1j88I9CMGkrD70t4bIGL6x9Q0uHMUl5Ak,6609
19
- overcode/presence_logger.py,sha256=0jIUPrhbeU0CDL9W2J7CbDPbAc-WPD4n4LFJJbLZ7Tc,13338
20
- overcode/protocols.py,sha256=iHsh-li-5x-99FM9L3hmlsPxMJK6q6pUDf5TqtA7FpU,3969
21
- overcode/session_manager.py,sha256=bTqi9jX7FfEK96SmPGTpyp-pDUr2mw1-Nc8SBXd7O0A,23057
22
- overcode/settings.py,sha256=OJ7iEz3IS4fu7Rtq5T3SruxNVtGgEuogABqRrFM5iik,12811
23
- overcode/standing_instructions.py,sha256=GZwhq0zT2IPMKDw1_8iTpT_9l6VkkyYTYGSD3u3AcVA,9594
24
- overcode/status_constants.py,sha256=f24L3pEyI32ntH_d-p_MMdN1SHsYj2IhFrTjTLVWIVc,5817
25
- overcode/status_detector.py,sha256=ga1MPnWGOsu73EV1lDzIMwZnuc7qKfvd8DiMHwX6hY0,14589
26
- overcode/status_history.py,sha256=NzhVuTqHkSqgTTdwNfQ8wudCggYjhelZWxpZh6AmzCM,4778
27
- overcode/status_patterns.py,sha256=5bqqlzaEwImRQvvrXA-Qaqng0F7hLUNxxQtBMniY9jQ,8182
28
- overcode/summarizer_client.py,sha256=RBRx6FCaKzLGfnLb3fKOK1XxmYlqclHvt6O8pSSQFv0,4322
29
- overcode/summarizer_component.py,sha256=IVLM-l2eOfiTAFQ_MX5jDm5lKBbe0nAVGkb0gMlxqhU,9797
30
- overcode/supervisor_daemon.py,sha256=mxzv3jNO-TTjGIoGuI1rlIwlRUiGxqTl7KvMtVAOPIA,37518
31
- overcode/supervisor_layout.sh,sha256=s0Fm4Fj7adv5IOsMx1JuA6OAXCoQx9OUnS1CmV0FOwI,1652
32
- overcode/tmux_manager.py,sha256=SNqgQN-MLCIlpg1u4Zf0k6OX2uYryKpIZ3PPnF4Jwb0,7624
33
- overcode/tui.py,sha256=26Mfg1BDf4NthzSWubbx4l_UAjArdWf73l6EHKhVaDU,110212
34
- overcode/tui_helpers.py,sha256=3J9e9CBaJYiG_WSVNokb6MpWFQJNJbAQVb58WPmiLRA,14329
35
- overcode/web_api.py,sha256=WUJEClWsbfCvTtOnhfhoMytqK8oY9HclAFPSkXAgaNk,9033
36
- overcode/web_server.py,sha256=SgxW6fplNTZ6T6yc9Xj4xUs3jqd64YXZr1K09kcjn1k,4722
37
- overcode/web_templates.py,sha256=9L2XWcdWDztgcqpyKaSuj3H8UB3IsAKEtfd29BE20KA,17719
38
- overcode-0.1.0.dist-info/licenses/LICENSE,sha256=6C9I9dhq8QTa4P6LckWXugYJ3xm2ufZKrLymqOqRZFs,1066
39
- overcode-0.1.0.dist-info/METADATA,sha256=WsByOcbTedjqlkq4ju9088PDkGiWw0kPv1QNs15xLSk,2635
40
- overcode-0.1.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
41
- overcode-0.1.0.dist-info/entry_points.txt,sha256=EveN-QDOji1HFbJAsIH-djI_s0E4KQC6N144arLeRb0,47
42
- overcode-0.1.0.dist-info/top_level.txt,sha256=5cfXcNbSNvigE7coZgIRPCl_NDWHu_5UIBmWi9Xiupo,9
43
- overcode-0.1.0.dist-info/RECORD,,