diff --git a/apps/mobile/src/features/settings/SettingsScheduledTasksRouteScreen.tsx b/apps/mobile/src/features/settings/SettingsScheduledTasksRouteScreen.tsx index e878f86581b4a..e0fb5174ff6a0 100644 --- a/apps/mobile/src/features/settings/SettingsScheduledTasksRouteScreen.tsx +++ b/apps/mobile/src/features/settings/SettingsScheduledTasksRouteScreen.tsx @@ -30,6 +30,14 @@ import { type AtomCommandResult, } from "@t3tools/client-runtime/state/runtime"; import { resolvePastedPath } from "@t3tools/shared/path"; +import { + MONTHS, + MONTH_DAYS, + MONTH_DAYS_UNSUPPORTED, + describeFixedTimeSchedule, + describeMonthEndFallback, + monthShortLabel, +} from "@t3tools/client-runtime/scheduled-task-schedule"; import { DEFAULT_WEBHOOK_PROMPT, emptyWebhookFilterDraft, @@ -49,6 +57,7 @@ import { AppState, Platform, Pressable, TextInput as RNTextInput, View } from "r import { useSafeAreaInsets } from "react-native-safe-area-context"; import { Button } from "../../components/ui/Button"; +import { cn } from "../../lib/cn"; import { AppText as Text } from "../../components/ui/AppText"; import { SymbolView } from "../../components/ui/AppSymbol"; import { @@ -139,14 +148,14 @@ function describeSchedule( } if (task.schedule.type === "interval") return formatScheduledTaskInterval(task.schedule.everyMs, resolve); - const days = task.schedule.weekdays?.length - ? repeatLabel(task.schedule.weekdays, resolve, locale) - : resolve(msg("Every day")); const zone = scheduleTimeZoneLabel(timeZone, task.nextRunAt); const time = formatTime(task.schedule.timeOfDay); - return zone === undefined - ? resolve(msg("{days} at {time}", { days, time })) - : resolve(msg("{days} at {time} {zone}", { days, time, zone })); + return describeFixedTimeSchedule( + task.schedule, + zone === undefined ? time : `${time} ${zone}`, + resolve, + locale, + ); } function formatTime(value: string): string { @@ -197,6 +206,61 @@ function repeatLabel( ); } +/** Many small choices at once, such as the days of a month; a check marks each chosen one. */ +function ChoiceGrid(props: { + readonly columns: number; + readonly options: ReadonlyArray<{ readonly value: number; readonly label: string }>; + readonly selected: ReadonlyArray; + readonly onToggle: (value: number) => void; + readonly disabled?: boolean; +}) { + return ( + + {props.options.map((option) => { + const selected = props.selected.includes(option.value); + return ( + + props.onToggle(option.value)} + className={cn( + "h-9 flex-row items-center justify-center gap-0.5 rounded-xl active:opacity-70", + selected ? "bg-primary" : "bg-subtle", + )} + > + {selected ? ( + + ) : null} + + {option.label} + + + + ); + })} + + ); +} + +function toggleChoice(values: ReadonlyArray, value: number): ReadonlyArray { + if (!values.includes(value)) return [...values, value]; + // One choice always stays on; clearing the last would leave nothing to run on. + return values.length > 1 ? values.filter((item) => item !== value) : values; +} + function FormField(props: { readonly label: string; readonly value: string; @@ -781,6 +845,15 @@ function TaskForm({ const submissionPending = useRef(false); const [timePickerOpen, setTimePickerOpen] = useState(false); const [runAtPicker, setRunAtPicker] = useState<"date" | "time" | null>(null); + const calendarSupported = config?.environment.capabilities.scheduledTaskMonthDays === true; + // A draft already using them keeps the controls, so switching to an older server can be undone. + const showCalendar = + calendarSupported || draft.schedule.dayMode === "month" || draft.schedule.limitMonths; + const draftSchedule = + draft.schedule.mode === "fixed_time" ? scheduleFromDraft(draft.schedule) : null; + const fixedSchedule = draftSchedule?.type === "fixed_time" ? draftSchedule : null; + const fixedScheduleFallback = fixedSchedule ? describeMonthEndFallback(fixedSchedule, m) : null; + const usesCalendar = Boolean(fixedSchedule?.monthDays?.length || fixedSchedule?.months?.length); const taskMissing = draft.task !== null && tasks.data !== null && @@ -875,6 +948,15 @@ function TaskForm({ Dialog.alert(gt("Project unavailable"), gt("Choose a project in this environment.")); return; } + if ( + !calendarSupported && + schedule.type === "fixed_time" && + (schedule.monthDays?.length || schedule.months?.length) + ) { + // Until the server config loads, wait instead of refusing. + if (config !== null) Dialog.alert(gt("Update this environment"), m(MONTH_DAYS_UNSUPPORTED)); + return; + } const input: ScheduledTaskUpsertInput = { ...(draft.task ? { id: draft.task.id, requireExisting: true } : {}), title: draft.title.trim(), @@ -1237,48 +1319,136 @@ function TaskForm({ }} /> ) : null} - ({ - id: String(day.index), - title: weekdayLabel(day.index, locale), - attributes: { keepsMenuPresented: true }, - state: draft.schedule.weekdays.includes(day.index) - ? ("on" as const) - : undefined, - })), - ]} - onSelect={(id) => { - setDraft((current) => { - const weekdays = - id === "every_day" - ? DAYS.map((day) => day.index) - : id === "weekdays" - ? [1, 2, 3, 4, 5] - : (() => { - const day = DAYS.find((item) => String(item.index) === id); - if (!day) return current.schedule.weekdays; - return current.schedule.weekdays.includes(day.index) - ? current.schedule.weekdays.filter((index) => index !== day.index) - : [...current.schedule.weekdays, day.index]; - })(); - return { ...current, schedule: { ...current.schedule, weekdays } }; - }); - }} - /> + {showCalendar ? ( + + + setDraft((current) => ({ + ...current, + schedule: { ...current.schedule, dayMode }, + })) + } + /> + + ) : null} + {draft.schedule.dayMode === "week" ? ( + ({ + id: String(day.index), + title: weekdayLabel(day.index, locale), + attributes: { keepsMenuPresented: true }, + state: draft.schedule.weekdays.includes(day.index) + ? ("on" as const) + : undefined, + })), + ]} + onSelect={(id) => { + setDraft((current) => { + const weekdays = + id === "every_day" + ? DAYS.map((day) => day.index) + : id === "weekdays" + ? [1, 2, 3, 4, 5] + : (() => { + const day = DAYS.find((item) => String(item.index) === id); + if (!day) return current.schedule.weekdays; + return current.schedule.weekdays.includes(day.index) + ? current.schedule.weekdays.filter((index) => index !== day.index) + : [...current.schedule.weekdays, day.index]; + })(); + return { ...current, schedule: { ...current.schedule, weekdays } }; + }); + }} + /> + ) : ( + ({ value: day, label: String(day) }))} + selected={draft.schedule.monthDays} + disabled={saving} + onToggle={(day) => + setDraft((current) => ({ + ...current, + schedule: { + ...current.schedule, + monthDays: toggleChoice(current.schedule.monthDays, day), + }, + })) + } + /> + )} + {showCalendar ? ( + + + Only in some months + + + setDraft((current) => ({ + ...current, + schedule: { ...current.schedule, limitMonths }, + })) + } + /> + + ) : null} + {draft.schedule.limitMonths ? ( + ({ + value: month, + label: monthShortLabel(month, locale), + }))} + selected={draft.schedule.months} + disabled={saving} + onToggle={(month) => + setDraft((current) => ({ + ...current, + schedule: { + ...current.schedule, + months: toggleChoice(current.schedule.months, month), + }, + })) + } + /> + ) : null} + {fixedSchedule ? ( + + + {describeFixedTimeSchedule( + fixedSchedule, + formatTime(fixedSchedule.timeOfDay), + m, + locale, + )} + + {fixedScheduleFallback ? ( + {fixedScheduleFallback} + ) : null} + + ) : null} ) : draft.schedule.mode === "webhook" && webhookDenial !== undefined && draft.enabled ? ( @@ -1476,6 +1646,8 @@ function TaskForm({ fullWidth loading={saving} disabled={ + // The server config says whether days of the month and months can be saved. + (usesCalendar && config === null) || !canOperate || dictationPending || taskMissing || diff --git a/apps/mobile/src/features/settings/scheduledTaskDraft.test.ts b/apps/mobile/src/features/settings/scheduledTaskDraft.test.ts index c4284fac14c43..5314fa6803830 100644 --- a/apps/mobile/src/features/settings/scheduledTaskDraft.test.ts +++ b/apps/mobile/src/features/settings/scheduledTaskDraft.test.ts @@ -13,6 +13,7 @@ import { editDraft, scheduledTaskDefaultModel, DEFAULT_SCHEDULE, + hasScheduledTaskDraftChanges, scheduleDraftForTask, scheduleFromDraft, } from "./scheduledTaskDraft"; @@ -245,3 +246,57 @@ describe("scheduled task worktree base", () => { ).toBe("release"); }); }); + +describe("day-of-month schedules", () => { + it("round-trips days of the month limited to some months", () => { + const schedule = { + type: "fixed_time" as const, + timeOfDay: "09:00", + monthDays: [5], + months: [1, 4, 7, 10], + }; + const draft = scheduleDraftForTask({ schedule }); + expect(draft.dayMode).toBe("month"); + expect(draft.limitMonths).toBe(true); + expect(scheduleFromDraft(draft)).toEqual(schedule); + // Switching the limit off runs every month but keeps the choice for switching back. + expect(scheduleFromDraft({ ...draft, limitMonths: false })).toEqual({ + type: "fixed_time", + timeOfDay: "09:00", + monthDays: [5], + months: [], + }); + }); + + it("sends only the active day selection, and empty lists to clear", () => { + expect( + scheduleFromDraft({ ...DEFAULT_SCHEDULE, dayMode: "month", monthDays: [31, 4, 10] }), + ).toEqual({ type: "fixed_time", timeOfDay: "09:00", monthDays: [4, 10, 31], months: [] }); + expect(scheduleFromDraft(DEFAULT_SCHEDULE)).toEqual({ + type: "fixed_time", + timeOfDay: "09:00", + weekdays: [1, 2, 3, 4, 5], + monthDays: [], + months: [], + }); + }); + + it.each([ + { dayMode: "month" as const, monthDays: [] }, + { dayMode: "month" as const, monthDays: [32] }, + { limitMonths: true, months: [] }, + { limitMonths: true, months: [13] }, + ])("rejects an empty or invalid calendar selection %o", (fields) => { + expect(scheduleFromDraft({ ...DEFAULT_SCHEDULE, ...fields })).toBeNull(); + }); + + it("marks a switch between weekdays and days of the month as a change", () => { + const draft = createDraft(null, null); + expect( + hasScheduledTaskDraftChanges(draft, { + ...draft, + schedule: { ...draft.schedule, dayMode: "month" }, + }), + ).toBe(true); + }); +}); diff --git a/apps/mobile/src/features/settings/scheduledTaskDraft.ts b/apps/mobile/src/features/settings/scheduledTaskDraft.ts index 5bacd4be83c81..1ece33304f7ed 100644 --- a/apps/mobile/src/features/settings/scheduledTaskDraft.ts +++ b/apps/mobile/src/features/settings/scheduledTaskDraft.ts @@ -12,6 +12,7 @@ import type { } from "@t3tools/contracts"; import { DEFAULT_SERVER_SETTINGS } from "@t3tools/contracts"; +import { MONTHS } from "@t3tools/client-runtime/scheduled-task-schedule"; import { parseMaxDeliveryAge, parseWebhookFilterDrafts, @@ -57,7 +58,12 @@ export type ScheduleDraft = { readonly timeOfDay: string; /** ISO time for a one-time run. Empty until the user picks the "Once" mode. */ readonly runAt: string; + readonly dayMode: "week" | "month"; readonly weekdays: ReadonlyArray; + readonly monthDays: ReadonlyArray; + /** Off runs in every month; the month choices are kept so switching back restores them. */ + readonly limitMonths: boolean; + readonly months: ReadonlyArray; readonly intervalMinutes: string; readonly signature: ScheduledTaskWebhookSignature | null; readonly maxDeliveryAgeMinutes: string; @@ -73,7 +79,11 @@ export const DEFAULT_SCHEDULE: ScheduleDraft = { mode: "fixed_time", timeOfDay: "09:00", runAt: "", + dayMode: "week", weekdays: [1, 2, 3, 4, 5], + monthDays: [1], + limitMonths: false, + months: MONTHS, intervalMinutes: "15", signature: null, maxDeliveryAgeMinutes: "", @@ -86,14 +96,20 @@ export const DEFAULT_SCHEDULE: ScheduleDraft = { export function scheduleDraftForTask(task: Pick): ScheduleDraft { switch (task.schedule.type) { - case "fixed_time": + case "fixed_time": { + const months = task.schedule.months?.length ? uniqueSorted(task.schedule.months) : MONTHS; return { ...DEFAULT_SCHEDULE, timeOfDay: task.schedule.timeOfDay, + dayMode: task.schedule.monthDays?.length ? "month" : "week", weekdays: task.schedule.weekdays?.length - ? [...new Set(task.schedule.weekdays)].sort((a, b) => a - b) + ? uniqueSorted(task.schedule.weekdays) : [0, 1, 2, 3, 4, 5, 6], + monthDays: task.schedule.monthDays?.length ? uniqueSorted(task.schedule.monthDays) : [1], + limitMonths: months.length < 12, + months, }; + } case "once": return { ...DEFAULT_SCHEDULE, mode: "once", runAt: task.schedule.runAt }; case "interval": @@ -182,21 +198,34 @@ export function scheduleFromDraft(draft: ScheduleDraft): ScheduledTaskUpsertSche const everyMs = Math.round(minutes * 60_000); return minutes >= 1 && Number.isSafeInteger(everyMs) ? { type: "interval", everyMs } : null; } - const weekdays = [...new Set(draft.weekdays)].sort((a, b) => a - b); + const weekdays = uniqueSorted(draft.weekdays); + const monthDays = uniqueSorted(draft.monthDays); + const months = draft.limitMonths ? uniqueSorted(draft.months) : MONTHS; + const days = draft.dayMode === "month" ? monthDays : weekdays; + const [minimum, maximum] = draft.dayMode === "month" ? [1, 31] : [0, 6]; if ( !/^([01]?\d|2[0-3]):[0-5]\d$/.test(draft.timeOfDay) || - weekdays.length === 0 || - weekdays.some((day) => !Number.isInteger(day) || day < 0 || day > 6) + days.length === 0 || + days.some((day) => !Number.isInteger(day) || day < minimum || day > maximum) || + months.length === 0 || + months.some((month) => !Number.isInteger(month) || month < 1 || month > 12) ) { return null; } return { type: "fixed_time", timeOfDay: draft.timeOfDay, - ...(weekdays.length === 7 ? {} : { weekdays }), + ...(draft.dayMode === "week" && weekdays.length < 7 ? { weekdays } : {}), + // Sent even when empty: the server keeps stored month days and months a save omits. + monthDays: draft.dayMode === "month" && monthDays.length < 31 ? monthDays : [], + months: months.length < 12 ? months : [], }; } +function uniqueSorted(values: ReadonlyArray): number[] { + return [...new Set(values)].sort((a, b) => a - b); +} + type Workspace = "worktree" | "root" | "existing_worktree"; export type ScheduledTaskDraft = { readonly task: ScheduledTask | null; @@ -230,7 +259,11 @@ function draftSignature(draft: ScheduledTaskDraft): string { draft.schedule.mode, draft.schedule.timeOfDay, draft.schedule.runAt, - [...draft.schedule.weekdays].sort((a, b) => a - b), + draft.schedule.dayMode, + uniqueSorted(draft.schedule.weekdays), + uniqueSorted(draft.schedule.monthDays), + draft.schedule.limitMonths, + uniqueSorted(draft.schedule.months), draft.schedule.intervalMinutes, draft.schedule.maxDeliveryAgeMinutes, draft.schedule.replayKey, diff --git a/apps/mobile/src/i18n/translations/de.json b/apps/mobile/src/i18n/translations/de.json index 039e1ddadd0bf..6296aed56b154 100644 --- a/apps/mobile/src/i18n/translations/de.json +++ b/apps/mobile/src/i18n/translations/de.json @@ -149,6 +149,19 @@ "556df31b330166ff": "Gib einen Namen für diese Ansicht ein.", "262cd2c6c05667db": "Verwende höchstens {max} Zeichen.", "3a85d6e4f8a78c72": "Eine Ansicht mit diesem Namen existiert bereits.", + "a549cb67dc897bbf": "Diese Umgebung nutzt eine ältere Version von T3 Code, die Aufgaben nicht an Tagen des Monats oder in ausgewählten Monaten ausführen kann. Aktualisiere sie oder wähle Wochentage.", + "0b120cf8d4dd2354": "{day}.", + "eecb213de0ae9419": "Am {days} im {months} um {time}", + "b5b0b286eb7838ec": "Am {days} jedes Monats um {time}", + "c395357f16da5daa": "Werktags um {time} im {months}", + "34d1af5dc60840d3": "Werktags um {time}", + "e49b14f1a256c64d": "Am Wochenende um {time} im {months}", + "04fd86882fa37523": "Am Wochenende um {time}", + "08192f840a3a94d6": "{days} um {time} im {months}", + "f01272d7032d8cc4": "{days} um {time}", + "8e8363a588b20ba5": "Täglich um {time} im {months}", + "5d1c6cbc698831b4": "Täglich um {time}", + "91d40d56165036c5": "In Monaten ohne einen {day} läuft die Aufgabe am letzten Tag.", "d3f84105b0d04d6a": "ist gleich", "7c67f23eece49873": "ist ungleich", "cc74241937cc5ae7": "ist einer von", @@ -3547,8 +3560,6 @@ "d1800696738e0855": "Per Webhook", "cc68653937406aaa": "Einmal, {date} um {time}", "e0226f73554fcc85": "Jeden Tag", - "e1222cad4667e338": "{days} um {time}", - "74b25bf2e8d10313": "{days} um {time} {zone}", "f724c5da673062e1": "Werktags", "93b4649762b66d2f": "Tage wählen", "1eb3b429da79beff": "{label}, {value}", @@ -3578,6 +3589,7 @@ "d6ff9c3accc17c2e": "Füge einen Namen, einen Prompt, ein Projekt, ein Modell, einen gültigen Zeitplan und bei Bedarf einen Checkout-Pfad hinzu.", "46ea6572900b7903": "Projekt nicht verfügbar", "6e4e06011b106d5e": "Wähle ein Projekt in dieser Umgebung.", + "9f415e1b15f4d137": "Diese Umgebung aktualisieren", "6e84e13468a04640": "Aufgabe konnte nicht gespeichert werden", "adeba4f2153a83d7": "Läuft auf", "09dd16bcf8dda706": "Aufgabe", @@ -3607,7 +3619,10 @@ "c4d24babc0c3056f": "Uhrzeit, {time} {zone}", "c59bf1e7072eb7d9": "Uhrzeit, {time}", "a3c37b4a4e597700": "Uhrzeit", + "5e60d9cccc7791b3": "Wochentage", + "80b55dab33fdfc51": "Tage des Monats", "f5b26c1c8f003aaf": "Wiederholung", + "f80b5747ef08eb63": "Nur in bestimmten Monaten", "a56f1480a041b1a4": "{reason} Stelle die Aufgabe auf einen Timer um oder schalte sie aus, um sie zu speichern.", "b92aceaf6b0eea30": "Datum, {date}", "12a46f713d714e93": "Datum", @@ -3656,6 +3671,7 @@ "3c5185df378edef9": "Wird nur ausgeführt, wenn alle Filter zutreffen. Andere Anfragen werden als gefiltert protokolliert. Trenne „ist eines von“-Werte mit Kommas; ein Wert darf kein Komma enthalten.", "d1a74724f70edb0b": "Diese Aufgabe existiert nicht mehr.", "c191069dded46bcc": "Diese Umgebung ist getrennt. Verbinde sie erneut, bevor du speicherst.", + "cbf2c5e72ae29460": "Nur in bestimmten Monaten", "0d15db4c81851479": "Anfragen mit demselben Schlüssel werden innerhalb von 7 Tagen nur einmal ausgeführt.", "a5bbe09b0c89d86c": "Beim Zusammenfassen wird die neueste Payload ausgeführt, wenn das Zeitfenster ab der ersten Zustellung endet. Leere Schlüssel werden normal ausgeführt.", "0e2233fb297f7c07": "Intervalle müssen mindestens 1 Minute betragen. Passe dieses Intervall vor dem Speichern an.", diff --git a/apps/mobile/src/i18n/translations/en.json b/apps/mobile/src/i18n/translations/en.json index 91170171c1621..04b6f91098fec 100644 --- a/apps/mobile/src/i18n/translations/en.json +++ b/apps/mobile/src/i18n/translations/en.json @@ -149,6 +149,19 @@ "556df31b330166ff": "Enter a name for this view.", "262cd2c6c05667db": "Use {max} characters or fewer.", "3a85d6e4f8a78c72": "A view with this name already exists.", + "a549cb67dc897bbf": "This environment runs an older T3 Code that can't run tasks on days of the month or in chosen months. Update it, or choose days of the week.", + "0b120cf8d4dd2354": "{day, selectordinal, one {{day}st} two {{day}nd} few {{day}rd} other {{day}th}}", + "eecb213de0ae9419": "At {time} on the {days} of {months}", + "b5b0b286eb7838ec": "At {time} on the {days} of every month", + "c395357f16da5daa": "At {time} on weekdays in {months}", + "34d1af5dc60840d3": "At {time} on weekdays", + "e49b14f1a256c64d": "At {time} on weekends in {months}", + "04fd86882fa37523": "At {time} on weekends", + "08192f840a3a94d6": "At {time} on {days} in {months}", + "f01272d7032d8cc4": "At {time} on {days}", + "8e8363a588b20ba5": "At {time} every day in {months}", + "5d1c6cbc698831b4": "At {time} every day", + "91d40d56165036c5": "In months without a {day}, it runs on the last day.", "d3f84105b0d04d6a": "equals", "7c67f23eece49873": "does not equal", "cc74241937cc5ae7": "is one of", @@ -3549,8 +3562,6 @@ "d1800696738e0855": "On webhook", "cc68653937406aaa": "Once, {date} at {time}", "e0226f73554fcc85": "Every day", - "e1222cad4667e338": "{days} at {time}", - "74b25bf2e8d10313": "{days} at {time} {zone}", "f724c5da673062e1": "Weekdays", "93b4649762b66d2f": "Choose days", "1eb3b429da79beff": "{label}, {value}", @@ -3580,6 +3591,7 @@ "d6ff9c3accc17c2e": "Add a name, prompt, project, model, valid schedule, and checkout path if needed.", "46ea6572900b7903": "Project unavailable", "6e4e06011b106d5e": "Choose a project in this environment.", + "9f415e1b15f4d137": "Update this environment", "6e84e13468a04640": "Could not save task", "adeba4f2153a83d7": "Runs on", "09dd16bcf8dda706": "Task", @@ -3609,7 +3621,10 @@ "c4d24babc0c3056f": "Time, {time} {zone}", "c59bf1e7072eb7d9": "Time, {time}", "a3c37b4a4e597700": "Time", + "5e60d9cccc7791b3": "Days of the week", + "80b55dab33fdfc51": "Days of the month", "f5b26c1c8f003aaf": "Repeat", + "f80b5747ef08eb63": "Only in some months", "a56f1480a041b1a4": "{reason} Switch the task to a timer, or turn it off, to save it.", "b92aceaf6b0eea30": "Date, {date}", "12a46f713d714e93": "Date", @@ -3658,6 +3673,7 @@ "3c5185df378edef9": "Runs only when every filter matches. Other requests are logged as filtered. Separate “is one of” values with commas; a value can't contain a comma.", "d1a74724f70edb0b": "This task no longer exists.", "c191069dded46bcc": "This environment is disconnected. Reconnect before saving.", + "cbf2c5e72ae29460": "Only in some months", "0d15db4c81851479": "Requests with the same key run only once within 7 days.", "a5bbe09b0c89d86c": "Coalescing runs the latest payload when the window from the first delivery closes. Empty keys run normally.", "0e2233fb297f7c07": "Intervals must be at least 1 minute. Update this interval before saving.", diff --git a/apps/mobile/src/i18n/translations/es.json b/apps/mobile/src/i18n/translations/es.json index 398c20ce17f1f..c09583d82e889 100644 --- a/apps/mobile/src/i18n/translations/es.json +++ b/apps/mobile/src/i18n/translations/es.json @@ -149,6 +149,19 @@ "556df31b330166ff": "Escribe un nombre para esta vista.", "262cd2c6c05667db": "Usa {max} caracteres como máximo.", "3a85d6e4f8a78c72": "Ya existe una vista con este nombre.", + "a549cb67dc897bbf": "Este entorno ejecuta una versión antigua de T3 Code que no puede ejecutar tareas en días del mes ni en meses concretos. Actualízalo o elige días de la semana.", + "0b120cf8d4dd2354": "{day}", + "eecb213de0ae9419": "El {days} de {months} a las {time}", + "b5b0b286eb7838ec": "El {days} de cada mes a las {time}", + "c395357f16da5daa": "Entre semana a las {time} en {months}", + "34d1af5dc60840d3": "Entre semana a las {time}", + "e49b14f1a256c64d": "Los fines de semana a las {time} en {months}", + "04fd86882fa37523": "Los fines de semana a las {time}", + "08192f840a3a94d6": "{days} a las {time} en {months}", + "f01272d7032d8cc4": "{days} a las {time}", + "8e8363a588b20ba5": "Cada día a las {time} en {months}", + "5d1c6cbc698831b4": "Cada día a las {time}", + "91d40d56165036c5": "En los meses sin día {day}, se ejecuta el último día.", "d3f84105b0d04d6a": "es igual a", "7c67f23eece49873": "no es igual a", "cc74241937cc5ae7": "es uno de", @@ -3542,8 +3555,6 @@ "d1800696738e0855": "Al recibir un webhook", "cc68653937406aaa": "Una vez, el {date} a las {time}", "e0226f73554fcc85": "Todos los días", - "e1222cad4667e338": "{days} a las {time}", - "74b25bf2e8d10313": "{days} a las {time} {zone}", "f724c5da673062e1": "Entre semana", "93b4649762b66d2f": "Elegir días", "1eb3b429da79beff": "{label}, {value}", @@ -3573,6 +3584,7 @@ "d6ff9c3accc17c2e": "Añade un nombre, un prompt, un proyecto, un modelo, una programación válida y la ruta del checkout si hace falta.", "46ea6572900b7903": "Proyecto no disponible", "6e4e06011b106d5e": "Elige un proyecto de este entorno.", + "9f415e1b15f4d137": "Actualizar este entorno", "6e84e13468a04640": "No se pudo guardar la tarea", "adeba4f2153a83d7": "Se ejecuta en", "09dd16bcf8dda706": "Tarea", @@ -3602,7 +3614,10 @@ "c4d24babc0c3056f": "Hora, {time} {zone}", "c59bf1e7072eb7d9": "Hora, {time}", "a3c37b4a4e597700": "Hora", + "5e60d9cccc7791b3": "Días de la semana", + "80b55dab33fdfc51": "Días del mes", "f5b26c1c8f003aaf": "Repetición", + "f80b5747ef08eb63": "Solo en algunos meses", "a56f1480a041b1a4": "{reason} Cambia la tarea a un temporizador, o desactívala, para guardarla.", "b92aceaf6b0eea30": "Fecha, {date}", "12a46f713d714e93": "Fecha", @@ -3651,6 +3666,7 @@ "3c5185df378edef9": "Se ejecuta solo cuando coinciden todos los filtros. Las demás solicitudes se registran como filtradas. Separa los valores de «es uno de» con comas; un valor no puede contener una coma.", "d1a74724f70edb0b": "Esta tarea ya no existe.", "c191069dded46bcc": "Este entorno está desconectado. Vuelve a conectarlo antes de guardar.", + "cbf2c5e72ae29460": "Solo en algunos meses", "0d15db4c81851479": "Las solicitudes con la misma clave solo se ejecutan una vez en 7 días.", "a5bbe09b0c89d86c": "La agrupación ejecuta la carga más reciente cuando se cierra la ventana abierta por la primera entrega. Las claves vacías se ejecutan con normalidad.", "0e2233fb297f7c07": "Los intervalos deben ser de al menos 1 minuto. Actualiza este intervalo antes de guardar.", diff --git a/apps/mobile/src/i18n/translations/fr.json b/apps/mobile/src/i18n/translations/fr.json index 1734d91934a04..cef243d1bcb1a 100644 --- a/apps/mobile/src/i18n/translations/fr.json +++ b/apps/mobile/src/i18n/translations/fr.json @@ -149,6 +149,19 @@ "556df31b330166ff": "Saisissez un nom pour cette vue.", "262cd2c6c05667db": "Utilisez {max} caractères au maximum.", "3a85d6e4f8a78c72": "Une vue portant ce nom existe déjà.", + "a549cb67dc897bbf": "Cet environnement exécute une ancienne version de T3 Code qui ne peut pas lancer de tâches certains jours du mois ou certains mois. Mettez-le à jour ou choisissez des jours de la semaine.", + "0b120cf8d4dd2354": "{day, selectordinal, one {{day}er} other {{day}}}", + "eecb213de0ae9419": "Le {days} en {months} à {time}", + "b5b0b286eb7838ec": "Le {days} de chaque mois à {time}", + "c395357f16da5daa": "En semaine à {time} en {months}", + "34d1af5dc60840d3": "En semaine à {time}", + "e49b14f1a256c64d": "Le week-end à {time} en {months}", + "04fd86882fa37523": "Le week-end à {time}", + "08192f840a3a94d6": "{days} à {time} en {months}", + "f01272d7032d8cc4": "{days} à {time}", + "8e8363a588b20ba5": "Tous les jours à {time} en {months}", + "5d1c6cbc698831b4": "Tous les jours à {time}", + "91d40d56165036c5": "Les mois sans jour {day}, la tâche s’exécute le dernier jour.", "d3f84105b0d04d6a": "est égal à", "7c67f23eece49873": "est différent de", "cc74241937cc5ae7": "fait partie de", @@ -3542,8 +3555,6 @@ "d1800696738e0855": "Sur webhook", "cc68653937406aaa": "Une fois, le {date} à {time}", "e0226f73554fcc85": "Tous les jours", - "e1222cad4667e338": "{days} à {time}", - "74b25bf2e8d10313": "{days} à {time} {zone}", "f724c5da673062e1": "En semaine", "93b4649762b66d2f": "Choisir les jours", "1eb3b429da79beff": "{label}, {value}", @@ -3573,6 +3584,7 @@ "d6ff9c3accc17c2e": "Ajoutez un nom, un prompt, un projet, un modèle, une planification valide et un chemin de checkout si nécessaire.", "46ea6572900b7903": "Projet indisponible", "6e4e06011b106d5e": "Choisissez un projet dans cet environnement.", + "9f415e1b15f4d137": "Mettre à jour cet environnement", "6e84e13468a04640": "Impossible d’enregistrer la tâche", "adeba4f2153a83d7": "S’exécute sur", "09dd16bcf8dda706": "Tâche", @@ -3602,7 +3614,10 @@ "c4d24babc0c3056f": "Heure, {time} {zone}", "c59bf1e7072eb7d9": "Heure, {time}", "a3c37b4a4e597700": "Heure", + "5e60d9cccc7791b3": "Jours de la semaine", + "80b55dab33fdfc51": "Jours du mois", "f5b26c1c8f003aaf": "Répétition", + "f80b5747ef08eb63": "Seulement certains mois", "a56f1480a041b1a4": "{reason} Passez la tâche sur un minuteur, ou désactivez-la, pour l’enregistrer.", "b92aceaf6b0eea30": "Date, {date}", "12a46f713d714e93": "Date", @@ -3651,6 +3666,7 @@ "3c5185df378edef9": "S’exécute uniquement si tous les filtres correspondent. Les autres requêtes sont journalisées comme filtrées. Séparez les valeurs « fait partie de » par des virgules ; une valeur ne peut pas contenir de virgule.", "d1a74724f70edb0b": "Cette tâche n’existe plus.", "c191069dded46bcc": "Cet environnement est déconnecté. Reconnectez-le avant d’enregistrer.", + "cbf2c5e72ae29460": "Seulement certains mois", "0d15db4c81851479": "Les requêtes avec la même clé ne s’exécutent qu’une fois en 7 jours.", "a5bbe09b0c89d86c": "Le regroupement exécute la dernière charge utile quand la fenêtre ouverte par la première livraison se ferme. Les clés vides s’exécutent normalement.", "0e2233fb297f7c07": "Les intervalles doivent être d’au moins 1 minute. Modifiez cet intervalle avant d’enregistrer.", diff --git a/apps/mobile/src/i18n/translations/ja.json b/apps/mobile/src/i18n/translations/ja.json index 113ada551f17d..bbec6361ee3a8 100644 --- a/apps/mobile/src/i18n/translations/ja.json +++ b/apps/mobile/src/i18n/translations/ja.json @@ -149,6 +149,19 @@ "556df31b330166ff": "このビューの名前を入力してください。", "262cd2c6c05667db": "{max} 文字以内で入力してください。", "3a85d6e4f8a78c72": "この名前のビューはすでに存在します。", + "a549cb67dc897bbf": "この環境では古い T3 Code が動作しており、月の日付や特定の月を指定したタスクを実行できません。環境を更新するか、曜日を選択してください。", + "0b120cf8d4dd2354": "{day}日", + "eecb213de0ae9419": "{months}の{days} {time}", + "b5b0b286eb7838ec": "毎月{days} {time}", + "c395357f16da5daa": "{months}の平日 {time}", + "34d1af5dc60840d3": "平日 {time}", + "e49b14f1a256c64d": "{months}の週末 {time}", + "04fd86882fa37523": "週末 {time}", + "08192f840a3a94d6": "{months}の{days} {time}", + "f01272d7032d8cc4": "{days} の {time}", + "8e8363a588b20ba5": "{months}の毎日 {time}", + "5d1c6cbc698831b4": "毎日 {time}", + "91d40d56165036c5": "{day}がない月は、最終日に実行します。", "d3f84105b0d04d6a": "等しい", "7c67f23eece49873": "等しくない", "cc74241937cc5ae7": "いずれかに一致", @@ -3538,8 +3551,6 @@ "d1800696738e0855": "Webhook 受信時", "cc68653937406aaa": "1 回、{date} {time}", "e0226f73554fcc85": "毎日", - "e1222cad4667e338": "{days} の {time}", - "74b25bf2e8d10313": "{days} の {time} {zone}", "f724c5da673062e1": "平日", "93b4649762b66d2f": "曜日を選択", "1eb3b429da79beff": "{label}、{value}", @@ -3569,6 +3580,7 @@ "d6ff9c3accc17c2e": "名前、プロンプト、プロジェクト、モデル、有効なスケジュール、必要に応じてチェックアウトのパスを追加してください。", "46ea6572900b7903": "プロジェクトを利用できません", "6e4e06011b106d5e": "この環境のプロジェクトを選んでください。", + "9f415e1b15f4d137": "この環境を更新", "6e84e13468a04640": "タスクを保存できませんでした", "adeba4f2153a83d7": "実行場所", "09dd16bcf8dda706": "タスク", @@ -3598,7 +3610,10 @@ "c4d24babc0c3056f": "時刻、{time} {zone}", "c59bf1e7072eb7d9": "時刻、{time}", "a3c37b4a4e597700": "時刻", + "5e60d9cccc7791b3": "曜日", + "80b55dab33fdfc51": "日付", "f5b26c1c8f003aaf": "繰り返し", + "f80b5747ef08eb63": "特定の月のみ", "a56f1480a041b1a4": "{reason} 保存するには、タスクをタイマーに切り替えるか、オフにしてください。", "b92aceaf6b0eea30": "日付、{date}", "12a46f713d714e93": "日付", @@ -3647,6 +3662,7 @@ "3c5185df378edef9": "すべてのフィルターに一致した場合のみ実行します。それ以外のリクエストはフィルター済みとして記録されます。「いずれかに一致」の値はカンマで区切ってください。値にカンマを含めることはできません。", "d1a74724f70edb0b": "このタスクは存在しません。", "c191069dded46bcc": "この環境は切断されています。保存する前に再接続してください。", + "cbf2c5e72ae29460": "特定の月のみ", "0d15db4c81851479": "同じキーのリクエストは 7 日以内に 1 回だけ実行されます。", "a5bbe09b0c89d86c": "集約すると、最初の配信からの期間が終了したときに最新のペイロードで実行します。キーが空の場合は通常どおり実行します。", "0e2233fb297f7c07": "間隔は 1 分以上にする必要があります。保存する前にこの間隔を更新してください。", diff --git a/apps/mobile/src/i18n/translations/ko.json b/apps/mobile/src/i18n/translations/ko.json index 7768bd410d434..bbce8676f3b38 100644 --- a/apps/mobile/src/i18n/translations/ko.json +++ b/apps/mobile/src/i18n/translations/ko.json @@ -149,6 +149,19 @@ "556df31b330166ff": "이 보기의 이름을 입력하세요.", "262cd2c6c05667db": "{max}자 이하로 입력하세요.", "3a85d6e4f8a78c72": "같은 이름의 보기가 이미 있습니다.", + "a549cb67dc897bbf": "이 환경은 이전 버전의 T3 Code를 실행 중이어서 특정 날짜나 특정 월에 작업을 실행할 수 없습니다. 환경을 업데이트하거나 요일을 선택하세요.", + "0b120cf8d4dd2354": "{day}일", + "eecb213de0ae9419": "{months} {days} {time}", + "b5b0b286eb7838ec": "매월 {days} {time}", + "c395357f16da5daa": "{months} 평일 {time}", + "34d1af5dc60840d3": "평일 {time}", + "e49b14f1a256c64d": "{months} 주말 {time}", + "04fd86882fa37523": "주말 {time}", + "08192f840a3a94d6": "{months} {days} {time}", + "f01272d7032d8cc4": "{days} {time}", + "8e8363a588b20ba5": "{months} 매일 {time}", + "5d1c6cbc698831b4": "매일 {time}", + "91d40d56165036c5": "{day}이 없는 달에는 마지막 날에 실행됩니다.", "d3f84105b0d04d6a": "같음", "7c67f23eece49873": "같지 않음", "cc74241937cc5ae7": "다음 중 하나", @@ -3542,8 +3555,6 @@ "d1800696738e0855": "웹후크 수신 시", "cc68653937406aaa": "한 번, {date} {time}", "e0226f73554fcc85": "매일", - "e1222cad4667e338": "{days} {time}", - "74b25bf2e8d10313": "{days} {time} {zone}", "f724c5da673062e1": "평일", "93b4649762b66d2f": "요일 선택", "1eb3b429da79beff": "{label}, {value}", @@ -3573,6 +3584,7 @@ "d6ff9c3accc17c2e": "이름, 프롬프트, 프로젝트, 모델, 올바른 일정, 필요한 경우 체크아웃 경로를 추가하세요.", "46ea6572900b7903": "프로젝트를 사용할 수 없음", "6e4e06011b106d5e": "이 환경에서 프로젝트를 선택하세요.", + "9f415e1b15f4d137": "이 환경 업데이트", "6e84e13468a04640": "작업을 저장할 수 없습니다", "adeba4f2153a83d7": "실행 위치", "09dd16bcf8dda706": "작업", @@ -3602,7 +3614,10 @@ "c4d24babc0c3056f": "시간, {time} {zone}", "c59bf1e7072eb7d9": "시간, {time}", "a3c37b4a4e597700": "시간", + "5e60d9cccc7791b3": "요일", + "80b55dab33fdfc51": "날짜", "f5b26c1c8f003aaf": "반복", + "f80b5747ef08eb63": "특정 월에만", "a56f1480a041b1a4": "{reason} 저장하려면 작업을 타이머로 바꾸거나 끄세요.", "b92aceaf6b0eea30": "날짜, {date}", "12a46f713d714e93": "날짜", @@ -3651,6 +3666,7 @@ "3c5185df378edef9": "모든 필터가 일치할 때만 실행합니다. 다른 요청은 필터링됨으로 기록됩니다. “다음 중 하나” 값은 쉼표로 구분하며, 값에는 쉼표를 넣을 수 없습니다.", "d1a74724f70edb0b": "이 작업은 더 이상 존재하지 않습니다.", "c191069dded46bcc": "이 환경의 연결이 끊어졌습니다. 저장하기 전에 다시 연결하세요.", + "cbf2c5e72ae29460": "특정 월에만", "0d15db4c81851479": "키가 같은 요청은 7일 이내에 한 번만 실행됩니다.", "a5bbe09b0c89d86c": "병합하면 첫 전송부터 시작된 기간이 끝날 때 최신 페이로드로 실행합니다. 키가 비어 있으면 정상적으로 실행됩니다.", "0e2233fb297f7c07": "간격은 1분 이상이어야 합니다. 저장하기 전에 간격을 업데이트하세요.", diff --git a/apps/mobile/src/i18n/translations/pt-BR.json b/apps/mobile/src/i18n/translations/pt-BR.json index 88dbb8da5cd87..f71a282d3ffc6 100644 --- a/apps/mobile/src/i18n/translations/pt-BR.json +++ b/apps/mobile/src/i18n/translations/pt-BR.json @@ -149,6 +149,19 @@ "556df31b330166ff": "Digite um nome para esta visualização.", "262cd2c6c05667db": "Use no máximo {max} caracteres.", "3a85d6e4f8a78c72": "Já existe uma visualização com este nome.", + "a549cb67dc897bbf": "Este ambiente executa uma versão antiga do T3 Code que não consegue executar tarefas em dias do mês ou em meses específicos. Atualize-o ou escolha dias da semana.", + "0b120cf8d4dd2354": "{day}", + "eecb213de0ae9419": "No dia {days} de {months} às {time}", + "b5b0b286eb7838ec": "No dia {days} de cada mês às {time}", + "c395357f16da5daa": "Dias úteis às {time} em {months}", + "34d1af5dc60840d3": "Dias úteis às {time}", + "e49b14f1a256c64d": "Fins de semana às {time} em {months}", + "04fd86882fa37523": "Fins de semana às {time}", + "08192f840a3a94d6": "{days} às {time} em {months}", + "f01272d7032d8cc4": "{days} às {time}", + "8e8363a588b20ba5": "Diariamente às {time} em {months}", + "5d1c6cbc698831b4": "Diariamente às {time}", + "91d40d56165036c5": "Nos meses sem dia {day}, a tarefa é executada no último dia.", "d3f84105b0d04d6a": "é igual a", "7c67f23eece49873": "é diferente de", "cc74241937cc5ae7": "é um de", @@ -3542,8 +3555,6 @@ "d1800696738e0855": "Por webhook", "cc68653937406aaa": "Uma vez, {date} às {time}", "e0226f73554fcc85": "Todos os dias", - "e1222cad4667e338": "{days} às {time}", - "74b25bf2e8d10313": "{days} às {time} {zone}", "f724c5da673062e1": "Dias úteis", "93b4649762b66d2f": "Escolher dias", "1eb3b429da79beff": "{label}, {value}", @@ -3573,6 +3584,7 @@ "d6ff9c3accc17c2e": "Adicione um nome, um prompt, um projeto, um modelo, um agendamento válido e o caminho do checkout, se necessário.", "46ea6572900b7903": "Projeto indisponível", "6e4e06011b106d5e": "Escolha um projeto neste ambiente.", + "9f415e1b15f4d137": "Atualizar este ambiente", "6e84e13468a04640": "Não foi possível salvar a tarefa", "adeba4f2153a83d7": "Executa em", "09dd16bcf8dda706": "Tarefa", @@ -3602,7 +3614,10 @@ "c4d24babc0c3056f": "Horário, {time} {zone}", "c59bf1e7072eb7d9": "Horário, {time}", "a3c37b4a4e597700": "Hora", + "5e60d9cccc7791b3": "Dias da semana", + "80b55dab33fdfc51": "Dias do mês", "f5b26c1c8f003aaf": "Repetição", + "f80b5747ef08eb63": "Somente em alguns meses", "a56f1480a041b1a4": "{reason} Mude a tarefa para um timer ou desative-a para salvá-la.", "b92aceaf6b0eea30": "Data, {date}", "12a46f713d714e93": "Data", @@ -3651,6 +3666,7 @@ "3c5185df378edef9": "Executa só quando todos os filtros correspondem. As outras requisições são registradas como filtradas. Separe os valores de “é um de” com vírgulas; um valor não pode conter vírgula.", "d1a74724f70edb0b": "Esta tarefa não existe mais.", "c191069dded46bcc": "Este ambiente está desconectado. Reconecte antes de salvar.", + "cbf2c5e72ae29460": "Somente em alguns meses", "0d15db4c81851479": "Requisições com a mesma chave executam só uma vez em 7 dias.", "a5bbe09b0c89d86c": "O agrupamento executa o payload mais recente quando a janela iniciada pela primeira entrega fecha. Chaves vazias executam normalmente.", "0e2233fb297f7c07": "Os intervalos devem ser de pelo menos 1 minuto. Atualize este intervalo antes de salvar.", diff --git a/apps/mobile/src/i18n/translations/ru.json b/apps/mobile/src/i18n/translations/ru.json index 2d0fb55302031..6b92c1da06cc0 100644 --- a/apps/mobile/src/i18n/translations/ru.json +++ b/apps/mobile/src/i18n/translations/ru.json @@ -149,6 +149,19 @@ "556df31b330166ff": "Введите название представления.", "262cd2c6c05667db": "Не более {max} символов.", "3a85d6e4f8a78c72": "Представление с таким названием уже существует.", + "a549cb67dc897bbf": "В этом окружении работает старая версия T3 Code, которая не умеет запускать задачи по числам месяца или в выбранные месяцы. Обновите её или выберите дни недели.", + "0b120cf8d4dd2354": "{day}-го", + "eecb213de0ae9419": "{days} числа в {time} ({months})", + "b5b0b286eb7838ec": "{days} числа каждого месяца в {time}", + "c395357f16da5daa": "По будням в {time} ({months})", + "34d1af5dc60840d3": "По будням в {time}", + "e49b14f1a256c64d": "По выходным в {time} ({months})", + "04fd86882fa37523": "По выходным в {time}", + "08192f840a3a94d6": "{days} в {time} ({months})", + "f01272d7032d8cc4": "{days} в {time}", + "8e8363a588b20ba5": "Ежедневно в {time} ({months})", + "5d1c6cbc698831b4": "Ежедневно в {time}", + "91d40d56165036c5": "В месяцах без {day} числа задача запускается в последний день.", "d3f84105b0d04d6a": "равно", "7c67f23eece49873": "не равно", "cc74241937cc5ae7": "одно из", @@ -3596,8 +3609,6 @@ "d1800696738e0855": "По вебхуку", "cc68653937406aaa": "Один раз, {date} в {time}", "e0226f73554fcc85": "Каждый день", - "e1222cad4667e338": "{days} в {time}", - "74b25bf2e8d10313": "{days} в {time} {zone}", "f724c5da673062e1": "По будням", "93b4649762b66d2f": "Выбрать дни", "1eb3b429da79beff": "{label}, {value}", @@ -3627,6 +3638,7 @@ "d6ff9c3accc17c2e": "Добавьте название, промпт, проект, модель, корректное расписание и, если нужно, путь к копии.", "46ea6572900b7903": "Проект недоступен", "6e4e06011b106d5e": "Выберите проект в этом окружении.", + "9f415e1b15f4d137": "Обновить это окружение", "6e84e13468a04640": "Не удалось сохранить задачу", "adeba4f2153a83d7": "Выполняется в", "09dd16bcf8dda706": "Задача", @@ -3656,7 +3668,10 @@ "c4d24babc0c3056f": "Время, {time} {zone}", "c59bf1e7072eb7d9": "Время, {time}", "a3c37b4a4e597700": "Время", + "5e60d9cccc7791b3": "Дни недели", + "80b55dab33fdfc51": "Числа месяца", "f5b26c1c8f003aaf": "Повтор", + "f80b5747ef08eb63": "Только в некоторые месяцы", "a56f1480a041b1a4": "{reason} Чтобы сохранить задачу, переключите её на таймер или выключите.", "b92aceaf6b0eea30": "Дата, {date}", "12a46f713d714e93": "Дата", @@ -3705,6 +3720,7 @@ "3c5185df378edef9": "Выполняется, только если совпадают все фильтры. Остальные запросы записываются как отфильтрованные. Значения для «одно из» разделяйте запятыми; значение не может содержать запятую.", "d1a74724f70edb0b": "Эта задача больше не существует.", "c191069dded46bcc": "Это окружение отключено. Переподключитесь перед сохранением.", + "cbf2c5e72ae29460": "Только в некоторые месяцы", "0d15db4c81851479": "Запросы с одинаковым ключом выполняются только один раз в течение 7 дней.", "a5bbe09b0c89d86c": "При объединении последний payload выполняется, когда закрывается окно, отсчитанное от первой доставки. Пустые ключи выполняются как обычно.", "0e2233fb297f7c07": "Интервал должен быть не меньше 1 минуты. Измените интервал перед сохранением.", diff --git a/apps/mobile/src/i18n/translations/sv.json b/apps/mobile/src/i18n/translations/sv.json index 70617afd183ca..9be6bce38dee9 100644 --- a/apps/mobile/src/i18n/translations/sv.json +++ b/apps/mobile/src/i18n/translations/sv.json @@ -149,6 +149,19 @@ "556df31b330166ff": "Ange ett namn för den här vyn.", "262cd2c6c05667db": "Använd högst {max} tecken.", "3a85d6e4f8a78c72": "Det finns redan en vy med det här namnet.", + "a549cb67dc897bbf": "Den här miljön kör en äldre version av T3 Code som inte kan köra uppgifter på dagar i månaden eller i valda månader. Uppdatera den eller välj veckodagar.", + "0b120cf8d4dd2354": "{day, selectordinal, one {{day}:a} other {{day}:e}}", + "eecb213de0ae9419": "Den {days} i {months} kl. {time}", + "b5b0b286eb7838ec": "Den {days} varje månad kl. {time}", + "c395357f16da5daa": "Vardagar kl. {time} i {months}", + "34d1af5dc60840d3": "Vardagar kl. {time}", + "e49b14f1a256c64d": "Helger kl. {time} i {months}", + "04fd86882fa37523": "Helger kl. {time}", + "08192f840a3a94d6": "{days} kl. {time} i {months}", + "f01272d7032d8cc4": "{days} kl. {time}", + "8e8363a588b20ba5": "Dagligen kl. {time} i {months}", + "5d1c6cbc698831b4": "Dagligen kl. {time}", + "91d40d56165036c5": "I månader utan en {day} dag körs uppgiften den sista dagen.", "d3f84105b0d04d6a": "är lika med", "7c67f23eece49873": "är inte lika med", "cc74241937cc5ae7": "är en av", @@ -3548,8 +3561,6 @@ "d1800696738e0855": "Vid webhook", "cc68653937406aaa": "En gång, {date} kl. {time}", "e0226f73554fcc85": "Varje dag", - "e1222cad4667e338": "{days} kl. {time}", - "74b25bf2e8d10313": "{days} kl. {time} {zone}", "f724c5da673062e1": "Vardagar", "93b4649762b66d2f": "Välj dagar", "1eb3b429da79beff": "{label}, {value}", @@ -3579,6 +3590,7 @@ "d6ff9c3accc17c2e": "Lägg till ett namn, en prompt, ett projekt, en modell, ett giltigt schema och vid behov en sökväg till utcheckningen.", "46ea6572900b7903": "Projektet är inte tillgängligt", "6e4e06011b106d5e": "Välj ett projekt i den här miljön.", + "9f415e1b15f4d137": "Uppdatera den här miljön", "6e84e13468a04640": "Kunde inte spara uppgiften", "adeba4f2153a83d7": "Körs på", "09dd16bcf8dda706": "Uppgift", @@ -3608,7 +3620,10 @@ "c4d24babc0c3056f": "Tid, {time} {zone}", "c59bf1e7072eb7d9": "Tid, {time}", "a3c37b4a4e597700": "Tid", + "5e60d9cccc7791b3": "Veckodagar", + "80b55dab33fdfc51": "Dagar i månaden", "f5b26c1c8f003aaf": "Upprepa", + "f80b5747ef08eb63": "Bara vissa månader", "a56f1480a041b1a4": "{reason} Byt uppgiften till en timer, eller stäng av den, för att spara den.", "b92aceaf6b0eea30": "Datum, {date}", "12a46f713d714e93": "Datum", @@ -3657,6 +3672,7 @@ "3c5185df378edef9": "Körs bara när alla filter matchar. Andra begäranden loggas som filtrerade. Separera värden för ”är en av” med kommatecken; ett värde får inte innehålla kommatecken.", "d1a74724f70edb0b": "Uppgiften finns inte längre.", "c191069dded46bcc": "Miljön är frånkopplad. Återanslut innan du sparar.", + "cbf2c5e72ae29460": "Bara vissa månader", "0d15db4c81851479": "Begäranden med samma nyckel körs bara en gång inom 7 dagar.", "a5bbe09b0c89d86c": "Sammanslagning kör den senaste nyttolasten när fönstret från den första leveransen stängs. Tomma nycklar körs som vanligt.", "0e2233fb297f7c07": "Intervall måste vara minst 1 minut. Uppdatera intervallet innan du sparar.", diff --git a/apps/mobile/src/i18n/translations/zh.json b/apps/mobile/src/i18n/translations/zh.json index 485d4206bf054..71f0771338af3 100644 --- a/apps/mobile/src/i18n/translations/zh.json +++ b/apps/mobile/src/i18n/translations/zh.json @@ -149,6 +149,19 @@ "556df31b330166ff": "请输入此视图的名称。", "262cd2c6c05667db": "最多使用 {max} 个字符。", "3a85d6e4f8a78c72": "已存在同名视图。", + "a549cb67dc897bbf": "此环境运行的是旧版 T3 Code,无法在每月指定日期或指定月份运行任务。请更新它,或改为选择星期几。", + "0b120cf8d4dd2354": "{day}日", + "eecb213de0ae9419": "{months}的{days} {time}", + "b5b0b286eb7838ec": "每月{days} {time}", + "c395357f16da5daa": "{months}的工作日 {time}", + "34d1af5dc60840d3": "工作日 {time}", + "e49b14f1a256c64d": "{months}的周末 {time}", + "04fd86882fa37523": "周末 {time}", + "08192f840a3a94d6": "{months}的{days} {time}", + "f01272d7032d8cc4": "{days} 的 {time}", + "8e8363a588b20ba5": "{months}的每天 {time}", + "5d1c6cbc698831b4": "每天 {time}", + "91d40d56165036c5": "没有{day}的月份会在最后一天运行。", "d3f84105b0d04d6a": "等于", "7c67f23eece49873": "不等于", "cc74241937cc5ae7": "属于以下值之一", @@ -3544,8 +3557,6 @@ "d1800696738e0855": "收到 webhook 时", "cc68653937406aaa": "一次,{date} {time}", "e0226f73554fcc85": "每天", - "e1222cad4667e338": "{days} 的 {time}", - "74b25bf2e8d10313": "{days} 的 {time} {zone}", "f724c5da673062e1": "周一至周五", "93b4649762b66d2f": "选择日期", "1eb3b429da79beff": "{label},{value}", @@ -3575,6 +3586,7 @@ "d6ff9c3accc17c2e": "请添加名称、提示词、项目、模型、有效的定时规则,并在需要时添加工作副本路径。", "46ea6572900b7903": "项目不可用", "6e4e06011b106d5e": "请在此环境中选择一个项目。", + "9f415e1b15f4d137": "更新此环境", "6e84e13468a04640": "无法保存任务", "adeba4f2153a83d7": "运行环境", "09dd16bcf8dda706": "任务", @@ -3604,7 +3616,10 @@ "c4d24babc0c3056f": "时间,{time} {zone}", "c59bf1e7072eb7d9": "时间,{time}", "a3c37b4a4e597700": "时间", + "5e60d9cccc7791b3": "星期", + "80b55dab33fdfc51": "日期", "f5b26c1c8f003aaf": "重复", + "f80b5747ef08eb63": "仅限部分月份", "a56f1480a041b1a4": "{reason} 将任务改为定时运行,或将其关闭,才能保存。", "b92aceaf6b0eea30": "日期,{date}", "12a46f713d714e93": "日期", @@ -3653,6 +3668,7 @@ "3c5185df378edef9": "仅在所有筛选条件都匹配时运行。其他请求会记录为已筛除。“属于其中之一”的多个值用逗号分隔;单个值不能包含逗号。", "d1a74724f70edb0b": "此任务已不存在。", "c191069dded46bcc": "此环境已断开连接。保存前请重新连接。", + "cbf2c5e72ae29460": "仅限部分月份", "0d15db4c81851479": "键相同的请求在 7 天内只运行一次。", "a5bbe09b0c89d86c": "合并会在自首次投递起的窗口结束时,用最新的负载运行。空键正常运行。", "0e2233fb297f7c07": "间隔必须至少为 1 分钟。保存前请更新此间隔。", diff --git a/apps/server/src/environment/ServerEnvironment.ts b/apps/server/src/environment/ServerEnvironment.ts index b29f9c874f123..85d02a429096c 100644 --- a/apps/server/src/environment/ServerEnvironment.ts +++ b/apps/server/src/environment/ServerEnvironment.ts @@ -281,6 +281,7 @@ export const make = Effect.gen(function* () { ignoredFileSearch: true, triage: true, oneTimeSchedules: true, + scheduledTaskMonthDays: true, freshContext: true, scheduledTaskThreadModes: true, npmReleaseLookup: true, diff --git a/apps/server/src/provider/agentContextBudget.json b/apps/server/src/provider/agentContextBudget.json index 222f23b6b02d9..f2f0d75dee9ab 100644 --- a/apps/server/src/provider/agentContextBudget.json +++ b/apps/server/src/provider/agentContextBudget.json @@ -1,5 +1,5 @@ { "claudeSystemAppendBytes": 6245, "codexAdditionalContextBytes": 7639, - "mcpToolListJsonBytes": 59170 + "mcpToolListJsonBytes": 59472 } diff --git a/apps/server/src/scheduledTasks/Schedule.test.ts b/apps/server/src/scheduledTasks/Schedule.test.ts index 0941c7392ff94..75755f4a22d4b 100644 --- a/apps/server/src/scheduledTasks/Schedule.test.ts +++ b/apps/server/src/scheduledTasks/Schedule.test.ts @@ -1,8 +1,40 @@ import { describe, expect, it } from "@effect/vitest"; +import type { ScheduledTaskSchedule } from "@t3tools/contracts"; import * as DateTime from "effect/DateTime"; import { isSameSchedule, nextScheduledRunAt } from "./Schedule.ts"; +const SOFIA = "Europe/Sofia"; + +function sofia(year: number, month: number, day: number, hour = 9, minute = 0) { + return DateTime.makeZonedUnsafe( + { year, month, day, hour, minute, second: 0, millisecond: 0 }, + { timeZone: SOFIA, adjustForTimeZone: true }, + ); +} + +function localLabel(value: DateTime.DateTime): string { + const parts = DateTime.toParts(value); + const pad = (part: number) => String(part).padStart(2, "0"); + return `${parts.year}-${pad(parts.month)}-${pad(parts.day)} ${pad(parts.hour)}:${pad(parts.minute)}`; +} + +function upcomingRuns( + schedule: ScheduledTaskSchedule, + from: DateTime.DateTime, + count: number, +): ReadonlyArray { + const runs: string[] = []; + let cursor = from; + while (runs.length < count) { + const next = nextScheduledRunAt(schedule, cursor); + if (next === null) break; + runs.push(localLabel(next)); + cursor = next; + } + return runs; +} + describe("scheduled task schedule calculation", () => { it("skips to the next matching fixed-time weekday", () => { const next = nextScheduledRunAt( @@ -26,6 +58,80 @@ describe("scheduled task schedule calculation", () => { expect(parts?.minute).toBe(0); }); + it("runs on the chosen days of every month", () => { + expect( + upcomingRuns( + { type: "fixed_time", timeOfDay: "09:00", monthDays: [6, 4] }, + sofia(2026, 10, 19, 10), + 4, + ), + ).toEqual(["2026-11-04 09:00", "2026-11-06 09:00", "2026-12-04 09:00", "2026-12-06 09:00"]); + }); + + it("runs a day a month doesn't have on that month's last day", () => { + expect( + upcomingRuns( + { type: "fixed_time", timeOfDay: "09:00", monthDays: [31] }, + sofia(2026, 1, 31, 10), + 5, + ), + ).toEqual([ + "2026-02-28 09:00", + "2026-03-31 09:00", + "2026-04-30 09:00", + "2026-05-31 09:00", + "2026-06-30 09:00", + ]); + // The 30th and the 31st share April's last day, so April runs once. + expect( + upcomingRuns( + { type: "fixed_time", timeOfDay: "09:00", monthDays: [30, 31] }, + sofia(2026, 4, 1), + 3, + ), + ).toEqual(["2026-04-30 09:00", "2026-05-30 09:00", "2026-05-31 09:00"]); + }); + + it("runs on 29 February in leap years and on the 28th otherwise", () => { + expect( + upcomingRuns( + { type: "fixed_time", timeOfDay: "09:00", monthDays: [29], months: [2] }, + sofia(2026, 1, 1), + 3, + ), + ).toEqual(["2026-02-28 09:00", "2027-02-28 09:00", "2028-02-29 09:00"]); + }); + + it("limits runs to the chosen months across a year boundary", () => { + expect( + upcomingRuns( + { type: "fixed_time", timeOfDay: "09:00", monthDays: [5], months: [1, 4, 7, 10] }, + sofia(2026, 10, 19, 10), + 4, + ), + ).toEqual(["2027-01-05 09:00", "2027-04-05 09:00", "2027-07-05 09:00", "2027-10-05 09:00"]); + expect( + upcomingRuns( + { type: "fixed_time", timeOfDay: "09:00", weekdays: [1], months: [1] }, + sofia(2026, 2, 1), + 2, + ), + ).toEqual(["2027-01-04 09:00", "2027-01-11 09:00"]); + }); + + it("keeps a monthly run on local wall-clock time across a daylight-saving change", () => { + const schedule = { type: "fixed_time", timeOfDay: "09:00", monthDays: [4] } as const; + const october = nextScheduledRunAt(schedule, sofia(2026, 10, 1)); + const november = october === null ? null : nextScheduledRunAt(schedule, october); + // Sofia leaves summer time (UTC+3) for UTC+2 on 25 October. + expect(october ? DateTime.formatIso(DateTime.toUtc(october)) : null).toBe( + "2026-10-04T06:00:00.000Z", + ); + expect(november ? DateTime.formatIso(DateTime.toUtc(november)) : null).toBe( + "2026-11-04T07:00:00.000Z", + ); + }); + it("compares schedules structurally", () => { expect( isSameSchedule( @@ -82,4 +188,36 @@ describe("scheduled task schedule calculation", () => { ), ).toBe(false); }); + + it("compares month-day and month selections structurally", () => { + expect( + isSameSchedule( + { type: "fixed_time", timeOfDay: "09:00", monthDays: [6, 4, 4], months: [10, 1] }, + { type: "fixed_time", timeOfDay: "09:00", monthDays: [4, 6], months: [1, 10] }, + ), + ).toBe(true); + expect( + isSameSchedule( + { + type: "fixed_time", + timeOfDay: "09:00", + monthDays: Array.from({ length: 31 }, (_, index) => index + 1), + months: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], + }, + { type: "fixed_time", timeOfDay: "09:00" }, + ), + ).toBe(true); + expect( + isSameSchedule( + { type: "fixed_time", timeOfDay: "09:00", monthDays: [4] }, + { type: "fixed_time", timeOfDay: "09:00", monthDays: [5] }, + ), + ).toBe(false); + expect( + isSameSchedule( + { type: "fixed_time", timeOfDay: "09:00", monthDays: [5] }, + { type: "fixed_time", timeOfDay: "09:00", monthDays: [5], months: [1, 4, 7, 10] }, + ), + ).toBe(false); + }); }); diff --git a/apps/server/src/scheduledTasks/Schedule.ts b/apps/server/src/scheduledTasks/Schedule.ts index f8fb648aaaaa9..14a02054fe93e 100644 --- a/apps/server/src/scheduledTasks/Schedule.ts +++ b/apps/server/src/scheduledTasks/Schedule.ts @@ -29,9 +29,10 @@ export function nextScheduledRunAt( const time = parseTimeOfDay(schedule.timeOfDay); if (time === null) return null; - const weekdays = - schedule.weekdays && schedule.weekdays.length > 0 ? new Set(schedule.weekdays) : null; - for (let offset = 0; offset <= 7; offset += 1) { + const weekdays = selection(schedule.weekdays); + const monthDays = selection(schedule.monthDays); + const months = selection(schedule.months); + for (let offset = 0; offset <= MAX_LOOKAHEAD_DAYS; offset += 1) { const candidate = DateTime.setParts(DateTime.add(from, { days: offset }), { hour: time.hour, minute: time.minute, @@ -39,15 +40,56 @@ export function nextScheduledRunAt( millisecond: 0, }); if (DateTime.toEpochMillis(candidate) <= DateTime.toEpochMillis(from)) continue; - if (weekdays !== null && !weekdays.has(DateTime.toParts(candidate).weekDay)) continue; + const parts = DateTime.toParts(candidate); + if (months !== null && !months.has(parts.month)) continue; + if (weekdays !== null && !weekdays.has(parts.weekDay)) continue; + if (monthDays !== null && !matchesMonthDay(monthDays, candidate)) continue; return candidate; } return null; } -function weekdayKey(weekdays: ReadonlyArray | undefined): string { - const unique = [...new Set(weekdays ?? [])].toSorted((x, y) => x - y); - if (unique.length === 0 || unique.length === 7) return "daily"; +// One month filter can put the next run a year away, and a weekday filter can +// push it up to six days further. +const MAX_LOOKAHEAD_DAYS = 366 + 6; + +function selection(values: ReadonlyArray | undefined): ReadonlySet | null { + return values && values.length > 0 ? new Set(values) : null; +} + +function matchesMonthDay(monthDays: ReadonlySet, candidate: DateTime.DateTime): boolean { + const { day } = DateTime.toParts(candidate); + if (monthDays.has(day)) return true; + // A day the month doesn't have runs on its last day, so 31 means "month end". + const lastDay = DateTime.toParts(DateTime.endOf(candidate, "month")).day; + return day === lastDay && [...monthDays].some((monthDay) => monthDay > lastDay); +} + +type FixedTimeSchedule = Extract; + +/** + * Omitted month days and months keep the stored ones, so a client that predates them can re-save + * a task without clearing them. An empty list clears, and chosen weekdays replace month days. + */ +export function withStoredCalendar( + schedule: FixedTimeSchedule, + stored: ScheduledTaskSchedule | undefined, +): FixedTimeSchedule { + const { monthDays: inputMonthDays, months: inputMonths, ...rest } = schedule; + const previous = stored?.type === "fixed_time" ? stored : undefined; + const monthDays = inputMonthDays ?? (schedule.weekdays?.length ? undefined : previous?.monthDays); + const months = inputMonths ?? previous?.months; + return { + ...rest, + ...(monthDays?.length ? { monthDays } : {}), + ...(months?.length ? { months } : {}), + }; +} + +/** Normalizes a selection where none and all mean the same thing: no filter. */ +function selectionKey(values: ReadonlyArray | undefined, all: number): string { + const unique = [...new Set(values ?? [])].toSorted((x, y) => x - y); + if (unique.length === 0 || unique.length === all) return "all"; return unique.join(","); } @@ -66,7 +108,9 @@ export function isSameSchedule(a: ScheduledTaskSchedule, b: ScheduledTaskSchedul bTime !== null && aTime.hour === bTime.hour && aTime.minute === bTime.minute && - weekdayKey(a.weekdays) === weekdayKey(b.weekdays) + selectionKey(a.weekdays, 7) === selectionKey(b.weekdays, 7) && + selectionKey(a.monthDays, 31) === selectionKey(b.monthDays, 31) && + selectionKey(a.months, 12) === selectionKey(b.months, 12) ); } diff --git a/apps/server/src/scheduledTasks/ScheduledTaskService.schedule.test.ts b/apps/server/src/scheduledTasks/ScheduledTaskService.schedule.test.ts index 0bbda517000c3..c146f305d22ce 100644 --- a/apps/server/src/scheduledTasks/ScheduledTaskService.schedule.test.ts +++ b/apps/server/src/scheduledTasks/ScheduledTaskService.schedule.test.ts @@ -601,3 +601,68 @@ it.effect( expect(morning?.nextRunAt).toBe(DateTime.formatIso(DateTime.toUtc(at(8, 0, 2)))); }).pipe(Effect.provide(SqlitePersistence.layerMemory)), ); + +it.effect("stores a day-of-month schedule and schedules its next chosen day", () => + Effect.gen(function* () { + const local = (month: number, day: number, year = 2026) => + DateTime.makeZonedUnsafe( + { year, month, day, hour: 9, minute: 0, second: 0, millisecond: 0 }, + { timeZone: DateTime.zoneMakeLocal(), adjustForTimeZone: true }, + ); + yield* TestClock.setTime(DateTime.toEpochMillis(local(10, 19))); + + const layerDependencies = Layer.mergeAll( + NodeCrypto.layer, + Scheduler.layer, + ManagedPolicy.layerTest(), + Layer.mock(ThreadLaunchService.ThreadLaunchService)({}), + Layer.mock(ManagedProjectFolders.ManagedProjectFolders)({ + namedProjectsRoot: "/projects", + isScratchProject: () => Effect.succeed(false), + }), + Layer.mock(ThreadManagementService.ThreadManagementService)({}), + Layer.mock(SecretRequests.SecretRequests)({}), + ); + yield* Effect.gen(function* () { + const service = yield* ScheduledTaskService.ScheduledTaskService; + const input = yield* decodeUpsertInput({ + title: "Quarterly report", + prompt: "Prepare the quarterly report.", + enabled: true, + schedule: { type: "fixed_time", timeOfDay: "09:00", monthDays: [5], months: [1, 4, 7, 10] }, + projectId: "project-month-days", + workspaceStrategy: { type: "root" }, + modelSelection: { instanceId: "codex", model: "gpt-5.4" }, + runtimeMode: "full-access", + interactionMode: "default", + }); + const created = yield* service.upsert(input); + expect(created.task.nextRunAt).toBe(DateTime.formatIso(DateTime.toUtc(local(1, 5, 2027)))); + + const [listed] = (yield* service.list()).tasks; + expect(listed?.schedule).toEqual(input.schedule); + + const resave = (schedule: typeof input.schedule) => + service.upsert({ ...input, id: created.task.id, schedule }); + const monthly = yield* resave({ + type: "fixed_time", + timeOfDay: "09:00", + monthDays: [4, 6], + months: [], + }); + expect(monthly.task.nextRunAt).toBe(DateTime.formatIso(DateTime.toUtc(local(11, 4)))); + + // A client that predates month days leaves them out, which keeps the stored ones. + const fromOlderClient = yield* resave({ type: "fixed_time", timeOfDay: "09:00" }); + expect(fromOlderClient.task.schedule).toEqual(monthly.task.schedule); + expect(fromOlderClient.task.nextRunAt).toBe(monthly.task.nextRunAt); + + const weekly = yield* resave({ type: "fixed_time", timeOfDay: "09:00", weekdays: [1] }); + expect(weekly.task.schedule).toEqual({ + type: "fixed_time", + timeOfDay: "09:00", + weekdays: [1], + }); + }).pipe(Effect.provide(ScheduledTaskService.layer.pipe(Layer.provide(layerDependencies)))); + }).pipe(Effect.provide(SqlitePersistence.layerMemory)), +); diff --git a/apps/server/src/scheduledTasks/ScheduledTaskService.ts b/apps/server/src/scheduledTasks/ScheduledTaskService.ts index 3db6f783f649a..53fe2d2d268b9 100644 --- a/apps/server/src/scheduledTasks/ScheduledTaskService.ts +++ b/apps/server/src/scheduledTasks/ScheduledTaskService.ts @@ -61,7 +61,12 @@ import * as ManagedPolicy from "../policy/ManagedPolicy.ts"; import * as DueHint from "../scheduling/DueHint.ts"; import * as Scheduler from "../scheduling/Scheduler.ts"; import { latestRootProviderFailure } from "@t3tools/shared/orchestrationV2ThreadError"; -import { isMissedFixedTimeRun, isSameSchedule, nextScheduledRunAt } from "./Schedule.ts"; +import { + isMissedFixedTimeRun, + isSameSchedule, + nextScheduledRunAt, + withStoredCalendar, +} from "./Schedule.ts"; import { redactHeaders, redactQuery, @@ -1542,7 +1547,9 @@ export const layer = Layer.effect( } : input.schedule.type === "once" ? { type: "once", runAt: iso(DateTime.makeUnsafe(input.schedule.runAt)) } - : input.schedule; + : input.schedule.type === "fixed_time" + ? withStoredCalendar(input.schedule, existingTask?.schedule) + : input.schedule; const webhook = input.schedule.type === "webhook" ? yield* Effect.gen(function* () { diff --git a/apps/web/src/components/settings/ScheduledTasksSettings.browser.test.tsx b/apps/web/src/components/settings/ScheduledTasksSettings.browser.test.tsx index 417868799a18d..e233035c1c48e 100644 --- a/apps/web/src/components/settings/ScheduledTasksSettings.browser.test.tsx +++ b/apps/web/src/components/settings/ScheduledTasksSettings.browser.test.tsx @@ -60,6 +60,7 @@ const state = vi.hoisted(() => ({ tasksLoaded: true, secondary: false, remove: vi.fn(), + monthDays: true, })); const secondaryId = EnvironmentId.make("secondary"); const permissions = new Map>(); @@ -69,6 +70,7 @@ function setup() { state.tasksLoaded = true; state.remove.mockReset().mockReturnValue(Effect.succeed({ id: task.id })); state.secondary = false; + state.monthDays = true; permissions.clear(); permissions.set(environmentId, Atom.make(true)); permissions.set(secondaryId, Atom.make(true)); @@ -90,7 +92,12 @@ function environment() { label: "Laptop", connection: { phase: state.connected ? "connected" : "disconnected" }, serverConfig: state.connected - ? { environment: { platform: "linux", capabilities: { oneTimeSchedules: true } } } + ? { + environment: { + platform: "linux", + capabilities: { oneTimeSchedules: true, scheduledTaskMonthDays: state.monthDays }, + }, + } : null, }; } @@ -293,4 +300,18 @@ describe("ScheduledTasksSettings", () => { await expect.element(dialog).toHaveAttribute("data-open"); await expect.element(name).toHaveValue("My draft"); }); + + it("offers days of the month only when the server can store them", async () => { + setup(); + const monthDaysToggle = async (monthDays: boolean) => { + state.monthDays = monthDays; + await using _screen = await render(); + await userEvent.click(page.getByRole("button", { name: "New task" })); + const dialog = page.getByRole("dialog"); + await expect.element(dialog.getByRole("button", { name: "Mon" })).toBeInTheDocument(); + return dialog.getByRole("button", { name: "Days of the month" }).query() !== null; + }; + expect(await monthDaysToggle(false)).toBe(false); + expect(await monthDaysToggle(true)).toBe(true); + }); }); diff --git a/apps/web/src/components/settings/ScheduledTasksSettings.tsx b/apps/web/src/components/settings/ScheduledTasksSettings.tsx index a2ffce32e68cd..2762e31955ad9 100644 --- a/apps/web/src/components/settings/ScheduledTasksSettings.tsx +++ b/apps/web/src/components/settings/ScheduledTasksSettings.tsx @@ -15,7 +15,7 @@ import { PlusIcon, Trash2Icon, } from "lucide-react"; -import { type ReactNode, useRef, useState } from "react"; +import { type Dispatch, type ReactNode, type SetStateAction, useRef, useState } from "react"; import type { EnvironmentId, ModelSelection, @@ -28,6 +28,14 @@ import type { ScheduledTaskWebhookDeliverySummary, ThreadId, } from "@t3tools/contracts"; +import { + MONTHS, + MONTH_DAYS, + MONTH_DAYS_UNSUPPORTED, + describeFixedTimeSchedule, + describeMonthEndFallback, + monthShortLabel, +} from "@t3tools/client-runtime/scheduled-task-schedule"; import { DEFAULT_WEBHOOK_PROMPT, emptyWebhookFilterDraft, @@ -53,7 +61,7 @@ import { import { msg, T, useGT, useLocale, useMessages, Var } from "gt-react"; import { m, type MessageResolver } from "../../i18n/messages"; -import { formatRelativeTime } from "../../timestampFormat"; +import { formatRelativeTime, formatTimeOfDay } from "../../timestampFormat"; import { useClientSettings, useEnvironmentSettings } from "../../hooks/useSettings"; import { getCustomModelOptionsByInstance } from "../../modelSelection"; import { providerInstanceEntriesFor } from "../../providerInstances"; @@ -111,6 +119,7 @@ import { taskToDraft, unbindDraftFromThread, type DraftState, + type DayMode, type ScheduleMode, type WorkspaceMode, } from "./scheduledTasksSettings.logic"; @@ -191,7 +200,11 @@ const EMPTY_DRAFT: DraftState = { timeOfDay: "09:00", runAt: "", savedRunAt: "", + dayMode: "week", weekdays: new Set([1, 2, 3, 4, 5]), + monthDays: new Set([1]), + limitMonths: false, + months: new Set(MONTHS), projectId: "", threadId: "", savedThreadId: "", @@ -1464,6 +1477,160 @@ function ScheduledTaskDestination({ ); } +/** Toggle values are strings; an empty choice is ignored so one option always stays on. */ +function numberChoices(values: readonly string[]): ReadonlySet | null { + return values.length === 0 ? null : new Set(values.map(Number)); +} + +function FixedTimeScheduleFields({ + draft, + setDraft, + calendarSupported, + zone, +}: { + readonly draft: DraftState; + readonly setDraft: Dispatch>; + readonly calendarSupported: boolean; + readonly zone: string | undefined; +}) { + const gt = useGT(); + const messages = useMessages(); + const locale = useLocale(); + const timestampFormat = useClientSettings((settings) => settings.timestampFormat); + const schedule = scheduleFromDraft(draft); + const fixed = schedule?.type === "fixed_time" ? schedule : null; + const fallback = fixed ? describeMonthEndFallback(fixed, messages) : null; + // A draft already using them keeps the controls, so switching to an older server can be undone. + const showCalendar = calendarSupported || draft.dayMode === "month" || draft.limitMonths; + return ( +
+
+
+ + + setDraft((current) => ({ ...current, timeOfDay: event.target.value })) + } + /> + {zone === undefined ? null : ( + + {zone} + + )} +
+ {showCalendar ? ( + { + const dayMode = values[0] as DayMode | undefined; + if (dayMode === "week" || dayMode === "month") + setDraft((current) => ({ ...current, dayMode })); + }} + > + + Days of the week + + + Days of the month + + + ) : null} +
+ {draft.dayMode === "week" ? ( + { + const weekdays = numberChoices(values); + if (weekdays) setDraft((current) => ({ ...current, weekdays })); + }} + > + {WEEKDAY_ORDER.map((day) => ( + + {messages(WEEKDAY_SHORT[day])} + + ))} + + ) : ( + { + const monthDays = numberChoices(values); + if (monthDays) setDraft((current) => ({ ...current, monthDays })); + }} + > + {MONTH_DAYS.map((day) => ( + + {day} + + ))} + + )} + {showCalendar ? ( +
+ + setDraft((current) => ({ ...current, limitMonths }))} + /> +
+ ) : null} + {draft.limitMonths ? ( + { + const months = numberChoices(values); + if (months) setDraft((current) => ({ ...current, months })); + }} + > + {MONTHS.map((month) => ( + + {monthShortLabel(month, locale)} + + ))} + + ) : null} + {fixed ? ( +

+ {describeFixedTimeSchedule( + fixed, + formatTimeOfDay(fixed.timeOfDay, timestampFormat), + messages, + locale, + )} + {fallback ? {fallback} : null} +

+ ) : null} +
+ ); +} + function ScheduledTaskEditorForm({ initialEnvironmentId, task, @@ -1478,7 +1645,6 @@ function ScheduledTaskEditorForm({ readonly onClose: () => void; }) { const messages = useMessages(); - const locale = useLocale(); const gt = useGT(); const { scope, connectedEnvironments } = useSettingsScope(); const [environmentId, setEnvironmentId] = useState(initialEnvironmentId); @@ -1491,6 +1657,8 @@ function ScheduledTaskEditorForm({ environment?.serverConfig?.environment.capabilities.scheduledTaskThreadModes === true; const connected = environment?.connection.phase === "connected" && environment.serverConfig !== null; + const calendarSupported = + environment?.serverConfig?.environment.capabilities.scheduledTaskMonthDays === true; const tasksQuery = useEnvironmentQuery( connected ? serverEnvironment.scheduledTasksLive({ environmentId, input: {} }) : null, messages, @@ -1634,6 +1802,14 @@ function ScheduledTaskEditorForm({ for (const error of scheduleDraftErrors(draft)) reportFailure(error.title, error.description); return; } + if ( + !calendarSupported && + schedule.type === "fixed_time" && + (schedule.monthDays?.length || schedule.months?.length) + ) { + reportFailure(gt("Update this environment"), messages(MONTH_DAYS_UNSUPPORTED)); + return; + } if ( schedule.type === "webhook" && schedule.signature && @@ -2252,60 +2428,12 @@ function ScheduledTaskEditorForm({ /> ) : draft.scheduleMode === "fixed" ? ( -
-
- - - setDraft((current) => ({ ...current, timeOfDay: event.target.value })) - } - /> - {runAtZone === undefined ? null : ( - - {runAtZone} - - )} - - - on - - -
- { - if (values.length === 0) return; - setDraft((current) => ({ - ...current, - weekdays: new Set(values.map(Number)), - })); - }} - > - {WEEKDAY_ORDER.map((day) => ( - - {messages(WEEKDAY_SHORT[day])} - - ))} - -
+ ) : (