mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-09 05:50:44 +08:00
Simplify oclaw product surface: drop niche specialists and admin noise.
Remove stock/image/video specialists, Gmail watcher, CocoLoop market, desktop packaging, and extra memory plugins; disable dynamic agents and hide Session Monitor / API grants / Admin Audit from nav. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
efa72df362
commit
cf31fd104d
290 changed files with 127 additions and 64576 deletions
|
|
@ -1,44 +0,0 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import shutil
|
||||
from dataclasses import dataclass
|
||||
from typing import Any
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class GmailWatcherResult:
|
||||
started: bool
|
||||
reason: str = ""
|
||||
|
||||
|
||||
def start_gmail_watcher(cfg: dict[str, Any] | None) -> GmailWatcherResult:
|
||||
"""
|
||||
Gmail watcher gate (OpenClaw ``startGmailWatcher`` parity, subset).
|
||||
|
||||
Full ``gog`` + Gmail API + renew loop is not ported in Python yet; this
|
||||
function encodes the same **configuration preconditions** so lifecycle
|
||||
logging matches expectations.
|
||||
"""
|
||||
if not isinstance(cfg, dict):
|
||||
return GmailWatcherResult(started=False, reason="no gmail account configured")
|
||||
|
||||
hooks = cfg.get("hooks")
|
||||
if not isinstance(hooks, dict):
|
||||
return GmailWatcherResult(started=False, reason="hooks not enabled")
|
||||
|
||||
# OpenClaw top-level ``hooks.enabled`` (when absent, treat as enabled).
|
||||
if hooks.get("enabled") is False:
|
||||
return GmailWatcherResult(started=False, reason="hooks not enabled")
|
||||
|
||||
internal = hooks.get("internal") if isinstance(hooks.get("internal"), dict) else {}
|
||||
if internal.get("enabled") is False:
|
||||
return GmailWatcherResult(started=False, reason="hooks not enabled")
|
||||
|
||||
gmail = hooks.get("gmail")
|
||||
if not isinstance(gmail, dict) or not str(gmail.get("account") or "").strip():
|
||||
return GmailWatcherResult(started=False, reason="no gmail account configured")
|
||||
|
||||
if not shutil.which("gog"):
|
||||
return GmailWatcherResult(started=False, reason="gog binary not found")
|
||||
|
||||
return GmailWatcherResult(started=False, reason="gmail watcher runtime not implemented (Python)")
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
from typing import Any, Callable, Protocol
|
||||
|
||||
from .gmail_watcher import GmailWatcherResult, start_gmail_watcher
|
||||
|
||||
|
||||
class GmailWatcherLog(Protocol):
|
||||
def info(self, msg: str) -> None: ...
|
||||
def warn(self, msg: str) -> None: ...
|
||||
def error(self, msg: str) -> None: ...
|
||||
|
||||
|
||||
def _is_truthy_env(value: str | None) -> bool:
|
||||
return str(value or "").strip().lower() in {"1", "true", "yes", "on"}
|
||||
|
||||
|
||||
def _skip_gmail_watcher_env() -> bool:
|
||||
for key in ("OCLAW_SKIP_GMAIL_WATCHER", "OPENCLAW_SKIP_GMAIL_WATCHER"):
|
||||
if _is_truthy_env(os.getenv(key)):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def start_gmail_watcher_with_logs(
|
||||
*,
|
||||
cfg: dict[str, Any] | None,
|
||||
log: GmailWatcherLog,
|
||||
on_skipped: Callable[[], None] | None = None,
|
||||
starter: Callable[[dict[str, Any] | None], GmailWatcherResult] = start_gmail_watcher,
|
||||
) -> None:
|
||||
"""Skip entirely when ``OCLAW_SKIP_GMAIL_WATCHER`` or ``OPENCLAW_SKIP_GMAIL_WATCHER`` is truthy."""
|
||||
if _skip_gmail_watcher_env():
|
||||
if on_skipped:
|
||||
on_skipped()
|
||||
return
|
||||
|
||||
try:
|
||||
res = starter(cfg)
|
||||
if bool(res.started):
|
||||
log.info("gmail watcher started")
|
||||
return
|
||||
reason = str(res.reason or "").strip()
|
||||
if reason and reason not in {
|
||||
"hooks not enabled",
|
||||
"no gmail account configured",
|
||||
"gmail watcher runtime not implemented (Python)",
|
||||
}:
|
||||
log.warn(f"gmail watcher not started: {reason}")
|
||||
except Exception as exc:
|
||||
log.error(f"gmail watcher failed to start: {exc}")
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue