mirror of
https://github.com/hansjone/dsh-ops-cron.git
synced 2026-10-11 06:40:45 +08:00
Fix cron_* registration: Host rejects JSON Schema type arrays.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
25454a5c8c
commit
9b8f937a65
4 changed files with 32 additions and 8 deletions
12
lib/tools.js
12
lib/tools.js
|
|
@ -41,9 +41,10 @@ const JOB_SCHEMA = {
|
|||
schedule: { type: 'object', additionalProperties: true },
|
||||
createdAt: { type: 'number' },
|
||||
updatedAt: { type: 'number' },
|
||||
lastRunAt: { type: ['number', 'null'] },
|
||||
lastStatus: { type: ['string', 'null'] },
|
||||
nextRunAt: { type: ['number', 'null'] },
|
||||
// Host assertSupportedJsonSchema rejects type arrays — use oneOf for nullables.
|
||||
lastRunAt: { oneOf: [{ type: 'number' }, { type: 'null' }] },
|
||||
lastStatus: { oneOf: [{ type: 'string' }, { type: 'null' }] },
|
||||
nextRunAt: { oneOf: [{ type: 'number' }, { type: 'null' }] },
|
||||
},
|
||||
}
|
||||
|
||||
|
|
@ -497,8 +498,9 @@ export function cronGuidanceText(nowMs = Date.now(), timeZone = 'Asia/Shanghai')
|
|||
'Agent preset: omit agent_preset to inherit (WhatsApp chat/group preset → creating session → Host default). Pass agent_preset to pin a preset for every scheduled run.',
|
||||
'When the user asks to look at, create, pause, resume, or delete 定时任务 / scheduled tasks / cron jobs:',
|
||||
'1. If cron_list / cron_create / cron_pause / cron_resume / cron_delete are in your tool list, call them.',
|
||||
'2. If they are not listed, search/unlock tools or skills with query "定时任务" or "cron" (skill_search, skill_load, or dev_tool_search) and then call them.',
|
||||
'3. Never run crontab, never read /etc/cron*, and never say there are no tasks until cron_list has returned.',
|
||||
'2. If they are not listed, load skill "scheduled-tasks" via the skill tool (exact name), then retry the cron_* tools. Those tools are registered by the dsh-ops-cron plugin — they are not unlocked by skill_search/dev_tool_search (those names are obsolete).',
|
||||
'3. If cron_* still return unknown tool after loading the skill, the plugin failed to register (check Host logs for unsupported JSON schema). Tell the user; do not invent crontab workarounds.',
|
||||
'4. Never run crontab, never read /etc/cron*, and never say there are no tasks until cron_list has returned.',
|
||||
].join('\n')
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue