@sentry/junior-google 0.266.0 → 0.267.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.
package/README.md CHANGED
@@ -15,8 +15,11 @@ Gmail and Drive writes are out of scope.
15
15
  own calendar. It reads free/busy data and calendar time zones only. It never
16
16
  reads event titles or details. Optional attendees do not block a slot.
17
17
  Slots where they are free come first, and each slot names the optional
18
- attendees who are busy or off hours. Slots are spread across days and
19
- across each day, so the requester gets a real choice.
18
+ attendees who are busy or off hours. A search can be limited to some
19
+ weekdays, such as Wednesdays and Fridays for a weekly meeting. A search
20
+ covers at most 14 days, counted on the local clock, so a daylight-saving
21
+ change does not shorten it. Slots are spread across days and across each
22
+ day, so the requester gets a real choice.
20
23
  - Every Calendar tool takes an optional `timeZone` for the times it reads and
21
24
  shows. Without it, the tool uses the requester's timezone from
22
25
  `ctx.users.resolveTimezone()`, so Junior does not have to ask for one.
package/dist/index.js CHANGED
@@ -1261,6 +1261,7 @@ var DAY_MS = 24 * 60 * 60 * 1e3;
1261
1261
  var MAX_WINDOW_MS = 14 * DAY_MS;
1262
1262
  var DEFAULT_WINDOW_MS = 7 * DAY_MS;
1263
1263
  var clockTimeSchema = z5.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/, "Use 24-hour HH:MM");
1264
+ var WEEKDAYS = ["Mon", "Tue", "Wed", "Thu", "Fri"];
1264
1265
  var inputSchema3 = z5.object({
1265
1266
  attendees: emailListSchema(20).min(1).describe(
1266
1267
  "Work emails of the people who must attend. Resolve names with userLookup. The runtime adds the requester as required when it knows their email. To make the requester optional, put their email in optionalAttendees."
@@ -1284,6 +1285,9 @@ var inputSchema3 = z5.object({
1284
1285
  workdayEnd: clockTimeSchema.default("17:00").describe(
1285
1286
  "Latest local end, 24-hour HH:MM, in each attendee's own calendar time zone."
1286
1287
  ),
1288
+ weekdays: z5.array(z5.enum(WEEKDAYS)).min(1).optional().describe(
1289
+ "Only return slots on these days, in the timeZone of the slot labels. Omit to search every weekday."
1290
+ ),
1287
1291
  maxResults: z5.number().int().min(1).max(20).default(3)
1288
1292
  }).strict();
1289
1293
  var slotSchema = z5.object({
@@ -1345,6 +1349,12 @@ function clockMinutes(value) {
1345
1349
  const [hours = 0, minutes = 0] = value.split(":").map(Number);
1346
1350
  return hours * 60 + minutes;
1347
1351
  }
1352
+ function wallClockMs(startMs, endMs, timeZone) {
1353
+ const format = localFormat(timeZone);
1354
+ const start = localParts(startMs, format);
1355
+ const end = localParts(endMs, format);
1356
+ return Date.parse(`${end.date}T00:00:00Z`) - Date.parse(`${start.date}T00:00:00Z`) + (end.minutes - start.minutes) * 6e4;
1357
+ }
1348
1358
  function overlaps(busy, startMs, endMs) {
1349
1359
  return busy.endMs > startMs && busy.startMs < endMs;
1350
1360
  }
@@ -1412,9 +1422,10 @@ function findFreeSlots(input) {
1412
1422
  let startMs = Math.ceil(input.timeMinMs / stepMs) * stepMs;
1413
1423
  while (startMs + durationMs <= input.timeMaxMs) {
1414
1424
  const endMs = startMs + durationMs;
1415
- if (required.every((attendee) => available(attendee, startMs, endMs))) {
1425
+ const local = partsIn(startMs, input.timeZone);
1426
+ if ((!input.weekdays || input.weekdays.includes(local.weekday)) && required.every((attendee) => available(attendee, startMs, endMs))) {
1416
1427
  candidates.push({
1417
- date: partsIn(startMs, input.timeZone).date,
1428
+ date: local.date,
1418
1429
  endMs,
1419
1430
  optionalConflicts: optional.filter((attendee) => !available(attendee, startMs, endMs)).map((attendee) => attendee.email),
1420
1431
  startMs
@@ -1479,7 +1490,7 @@ function createFindMeetingTimesTool(ctx) {
1479
1490
  "timeMax must be after timeMin and now."
1480
1491
  );
1481
1492
  }
1482
- if (timeMaxMs - timeMinMs > MAX_WINDOW_MS) {
1493
+ if (wallClockMs(timeMinMs, timeMaxMs, timeZone) > MAX_WINDOW_MS) {
1483
1494
  throw new PluginToolInputError3("Search at most 14 days at a time.");
1484
1495
  }
1485
1496
  if (clockMinutes(input.workdayEnd) <= clockMinutes(input.workdayStart)) {
@@ -1545,6 +1556,7 @@ function createFindMeetingTimesTool(ctx) {
1545
1556
  timeMaxMs,
1546
1557
  timeMinMs,
1547
1558
  timeZone,
1559
+ weekdays: input.weekdays,
1548
1560
  workdayEnd: input.workdayEnd,
1549
1561
  workdayStart: input.workdayStart
1550
1562
  });
@@ -17,7 +17,8 @@ export interface SlotAttendee {
17
17
  *
18
18
  * Optional attendees who are busy or outside their hours do not block a slot.
19
19
  * Slots without such conflicts come first. Options are spread across the days
20
- * of `timeZone` and across each day.
20
+ * of `timeZone` and across each day. With `weekdays`, only those days of
21
+ * `timeZone` are searched.
21
22
  *
22
23
  * Exported for tests. Busy intervals come from Google free/busy only, so
23
24
  * Junior never sees event titles or details.
@@ -29,6 +30,7 @@ export declare function findFreeSlots(input: {
29
30
  timeMaxMs: number;
30
31
  timeMinMs: number;
31
32
  timeZone: string;
33
+ weekdays?: readonly string[];
32
34
  workdayEnd: string;
33
35
  workdayStart: string;
34
36
  }): Array<Interval & {
@@ -48,6 +50,7 @@ export declare function createFindMeetingTimesTool(ctx: GoogleToolContext): impo
48
50
  timeZone?: string | undefined;
49
51
  workdayStart: string;
50
52
  workdayEnd: string;
53
+ weekdays?: ("Fri" | "Mon" | "Thu" | "Tue" | "Wed")[] | undefined;
51
54
  maxResults: number;
52
55
  }, {
53
56
  [x: string]: unknown;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/junior-google",
3
- "version": "0.266.0",
3
+ "version": "0.267.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -25,7 +25,7 @@
25
25
  "commander": "^14.0.3",
26
26
  "drizzle-orm": "^0.45.2",
27
27
  "zod": "^4.5.4",
28
- "@sentry/junior-plugin-api": "0.266.0"
28
+ "@sentry/junior-plugin-api": "0.267.0"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@oxlint/plugins": "1.79.0",