jobs: show target path in list rows; delete queued/finished jobs + clear-all history

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-23 16:31:52 +00:00
co-authored by Claude Opus 4.8
parent 5da29e4004
commit 32caa67cab
5 changed files with 95 additions and 24 deletions
@@ -24,6 +24,8 @@ pipelineJobsRouter.get('/', async (c) => {
status: j.status,
isLive: j.isLive,
exitCode: j.exitCode,
// The file/folder the job is working on (for the list rows).
target: (j.inputs as Record<string, unknown> | null)?.file_path ?? j.cwd ?? null,
totalCost: j.totalCost,
createdAt: j.createdAt,
startedAt: j.startedAt,
@@ -107,6 +109,23 @@ pipelineJobsRouter.post('/:id/stop', async (c) => {
return c.json({ ok: true, result });
});
// DELETE /history — clear all finished jobs (rows + logs). Before /:id so it isn't captured as an id.
pipelineJobsRouter.delete('/history', async (c) => {
const user = c.get('user');
const cleared = await jobManager.clearHistory(user.id);
return c.json({ ok: true, cleared });
});
// DELETE /:id — delete a job (queued or finished). Running jobs must be stopped first (409).
pipelineJobsRouter.delete('/:id', async (c) => {
const user = c.get('user');
const job = await getPipelineJob(c.req.param('id'));
if (!job || job.userId !== user.id) return c.json({ error: 'Not found' }, 404);
const result = await jobManager.deleteJob(job.id);
if (result === 'running') return c.json({ error: 'Stop the job before deleting' }, 409);
return c.json({ ok: true, result });
});
// GET /:id — single job detail (full row).
pipelineJobsRouter.get('/:id', async (c) => {
const user = c.get('user');