@mgcrea/mcp-apple-calendar 0.0.0-bootstrap → 1.3.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/dist/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { A as BUILD_INFO, C as CALENDAR_SURFACE, a as loadConfig, r as createServer } from "./server-B2HtiXLF.js";
2
+ import { A as BUILD_INFO, C as CALENDAR_SURFACE, a as loadConfig, r as createServer } from "./server-ai6cmDj4.js";
3
3
  import { runStdioServer } from "@mgcrea/mcp-apple-core";
4
4
  //#region src/cli.ts
5
5
  const LOG_PREFIX = "apple-calendar-mcp";
package/dist/index.d.ts CHANGED
@@ -175,6 +175,7 @@ declare const openStore: (path: string | null, mode: ReadOnlyMode, logger?: Logg
175
175
  */
176
176
  declare const ConfigSchema: z.ZodObject<{
177
177
  allowWrites: z.ZodDefault<z.ZodBoolean>;
178
+ exposePrompts: z.ZodDefault<z.ZodBoolean>;
178
179
  debug: z.ZodDefault<z.ZodBoolean>;
179
180
  osascriptPath: z.ZodDefault<z.ZodString>;
180
181
  osascriptTimeoutMs: z.ZodDefault<z.ZodNumber>;
@@ -191,6 +192,17 @@ declare const ConfigSchema: z.ZodObject<{
191
192
  defaultCalendar: z.ZodOptional<z.ZodString>;
192
193
  defaultRangeDays: z.ZodDefault<z.ZodNumber>;
193
194
  maxRangeDays: z.ZodDefault<z.ZodNumber>;
195
+ workdayStart: z.ZodDefault<z.ZodString>;
196
+ workdayEnd: z.ZodDefault<z.ZodString>;
197
+ workdays: z.ZodDefault<z.ZodArray<z.ZodEnum<{
198
+ fri: "fri";
199
+ mon: "mon";
200
+ sat: "sat";
201
+ sun: "sun";
202
+ thu: "thu";
203
+ tue: "tue";
204
+ wed: "wed";
205
+ }>>>;
194
206
  defaultEventDurationMinutes: z.ZodDefault<z.ZodNumber>;
195
207
  includeDeclined: z.ZodDefault<z.ZodBoolean>;
196
208
  includeCancelled: z.ZodDefault<z.ZodBoolean>;
@@ -203,6 +215,10 @@ type Config = z.infer<typeof ConfigSchema>;
203
215
  */
204
216
  declare const loadConfig: (env?: NodeJS.ProcessEnv) => Config;
205
217
  //#endregion
218
+ //#region src/client/availability.d.ts
219
+ declare const WEEKDAY_KEYS: readonly ["sun", "mon", "tue", "wed", "thu", "fri", "sat"];
220
+ type WeekdayKey = (typeof WEEKDAY_KEYS)[number];
221
+ //#endregion
206
222
  //#region src/client/dates.d.ts
207
223
  /**
208
224
  * What a tool reports for an event's start or end.
@@ -374,6 +390,97 @@ type EventFilters = {
374
390
  includeCancelled?: boolean | undefined;
375
391
  limit: number;
376
392
  };
393
+ /**
394
+ * A window of time nothing is on the calendar, long enough to hold the meeting
395
+ * that was asked for.
396
+ */
397
+ type FreeSlot = {
398
+ /** Local wall clock with its offset, ready to hand back to create_event. */
399
+ start: string;
400
+ end: string;
401
+ /** The local day it falls on, so a caller can group without re-parsing. */
402
+ day: string;
403
+ /** How long the whole gap is — usually longer than the duration requested. */
404
+ minutes: number;
405
+ };
406
+ type AvailabilityFilters = {
407
+ from?: string | undefined;
408
+ to?: string | undefined;
409
+ durationMinutes: number;
410
+ calendar?: string | undefined;
411
+ dayStart: string;
412
+ dayEnd: string;
413
+ weekdays?: readonly WeekdayKey[] | undefined;
414
+ granularityMinutes: number;
415
+ /** Let an all-day event block its whole day. Off by default — see below. */
416
+ allDayBusy: boolean;
417
+ /** Trust `CalendarItem.availability`. Off by default — the mapping is inferred. */
418
+ respectFreeMarking: boolean;
419
+ includeDeclined?: boolean | undefined;
420
+ includeCancelled?: boolean | undefined;
421
+ limit: number;
422
+ };
423
+ /**
424
+ * Why an availability answer was withheld.
425
+ *
426
+ * A separate shape from an empty `slots` array on purpose, and the distinction
427
+ * is the whole point of the tool: "nothing is free" and "I cannot see enough of
428
+ * the calendar to say" look identical to a model unless one of them says so.
429
+ */
430
+ type AvailabilityRefusal = {
431
+ degraded: true;
432
+ capability: string;
433
+ reason: string;
434
+ hint: string;
435
+ };
436
+ type AvailabilityResult = {
437
+ slots: FreeSlot[];
438
+ durationMinutes: number;
439
+ window: {
440
+ from: string;
441
+ to: string;
442
+ clamped: boolean;
443
+ /** True when the start was pulled forward to now, dropping time already past. */
444
+ startedAtNow: boolean;
445
+ };
446
+ workingHours: {
447
+ dayStart: string;
448
+ dayEnd: string;
449
+ weekdays: readonly WeekdayKey[];
450
+ granularityMinutes: number;
451
+ /** The zone the working hours were read in — always this machine's. */
452
+ timeZone: string;
453
+ };
454
+ busy: {
455
+ /** Events that blocked time, after every filter. */
456
+ blocking: number;
457
+ /** Contiguous busy intervals they collapsed into. */
458
+ intervals: number;
459
+ };
460
+ /**
461
+ * All-day events overlapping the window, reported whether or not they were
462
+ * applied. See `allDayBusy` on the tool for why this is not a default.
463
+ */
464
+ allDayEvents: {
465
+ day: string;
466
+ summary: string | null;
467
+ calendar: string | null;
468
+ }[];
469
+ expansion: ExpansionState;
470
+ coverage: {
471
+ from: string;
472
+ to: string;
473
+ rows: number;
474
+ } | null;
475
+ /** Set when the window was cut back to what the expansion actually covers. */
476
+ truncated?: {
477
+ reason: string;
478
+ requestedTo?: string;
479
+ requestedFrom?: string;
480
+ };
481
+ /** Set when the window survived every check but held no time at all. */
482
+ note?: string;
483
+ };
377
484
  type CreateClientOptions = {
378
485
  config: Config;
379
486
  logger?: Logger;
@@ -450,6 +557,32 @@ declare class AppleCalendarClient {
450
557
  query: string;
451
558
  scope?: "summary" | "full" | undefined;
452
559
  }): EventPage;
560
+ /**
561
+ * When nothing is on the calendar, for long enough to hold a meeting.
562
+ *
563
+ * ## Why this is not list_events with arithmetic bolted on
564
+ *
565
+ * Every other read here returns what it found and flags what it missed, and
566
+ * a caller reads the flag or does not. This one INVERTS the events: what it
567
+ * returns is the complement of what it read, so anything the read missed
568
+ * comes back as free time. A page limit, an unexpanded weekly meeting, an
569
+ * event past the coverage edge — each of those shortens a `list_events`
570
+ * result harmlessly and each of them, here, invents a slot that is already
571
+ * booked. `docs/calendar.md` names the failure directly: "a short list of
572
+ * events is indistinguishable from a free afternoon."
573
+ *
574
+ * So the busy set is either complete or the answer is withheld. Three checks
575
+ * enforce that, and each returns a refusal rather than a short list:
576
+ *
577
+ * 1. the scan bound, so a saturated leg never passes for a quiet week
578
+ * 2. the expansion, because an unexpanded series is invisible on every
579
+ * date but one
580
+ * 3. the coverage edge, past which repeating events simply are not there
581
+ *
582
+ * The third clips the window rather than refusing outright, because the part
583
+ * inside the edge is genuinely answerable — but it says what it cut.
584
+ */
585
+ findAvailability(args: AvailabilityFilters): AvailabilityResult | AvailabilityRefusal;
453
586
  getEvent(ref: string): EventDetail;
454
587
  calendars(): IndexCalendar[];
455
588
  accounts(): IndexAccount[];
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/build-info.ts","../src/client/store.ts","../src/config.ts","../src/client/dates.ts","../src/client/locate.ts","../src/client/recurrence.ts","../src/client/calendar.ts","../src/client/errors.ts","../src/client/ref.ts","../src/server.ts","../src/tools/index.ts"],"mappings":";;;;;cAkBa,YAAY;;;KCiDb;EACV;;EAEA,aAAa;EACb,iBAAiB;EACjB,mBAAmB;EACnB,mBAAmB;EACnB,cAAc;;;;;;;;;EASd;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;KAIU;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;;EAEA;;KAGU;;EAEV;;EAEA;;EAEA;EACA;;KAGU,cAAc;EACxB;EACA;;;KAIU;EAAa;EAAmB;EAAiB;;KAEjD;EACV;EACA;EACA;EACA;EACA;EACA;EACA;;;;;;;;;;;EAWA;EACA;;KAGU;EAAiB;EAAqB;EAAqB;;cAM1D;;WACF,IAAI;WACJ;WACA,MAAM;EAEf,YAAY,IAAI,cAAc,cAAc,MAAM;;;;;;;;;;;;EAyHlD,WAAW,GAAG,aAAa;;;;;;;;;EAuC3B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AQjB,YAAY,MAAM;;EAelB,UAAU;;;;;;;EAWV,SAAS;;;;;;;;EAoBT;EA2HA,WAAW,SAAS,eAAe;;;;;;;;EA+EnC,aACE,MAAM;IAAiB;IAAe;MACrC;EAkDH,SAAS,cAAc;EAkCvB,aAlCuB;EAsCvB,YAAY;EA+JN,YAAY,QAAQ,oBAAoB,QAAQ;EAuBhD,YAAY,QAAQ,oBAAoB,QAAQ;;;;;;;;;;;EAqDhD,aAAa,0BAA0B;IAAU;IAAoB;;EAkC3E,SAAS;;;;;;;;;;;cCpwBE,kBAAkB;;cAMlB;;;;;;;cAsBA,yBAAyB;WAClB;EAElB,YAAY,eAAe,aAAa;;;cAY7B,2BAA2B;WACpB;EAElB,YAAY;;;cAUD,8BAA8B;WACvB;EAElB,YAAY,cAAc;;;;;;;;;;cAmBf,iCAAiC;WAC1B;EAElB,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cCtDD;KAWD;;EAEV;;EAEA;;EAEA,iBAAiB;;EAEjB;;cA4BW,YAAS,qBACD,kBACH,kBACE;cAQP,YAAS,gBAAkB;;cA2D3B,cAAW,KAAS;;cAGpB,SAAM;;;cC1JN;cACA;KAED;EACV,QAAQ;EACR,SAAS;;EAET,YAAY;;EAEZ,YAAY;;KAGF;EACV,QAAQ;EACR,QAAQ;;;;;;;;cASG,eAAY,MAAU,wBAAsB;;;KCvB7C;;;;;EAKV;;;;;;;;;;;;;;;;cAiBW,gBAAa,QAChB,WAAS,QACT,qBAAmB,KACtB"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/build-info.ts","../src/client/store.ts","../src/config.ts","../src/client/availability.ts","../src/client/dates.ts","../src/client/locate.ts","../src/client/recurrence.ts","../src/client/calendar.ts","../src/client/errors.ts","../src/client/ref.ts","../src/server.ts","../src/tools/index.ts"],"mappings":";;;;;cAkBa,YAAY;;;KCiDb;EACV;;EAEA,aAAa;EACb,iBAAiB;EACjB,mBAAmB;EACnB,mBA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AQ,oBAAoB,QAAQ;;;;;;;;;;;EAqDhD,aAAa,0BAA0B;IAAU;IAAoB;;EAkC3E,SAAS;;;;;;;;;;;cC9nCE,kBAAkB;;cAMlB;;;;;;;cAsBA,yBAAyB;WAClB;EAElB,YAAY,eAAe,aAAa;;;cAY7B,2BAA2B;WACpB;EAElB,YAAY;;;cAUD,8BAA8B;WACvB;EAElB,YAAY,cAAc;;;;;;;;;;cAmBf,iCAAiC;WAC1B;EAElB,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cCtDD;KAWD;;EAEV;;EAEA;;EAEA,iBAAiB;;EAEjB;;cA4BW,YAAS,qBACD,kBACH,kBACE;cAQP,YAAS,gBAAkB;;cA2D3B,cAAW,KAAS;;cAGpB,SAAM;;;cCnJN;cACA;KAED;EACV,QAAQ;EACR,SAAS;;EAET,YAAY;;EAEZ,YAAY;;KAGF;EACV,QAAQ;EACR,QAAQ;;;;;;;;cASG,eAAY,MAAU,wBAAsB;;;KC7B7C;;;;;EAKV;;;;;;;;;;;;;;;;cAiBW,gBAAa,QAChB,WAAS,QACT,qBAAmB,KACtB"}
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { A as BUILD_INFO, C as CALENDAR_SURFACE, D as CalendarNotWritableError, E as CalendarNotRunningError, O as EventNotFoundError, S as CALENDAR_BUNDLE_ID, T as CalendarNotFoundError, _ as STORE_FILENAME, a as loadConfig, b as locateStore, c as introspect, d as decodeRef, f as encodeRef, g as GROUP_CONTAINER, h as EXTRAS_FILENAME, i as registerTools, k as InvalidDateError, l as openStore, m as uuidOf, n as SERVER_VERSION, o as AppleCalendarClient, p as seriesRefOf, r as createServer, s as CalendarStore, t as SERVER_NAME, u as REF_VERSION, v as defaultContainerPath, w as CalendarBusyError, x as AppleCalendarError, y as defaultStorePath } from "./server-B2HtiXLF.js";
1
+ import { A as BUILD_INFO, C as CALENDAR_SURFACE, D as CalendarNotWritableError, E as CalendarNotRunningError, O as EventNotFoundError, S as CALENDAR_BUNDLE_ID, T as CalendarNotFoundError, _ as STORE_FILENAME, a as loadConfig, b as locateStore, c as introspect, d as decodeRef, f as encodeRef, g as GROUP_CONTAINER, h as EXTRAS_FILENAME, i as registerTools, k as InvalidDateError, l as openStore, m as uuidOf, n as SERVER_VERSION, o as AppleCalendarClient, p as seriesRefOf, r as createServer, s as CalendarStore, t as SERVER_NAME, u as REF_VERSION, v as defaultContainerPath, w as CalendarBusyError, x as AppleCalendarError, y as defaultStorePath } from "./server-ai6cmDj4.js";
2
2
  export { AppleCalendarClient, AppleCalendarError, BUILD_INFO, CALENDAR_BUNDLE_ID, CALENDAR_SURFACE, CalendarBusyError, CalendarNotFoundError, CalendarNotRunningError, CalendarNotWritableError, CalendarStore, EXTRAS_FILENAME, EventNotFoundError, GROUP_CONTAINER, InvalidDateError, REF_VERSION, SERVER_NAME, SERVER_VERSION, STORE_FILENAME, createServer, decodeRef, defaultContainerPath, defaultStorePath, encodeRef, introspect, loadConfig, locateStore, openStore, registerTools, seriesRefOf, uuidOf };