fix(wechat): route scheduled task cancel and spec updates through Goose MCP

Pass cancel requests to Goose like create instead of inbound title matching,
and add scheduled_task_update_spec so format or execution constraints update
taskSpec without triggering page delivery guards.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-08-29 09:47:39 +08:00
parent e13df82021
commit a1a921eba6
12 changed files with 265 additions and 36 deletions
+15 -5
View File
@@ -4,7 +4,11 @@ import {
isPageDataIntent,
} from '../../chat-skills.mjs';
import { shouldUseScheduleAssistant } from '../../schedule-intent.mjs';
import { shouldUseScheduledTaskAutomation } from '../../scheduled-task-intent.mjs';
import {
isScheduledTaskIntent,
parseScheduledTaskIntent,
shouldUseScheduledTaskAutomation,
} from '../../scheduled-task-intent.mjs';
import { buildCurrentTimeAgentPrefix } from '../../user-memory-profile.mjs';
import { isPageGenerateText, wantsDocxDownload } from '../intent/patterns.mjs';
import { buildWechatStandaloneImageInstruction } from '../image-generation-policy.mjs';
@@ -82,12 +86,18 @@ export function buildWechatAgentPrompt(intent, {
'',
].filter(Boolean).join('\n')
: '';
const scheduledTaskAutomationHint = shouldUseScheduledTaskAutomation(agentText)
const scheduledTaskIntent = parseScheduledTaskIntent(agentText);
const scheduledTaskAutomationHint = (
shouldUseScheduledTaskAutomation(agentText)
|| isScheduledTaskIntent(scheduledTaskIntent)
)
? [
'【定时自动任务要求】这条消息 Scheduled Automation(到点自动执行并推送结果),不是待办提醒。',
'【定时自动任务要求】这条消息涉及 Scheduled Automation(到点自动执行并推送结果),不是待办提醒。',
'开始前先加载 `scheduled-task-automation` skill,并严格按 skill 边界执行。',
'澄清缺失的执行时间或 taskSpec,再调用 scheduled_task_create / scheduled_task_list / scheduled_task_cancel。',
'禁止在当前对话立即执行长任务;工具成功返回后才能确认已设置。',
'创建:澄清缺失的执行时间或 taskSpec,再调用 scheduled_task_create(需用户确认卡片)。',
'取消/更新规范:必须先 scheduled_task_list 拿 taskId;取消用 scheduled_task_cancel,补充格式/长期约束用 scheduled_task_update_spec(可 mergeTaskSpec。',
'若用户只是在补充已有定时任务的执行规范(不是要做新页面),禁止走 static-page-publish 页面交付链路。',
'禁止在当前对话立即执行长任务;工具成功返回后才能确认已设置/已取消。',
'一次性任务用 runAtLocal;循环任务用 hour/minute/weekday,禁止自行估算 Unix 毫秒。',
intent?.msgId ? `调用 scheduled_task_create 时必须传入 sourceMessageId: ${intent.msgId}` : '',
'',
+1
View File
@@ -66,6 +66,7 @@ export function buildPageGenerateAgentPrompt(
return [
'【微信服务号 · 页面生成任务】',
'这是服务号专用页面生成,不是普通聊天。必须按步骤完成,未完成前禁止告诉用户“已生成/已发布”。',
'【定时任务规范】若用户是在为已有定时自动任务补充长期格式/参考页/执行约束(不是要你此刻写 HTML),改加载 scheduled-task-automation,用 scheduled_task_list + scheduled_task_update_spec;禁止走本页面交付链路。',
'',
docxBlock,
imageBlock,