@agenticmail/enterprise 0.5.169 → 0.5.170

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -25,16 +25,13 @@ export interface AutonomySettings {
25
25
  /** Auto clock-in/out based on work schedule */
26
26
  clockEnabled: boolean;
27
27
 
28
- /** Daily catchup email to manager */
28
+ /**
29
+ * Daily/Weekly catchup: times are read from config.dailyCatchUp (Manager & Catch-Up tab).
30
+ * These booleans just enable/disable the behavior.
31
+ */
29
32
  dailyCatchupEnabled: boolean;
30
- dailyCatchupHour: number; // 0-23, default 9
31
- dailyCatchupMinute: number; // 0-59, default 0
32
-
33
- /** Weekly catchup email (broader summary + goals) */
34
33
  weeklyCatchupEnabled: boolean;
35
34
  weeklyCatchupDay: number; // 0=Sun..6=Sat, default 1 (Monday)
36
- weeklyCatchupHour: number; // default 9
37
- weeklyCatchupMinute: number; // default 0
38
35
 
39
36
  /** Goal progress check */
40
37
  goalCheckEnabled: boolean;
@@ -59,12 +56,8 @@ export const DEFAULT_AUTONOMY_SETTINGS: AutonomySettings = {
59
56
  enabled: true,
60
57
  clockEnabled: true,
61
58
  dailyCatchupEnabled: true,
62
- dailyCatchupHour: 9,
63
- dailyCatchupMinute: 0,
64
59
  weeklyCatchupEnabled: true,
65
60
  weeklyCatchupDay: 1,
66
- weeklyCatchupHour: 9,
67
- weeklyCatchupMinute: 0,
68
61
  goalCheckEnabled: true,
69
62
  goalCheckHours: [14, 17],
70
63
  knowledgeContribEnabled: true,
@@ -177,7 +170,7 @@ export class AgentAutonomyManager {
177
170
 
178
171
  const features = [];
179
172
  if (this.settings.clockEnabled) features.push('clock');
180
- if (this.settings.dailyCatchupEnabled) features.push('daily-catchup@' + this.settings.dailyCatchupHour + ':' + String(this.settings.dailyCatchupMinute).padStart(2, '0'));
173
+ if (this.settings.dailyCatchupEnabled) features.push('daily-catchup(time from Manager tab)');
181
174
  if (this.settings.weeklyCatchupEnabled) features.push('weekly-catchup@' + ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'][this.settings.weeklyCatchupDay]);
182
175
  if (this.settings.goalCheckEnabled) features.push('goals@' + this.settings.goalCheckHours.join(','));
183
176
  if (this.settings.knowledgeContribEnabled) features.push('knowledge@' + ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'][this.settings.knowledgeContribDay]);
@@ -284,24 +277,44 @@ export class AgentAutonomyManager {
284
277
  private async checkCatchupSchedule(): Promise<void> {
285
278
  if (!this.config.managerEmail || !this.config.runtime) return;
286
279
 
280
+ // Read catchup time from config.dailyCatchUp (set in Manager & Catch-Up tab)
281
+ let catchUpHour = 9;
282
+ let catchUpMinute = 0;
283
+ let catchUpTz = this.config.timezone || 'UTC';
284
+ try {
285
+ const rows = await this.config.engineDb.query<any>(
286
+ `SELECT config FROM managed_agents WHERE id = $1`, [this.config.agentId]
287
+ );
288
+ if (rows?.[0]?.config) {
289
+ const cfg = typeof rows[0].config === 'string' ? JSON.parse(rows[0].config) : rows[0].config;
290
+ if (cfg.dailyCatchUp?.time) {
291
+ const parts = cfg.dailyCatchUp.time.split(':');
292
+ catchUpHour = parseInt(parts[0]) || 9;
293
+ catchUpMinute = parseInt(parts[1]) || 0;
294
+ }
295
+ if (cfg.dailyCatchUp?.timezone) catchUpTz = cfg.dailyCatchUp.timezone;
296
+ // If dailyCatchUp is explicitly disabled in Manager tab, respect that
297
+ if (cfg.dailyCatchUp && cfg.dailyCatchUp.enabled === false) return;
298
+ }
299
+ } catch {}
300
+
287
301
  const now = new Date();
288
- const tz = this.config.timezone || 'UTC';
289
- const localTime = new Date(now.toLocaleString('en-US', { timeZone: tz }));
302
+ const localTime = new Date(now.toLocaleString('en-US', { timeZone: catchUpTz }));
290
303
  const hour = localTime.getHours();
291
304
  const minute = localTime.getMinutes();
292
305
  const dayOfWeek = localTime.getDay();
293
306
  const dateStr = localTime.toISOString().split('T')[0];
294
307
 
295
- // Weekly catchup: configurable day + time
308
+ // Weekly catchup: configurable day, same time as daily
296
309
  const isWeeklyCatchupTime = this.settings.weeklyCatchupEnabled
297
310
  && dayOfWeek === this.settings.weeklyCatchupDay
298
- && hour === this.settings.weeklyCatchupHour
299
- && minute >= this.settings.weeklyCatchupMinute && minute < this.settings.weeklyCatchupMinute + 15;
311
+ && hour === catchUpHour
312
+ && minute >= catchUpMinute && minute < catchUpMinute + 15;
300
313
 
301
- // Daily catchup: configurable time (skip if weekly already covers it)
314
+ // Daily catchup: uses time from Manager & Catch-Up tab
302
315
  const isDailyCatchupTime = this.settings.dailyCatchupEnabled
303
- && hour === this.settings.dailyCatchupHour
304
- && minute >= this.settings.dailyCatchupMinute && minute < this.settings.dailyCatchupMinute + 15;
316
+ && hour === catchUpHour
317
+ && minute >= catchUpMinute && minute < catchUpMinute + 15;
305
318
 
306
319
  if (!isDailyCatchupTime && !isWeeklyCatchupTime) return;
307
320