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:
@@ -0,0 +1,43 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import {
|
||||
commitAgentSideEffectTool,
|
||||
executeScheduledTaskUpdateSpecTool,
|
||||
} from './agent-side-effect-tools.mjs';
|
||||
|
||||
test('executeScheduledTaskUpdateSpecTool delegates to scheduledTaskService.updateTaskSpec', async () => {
|
||||
const calls = [];
|
||||
const task = await executeScheduledTaskUpdateSpecTool({
|
||||
taskId: 'task-1',
|
||||
taskSpec: '新规范',
|
||||
mergeTaskSpec: true,
|
||||
}, {
|
||||
userId: 'user-1',
|
||||
scheduledTaskService: {
|
||||
async updateTaskSpec(payload) {
|
||||
calls.push(payload);
|
||||
return { id: 'task-1', taskSpec: 'merged spec', title: '新闻' };
|
||||
},
|
||||
},
|
||||
});
|
||||
assert.equal(calls[0].taskId, 'task-1');
|
||||
assert.equal(calls[0].mergeTaskSpec, true);
|
||||
assert.equal(task.title, '新闻');
|
||||
});
|
||||
|
||||
test('commitAgentSideEffectTool supports scheduled_task_update_spec', async () => {
|
||||
const committed = await commitAgentSideEffectTool('scheduled_task_update_spec', {
|
||||
taskId: 'task-1',
|
||||
taskSpec: '标准格式说明',
|
||||
mergeTaskSpec: true,
|
||||
}, {
|
||||
userId: 'user-1',
|
||||
scheduledTaskService: {
|
||||
async updateTaskSpec() {
|
||||
return { id: 'task-1', taskSpec: '标准格式说明', status: 'active' };
|
||||
},
|
||||
},
|
||||
});
|
||||
assert.equal(committed.kind, 'scheduled_task');
|
||||
assert.equal(committed.updated, true);
|
||||
});
|
||||
Reference in New Issue
Block a user