Assemble the full diagnostic snapshot. Raises nothing. ``recent_window_hours`` bounds the plugin.log scan — only entries newer than ``now - window`` contribute to the recent-activity aggregate. 24h is the default because the log rotates daily, so a full active-day view fits in exact
(
home: str | Path | None = None,
recent_window_hours: float = 24.0,
)
| 47 | |
| 48 | |
| 49 | def collect_status( |
| 50 | home: str | Path | None = None, |
| 51 | recent_window_hours: float = 24.0, |
| 52 | ) -> dict[str, Any]: |
| 53 | """Assemble the full diagnostic snapshot. Raises nothing. |
| 54 | |
| 55 | ``recent_window_hours`` bounds the plugin.log scan — only entries newer |
| 56 | than ``now - window`` contribute to the recent-activity aggregate. 24h |
| 57 | is the default because the log rotates daily, so a full active-day view |
| 58 | fits in exactly one file without the scanner stitching across rotations. |
| 59 | """ |
| 60 | home_dir = Path(home).expanduser().resolve() if home else get_home_dir() |
| 61 | legacy_hooks = _check_hooks() |
| 62 | return { |
| 63 | "timestamp": datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ"), |
| 64 | "home": str(home_dir), |
| 65 | # Backwards-compatible alias for one release. New consumers should use |
| 66 | # legacy_user_hooks for ~/.codex/hooks.json and plugin_hooks for the |
| 67 | # bundled plugin metadata path. |
| 68 | "hooks": legacy_hooks, |
| 69 | "legacy_user_hooks": legacy_hooks, |
| 70 | "plugin_hooks": _check_plugin_hook_bundle(), |
| 71 | "scheduler": _check_scheduler(), |
| 72 | "skill_synthesis": _check_skill_synthesis(home_dir), |
| 73 | "skills": _check_skill_counts(), |
| 74 | "env_provider": _check_env_provider(home_dir), |
| 75 | "tools": _check_tools(), |
| 76 | "buckets": _list_buckets(home_dir), |
| 77 | "recent_activity": _recent_activity(home_dir, window_hours=recent_window_hours), |
| 78 | } |
| 79 | |
| 80 | |
| 81 | # ---------- hooks -------------------------------------------------------- |