mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-07 13:02:07 +00:00
The manage overlay held its own local jobs list, so deleting/creating a job there left the sidebar's $cronJobs atom stale until the 30s poll (delete all → section lingered). Make the overlay read and mutate the shared atom directly (updateCronJobs), so sidebar + overlay are one source of truth and changes show immediately.
19 lines
1.1 KiB
TypeScript
19 lines
1.1 KiB
TypeScript
import { atom } from 'nanostores'
|
|
|
|
import type { CronJob } from '@/types/hermes'
|
|
|
|
// Cron *jobs* (not run sessions) power the sidebar "Cron jobs" section. Listing
|
|
// the job — schedule, state, live next-run countdown — makes the job the
|
|
// first-class entity; its runs (sessions) resolve under it in the cron detail.
|
|
export const $cronJobs = atom<CronJob[]>([])
|
|
export const setCronJobs = (jobs: CronJob[]) => $cronJobs.set(jobs)
|
|
|
|
// In-place edit so the cron overlay's mutations (create/edit/delete/pause/…)
|
|
// land in the same atom the sidebar renders — no stale list until the next poll.
|
|
export const updateCronJobs = (fn: (jobs: CronJob[]) => CronJob[]) => $cronJobs.set(fn($cronJobs.get()))
|
|
|
|
// One-shot focus target: clicking "Manage" on a job sets this, then opens the
|
|
// cron overlay, which reads it once to select + scroll to that job. Cleared
|
|
// after consumption so re-opening cron normally doesn't re-focus a stale job.
|
|
export const $cronFocusJobId = atom<null | string>(null)
|
|
export const setCronFocusJobId = (id: null | string) => $cronFocusJobId.set(id)
|