@chronary/toolkit 1.1.0 → 1.2.1

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/openai.js CHANGED
@@ -28,6 +28,7 @@ var WEBHOOK_EVENT_TYPES = [
28
28
  ];
29
29
  var WEBHOOK_DELIVERY_STATUSES = ["pending", "delivered", "failed"];
30
30
  var ListCalendarsSchema = z.object({
31
+ agent_id: z.string().optional().describe("Filter to calendars owned by this agent. Org keys only \u2014 agent-scoped keys are always limited to their own agent and ignore this."),
31
32
  include: z.enum(["all"]).optional().describe('Pass "all" to include calendars across all agents (org keys only)'),
32
33
  limit: z.number().int().min(1).max(200).default(50).describe("Max results to return"),
33
34
  offset: z.number().int().min(0).default(0).describe("Pagination offset")
@@ -53,15 +54,18 @@ var DeleteCalendarSchema = z.object({
53
54
  calendar_id: z.string().describe("Calendar ID to delete")
54
55
  });
55
56
  var ListEventsSchema = z.object({
56
- calendar_id: z.string().describe("Calendar ID to list events from"),
57
- start_after: z.string().datetime().optional().describe("Filter events starting after this time"),
58
- start_before: z.string().datetime().optional().describe("Filter events starting before this time"),
57
+ calendar_id: z.string().optional().describe("Calendar ID to list events from. Provide this or agent_id."),
58
+ agent_id: z.string().optional().describe("Agent ID to list events for across all of the agent's calendars. Provide this or calendar_id."),
59
+ start_after: z.string().datetime().optional().describe("Only events starting after this ISO 8601 time"),
60
+ start_before: z.string().datetime().optional().describe("Only events starting before this ISO 8601 time"),
61
+ status: z.enum(["confirmed", "tentative", "cancelled", "hold"]).optional().describe("Filter by event status"),
62
+ source: z.enum(["internal", "external_ical"]).optional().describe('Filter by source: "internal" (created via the API) or "external_ical" (synced from an iCal subscription)'),
59
63
  limit: z.number().int().min(1).max(200).default(50).describe("Max results to return"),
60
64
  offset: z.number().int().min(0).default(0).describe("Pagination offset")
61
65
  });
62
66
  var GetEventSchema = z.object({
63
67
  event_id: z.string().describe("Event ID to retrieve"),
64
- calendar_id: z.string().describe("Calendar ID that owns the event. Required \u2014 the SDK is calendar-scoped (unlike the hosted MCP, which can resolve the calendar from event_id).")
68
+ calendar_id: z.string().optional().describe("Calendar ID that owns the event. Optional \u2014 if omitted the calendar is resolved from the event.")
65
69
  });
66
70
  var CreateEventSchema = z.object({
67
71
  calendar_id: z.string().describe("Calendar ID to add the event to"),
@@ -77,7 +81,7 @@ var CreateEventSchema = z.object({
77
81
  });
78
82
  var UpdateEventSchema = z.object({
79
83
  event_id: z.string().describe("Event ID to update"),
80
- calendar_id: z.string().describe("Calendar ID that owns the event. Required \u2014 the SDK is calendar-scoped (unlike the hosted MCP, which can resolve the calendar from event_id)."),
84
+ calendar_id: z.string().optional().describe("Calendar ID that owns the event. Optional \u2014 if omitted the calendar is resolved from the event."),
81
85
  title: z.string().min(1).max(500).optional().describe("New event title"),
82
86
  description: z.string().nullable().optional().describe("New description, or null to clear it"),
83
87
  start_time: z.string().datetime().optional().describe("New start time (ISO 8601)"),
@@ -89,7 +93,7 @@ var UpdateEventSchema = z.object({
89
93
  });
90
94
  var CancelEventSchema = z.object({
91
95
  event_id: z.string().describe("Event ID to cancel"),
92
- calendar_id: z.string().describe("Calendar ID that owns the event. Required \u2014 the SDK is calendar-scoped (unlike the hosted MCP, which can resolve the calendar from event_id).")
96
+ calendar_id: z.string().optional().describe("Calendar ID that owns the event. Optional \u2014 if omitted the calendar is resolved from the event. Matches the asymmetry with confirm_event / release_event which never required this arg.")
93
97
  });
94
98
  var ConfirmEventSchema = z.object({
95
99
  event_id: z.string().describe("Event ID of the hold to confirm")
@@ -186,7 +190,7 @@ var timeOfDay = z.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/, "must be HH:MM in
186
190
  var workingHoursDaySchema = z.object({
187
191
  start: timeOfDay,
188
192
  end: timeOfDay
189
- });
193
+ }).refine((v) => v.end > v.start, "end must be after start").describe("A single day's working hours window");
190
194
  var workingHoursSchema = z.object({
191
195
  mon: workingHoursDaySchema.optional(),
192
196
  tue: workingHoursDaySchema.optional(),
@@ -195,7 +199,7 @@ var workingHoursSchema = z.object({
195
199
  fri: workingHoursDaySchema.optional(),
196
200
  sat: workingHoursDaySchema.optional(),
197
201
  sun: workingHoursDaySchema.optional()
198
- }).nullable();
202
+ }).refine((v) => Object.keys(v).length > 0, "at least one day must be specified").nullable();
199
203
  var SetAvailabilityRulesSchema = z.object({
200
204
  calendar_id: z.string().describe("Calendar to configure"),
201
205
  buffer_before_minutes: z.number().int().min(0).max(120).default(0).describe("Minutes of buffer before each event (0\u2013120)"),
@@ -309,7 +313,7 @@ async function fetchPage(iterator, offset, limit) {
309
313
  }
310
314
  var listCalendars = safeFunc(async (ctx) => {
311
315
  const { client, params } = ctx;
312
- const iter = client.calendars.list({ include: params.include, limit: params.limit });
316
+ const iter = client.calendars.list({ agentId: params.agent_id, include: params.include, limit: params.limit });
313
317
  return fetchPage(iter, params.offset, params.limit);
314
318
  });
315
319
  var getCalendar = safeFunc(async (ctx) => {
@@ -336,16 +340,23 @@ var deleteCalendar = safeFunc(async (ctx) => {
336
340
  });
337
341
  var listEvents = safeFunc(async (ctx) => {
338
342
  const { client, params } = ctx;
343
+ if (!params.calendar_id && !params.agent_id) {
344
+ throw new Error("Provide calendar_id or agent_id");
345
+ }
339
346
  const iter = client.events.list({
340
347
  calendarId: params.calendar_id,
348
+ agentId: params.agent_id,
341
349
  start_after: params.start_after,
342
350
  start_before: params.start_before,
351
+ status: params.status,
352
+ source: params.source,
343
353
  limit: params.limit
344
354
  });
345
355
  return fetchPage(iter, params.offset, params.limit);
346
356
  });
347
357
  var getEvent = safeFunc(async (ctx) => {
348
- return ctx.client.events.get(ctx.params.calendar_id, ctx.params.event_id);
358
+ const { calendar_id, event_id } = ctx.params;
359
+ return calendar_id ? ctx.client.events.get(calendar_id, event_id) : ctx.client.events.getById(event_id);
349
360
  });
350
361
  var createEvent = safeFunc(async (ctx) => {
351
362
  const { client, params } = ctx;
@@ -355,10 +366,15 @@ var createEvent = safeFunc(async (ctx) => {
355
366
  var updateEvent = safeFunc(async (ctx) => {
356
367
  const { client, params } = ctx;
357
368
  const { calendar_id, event_id, ...updates } = params;
358
- return client.events.update(calendar_id, event_id, updates);
369
+ return calendar_id ? client.events.update(calendar_id, event_id, updates) : client.events.updateById(event_id, updates);
359
370
  });
360
371
  var cancelEvent = safeFunc(async (ctx) => {
361
- await ctx.client.events.delete(ctx.params.calendar_id, ctx.params.event_id);
372
+ const { calendar_id, event_id } = ctx.params;
373
+ if (calendar_id) {
374
+ await ctx.client.events.delete(calendar_id, event_id);
375
+ } else {
376
+ await ctx.client.events.deleteById(event_id);
377
+ }
362
378
  return void 0;
363
379
  });
364
380
  var confirmEvent = safeFunc(async (ctx) => {
@@ -626,7 +642,7 @@ var TOOL_DEFINITIONS = [
626
642
  // ── Events ─────────────────────────────────────────────────────
627
643
  {
628
644
  name: "list_events",
629
- description: "List all events on a calendar, including internally created events and externally synced events from iCal subscriptions (e.g. Google Calendar, Outlook). Use start_after and start_before to query a specific time window.",
645
+ description: "List events on a calendar or across an agent's calendars, including internally created events and externally synced events from iCal subscriptions (e.g. Google Calendar, Outlook). Provide `calendar_id` OR `agent_id`. Narrow with `start_after`/`start_before` (time window), `status`, and `source`.",
630
646
  schema: ListEventsSchema,
631
647
  annotations: { title: "List Events", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
632
648
  execute: createExecutor(listEvents)
@@ -900,7 +916,7 @@ var TOOL_DEFINITIONS = [
900
916
  },
901
917
  {
902
918
  name: "revoke_scoped_key",
903
- description: "Revoke an agent-scoped API key by ID. The key stops authenticating immediately and cannot be un-revoked. Requires an org-level API key.",
919
+ description: "Revoke an agent-scoped API key by ID. Revocation is permanent (cannot be un-revoked); the key stops authenticating within about a minute. Requires an org-level API key.",
904
920
  schema: RevokeScopedKeySchema,
905
921
  annotations: { title: "Revoke Scoped Key", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
906
922
  execute: createExecutor(revokeScopedKey)