Cron: normalize cron.add inputs + align channels (#256)

* fix: harden cron add and align channels

* fix: keep cron tool id params

---------

Co-authored-by: Peter Steinberger <steipete@gmail.com>
This commit is contained in:
Marcus Neves
2026-01-05 23:09:48 -03:00
committed by GitHub
parent 00061b2fd3
commit 67e1452f4a
21 changed files with 457 additions and 48 deletions

View File

@@ -73,7 +73,14 @@ export function buildCronPayload(form: CronFormState) {
kind: "agentTurn";
message: string;
deliver?: boolean;
channel?: "last" | "whatsapp" | "telegram";
channel?:
| "last"
| "whatsapp"
| "telegram"
| "discord"
| "slack"
| "signal"
| "imessage";
to?: string;
timeoutSeconds?: number;
} = { kind: "agentTurn", message };
@@ -188,4 +195,3 @@ export async function loadCronRuns(state: CronState, jobId: string) {
state.cronError = String(err);
}
}

View File

@@ -12,7 +12,7 @@
"element",
"node",
"nodeId",
"jobId",
"id",
"requestId",
"to",
"channelId",
@@ -136,10 +136,10 @@
"label": "add",
"detailKeys": ["job.name", "job.id", "job.schedule", "job.cron"]
},
"update": { "label": "update", "detailKeys": ["jobId"] },
"remove": { "label": "remove", "detailKeys": ["jobId"] },
"run": { "label": "run", "detailKeys": ["jobId"] },
"runs": { "label": "runs", "detailKeys": ["jobId"] },
"update": { "label": "update", "detailKeys": ["id"] },
"remove": { "label": "remove", "detailKeys": ["id"] },
"run": { "label": "run", "detailKeys": ["id"] },
"runs": { "label": "runs", "detailKeys": ["id"] },
"wake": { "label": "wake", "detailKeys": ["text", "mode"] }
}
},

View File

@@ -271,7 +271,14 @@ export type CronPayload =
thinking?: string;
timeoutSeconds?: number;
deliver?: boolean;
channel?: "last" | "whatsapp" | "telegram";
channel?:
| "last"
| "whatsapp"
| "telegram"
| "discord"
| "slack"
| "signal"
| "imessage";
to?: string;
bestEffortDeliver?: boolean;
};
@@ -306,7 +313,7 @@ export type CronJob = {
export type CronStatus = {
enabled: boolean;
jobCount: number;
jobs: number;
nextWakeAtMs?: number | null;
};

View File

@@ -162,7 +162,14 @@ export type CronFormState = {
payloadKind: "systemEvent" | "agentTurn";
payloadText: string;
deliver: boolean;
channel: "last" | "whatsapp" | "telegram";
channel:
| "last"
| "whatsapp"
| "telegram"
| "discord"
| "slack"
| "signal"
| "imessage";
to: string;
timeoutSeconds: string;
postToMainPrefix: string;

View File

@@ -47,7 +47,7 @@ export function renderCron(props: CronProps) {
</div>
<div class="stat">
<div class="stat-label">Jobs</div>
<div class="stat-value">${props.status?.jobCount ?? "n/a"}</div>
<div class="stat-value">${props.status?.jobs ?? "n/a"}</div>
</div>
<div class="stat">
<div class="stat-label">Next wake</div>
@@ -185,6 +185,10 @@ export function renderCron(props: CronProps) {
<option value="last">Last</option>
<option value="whatsapp">WhatsApp</option>
<option value="telegram">Telegram</option>
<option value="discord">Discord</option>
<option value="slack">Slack</option>
<option value="signal">Signal</option>
<option value="imessage">iMessage</option>
</select>
</label>
<label class="field">
@@ -387,4 +391,3 @@ function renderRun(entry: CronRunLogEntry) {
</div>
`;
}