feat: cron agent binding + doctor UI refresh

This commit is contained in:
Peter Steinberger
2026-01-13 03:23:36 +00:00
parent bfdbaa5ab6
commit b41e75a15d
19 changed files with 127 additions and 32 deletions

View File

@@ -175,6 +175,7 @@ declare global {
const DEFAULT_CRON_FORM: CronFormState = {
name: "",
description: "",
agentId: "",
enabled: true,
scheduleKind: "every",
scheduleAt: "",

View File

@@ -99,9 +99,11 @@ export async function addCronJob(state: CronState) {
try {
const schedule = buildCronSchedule(state.cronForm);
const payload = buildCronPayload(state.cronForm);
const agentId = state.cronForm.agentId.trim();
const job = {
name: state.cronForm.name.trim(),
description: state.cronForm.description.trim() || undefined,
agentId: agentId || undefined,
enabled: state.cronForm.enabled,
schedule,
sessionTarget: state.cronForm.sessionTarget,

View File

@@ -157,6 +157,7 @@ export type IMessageForm = {
export type CronFormState = {
name: string;
description: string;
agentId: string;
enabled: boolean;
scheduleKind: "at" | "every" | "cron";
scheduleAt: string;

View File

@@ -82,6 +82,15 @@ export function renderCron(props: CronProps) {
props.onFormChange({ description: (e.target as HTMLInputElement).value })}
/>
</label>
<label class="field">
<span>Agent ID</span>
<input
.value=${props.form.agentId}
@input=${(e: Event) =>
props.onFormChange({ agentId: (e.target as HTMLInputElement).value })}
placeholder="default"
/>
</label>
<label class="field checkbox">
<span>Enabled</span>
<input
@@ -338,6 +347,7 @@ function renderJob(job: CronJob, props: CronProps) {
<div class="list-title">${job.name}</div>
<div class="list-sub">${formatCronSchedule(job)}</div>
<div class="muted">${formatCronPayload(job)}</div>
${job.agentId ? html`<div class="muted">Agent: ${job.agentId}</div>` : nothing}
<div class="chip-row" style="margin-top: 6px;">
<span class="chip">${job.enabled ? "enabled" : "disabled"}</span>
<span class="chip">${job.sessionTarget}</span>