Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ jobs:
- name: Install project dependencies
run: uv sync --frozen

- name: Run pre-commit
uses: pre-commit/action@v3.0.1

- name: Setup Node
uses: actions/setup-node@v4
with:
Expand Down
23 changes: 23 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-json
- id: check-added-large-files
args: ["--maxkb=512"]
- id: check-merge-conflict
- id: check-toml

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.11.10
hooks:
- id: ruff-format

- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.10.0.1
hooks:
- id: shellcheck
files: \.sh$
9 changes: 8 additions & 1 deletion apps/api/api_runtime_console.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ def _tools(app: Any, *, tool_overrides: Mapping[str, Any]) -> list[dict[str, Any
)
return rows


def _cron_jobs(app: Any) -> list[dict[str, Any]]:
rows: list[dict[str, Any]] = []
for job in app.cron_runtime.list_jobs():
Expand Down Expand Up @@ -183,7 +184,13 @@ def _proactive_ask_system_job(app: Any) -> dict[str, Any] | None:
"status": "scheduled" if enabled else "paused",
"profileId": None,
"eggId": None,
"payload": {"type": "proactive_ask", "enabled": enabled, "idle_threshold_minutes": idle, "daily_max": daily_max, "quiet_hours": [qs, qe]},
"payload": {
"type": "proactive_ask",
"enabled": enabled,
"idle_threshold_minutes": idle,
"daily_max": daily_max,
"quiet_hours": [qs, qe],
},
"skills": [],
"createdAt": None,
"updatedAt": None,
Expand Down
328 changes: 243 additions & 85 deletions apps/api/api_runtime_console_ops.py

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion apps/api/api_runtime_cron_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
def run_proactive_ask_now(self) -> dict[str, Any]:
"""Run the built-in proactive ask scheduler once on demand."""
from apps.gateway.cron_service import CONFIGURED_IM_ADAPTERS
from apps.gateway.proactive_ask_job import ProactiveAskTickResult, run_proactive_ask_tick
from apps.gateway.proactive_ask_job import (
ProactiveAskTickResult,
run_proactive_ask_tick,
)
from apps.gateway.runtime import build_gateway_app
from packages.runtime_config import (
global_config_path_for_state_dir,
Expand Down
7 changes: 2 additions & 5 deletions apps/api/api_runtime_http_dispatch_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,14 @@
def _elephant_id_from_name(name: str) -> str:
"""Convert elephant display name to elephant ID format."""
import re

return re.sub(r"[^a-zA-Z0-9_-]", "", name.lower().replace(" ", "-"))


def _cron_payload(payload: Mapping[str, Any]) -> dict[str, Any]:
"""Extract validated cron job payload."""
job_payload = {
key: value
for key, value in (
("prompt", _optional_str(payload.get("prompt"))),
)
if value is not None
key: value for key, value in (("prompt", _optional_str(payload.get("prompt"))),) if value is not None
}
skills = _cron_skill_ids(payload.get("skills"))
if skills:
Expand Down
Loading
Loading