





















@@ -29,7 +29,17 @@ import { resolveInternalSessionKey, resolveMainSessionAlias } from "./sessions-h
2929// We spell out job/patch properties so that LLMs know what fields to send.
3030// Nested unions are avoided; runtime validation happens in normalizeCronJob*.
313132-const CRON_ACTIONS = ["status", "list", "add", "update", "remove", "run", "runs", "wake"] as const;
32+const CRON_ACTIONS = [
33+"status",
34+"list",
35+"get",
36+"add",
37+"update",
38+"remove",
39+"run",
40+"runs",
41+"wake",
42+] as const;
33433444const CRON_SCHEDULE_KINDS = ["at", "every", "cron"] as const;
3545const CRON_WAKE_MODES = ["now", "next-heartbeat"] as const;
@@ -315,7 +325,6 @@ export const CronToolSchema = Type.Object(
315325type CronToolOptions = {
316326agentSessionKey?: string;
317327currentDeliveryContext?: DeliveryContext;
318-/** Restrict this cron tool instance to removing only this active cron job. */
319328selfRemoveOnlyJobId?: string;
320329};
321330@@ -350,7 +359,7 @@ function readCronJobIdParam(params: Record<string, unknown>) {
350359return readStringParam(params, "jobId") ?? readStringParam(params, "id");
351360}
352361353-const CRON_SELF_REMOVE_SCOPE_ERROR = "Cron tool is restricted to removing the current cron job.";
362+const CRON_SELF_REMOVE_SCOPE_ERROR = "Cron tool is restricted to the current cron job.";
354363355364function readCronSelfRemoveOnlyJobId(opts: CronToolOptions | undefined) {
356365return opts?.selfRemoveOnlyJobId?.trim() || undefined;
@@ -369,7 +378,7 @@ function assertCronSelfRemoveScope(
369378if (!selfRemoveOnlyJobId || isCronSelfIntrospectionAction(action)) {
370379return;
371380}
372-if (action === "remove" || action === "runs") {
381+if (action === "get" || action === "remove" || action === "runs") {
373382const id = readCronJobIdParam(params);
374383if (id && id === selfRemoveOnlyJobId) {
375384return;
@@ -623,13 +632,14 @@ export function createCronTool(opts?: CronToolOptions, deps?: CronToolDeps): Any
623632name: "cron",
624633ownerOnly: isOpenClawOwnerOnlyCoreToolName("cron"),
625634displaySummary: CRON_TOOL_DISPLAY_SUMMARY,
626-description: `Manage Gateway cron jobs (status/list/add/update/remove/run/runs) and send wake events. Use this for reminders, "check back later" requests, delayed follow-ups, and recurring tasks. Do not emulate scheduling with exec sleep or process polling.
635+description: `Manage Gateway cron jobs (status/list/get/add/update/remove/run/runs) and send wake events. Use this for reminders, "check back later" requests, delayed follow-ups, and recurring tasks. Do not emulate scheduling with exec sleep or process polling.
627636628637Main-session cron jobs enqueue system events for heartbeat handling. Isolated cron jobs create background task runs that appear in \`openclaw tasks\`.
629638630639ACTIONS:
631640- status: Check cron scheduler status
632641- list: List jobs (use includeDisabled:true to include disabled; agentId filters by agent, auto-filled from session)
642+- get: Get one job by id (requires jobId)
633643- add: Create job (requires job object, see schema below)
634644- update: Modify job (requires jobId + patch object)
635645- remove: Delete job (requires jobId)
@@ -692,7 +702,7 @@ CRITICAL CONSTRAINTS:
692702Default: prefer isolated agentTurn jobs unless the user explicitly wants current-session binding.
693703694704RESTRICTED CRON RUNS:
695-- Some isolated cron runs receive a narrow cron grant for self-cleanup. In that mode, read-only status and list are for self-introspection only, runs (job run history) is allowed for the current job only, and mutation actions remain limited to removing the current cron job.
705+- Some isolated cron runs receive a narrow cron grant for self-cleanup. In that mode, read-only status and list are for self-introspection only, get/runs are allowed for the current job only, and mutation actions remain limited to removing the current cron job.
696706697707WAKE MODES (for wake action):
698708- "next-heartbeat" (default): Wake on next heartbeat
@@ -756,6 +766,13 @@ Use jobId as the canonical identifier; id is accepted for compatibility. Use con
756766selfRemoveOnlyJobId ? filterCronListResultToJobId(result, selfRemoveOnlyJobId) : result,
757767);
758768}
769+case "get": {
770+const id = readCronJobIdParam(params);
771+if (!id) {
772+throw new Error("jobId required (id accepted for backward compatibility)");
773+}
774+return jsonResult(await callGateway("cron.get", gatewayOpts, { id }));
775+}
759776case "add": {
760777// Flat-params recovery: non-frontier models (e.g. Grok) sometimes flatten
761778// job properties to the top level alongside `action` instead of nesting
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。