Add cron monitor APIs: labels, watch, progress, and query tools.

Extend jobs with lifecycle projection and history policies so listeners can poll state at scale without breaking existing cron_* flows.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-09-10 15:23:42 +08:00
parent 43facd608a
commit b6934b20a3
10 changed files with 1501 additions and 53 deletions

View file

@ -431,7 +431,16 @@ test('registerCronTools registers each definition and disposer unregisters', ()
},
}
const off = registerCronTools(ctx, {})
assert.deepEqual(registered, ['cron_create', 'cron_list', 'cron_pause', 'cron_resume', 'cron_delete'])
assert.deepEqual(registered, [
'cron_create',
'cron_list',
'cron_query',
'cron_runs',
'cron_progress',
'cron_pause',
'cron_resume',
'cron_delete',
])
off()
assert.deepEqual(registered, [])
})
@ -440,6 +449,9 @@ test('cron tool output schemas never use type arrays (Host rejects them)', () =>
const defs = cronToolDefinitions({
async createJob() { return {} },
async listJobs() { return [] },
async queryJobs() { return { jobs: [], items: [], count: 0 } },
async listRuns() { return { task_id: '', runs: [], next_cursor: null, total: 0 } },
async getProgress() { return { snapshots: [], count: 0 } },
async pauseJob() { return {} },
async resumeJob() { return {} },
async deleteJob() { return {} },