e13df82021
Memind CI / Test, build, and release guards (push) Failing after 14m19s
Stop ITL regex from intercepting new messages before Agent execution; move scheduled task and schedule write confirmation to MCP tool calls with draft commit on 确认. Co-authored-by: Cursor <cursoragent@cursor.com>
72 lines
2.0 KiB
JavaScript
72 lines
2.0 KiB
JavaScript
import assert from 'node:assert/strict';
|
|
import test from 'node:test';
|
|
import { handleWechatScheduledTaskIntent } from './scheduled-task.mjs';
|
|
|
|
test('handleWechatScheduledTaskIntent passes create requests to goose', async () => {
|
|
const reply = await handleWechatScheduledTaskIntent({
|
|
intent: {
|
|
msgType: 'text',
|
|
agentText: '每天6点帮我做今日新闻页面',
|
|
msgId: 'msg-1',
|
|
},
|
|
user: { userId: 'user-1' },
|
|
scheduledTaskService: {
|
|
async createTask() {
|
|
throw new Error('should not create from inbound regex');
|
|
},
|
|
},
|
|
});
|
|
assert.equal(reply, null);
|
|
});
|
|
|
|
test('handleWechatScheduledTaskIntent passes incomplete create requests to goose', async () => {
|
|
const reply = await handleWechatScheduledTaskIntent({
|
|
intent: {
|
|
msgType: 'text',
|
|
agentText: '帮我设一个定时自动任务',
|
|
msgId: 'msg-1',
|
|
},
|
|
user: { userId: 'user-1' },
|
|
scheduledTaskService: {
|
|
async createTask() {
|
|
throw new Error('should not create from inbound regex');
|
|
},
|
|
},
|
|
});
|
|
assert.equal(reply, null);
|
|
});
|
|
|
|
test('handleWechatScheduledTaskIntent ignores non automation text', async () => {
|
|
const reply = await handleWechatScheduledTaskIntent({
|
|
intent: {
|
|
msgType: 'text',
|
|
agentText: '明天下午三点提醒我开会',
|
|
msgId: 'msg-1',
|
|
},
|
|
user: { userId: 'user-1' },
|
|
scheduledTaskService: {
|
|
async createTask() {
|
|
throw new Error('should not create');
|
|
},
|
|
},
|
|
});
|
|
assert.equal(reply, null);
|
|
});
|
|
|
|
test('handleWechatScheduledTaskIntent still lists tasks', async () => {
|
|
const reply = await handleWechatScheduledTaskIntent({
|
|
intent: {
|
|
msgType: 'text',
|
|
agentText: '看看我的定时自动任务',
|
|
msgId: 'msg-1',
|
|
},
|
|
user: { userId: 'user-1' },
|
|
scheduledTaskService: {
|
|
async listTasks() {
|
|
return [{ title: '新闻页面', recurrence: 'daily', hour: 6, minute: 0, timezone: 'Asia/Shanghai' }];
|
|
},
|
|
},
|
|
});
|
|
assert.match(reply, /新闻页面/u);
|
|
});
|