feat(scheduler): 定时任务完成通知经微信直投

任务专柜下班退位后执行结果没人接——现在跑完主动推微信:
「⏰ 任务 · 完成/失败」+ 本轮收尾纯文本 + 触发时刻后 files 表新增成果文件(沙箱+限5个/20MB,
正文里的 /p/ 链同样转卡片)。超长截头部+全文落 .md 转卡片,与交互投递同款兜底。

- scheduled_tasks 加 notify_channel 列:op=create 时记本会话微信绑定(谁设的闹钟通知谁),
  建任务回执带一行事实;存量任务/无绑定退回用户全部在线绑定
- 钩点在 scheduler 阶段A(running→ok 轮询推断=定时轮收尾权威信号,用户手聊专柜不误触)与
  阶段B投递失败;notifyTask 经 server.js 惰性闭包注入(防 scheduler→wechat→engine require 环)
- 通知与交互投递共用 bid 串行链不插队;不碰 last_msg_id 游标;失败/离线只记日志不重试
- definitions.json prompt 参数撤掉 skill/webhook 自推引导(内置通知防双推)
This commit is contained in:
2026-09-29 22:21:34 +08:00
parent 16c5557045
commit ba4b1149aa
6 changed files with 120 additions and 10 deletions
+1 -1
View File
@@ -320,7 +320,7 @@
},
"prompt": {
"type": "string",
"description": "Self-contained instruction delivered as the only input at each trigger (prior history is archived). Output stays in the task's session; if the result must reach the user proactively, say how inside the prompt (e.g. via a skill or webhook). Required with op=create; optional with op=update."
"description": "Self-contained instruction delivered as the only input at each trigger (prior history is archived). Each run's closing reply plus newly written artifact files are automatically pushed to the user via WeChat, so do not wire a webhook/email push into the prompt. Required with op=create; optional with op=update."
},
"brief": {
"type": "string",