@rubytech/taskmaster 1.42.1 → 1.44.0

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.
@@ -31,6 +31,10 @@ const OpeningHoursSchema = Type.Object({
31
31
  sunday: Type.Optional(Type.Union([Type.Object({ start: Type.String(), end: Type.String() }), Type.Null()])),
32
32
  }, { description: "Per-weekday time windows. null = closed that day." })),
33
33
  closedDates: Type.Optional(Type.Array(Type.String(), { description: "ISO dates (YYYY-MM-DD) to mark as closed." })),
34
+ invertedMode: Type.Optional(Type.Boolean({
35
+ description: "When true, the agent responds OUTSIDE the scheduled windows (out-of-hours cover). " +
36
+ "Days with no schedule entry become open all day. Closed dates remain absolute.",
37
+ })),
34
38
  });
35
39
  export function createOpeningHoursTool() {
36
40
  return {
@@ -75,6 +79,8 @@ export function createOpeningHoursTool() {
75
79
  ohPatch.schedule = params.schedule;
76
80
  if (Array.isArray(params.closedDates))
77
81
  ohPatch.closedDates = params.closedDates;
82
+ if (typeof params.invertedMode === "boolean")
83
+ ohPatch.invertedMode = params.invertedMode;
78
84
  if (Object.keys(ohPatch).length > 0)
79
85
  businessPatch.openingHours = ohPatch;
80
86
  const snapshot = await callGatewayTool("config.get", gatewayOpts, {});
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.42.1",
3
- "commit": "d860a07a6a2c8b8db885801f38ec7d4d5503d1e0",
4
- "builtAt": "2026-03-14T21:34:46.499Z"
2
+ "version": "1.44.0",
3
+ "commit": "20dfd6f6f756846807d1175f4148e566616b84b1",
4
+ "builtAt": "2026-03-16T11:14:34.804Z"
5
5
  }
@@ -47,9 +47,23 @@ export function isWithinOpeningHours(config, now = new Date()) {
47
47
  // 2. Check weekly schedule.
48
48
  const daySchedule = config.schedule[weekday];
49
49
  if (daySchedule === null || daySchedule === undefined) {
50
+ // No schedule entry for this day.
51
+ // invertedMode: no window to be outside of → open all day.
52
+ // Normal: no window → closed all day.
53
+ if (config.invertedMode) {
54
+ return { open: true, reason: `open all day on ${weekday}s (inverted)` };
55
+ }
50
56
  return { open: false, reason: `closed on ${weekday}s` };
51
57
  }
52
58
  // 3. Check time window (start inclusive, end exclusive).
59
+ const withinWindow = currentTime >= daySchedule.start && currentTime < daySchedule.end;
60
+ if (config.invertedMode) {
61
+ // Inverted: agent responds OUTSIDE the window.
62
+ return withinWindow
63
+ ? { open: false, reason: `within scheduled window ${daySchedule.start}–${daySchedule.end}` }
64
+ : { open: true, reason: "outside scheduled window" };
65
+ }
66
+ // Normal mode.
53
67
  if (currentTime < daySchedule.start) {
54
68
  return { open: false, reason: `opens at ${daySchedule.start}` };
55
69
  }
@@ -259,6 +259,7 @@ export const TaskmasterSchema = z
259
259
  })
260
260
  .strict(),
261
261
  closedDates: z.array(z.string().regex(/^\d{4}-\d{2}-\d{2}$/)).optional(),
262
+ invertedMode: z.boolean().optional(),
262
263
  })
263
264
  .strict()
264
265
  .optional(),