@chronary/toolkit 1.3.1 → 1.5.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/ai-sdk.js CHANGED
@@ -50,6 +50,28 @@ var UpdateCalendarSchema = z.object({
50
50
  var DeleteCalendarSchema = z.object({
51
51
  calendar_id: z.string().describe("Calendar ID to delete")
52
52
  });
53
+ var ListBookingPagesSchema = z.object({
54
+ limit: z.number().int().min(1).max(200).default(50).describe("Max results to return"),
55
+ offset: z.number().int().min(0).default(0).describe("Pagination offset")
56
+ });
57
+ var GetBookingPageSchema = z.object({
58
+ booking_page_id: z.string().describe("Booking page ID to fetch (bkp_...)")
59
+ });
60
+ var CreateBookingPageSchema = z.object({
61
+ calendar_id: z.string().describe("Calendar a booking resolves to (from create_calendar/list_calendars)."),
62
+ title: z.string().min(1).max(200).describe("Meeting title shown on the page."),
63
+ description: z.string().max(2e3).optional().describe("Optional description shown to the booker."),
64
+ duration_minutes: z.number().int().min(5).max(480).optional().describe("Slot length in minutes (default 30)."),
65
+ buffer_minutes: z.number().int().min(0).max(120).optional().describe("Padding before/after existing events (default 0)."),
66
+ window_days: z.number().int().min(1).max(365).optional().describe("How far ahead bookings are allowed (default 14)."),
67
+ min_notice_minutes: z.number().int().min(0).max(40320).optional().describe("Minimum lead time before a bookable slot (default 0)."),
68
+ timezone: z.string().min(1).max(64).optional().describe("IANA timezone for display + working hours (default UTC)."),
69
+ availability_constraints: z.record(z.string(), z.object({ start: z.string(), end: z.string() })).nullable().optional().describe('Weekly working hours, e.g. {"mon":{"start":"09:00","end":"17:00"}}. Omit/null for any time in the window.'),
70
+ active: z.boolean().optional().describe("Whether the page accepts bookings (default true).")
71
+ });
72
+ var DeleteBookingPageSchema = z.object({
73
+ booking_page_id: z.string().describe("Booking page ID to delete (bkp_...)")
74
+ });
53
75
  var ListEventsSchema = z.object({
54
76
  calendar_id: z.string().optional().describe("Calendar ID to list events from. Provide this or agent_id."),
55
77
  agent_id: z.string().optional().describe("Agent ID to list events for across all of the agent's calendars. Provide this or calendar_id."),
@@ -148,6 +170,15 @@ var FindMeetingTimeSchema = z.object({
148
170
  calendars: z.array(z.string()).optional().describe("Additional shared calendar IDs to treat as busy"),
149
171
  include_busy: z.boolean().default(false).describe("Include per-agent busy blocks in response")
150
172
  });
173
+ var CreateConnectionLinkSchema = z.object({
174
+ calendar_id: z.string().startsWith("cal_").describe("Chronary calendar whose owning agent will receive authorized availability"),
175
+ capabilities: z.array(z.enum(["availability", "publishing"])).min(1).max(2).default(["availability"]).describe("Request opaque availability and optional publishing permission"),
176
+ publication_policy: z.enum(["none", "confirmed", "confirmed_tentative"]).default("none").describe("Desired event publishing policy; a human still selects the destination")
177
+ });
178
+ var GetConnectionLinkSchema = z.object({
179
+ connection_link_id: z.string().startsWith("csl_").describe("Connection setup link ID")
180
+ });
181
+ var CancelConnectionLinkSchema = GetConnectionLinkSchema;
151
182
  var GetCalendarContextSchema = z.object({
152
183
  calendar_id: z.string().describe("Calendar ID")
153
184
  });
@@ -341,6 +372,33 @@ var deleteCalendar = safeFunc(async (ctx) => {
341
372
  await ctx.client.calendars.delete(ctx.params.calendar_id);
342
373
  return void 0;
343
374
  });
375
+ var listBookingPages = safeFunc(async (ctx) => {
376
+ const { client, params } = ctx;
377
+ const iter = client.bookingPages.list({ limit: params.limit });
378
+ return fetchPage(iter, params.offset, params.limit);
379
+ });
380
+ var getBookingPage = safeFunc(async (ctx) => {
381
+ return ctx.client.bookingPages.get(ctx.params.booking_page_id);
382
+ });
383
+ var createBookingPage = safeFunc(async (ctx) => {
384
+ const { client, params } = ctx;
385
+ return client.bookingPages.create({
386
+ calendar_id: params.calendar_id,
387
+ title: params.title,
388
+ description: params.description,
389
+ duration_minutes: params.duration_minutes,
390
+ buffer_minutes: params.buffer_minutes,
391
+ window_days: params.window_days,
392
+ min_notice_minutes: params.min_notice_minutes,
393
+ timezone: params.timezone,
394
+ availability_constraints: params.availability_constraints,
395
+ active: params.active
396
+ });
397
+ });
398
+ var deleteBookingPage = safeFunc(async (ctx) => {
399
+ await ctx.client.bookingPages.delete(ctx.params.booking_page_id);
400
+ return void 0;
401
+ });
344
402
  var listEvents = safeFunc(async (ctx) => {
345
403
  const { client, params } = ctx;
346
404
  if (!params.calendar_id && !params.agent_id) {
@@ -444,6 +502,15 @@ var findMeetingTime = safeFunc(async (ctx) => {
444
502
  include_busy: params.include_busy
445
503
  });
446
504
  });
505
+ var createConnectionLink = safeFunc(async (ctx) => {
506
+ const { calendar_id, ...params } = ctx.params;
507
+ return ctx.client.connectionLinks.create(calendar_id, params);
508
+ });
509
+ var getConnectionLink = safeFunc(async (ctx) => ctx.client.connectionLinks.get(ctx.params.connection_link_id));
510
+ var cancelConnectionLink = safeFunc(async (ctx) => {
511
+ await ctx.client.connectionLinks.cancel(ctx.params.connection_link_id);
512
+ return { cancelled: true, id: ctx.params.connection_link_id };
513
+ });
447
514
  var getCalendarContext = safeFunc(async (ctx) => {
448
515
  return ctx.client.calendars.getContext(ctx.params.calendar_id);
449
516
  });
@@ -573,6 +640,9 @@ var HOSTED_API_MCP_TOOL_NAMES = [
573
640
  "update_event",
574
641
  "get_availability",
575
642
  "find_meeting_time",
643
+ "create_connection_link",
644
+ "get_connection_link",
645
+ "cancel_connection_link",
576
646
  "cancel_event",
577
647
  "confirm_event",
578
648
  "release_event",
@@ -608,6 +678,10 @@ var HOSTED_API_MCP_TOOL_NAMES = [
608
678
  "get_calendar",
609
679
  "update_calendar",
610
680
  "delete_calendar",
681
+ "create_booking_page",
682
+ "list_booking_pages",
683
+ "get_booking_page",
684
+ "delete_booking_page",
611
685
  "get_usage",
612
686
  "get_audit_log",
613
687
  "accept_terms"
@@ -649,6 +723,35 @@ var TOOL_DEFINITIONS = [
649
723
  annotations: { title: "Delete Calendar", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
650
724
  execute: createExecutor(deleteCalendar)
651
725
  },
726
+ // ── Booking pages ──────────────────────────────────────────────
727
+ {
728
+ name: "create_booking_page",
729
+ description: "Create a public booking page (Calendly-style scheduling link) for a calendar. Returns a booking_url to send to a human; when they pick a slot, a confirmed event is created on the calendar and an event.created webhook fires with a booking_page_id field. Set availability_constraints to restrict to weekly working hours; existing calendar events always block slots.",
730
+ schema: CreateBookingPageSchema,
731
+ annotations: { title: "Create Booking Page", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
732
+ execute: createExecutor(createBookingPage)
733
+ },
734
+ {
735
+ name: "list_booking_pages",
736
+ description: "List booking pages in the org. Agent-scoped keys see only pages on their own agent's calendars.",
737
+ schema: ListBookingPagesSchema,
738
+ annotations: { title: "List Booking Pages", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
739
+ execute: createExecutor(listBookingPages)
740
+ },
741
+ {
742
+ name: "get_booking_page",
743
+ description: "Fetch a single booking page by ID, including its public booking_url and settings.",
744
+ schema: GetBookingPageSchema,
745
+ annotations: { title: "Get Booking Page", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
746
+ execute: createExecutor(getBookingPage)
747
+ },
748
+ {
749
+ name: "delete_booking_page",
750
+ description: "Delete (deactivate) a booking page. Its hosted URL stops resolving; already-booked events are unaffected.",
751
+ schema: DeleteBookingPageSchema,
752
+ annotations: { title: "Delete Booking Page", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
753
+ execute: createExecutor(deleteBookingPage)
754
+ },
652
755
  // ── Events ─────────────────────────────────────────────────────
653
756
  {
654
757
  name: "list_events",
@@ -738,18 +841,39 @@ var TOOL_DEFINITIONS = [
738
841
  // ── Availability ───────────────────────────────────────────────
739
842
  {
740
843
  name: "get_availability",
741
- description: "Check when a single agent is free within a time range. Accepts `start`/`end` (preferred \u2014 matches the underlying availability service) or `start_time`/`end_time` (aliases that match the REST events schema).",
844
+ description: "Check when a single agent is free across Chronary and authorized human calendars. This tool is fail-closed: always inspect availability_state and warnings before using slots.",
742
845
  schema: GetAvailabilitySchema,
743
846
  annotations: { title: "Get Availability", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
744
847
  execute: createExecutor(getAvailability)
745
848
  },
746
849
  {
747
850
  name: "find_meeting_time",
748
- description: "Find time slots when multiple agents are all free simultaneously. Accepts `agents`/`start`/`end` (preferred \u2014 matches the availability service) or `agent_ids`/`start_time`/`end_time` (aliases that match the REST/scheduling-proposal naming).",
851
+ description: "Find time when multiple agents are free across Chronary and their authorized human calendars. This tool is fail-closed: always inspect availability_state and warnings before using slots.",
749
852
  schema: FindMeetingTimeSchema,
750
853
  annotations: { title: "Find Meeting Time", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
751
854
  execute: createExecutor(findMeetingTime)
752
855
  },
856
+ {
857
+ name: "create_connection_link",
858
+ description: "Request human setup of Google Calendar or Microsoft Outlook for a Chronary calendar. Give setup_url to a human; agents never receive provider credentials or event data. The secret URL is returned only once.",
859
+ schema: CreateConnectionLinkSchema,
860
+ annotations: { title: "Create Human Calendar Setup Link", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
861
+ execute: createExecutor(createConnectionLink)
862
+ },
863
+ {
864
+ name: "get_connection_link",
865
+ description: "Poll provider-neutral human-calendar setup status. The bearer setup URL and provider data are never returned by polling.",
866
+ schema: GetConnectionLinkSchema,
867
+ annotations: { title: "Get Human Calendar Setup Status", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
868
+ execute: createExecutor(getConnectionLink)
869
+ },
870
+ {
871
+ name: "cancel_connection_link",
872
+ description: "Cancel a pending human-calendar setup request and invalidate its setup URL.",
873
+ schema: CancelConnectionLinkSchema,
874
+ annotations: { title: "Cancel Human Calendar Setup Link", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
875
+ execute: createExecutor(cancelConnectionLink)
876
+ },
753
877
  // ── Calendar context ───────────────────────────────────────────
754
878
  {
755
879
  name: "get_calendar_context",