feat(automation): add timezone-safe daily briefing dedupe

This commit is contained in:
William Valentin
2026-02-16 14:01:14 -08:00
parent 71af3b5a42
commit 56854f04bd
10 changed files with 118 additions and 4 deletions
+7 -1
View File
@@ -24,7 +24,7 @@ export function createCronTools(scheduler: CronScheduler): Tool[] {
const lines = jobNames.map((name) => {
const job = scheduler.getJob(name);
if (!job) {return `- ${name}`;}
return `- **${name}** — schedule: \`${job.schedule}\`, enabled: ${job.enabled}, output: ${job.output.channel}/${job.output.peer}\n message: "${job.message.length > 80 ? job.message.slice(0, 80) + '...' : job.message}"`;
return `- **${name}** — schedule: \`${job.schedule}\`, enabled: ${job.enabled}, output: ${job.output.channel}/${job.output.peer}, once_per_local_day: ${job.once_per_local_day}\n message: "${job.message.length > 80 ? job.message.slice(0, 80) + '...' : job.message}"`;
});
return {
success: true,
@@ -113,6 +113,10 @@ export function createCronTools(scheduler: CronScheduler): Tool[] {
type: 'string',
description: 'IANA timezone (e.g. "America/Los_Angeles"). Defaults to system timezone.',
},
once_per_local_day: {
type: 'boolean',
description: 'If true, suppress duplicate triggers within the same local day for this job (uses job timezone).',
},
},
required: ['name', 'schedule', 'message'],
},
@@ -124,6 +128,7 @@ export function createCronTools(scheduler: CronScheduler): Tool[] {
output_channel?: string;
output_peer?: string;
timezone?: string;
once_per_local_day?: boolean;
};
try {
@@ -149,6 +154,7 @@ export function createCronTools(scheduler: CronScheduler): Tool[] {
},
enabled: true,
timezone: args.timezone,
once_per_local_day: args.once_per_local_day ?? false,
});
if (!created) {