初始化测试通过
This commit is contained in:
@@ -13,6 +13,7 @@ import json
|
||||
import os
|
||||
import time
|
||||
from typing import Any, Optional
|
||||
import uuid
|
||||
|
||||
from jiangchang_skill_core import collect_runtime_diagnostics, config, format_runtime_health_lines
|
||||
from jiangchang_skill_core.activity import JobStopped, emit, finish, job_context
|
||||
@@ -68,7 +69,7 @@ async def _run_template_demo(target: Optional[str], input_id: Optional[str]) ->
|
||||
def cmd_run(target: Optional[str] = None, input_id: Optional[str] = None) -> int:
|
||||
"""通用任务执行入口模板。复制后请实现真实业务逻辑。"""
|
||||
log = _get_task_logger()
|
||||
task_type = "cmd_run"
|
||||
task_type = "demo"
|
||||
|
||||
with job_context(skill=SKILL_SLUG):
|
||||
log.info(
|
||||
@@ -223,7 +224,7 @@ def cmd_add(*, title: str, priority: str = "normal", due_at: Optional[int] = Non
|
||||
try:
|
||||
todo = todo_service.add_todo(title=title, priority=priority, due_at=due_at)
|
||||
except ValueError as exc:
|
||||
print(f"ERROR:TODO_INVALID: {exc}")
|
||||
_get_task_logger().error(f"ERROR:TODO_INVALID: {exc}")
|
||||
return 1
|
||||
_get_task_logger().info(json.dumps(todo.to_dict(), ensure_ascii=False))
|
||||
return 0
|
||||
@@ -266,7 +267,7 @@ async def _run_remind_async(*, seconds: int) -> dict[str, Any]:
|
||||
"""
|
||||
steps = max(1, int(seconds))
|
||||
for i in range(1, steps + 1):
|
||||
await asyncio.sleep(1)
|
||||
await interruptible_sleep(1)
|
||||
emit(f"提醒任务进度 {i}/{steps}", skill=SKILL_SLUG, stage="remind", progress=i, total=steps)
|
||||
# 真实业务在这里会查 todos 表挑出 due/pending 项发出提醒;demo 不做真实推送
|
||||
summary = todo_service.stats()
|
||||
|
||||
Reference in New Issue
Block a user