Skip to content

The agent that grows with you

feat(cron): continuity toggle across dashboard, Bot Mode routines, and TUI cron RPC

Teknium0b13cafffafb
diff --git a/apps/desktop/src/plugins/hermes-bots/plugin.js b/apps/desktop/src/plugins/hermes-bots/plugin.js
index d0e06c877d1..fd595e8e508 100644
--- a/apps/desktop/src/plugins/hermes-bots/plugin.js
+++ b/apps/desktop/src/plugins/hermes-bots/plugin.js
@@ -5456,6 +5456,7 @@ function CreateRoutineDialog({ bot, open, onClose }) {
const [name, setName] = useState('')
const [instruction, setInstruction] = useState('')
const [sched, setSched] = useState(defaultScheduleState())
+ const [continuity, setContinuity] = useState(false)
const [busy, setBusy] = useState(false)
const [error, setError] = useState(null)
const activeProfile = useValue(host.state.profile)
@@ -5465,6 +5466,7 @@ function CreateRoutineDialog({ bot, open, onClose }) {
setName('')
setInstruction('')
setSched(defaultScheduleState())
+ setContinuity(false)
setBusy(false)
setError(null)
}
@@ -5497,7 +5499,8 @@ function CreateRoutineDialog({ bot, open, onClose }) {
schedule: schedule.trim(),
prompt: routinePrompt(bot, title, task, activeProfile),
...(bot ? { profile: bot } : {}),
- ...(repeatN ? { repeat: repeatN } : {})
+ ...(repeatN ? { repeat: repeatN } : {}),
+ ...(continuity ? { continuity: true } : {})
})
await invalidateRoutineOwner(bot)
host.notify({ kind: 'success', message: `Cronjob "${title}" scheduled` })
@@ -5550,6 +5553,18 @@ function CreateRoutineDialog({ bot, open, onClose }) {
})
),
labeled('When to run', jsx(SchedulePicker, { state: sched, setState: setSched })),
+ jsxs('label', {
+ className: 'flex items-center gap-2 text-xs text-(--ui-text-tertiary) cursor-pointer select-none',
+ children: [
+ jsx('input', {
+ type: 'checkbox',
+ className: 'accent-(--ui-accent)',
+ checked: continuity,
+ onChange: event => setContinuity(event.target.checked)
+ }),
+ 'Continuity: each run sees the previous run\u2019s output (dedupe, continue where it left off)'
+ ]
+ }),
error
? jsx('div', {
className: 'rounded-md border border-(--ui-stroke-secondary) px-3 py-2 text-xs text-(--ui-accent)',
diff --git a/hermes_cli/web_server.py b/hermes_cli/web_server.py
index f3cd4e8c0bc..e78121393b7 100644
--- a/hermes_cli/web_server.py
+++ b/hermes_cli/web_server.py
@@ -12307,6 +12307,11 @@ def _validate_dashboard_cron_context_from(
if not refs:
return
for ref in refs:
+ # "self" (the continuity toggle) resolves to the job's own id at run
+ # time — it can't be validated against the store (create precedes the
+ # job's existence).
+ if isinstance(ref, str) and ref.strip().lower() == "self":
+ continue
if not _call_cron_for_profile(profile_name, "get_job", ref):
raise HTTPException(
status_code=400,
diff --git a/tui_gateway/methods_tools.py b/tui_gateway/methods_tools.py
index ed3ac3180ed..9042340bc20 100644
--- a/tui_gateway/methods_tools.py
+++ b/tui_gateway/methods_tools.py
@@ -1725,6 +1725,14 @@ def _(rid, params: dict) -> dict:
if str(params.get("repeat", "")).strip().isdigit()
else None
),
+ # Optional continuity toggle: the job's own previous
+ # output is injected into each run (stored as the
+ # reserved "self" entry in context_from).
+ continuity=(
+ is_truthy_value(params.get("continuity"))
+ if params.get("continuity") is not None
+ else None
+ ),
)
),
)
diff --git a/web/src/lib/cron-job.test.ts b/web/src/lib/cron-job.test.ts
index 2b4b3433d0f..172f7f939ed 100644
--- a/web/src/lib/cron-job.test.ts
+++ b/web/src/lib/cron-job.test.ts
@@ -22,6 +22,7 @@ function form(overrides: Partial<CronJobFormState> = {}): CronJobFormState {
script: "",
no_agent: false,
context_from: "",
+ continuity: false,
enabled_toolsets: [],
workdir: "",
...overrides,
@@ -55,6 +56,22 @@ describe("buildCronJobPayload", () => {
});
});
+ it("stores continuity as the reserved self entry", () => {
+ const payload = buildCronJobPayload(
+ form({ continuity: true, context_from: "upstream-a" }),
+ );
+
+ expect(payload.context_from).toEqual(["upstream-a", "self"]);
+ });
+
+ it("continuity off strips any hand-typed self entry", () => {
+ const payload = buildCronJobPayload(
+ form({ continuity: false, context_from: "SELF\nupstream-a" }),
+ );
+
+ expect(payload.context_from).toEqual(["upstream-a"]);
+ });
+
it("keeps clear operations explicit for update payloads", () => {
const payload = buildCronJobPayload(form({ schedule: "every 2h" }));
@@ -101,10 +118,25 @@ describe("cronJobFormFromJob", () => {
expect(cronJobFormFromJob(job)).toMatchObject({
schedule: "every 1h",
context_from: "upstream-a\nupstream-b",
+ continuity: false,
enabled_toolsets: ["web"],
});
});
+ it("splits the stored self entry into the continuity toggle", () => {
+ const job: CronJob = {
+ id: "abc",
+ enabled: true,
+ schedule_display: "every 1h",
+ context_from: ["self", "upstream-a"],
+ };
+
+ expect(cronJobFormFromJob(job)).toMatchObject({
+ context_from: "upstream-a",
+ continuity: true,
+ });
+ });
+
it("prefers one-shot run_at over the human display string", () => {
const job: CronJob = {
id: "once-job",
diff --git a/web/src/lib/cron-job.ts b/web/src/lib/cron-job.ts
index 77839f28f72..a165c774c1b 100644
--- a/web/src/lib/cron-job.ts
+++ b/web/src/lib/cron-job.ts
@@ -12,6 +12,7 @@ export interface CronJobFormState {
script: string;
no_agent: boolean;
context_from: string;
+ continuity: boolean;
enabled_toolsets: string[];
workdir: string;
}
@@ -33,12 +34,6 @@ function optionalText(value: string, stripTrailingSlash = false): string | null
return text || null;
}
-/** Coerce a stored list/string field back into the textarea's newline form. */
-function listToText(value: unknown): string {
- if (Array.isArray(value)) return splitCronList(value).join("\n");
- return typeof value === "string" ? value : "";
-}
-
/** Read a stored string field as a plain string ("" when absent). */
function asString(value: unknown): string {
return typeof value === "string" ? value : "";
@@ -47,7 +42,13 @@ function asString(value: unknown): string {
/** Build the create/update payload. Optional fields collapse to null so an
* update explicitly clears them rather than leaving stale values. */
export function buildCronJobPayload(form: CronJobFormState): CronJobMutation {
- const contextFrom = splitCronList(form.context_from);
+ // The `continuity` toggle is stored as the reserved "self" entry in
+ // context_from (the job's own previous output). Users never type "self" —
+ // the checkbox is the surface; strip any hand-typed variant first.
+ const contextFrom = splitCronList(form.context_from).filter(
+ (item) => item.toLowerCase() !== "self",
+ );
+ if (form.continuity) contextFrom.push("self");
const enabledToolsets = form.enabled_toolsets.filter(Boolean);
return {
name: form.name.trim(),
@@ -74,6 +75,9 @@ export function cronJobHasExecutionContent(
}
export function cronJobFormFromJob(job: CronJob): CronJobFormState {
+ const storedRefs = splitCronList(job.context_from);
+ const continuity = storedRefs.some((item) => item.toLowerCase() === "self");
+ const externalRefs = storedRefs.filter((item) => item.toLowerCase() !== "self");
return {
name: asString(job.name),
prompt: asString(job.prompt),
@@ -88,7 +92,8 @@ export function cronJobFormFromJob(job: CronJob): CronJobFormState {
base_url: asString(job.base_url),
script: asString(job.script),
no_agent: Boolean(job.no_agent),
- context_from: listToText(job.context_from),
+ context_from: externalRefs.join("\n"),
+ continuity,
enabled_toolsets: splitCronList(job.enabled_toolsets),
workdir: asString(job.workdir),
};
diff --git a/web/src/pages/CronPage.tsx b/web/src/pages/CronPage.tsx
index 8d7b81ae7c1..fed2013270d 100644
--- a/web/src/pages/CronPage.tsx
+++ b/web/src/pages/CronPage.tsx
@@ -145,6 +145,7 @@ function emptyCronJobForm(): CronJobEditorState {
script: "",
no_agent: false,
context_from: "",
+ continuity: false,
enabled_toolsets: [],
workdir: "",
scheduleState: { ...DEFAULT_SCHEDULE_STATE },
@@ -291,6 +292,16 @@ function CronAdvancedFields({
/>
</div>
+ <label className="flex items-center gap-2 text-xs text-muted-foreground">
+ <input
+ type="checkbox"
+ className="accent-foreground"
+ checked={form.continuity}
+ onChange={(e) => update("continuity", e.target.checked)}
+ />
+ continuity: each run sees the previous run&apos;s output (dedupe, pick up where it left off)
+ </label>
+
<div className="grid grid-cols-1 sm:grid-cols-2 gap-3">
<div className="grid gap-1">
<Label htmlFor={`${idPrefix}-context-from`}>context_from job IDs</Label>