feat: add --reflect mode with error handling + scheduler/autonomous scripts

This commit is contained in:
Jiaqing Liang committed 2026-03-02 23:25:31 +08:00
1 parent 5c3193f326
commit 9219042a8f
3 files changed
+52 -1

No files matched your search

+6
View File
@@ -0,0 +1,6 @@
# reflect/autonomous.py
INTERVAL = 1800
ONCE = False
def check():
return "[AUTO]🤖 用户已经离开超过30分钟,作为自主智能体,请阅读自动化sop,执行自动任务。"
+17
View File
@@ -0,0 +1,17 @@
import os, re
from datetime import datetime
INTERVAL = 60 # 原版 55+random*10
ONCE = False
PENDING = './sche_tasks/pending'
def check():
if not os.path.isdir(PENDING): return None
now = datetime.now()
for f in os.listdir(PENDING):
m = re.match(r'(\d{4}-\d{2}-\d{2})_(\d{4})_', f)
if m and now >= datetime.strptime(f'{m[1]} {m[2]}', '%Y-%m-%d %H%M'):
raw = open(f'{PENDING}/{f}', encoding='utf-8').read()
return f'按scheduled_task_sop执行任务文件 ../sche_tasks/pending/{f}(立刻移到running)\n内容:\n{raw}'
return None