Skip to content

The agent that grows with you

fix(desktop): render script-only cron jobs in the detail view and sidebar

Hermes Agent4f11ac246c96
diff --git a/apps/desktop/src/app/chat/sidebar/cron-jobs-section.tsx b/apps/desktop/src/app/chat/sidebar/cron-jobs-section.tsx
index 2e6575f43c0..0bc80e8263c 100644
--- a/apps/desktop/src/app/chat/sidebar/cron-jobs-section.tsx
+++ b/apps/desktop/src/app/chat/sidebar/cron-jobs-section.tsx
@@ -66,6 +66,13 @@ function formatRunTime(seconds?: null | number): string {
return Number.isNaN(date.valueOf()) ? '—' : fmtDayTime.format(date)
}
+// Script-only (no_agent) jobs have no agent sessions; the runs endpoint
+// surfaces their per-fire output docs as rows with source='cron_output'
+// (see _list_cron_output_runs in hermes_cli/web_routers/cron.py).
+function isSyntheticCronOutputRun(run: SessionInfo): boolean {
+ return run.source === 'cron_output'
+}
+
interface SidebarCronJobsSectionProps {
jobs: CronJob[]
label: string
@@ -450,21 +457,31 @@ function CronJobSidebarRuns({ jobId, onOpenRun }: { jobId: string; onOpenRun: (s
<div className="py-1 pl-1 text-[0.6875rem] text-(--ui-text-tertiary)">{c.noRuns}</div>
) : (
<>
- {runs.map(run => (
- <button
- className={cn(
- 'truncate rounded-md px-1.5 py-0.5 text-left text-[0.6875rem] tabular-nums focus-visible:bg-(--chrome-action-hover) focus-visible:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40',
- run.id === selectedSessionId
- ? 'bg-(--ui-row-active-background) text-foreground'
- : 'text-(--ui-text-secondary) hover:bg-(--chrome-action-hover) hover:text-foreground'
- )}
- key={run.id}
- onClick={() => onOpenRun(run.id)}
- type="button"
- >
- {formatRunTime(run.last_active || run.started_at)}
- </button>
- ))}
+ {runs.map(run =>
+ isSyntheticCronOutputRun(run) ? (
+ // Output-doc rows have no backing session to open.
+ <div
+ className="truncate rounded-md px-1.5 py-0.5 text-[0.6875rem] text-(--ui-text-secondary) tabular-nums"
+ key={run.id}
+ >
+ {formatRunTime(run.last_active || run.started_at)}
+ </div>
+ ) : (
+ <button
+ className={cn(
+ 'truncate rounded-md px-1.5 py-0.5 text-left text-[0.6875rem] tabular-nums focus-visible:bg-(--chrome-action-hover) focus-visible:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40',
+ run.id === selectedSessionId
+ ? 'bg-(--ui-row-active-background) text-foreground'
+ : 'text-(--ui-text-secondary) hover:bg-(--chrome-action-hover) hover:text-foreground'
+ )}
+ key={run.id}
+ onClick={() => onOpenRun(run.id)}
+ type="button"
+ >
+ {formatRunTime(run.last_active || run.started_at)}
+ </button>
+ )
+ )}
</>
)}
</div>
diff --git a/apps/desktop/src/app/cron/cron-job-model.test.ts b/apps/desktop/src/app/cron/cron-job-model.test.ts
index a29de820e45..b6db7f82bf3 100644
--- a/apps/desktop/src/app/cron/cron-job-model.test.ts
+++ b/apps/desktop/src/app/cron/cron-job-model.test.ts
@@ -3,6 +3,7 @@ import { describe, expect, it } from 'vitest'
import {
cronEditorUpdates,
cronModelChoiceValue,
+ jobDescription,
jobIsScriptOnly,
lastErrorSummary,
parseCronDeliveryTargets,
@@ -35,6 +36,21 @@ describe('jobIsScriptOnly', () => {
})
})
+describe('jobDescription', () => {
+ it('returns the prompt when present', () => {
+ expect(jobDescription({ prompt: 'Summarize mail', script: 'sync.sh' })).toBe('Summarize mail')
+ })
+
+ it('falls back to the script when the prompt is empty (script-only jobs)', () => {
+ expect(jobDescription({ prompt: '', script: 'sync_quillreach_cron.sh' })).toBe('sync_quillreach_cron.sh')
+ })
+
+ it('returns an empty string when neither prompt nor script is set', () => {
+ expect(jobDescription({ prompt: '', script: '' })).toBe('')
+ expect(jobDescription({ prompt: null, script: null })).toBe('')
+ })
+})
+
describe('validateCronEditor', () => {
it('requires prompt and schedule for agent-backed jobs', () => {
expect(validateCronEditor({ prompt: '', schedule: '', scriptOnlyJob: false })).toBe('prompt_and_schedule')
diff --git a/apps/desktop/src/app/cron/cron-job-model.ts b/apps/desktop/src/app/cron/cron-job-model.ts
index f0106001c52..4a8f832dae5 100644
--- a/apps/desktop/src/app/cron/cron-job-model.ts
+++ b/apps/desktop/src/app/cron/cron-job-model.ts
@@ -7,6 +7,11 @@ export function jobIsScriptOnly(job: Pick<CronJob, 'no_agent' | 'script'>): bool
return Boolean(job.no_agent) && Boolean(asText(job.script).trim())
}
+/** Description shown for a cron job: the prompt, or the script when script-only. */
+export function jobDescription(job: Pick<CronJob, 'prompt' | 'script'>): string {
+ return asText(job.prompt) || asText(job.script)
+}
+
export type CronEditorValidationError = 'prompt' | 'prompt_and_schedule' | 'schedule'
export interface CronEditorValidationInput {
diff --git a/apps/desktop/src/app/cron/index.tsx b/apps/desktop/src/app/cron/index.tsx
index 41d6435d614..1c3a4c4443f 100644
--- a/apps/desktop/src/app/cron/index.tsx
+++ b/apps/desktop/src/app/cron/index.tsx
@@ -78,6 +78,7 @@ import { mutateAndRefreshCronJobs, refreshCronJobs, triggerAndRefreshCronJobs }
import {
cronEditorUpdates,
cronModelChoiceValue,
+ jobDescription,
jobIsScriptOnly,
lastErrorSummary,
parseCronDeliveryTargets,
@@ -796,6 +797,8 @@ function CronJobDetail({ busy, c, job, onEdit, onOpenSession, onPauseResume, onT
const isPaused = state === 'paused'
const deliver = jobDeliver(job)
const prompt = jobPrompt(job)
+ const scriptOnly = jobIsScriptOnly(job)
+ const description = jobDescription(job)
const modelOverride = jobModel(job)
return (
@@ -804,6 +807,7 @@ function CronJobDetail({ busy, c, job, onEdit, onOpenSession, onPauseResume, onT
<div className="flex flex-wrap items-start justify-between gap-3">
<div className="flex min-w-0 flex-wrap items-center gap-2">
<h3 className="text-[0.95rem] font-semibold tracking-tight text-foreground">{jobTitle(job)}</h3>
+ {scriptOnly && <PanelPill tone="muted">{c.scriptBadge}</PanelPill>}
<PanelPill tone={STATE_TONE[state] ?? 'muted'}>{c.states[state] ?? state}</PanelPill>
</div>
<div className="flex shrink-0 items-center gap-0.5">
@@ -849,10 +853,10 @@ function CronJobDetail({ busy, c, job, onEdit, onOpenSession, onPauseResume, onT
) : null}
</header>
- {prompt ? (
+ {description ? (
<section className="space-y-1.5">
- <PanelSectionLabel>{c.promptLabel}</PanelSectionLabel>
- <PanelBlock>{prompt}</PanelBlock>
+ <PanelSectionLabel>{scriptOnly && !prompt ? c.scriptLabel : c.promptLabel}</PanelSectionLabel>
+ <PanelBlock>{description}</PanelBlock>
</section>
) : null}
@@ -871,6 +875,13 @@ function formatRunTime(seconds?: null | number): string {
return Number.isNaN(date.valueOf()) ? '—' : date.toLocaleString()
}
+// Script-only (no_agent) jobs have no agent sessions; the runs endpoint
+// surfaces their per-fire output docs as rows with source='cron_output'
+// (see _list_cron_output_runs in hermes_cli/web_routers/cron.py).
+function isSyntheticCronOutputRun(run: SessionInfo): boolean {
+ return run.source === 'cron_output'
+}
+
// Runs are produced by the background scheduler tick. cron.changed /
// sessions.changed broadcasts re-load immediately on event-capable backends
// (the tick dep below), so the poll drops to a slow backstop there; older
@@ -948,19 +959,34 @@ function CronJobRuns({
<div className="py-1 text-xs text-muted-foreground">{c.noRuns}</div>
) : (
<div className="flex flex-col gap-px">
- {runs.map(run => (
- <button
- className="row-hover flex items-center justify-between gap-3 rounded-md px-2 py-1 text-left text-xs focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40"
- key={run.id}
- onClick={() => onOpenSession?.(run.id)}
- type="button"
- >
- <span className="truncate text-foreground/85">{run.title?.trim() || run.preview?.trim() || run.id}</span>
- <span className="shrink-0 text-[0.62rem] text-muted-foreground/55 tabular-nums">
- {formatRunTime(run.last_active || run.started_at)}
- </span>
- </button>
- ))}
+ {runs.map(run =>
+ isSyntheticCronOutputRun(run) ? (
+ // Output-doc rows have no backing session to open; show the
+ // recorded output preview without a chat-navigation affordance.
+ <div className="flex items-center justify-between gap-3 rounded-md px-2 py-1 text-xs" key={run.id}>
+ <span className="truncate text-foreground/85">
+ {run.title?.trim() || run.preview?.trim() || run.id}
+ </span>
+ <span className="shrink-0 text-[0.62rem] text-muted-foreground/55 tabular-nums">
+ {formatRunTime(run.last_active || run.started_at)}
+ </span>
+ </div>
+ ) : (
+ <button
+ className="row-hover flex items-center justify-between gap-3 rounded-md px-2 py-1 text-left text-xs focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40"
+ key={run.id}
+ onClick={() => onOpenSession?.(run.id)}
+ type="button"
+ >
+ <span className="truncate text-foreground/85">
+ {run.title?.trim() || run.preview?.trim() || run.id}
+ </span>
+ <span className="shrink-0 text-[0.62rem] text-muted-foreground/55 tabular-nums">
+ {formatRunTime(run.last_active || run.started_at)}
+ </span>
+ </button>
+ )
+ )}
</div>
)}
</div>
diff --git a/apps/desktop/src/i18n/ar.ts b/apps/desktop/src/i18n/ar.ts
index 1230bba16b8..632475c3f24 100644
--- a/apps/desktop/src/i18n/ar.ts
+++ b/apps/desktop/src/i18n/ar.ts
@@ -1983,6 +1983,8 @@ export const ar = defineLocale({
nameLabel: 'الاسم',
namePlaceholder: 'مثال: الملخص الصباحي',
promptLabel: 'الرسالة',
+ scriptLabel: 'البرنامج النصي',
+ scriptBadge: 'برنامج نصي',
promptPlaceholder: 'ماذا تريد من Hermes أن يفعل؟',
frequencyLabel: 'التكرار',
deliverLabel: 'التسليم',
diff --git a/apps/desktop/src/i18n/de.ts b/apps/desktop/src/i18n/de.ts
index 699db102737..e2b54e08b31 100644
--- a/apps/desktop/src/i18n/de.ts
+++ b/apps/desktop/src/i18n/de.ts
@@ -3781,6 +3781,8 @@ export const deOverrides = {
nameLabel: 'Name',
namePlaceholder: 'Morgenübersicht',
promptLabel: 'Prompt',
+ scriptLabel: 'Skript',
+ scriptBadge: 'Skript',
promptPlaceholder: 'Fass meine ungelesenen Slack-Kanäle zusammen und schick mir die Top 5 per E-Mail...',
frequencyLabel: 'Häufigkeit',
deliverLabel: 'Zustellen an',
diff --git a/apps/desktop/src/i18n/en.ts b/apps/desktop/src/i18n/en.ts
index a8694196743..a4a03dcd5e0 100644
--- a/apps/desktop/src/i18n/en.ts
+++ b/apps/desktop/src/i18n/en.ts
@@ -3397,6 +3397,8 @@ export const en: Translations = {
nameLabel: 'Name',
namePlaceholder: 'Morning briefing',
promptLabel: 'Prompt',
+ scriptLabel: 'Script',
+ scriptBadge: 'script',
promptPlaceholder: 'Summarize my unread Slack threads and email me the top 5...',
frequencyLabel: 'Frequency',
deliverLabel: 'Deliver to',
diff --git a/apps/desktop/src/i18n/es.ts b/apps/desktop/src/i18n/es.ts
index 6cd14544d5b..349aabdf375 100644
--- a/apps/desktop/src/i18n/es.ts
+++ b/apps/desktop/src/i18n/es.ts
@@ -3770,6 +3770,8 @@ export const esOverrides = {
nameLabel: 'Nombre',
namePlaceholder: 'Resumen matutino',
promptLabel: 'Prompt',
+ scriptLabel: 'Script',
+ scriptBadge: 'script',
promptPlaceholder: 'Resume mis hilos de Slack sin leer y envíame por email los 5 principales...',
frequencyLabel: 'Frecuencia',
deliverLabel: 'Entregar a',
diff --git a/apps/desktop/src/i18n/fr.ts b/apps/desktop/src/i18n/fr.ts
index 8ff030d8d5f..d009fb270a0 100644
--- a/apps/desktop/src/i18n/fr.ts
+++ b/apps/desktop/src/i18n/fr.ts
@@ -3789,6 +3789,8 @@ export const frOverrides = {
nameLabel: 'Nom',
namePlaceholder: 'Point du matin',
promptLabel: 'Invite',
+ scriptLabel: "Script",
+ scriptBadge: "script",
promptPlaceholder: 'Résumez mes fils Slack non lus et envoyez-moi les 5 principaux par email...',
frequencyLabel: 'Fréquence',
deliverLabel: 'Livrer vers',
diff --git a/apps/desktop/src/i18n/ja.ts b/apps/desktop/src/i18n/ja.ts
index 677adfb863e..ee31b6ee2a4 100644
--- a/apps/desktop/src/i18n/ja.ts
+++ b/apps/desktop/src/i18n/ja.ts
@@ -2335,6 +2335,8 @@ export const ja = defineLocale({
nameLabel: '名前',
namePlaceholder: '例: 日次サマリー',
promptLabel: 'プロンプト',
+ scriptLabel: 'スクリプト',
+ scriptBadge: 'スクリプト',
promptPlaceholder: '実行ごとにエージェントが行う内容は?',
frequencyLabel: '頻度',
deliverLabel: '配信先',
diff --git a/apps/desktop/src/i18n/ru.ts b/apps/desktop/src/i18n/ru.ts
index 45d2a7c4c90..868fa3ae4cb 100644
--- a/apps/desktop/src/i18n/ru.ts
+++ b/apps/desktop/src/i18n/ru.ts
@@ -2529,6 +2529,8 @@ export const ru = defineLocale({
nameLabel: 'Имя',
namePlaceholder: 'Утренний брифинг',
promptLabel: 'Промпт',
+ scriptLabel: 'Скрипт',
+ scriptBadge: 'скрипт',
promptPlaceholder: 'Суммируй мои непрочитанные треды Slack и пришли топ-5 на почту...',
frequencyLabel: 'Частота',
deliverLabel: 'Доставить в',
diff --git a/apps/desktop/src/i18n/types.ts b/apps/desktop/src/i18n/types.ts
index bbbe41fc6e4..fcfb3a59236 100644
--- a/apps/desktop/src/i18n/types.ts
+++ b/apps/desktop/src/i18n/types.ts
@@ -2840,6 +2840,8 @@ export interface Translations {
nameLabel: string
namePlaceholder: string
promptLabel: string
+ scriptLabel: string
+ scriptBadge: string
promptPlaceholder: string
frequencyLabel: string
deliverLabel: string
diff --git a/apps/desktop/src/i18n/zh-hant.ts b/apps/desktop/src/i18n/zh-hant.ts
index 5e5e52c57df..2d4ad68e9e5 100644
--- a/apps/desktop/src/i18n/zh-hant.ts
+++ b/apps/desktop/src/i18n/zh-hant.ts
@@ -2553,6 +2553,8 @@ export const zhHant = defineLocale({
nameLabel: '名稱',
namePlaceholder: '例如:每日摘要',
promptLabel: '提示詞',
+ scriptLabel: '指令碼',
+ scriptBadge: '指令碼',
promptPlaceholder: '代理每次執行時應做什麼?',
frequencyLabel: '頻率',
deliverLabel: '傳遞至',
diff --git a/apps/desktop/src/i18n/zh.ts b/apps/desktop/src/i18n/zh.ts
index 694873d6e10..2ebb2a1b4a0 100644
--- a/apps/desktop/src/i18n/zh.ts
+++ b/apps/desktop/src/i18n/zh.ts
@@ -3192,6 +3192,8 @@ export const zh = defineLocale({
nameLabel: '名称',
namePlaceholder: '晨间简报',
promptLabel: '提示词',
+ scriptLabel: '脚本',
+ scriptBadge: '脚本',
promptPlaceholder: '总结我未读的 Slack 话题,并把前 5 条邮件发给我…',
frequencyLabel: '频率',
deliverLabel: '投递至',