import type { Command } from "commander"; import { THINKING_LEVELS_HELP } from "../../auto-reply/thinking.shared.js"; import { getCronChannelOptions } from "./shared.js"; export function registerCronMutationOptions(command: Command, mode: "add" | "edit"): Command { const create = mode === "add"; return command .option("--name ", "Job name") .option("--display-name ", "Human-readable job label") .option("--description ", "Job description") .option( "--delete-after-run", "Delete one-shot after successful completion (confirmed/no delivery, intentional silence, or best effort); failed/unknown required delivery retains it disabled", false, ) .option("--keep-after-run", "Keep one-shot job after it succeeds", false) .option("--agent ", "Agent id for this job") .option("--session ", "Session target (main|isolated|current|session:)") .option("--session-key ", "Session key for job routing") .option("--wake ", "Wake mode (now|next-heartbeat)", create ? "now" : undefined) .option("--at ", "One-shot time (ISO, offset-less uses --tz) or duration like 20m") .option("--every ", "Interval duration (e.g. 10m, 1h)") .option("--pacing-min ", "Minimum delay for a dynamic next check") .option("--pacing-max ", "Maximum delay for a dynamic next check") .option("--cron ", "Cron expression (5-field or 6-field with seconds)") .option("--on-exit ", "Fire once when the watched command exits") .option("--on-exit-cwd ", "Working directory for the --on-exit watched command") .option("--stream-command ", "Stream source argv as a JSON array of strings") .option("--stream-cwd ", "Working directory for the stream source") .option("--stream-mode ", "Stream line selection mode (line|match)") .option("--stream-match ", "Regex source required for stream match mode") .option("--stream-batch-ms ", "Quiet-window batch delay in milliseconds") .option("--stream-max-batch-bytes ", "Maximum UTF-8 bytes per stream batch") .option( "--tz ", "Timezone for cron expressions (IANA; cron default: Gateway host local timezone)", create ? "" : undefined, ) .option("--stagger ", "Cron stagger window (e.g. 30s, 5m)") .option("--exact", "Disable cron staggering (set stagger to 0)", create ? false : undefined) .option("--trigger-script ", "Condition script file, or - for stdin") .option("--trigger-once", "Disable after the first successful triggered run", false) .option("--system-event ", "System event payload (main session)") .option("--message ", "Agent message payload") .option("--script ", "Headless script payload file, or - for stdin") .option("--script-timeout-seconds ", "Script wall-clock timeout seconds") .option("--script-tool-budget ", "Maximum script tool calls") .option("--command ", "Command payload run as sh -lc on the Gateway") .option("--command-argv ", "Command payload argv as JSON array of strings") .option("--command-cwd ", "Working directory for command payloads") .option( "--command-env ", "Environment override for command payloads (repeatable)", (value: string, previous: string[] | undefined) => [...(previous ?? []), value], ) .option("--command-input ", "stdin for command payloads") .option("--thinking ", `Thinking level for agent jobs (${THINKING_LEVELS_HELP})`) .option("--model ", "Model override for agent jobs (provider/model or alias)") .option("--fallbacks ", "Fallback model list for agent jobs") .option( "--timeout-seconds ", "Timeout seconds for agent or command jobs (non-negative integer; 0 disables scheduler timeout)", ) .option("--no-output-timeout-seconds ", "No-output timeout seconds for command jobs") .option("--output-max-bytes ", "Maximum captured stdout/stderr bytes for command jobs") .option( "--light-context", "Use lightweight bootstrap context for agent jobs", create ? false : undefined, ) .option( "--tools ", 'Tool allow-list (e.g. exec,read or exec read; "" disables all tools)', ) .option("--announce", "Fallback-deliver final text to a chat", create ? false : undefined) .option("--deliver", "Deprecated (use --announce). Fallback-delivers final text to a chat.") .option("--no-deliver", "Disable runner fallback delivery") .option("--webhook ", "POST the finished payload to a webhook URL") .option( "--channel ", `Delivery channel (${getCronChannelOptions()})`, create ? "last" : undefined, ) .option("--to ", "Delivery destination (E.164, Telegram chatId, or Discord channel/user)") .option("--thread-id ", "Telegram forum topic thread id") .option("--account ", "Channel account id for delivery (multi-account setups)") .option( "--best-effort-deliver", create ? "Do not fail the job if delivery fails" : "Do not fail job if delivery fails (also implies --announce when used alone)", create ? false : undefined, ); }