Add scheduled task automation skill with worker execution pipeline.
Memind CI / Test, build, and release guards (push) Failing after 18s
Memind CI / Test, build, and release guards (push) Failing after 18s
Introduce scheduled-task-automation for H5 and WeChat, persist tasks in h5_scheduled_tasks, and run due jobs via a dedicated worker that executes agent tasks and delivers results. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import {
|
||||
buildScheduledTaskExecutionPrompt,
|
||||
extractScheduledTaskDeliveryText,
|
||||
formatScheduledTaskDeliveryMessage,
|
||||
} from './scheduled-task-executor.mjs';
|
||||
|
||||
test('buildScheduledTaskExecutionPrompt includes task spec and automation marker', () => {
|
||||
const message = buildScheduledTaskExecutionPrompt({
|
||||
id: 'task-1',
|
||||
title: '每日新闻页',
|
||||
taskSpec: '搜索今日新闻并生成 HTML 页面',
|
||||
recurrence: 'daily',
|
||||
timezone: 'Asia/Shanghai',
|
||||
});
|
||||
const text = message.content[0].text;
|
||||
assert.match(text, /scheduled-task-automation/);
|
||||
assert.match(text, /每日新闻页/);
|
||||
assert.match(text, /搜索今日新闻并生成 HTML 页面/);
|
||||
assert.match(text, /Scheduled Automation/);
|
||||
});
|
||||
|
||||
test('extractScheduledTaskDeliveryText reads last assistant message', () => {
|
||||
const text = extractScheduledTaskDeliveryText([
|
||||
{ role: 'user', content: [{ type: 'text', text: 'hi' }] },
|
||||
{ role: 'assistant', content: [{ type: 'text', text: '今日新闻页:https://example.com/news.html' }] },
|
||||
], { title: '每日新闻页' });
|
||||
assert.match(text, /https:\/\/example.com\/news.html/);
|
||||
});
|
||||
|
||||
test('formatScheduledTaskDeliveryMessage wraps delivery body', () => {
|
||||
const text = formatScheduledTaskDeliveryMessage(
|
||||
{ title: '每日新闻页' },
|
||||
'页面已生成:https://example.com/news.html',
|
||||
);
|
||||
assert.match(text, /定时任务完成:每日新闻页/);
|
||||
assert.match(text, /页面已生成/);
|
||||
});
|
||||
Reference in New Issue
Block a user