@chronary/toolkit 0.1.2 → 1.0.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/index.cjs CHANGED
@@ -41,44 +41,92 @@ var TOOL_NAMES = [
41
41
  "get_event",
42
42
  "create_event",
43
43
  "update_event",
44
- "delete_event",
45
- "check_availability",
44
+ "cancel_event",
45
+ "confirm_event",
46
+ "release_event",
47
+ "create_agent",
48
+ "list_agents",
49
+ "get_agent",
50
+ "update_agent",
51
+ "delete_agent",
52
+ "get_availability",
53
+ "find_meeting_time",
54
+ "get_calendar_context",
55
+ "create_proposal",
56
+ "list_proposals",
57
+ "get_proposal",
58
+ "respond_to_proposal",
59
+ "resolve_proposal",
60
+ "cancel_proposal",
61
+ "set_availability_rules",
62
+ "get_availability_rules",
63
+ "clear_availability_rules",
46
64
  "list_webhooks",
47
65
  "get_webhook",
48
66
  "create_webhook",
49
67
  "update_webhook",
50
68
  "delete_webhook",
69
+ "list_webhook_deliveries",
51
70
  "list_ical_subscriptions",
52
71
  "get_ical_subscription",
53
- "create_ical_subscription",
72
+ "subscribe_ical",
54
73
  "update_ical_subscription",
55
74
  "delete_ical_subscription",
56
75
  "sync_ical_subscription",
76
+ "create_scoped_key",
77
+ "list_scoped_keys",
78
+ "revoke_scoped_key",
79
+ "get_audit_log",
80
+ "accept_terms",
57
81
  "get_usage"
58
82
  ];
59
83
 
60
84
  // src/schemas.ts
61
85
  var schemas_exports = {};
62
86
  __export(schemas_exports, {
63
- CheckAvailabilitySchema: () => CheckAvailabilitySchema,
87
+ AcceptTermsSchema: () => AcceptTermsSchema,
88
+ CancelEventSchema: () => CancelEventSchema,
89
+ CancelProposalSchema: () => CancelProposalSchema,
90
+ ClearAvailabilityRulesSchema: () => ClearAvailabilityRulesSchema,
91
+ ConfirmEventSchema: () => ConfirmEventSchema,
92
+ CreateAgentSchema: () => CreateAgentSchema,
64
93
  CreateCalendarSchema: () => CreateCalendarSchema,
65
94
  CreateEventSchema: () => CreateEventSchema,
66
- CreateICalSubscriptionSchema: () => CreateICalSubscriptionSchema,
95
+ CreateProposalSchema: () => CreateProposalSchema,
96
+ CreateScopedKeySchema: () => CreateScopedKeySchema,
67
97
  CreateWebhookSchema: () => CreateWebhookSchema,
98
+ DeleteAgentSchema: () => DeleteAgentSchema,
68
99
  DeleteCalendarSchema: () => DeleteCalendarSchema,
69
- DeleteEventSchema: () => DeleteEventSchema,
70
100
  DeleteICalSubscriptionSchema: () => DeleteICalSubscriptionSchema,
71
101
  DeleteWebhookSchema: () => DeleteWebhookSchema,
102
+ FindMeetingTimeSchema: () => FindMeetingTimeSchema,
103
+ GetAgentSchema: () => GetAgentSchema,
104
+ GetAuditLogSchema: () => GetAuditLogSchema,
105
+ GetAvailabilityRulesSchema: () => GetAvailabilityRulesSchema,
106
+ GetAvailabilitySchema: () => GetAvailabilitySchema,
107
+ GetCalendarContextSchema: () => GetCalendarContextSchema,
72
108
  GetCalendarSchema: () => GetCalendarSchema,
73
109
  GetEventSchema: () => GetEventSchema,
74
110
  GetICalSubscriptionSchema: () => GetICalSubscriptionSchema,
111
+ GetProposalSchema: () => GetProposalSchema,
75
112
  GetUsageSchema: () => GetUsageSchema,
76
113
  GetWebhookSchema: () => GetWebhookSchema,
114
+ ListAgentsSchema: () => ListAgentsSchema,
77
115
  ListCalendarsSchema: () => ListCalendarsSchema,
78
116
  ListEventsSchema: () => ListEventsSchema,
79
117
  ListICalSubscriptionsSchema: () => ListICalSubscriptionsSchema,
118
+ ListProposalsSchema: () => ListProposalsSchema,
119
+ ListScopedKeysSchema: () => ListScopedKeysSchema,
120
+ ListWebhookDeliveriesSchema: () => ListWebhookDeliveriesSchema,
80
121
  ListWebhooksSchema: () => ListWebhooksSchema,
122
+ ReleaseEventSchema: () => ReleaseEventSchema,
123
+ ResolveProposalSchema: () => ResolveProposalSchema,
124
+ RespondToProposalSchema: () => RespondToProposalSchema,
125
+ RevokeScopedKeySchema: () => RevokeScopedKeySchema,
126
+ SetAvailabilityRulesSchema: () => SetAvailabilityRulesSchema,
127
+ SubscribeICalSchema: () => SubscribeICalSchema,
81
128
  SyncICalSubscriptionSchema: () => SyncICalSubscriptionSchema,
129
+ UpdateAgentSchema: () => UpdateAgentSchema,
82
130
  UpdateCalendarSchema: () => UpdateCalendarSchema,
83
131
  UpdateEventSchema: () => UpdateEventSchema,
84
132
  UpdateICalSubscriptionSchema: () => UpdateICalSubscriptionSchema,
@@ -98,13 +146,15 @@ var CreateCalendarSchema = import_zod.z.object({
98
146
  name: import_zod.z.string().describe("Calendar name"),
99
147
  timezone: import_zod.z.string().describe('IANA timezone (e.g., "America/New_York")'),
100
148
  agent_id: import_zod.z.string().optional().describe("Agent ID to associate the calendar with"),
101
- metadata: import_zod.z.record(import_zod.z.unknown()).optional().describe("Arbitrary key-value metadata")
149
+ default_reminders: import_zod.z.array(import_zod.z.number().int().min(1).max(40320)).max(5).nullable().optional().describe("Default reminder offsets in minutes before start, inherited by events that don't set their own (e.g. [10, 1440]). null/omit = system default (10 min); [] = no reminders. Max 5, each 1\u201340320."),
150
+ metadata: import_zod.z.record(import_zod.z.string(), import_zod.z.unknown()).optional().describe("Arbitrary key-value metadata")
102
151
  });
103
152
  var UpdateCalendarSchema = import_zod.z.object({
104
153
  calendar_id: import_zod.z.string().describe("The calendar ID to update"),
105
154
  name: import_zod.z.string().optional().describe("New calendar name"),
106
155
  timezone: import_zod.z.string().optional().describe("New IANA timezone"),
107
- metadata: import_zod.z.record(import_zod.z.unknown()).optional().describe("Updated metadata")
156
+ default_reminders: import_zod.z.array(import_zod.z.number().int().min(1).max(40320)).max(5).nullable().optional().describe("New default reminder offsets in minutes before start. null = system default (10 min); [] = no reminders. Max 5, each 1\u201340320."),
157
+ metadata: import_zod.z.record(import_zod.z.string(), import_zod.z.unknown()).optional().describe("Updated metadata")
108
158
  });
109
159
  var DeleteCalendarSchema = import_zod.z.object({
110
160
  calendar_id: import_zod.z.string().describe("The calendar ID to delete")
@@ -131,7 +181,8 @@ var CreateEventSchema = import_zod.z.object({
131
181
  description: import_zod.z.string().optional().describe("Event description"),
132
182
  all_day: import_zod.z.boolean().optional().describe("Whether this is an all-day event"),
133
183
  status: import_zod.z.enum(["confirmed", "tentative", "cancelled"]).optional().describe('Event status (default "confirmed")'),
134
- metadata: import_zod.z.record(import_zod.z.unknown()).optional().describe("Arbitrary key-value metadata")
184
+ reminders: import_zod.z.array(import_zod.z.number().int().min(1).max(40320)).max(5).nullable().optional().describe("Reminder offsets in minutes before start (e.g. [10, 1440]). Each fires an event.reminder webhook. null/omit = inherit calendar default (then 10 min); [] = no reminders. Max 5, each 1\u201340320."),
185
+ metadata: import_zod.z.record(import_zod.z.string(), import_zod.z.unknown()).optional().describe("Arbitrary key-value metadata")
135
186
  });
136
187
  var UpdateEventSchema = import_zod.z.object({
137
188
  calendar_id: import_zod.z.string().describe("Calendar ID the event belongs to"),
@@ -142,20 +193,145 @@ var UpdateEventSchema = import_zod.z.object({
142
193
  end_time: import_zod.z.string().optional().describe("New end time in ISO 8601 format"),
143
194
  all_day: import_zod.z.boolean().optional().describe("Whether this is an all-day event"),
144
195
  status: import_zod.z.enum(["confirmed", "tentative", "cancelled"]).optional().describe("New event status"),
145
- metadata: import_zod.z.record(import_zod.z.unknown()).optional().describe("Updated metadata")
196
+ reminders: import_zod.z.array(import_zod.z.number().int().min(1).max(40320)).max(5).nullable().optional().describe("New reminder offsets in minutes before start. null = inherit calendar default; [] = no reminders. Max 5, each 1\u201340320."),
197
+ metadata: import_zod.z.record(import_zod.z.string(), import_zod.z.unknown()).optional().describe("Updated metadata")
146
198
  });
147
- var DeleteEventSchema = import_zod.z.object({
148
- calendar_id: import_zod.z.string().describe("Calendar ID the event belongs to"),
149
- event_id: import_zod.z.string().describe("The event ID to delete")
150
- });
151
- var CheckAvailabilitySchema = import_zod.z.object({
152
- agents: import_zod.z.array(import_zod.z.string()).min(1).describe("Agent IDs to check availability for"),
153
- start: import_zod.z.string().describe("Start of time range in ISO 8601 format"),
154
- end: import_zod.z.string().describe("End of time range in ISO 8601 format"),
155
- slot_duration: import_zod.z.enum(["15m", "30m", "45m", "1h", "2h"]).optional().describe('Duration of availability slots (default "30m")'),
156
- calendars: import_zod.z.array(import_zod.z.string()).optional().describe("Specific calendar IDs to check (default: all agent calendars)"),
199
+ var CancelEventSchema = import_zod.z.object({
200
+ calendar_id: import_zod.z.string().describe("Calendar ID that owns the event"),
201
+ event_id: import_zod.z.string().describe("Event ID to cancel")
202
+ });
203
+ var ConfirmEventSchema = import_zod.z.object({
204
+ event_id: import_zod.z.string().describe("Event ID of the hold to confirm")
205
+ });
206
+ var ReleaseEventSchema = import_zod.z.object({
207
+ event_id: import_zod.z.string().describe("Event ID of the hold to release")
208
+ });
209
+ var CreateAgentSchema = import_zod.z.object({
210
+ name: import_zod.z.string().min(1).max(255).describe("Display name for the agent"),
211
+ type: import_zod.z.enum(["ai", "human", "resource"]).describe("Agent type"),
212
+ description: import_zod.z.string().optional().describe("Optional description"),
213
+ metadata: import_zod.z.record(import_zod.z.string(), import_zod.z.unknown()).optional().describe("Arbitrary key-value metadata")
214
+ });
215
+ var ListAgentsSchema = import_zod.z.object({
216
+ type: import_zod.z.enum(["ai", "human", "resource"]).optional().describe("Filter by agent type"),
217
+ status: import_zod.z.enum(["active", "paused", "decommissioned"]).optional().describe("Filter by status"),
218
+ limit: import_zod.z.number().int().min(1).max(200).optional().describe("Max results per page (default 50)"),
219
+ offset: import_zod.z.number().int().min(0).optional().describe("Pagination offset (default 0)")
220
+ });
221
+ var GetAgentSchema = import_zod.z.object({
222
+ agent_id: import_zod.z.string().describe("Agent ID to fetch")
223
+ });
224
+ var UpdateAgentSchema = import_zod.z.object({
225
+ agent_id: import_zod.z.string().describe("Agent ID to update"),
226
+ name: import_zod.z.string().min(1).max(255).optional().describe("New display name"),
227
+ description: import_zod.z.string().nullable().optional().describe("New description (null to clear)"),
228
+ metadata: import_zod.z.record(import_zod.z.string(), import_zod.z.unknown()).optional().describe("Arbitrary metadata (max 16KB)"),
229
+ status: import_zod.z.enum(["active", "paused"]).optional().describe("Operational status")
230
+ });
231
+ var DeleteAgentSchema = import_zod.z.object({
232
+ agent_id: import_zod.z.string().describe("Agent ID to decommission")
233
+ });
234
+ var GetAvailabilitySchema = import_zod.z.object({
235
+ agent_id: import_zod.z.string().describe("Agent ID to check availability for"),
236
+ start: import_zod.z.string().describe("Range start (ISO 8601)"),
237
+ end: import_zod.z.string().describe("Range end (ISO 8601)"),
238
+ slot_duration: import_zod.z.enum(["15m", "30m", "45m", "1h", "2h"]).optional().describe('Minimum slot duration required (default "30m")'),
157
239
  include_busy: import_zod.z.boolean().optional().describe("Include busy blocks in response")
158
240
  });
241
+ var FindMeetingTimeSchema = import_zod.z.object({
242
+ agents: import_zod.z.array(import_zod.z.string()).min(1).describe("Array of agent IDs to find common free time for. All agents must be free during the returned slots."),
243
+ start: import_zod.z.string().describe("Search range start (ISO 8601)"),
244
+ end: import_zod.z.string().describe("Search range end (ISO 8601)"),
245
+ slot_duration: import_zod.z.enum(["15m", "30m", "45m", "1h", "2h"]).optional().describe('Minimum slot duration required (default "30m")'),
246
+ calendars: import_zod.z.array(import_zod.z.string()).optional().describe("Additional shared calendar IDs to treat as busy"),
247
+ include_busy: import_zod.z.boolean().optional().describe("Include per-agent busy blocks in response")
248
+ });
249
+ var GetCalendarContextSchema = import_zod.z.object({
250
+ calendar_id: import_zod.z.string().describe("Calendar ID")
251
+ });
252
+ var proposalSlotSchema = import_zod.z.object({
253
+ start_time: import_zod.z.string().describe("Slot start (ISO 8601)"),
254
+ end_time: import_zod.z.string().describe("Slot end (ISO 8601)"),
255
+ weight: import_zod.z.number().min(0).max(10).optional().describe("Preference weight (default 1.0)"),
256
+ calendar_id: import_zod.z.string().optional().describe("Override calendar for this slot")
257
+ });
258
+ var CreateProposalSchema = import_zod.z.object({
259
+ title: import_zod.z.string().min(1).max(500).describe("Short description of what the meeting is about"),
260
+ description: import_zod.z.string().max(5e3).optional().describe("Longer context/agenda"),
261
+ organizer_agent_id: import_zod.z.string().describe("Agent ID proposing the meeting"),
262
+ participant_agent_ids: import_zod.z.array(import_zod.z.string()).min(1).max(50).describe("Agent IDs invited to respond"),
263
+ calendar_id: import_zod.z.string().describe("Calendar the resolved event will be created on"),
264
+ slots: import_zod.z.array(proposalSlotSchema).min(1).max(20).describe("Candidate time slots (up to 20)"),
265
+ expires_at: import_zod.z.string().optional().describe("Auto-cancel cutoff if unresolved (ISO 8601)")
266
+ });
267
+ var ListProposalsSchema = import_zod.z.object({
268
+ status: import_zod.z.enum(["pending", "confirmed", "expired", "cancelled"]).optional().describe("Filter by proposal status"),
269
+ organizer_agent_id: import_zod.z.string().optional().describe("Filter by organizer agent"),
270
+ limit: import_zod.z.number().int().min(1).max(200).optional().describe("Max results (default 50)"),
271
+ offset: import_zod.z.number().int().min(0).optional().describe("Pagination offset (default 0)")
272
+ });
273
+ var GetProposalSchema = import_zod.z.object({
274
+ proposal_id: import_zod.z.string().describe("Proposal to fetch")
275
+ });
276
+ var RespondToProposalSchema = import_zod.z.object({
277
+ proposal_id: import_zod.z.string().describe("Proposal to respond to"),
278
+ agent_id: import_zod.z.string().describe("Participant agent responding"),
279
+ response: import_zod.z.enum(["accept", "decline", "counter"]).describe("Decision from this agent"),
280
+ selected_slot_id: import_zod.z.string().optional().describe('Required when response is "accept"'),
281
+ counter_slots: import_zod.z.array(proposalSlotSchema).max(20).optional().describe('Alternative slots when response is "counter"'),
282
+ message: import_zod.z.string().max(2e3).optional().describe("Optional note for the organizer")
283
+ });
284
+ var ResolveProposalSchema = import_zod.z.object({
285
+ proposal_id: import_zod.z.string().describe("Proposal to resolve")
286
+ });
287
+ var CancelProposalSchema = import_zod.z.object({
288
+ proposal_id: import_zod.z.string().describe("Proposal to cancel")
289
+ });
290
+ var workingHoursDaySchema = import_zod.z.object({
291
+ start: import_zod.z.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/, "must be HH:MM in 24-hour time"),
292
+ end: import_zod.z.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/, "must be HH:MM in 24-hour time")
293
+ });
294
+ var workingHoursSchema = import_zod.z.object({
295
+ mon: workingHoursDaySchema.optional(),
296
+ tue: workingHoursDaySchema.optional(),
297
+ wed: workingHoursDaySchema.optional(),
298
+ thu: workingHoursDaySchema.optional(),
299
+ fri: workingHoursDaySchema.optional(),
300
+ sat: workingHoursDaySchema.optional(),
301
+ sun: workingHoursDaySchema.optional()
302
+ }).nullable();
303
+ var SetAvailabilityRulesSchema = import_zod.z.object({
304
+ calendar_id: import_zod.z.string().describe("Calendar to configure"),
305
+ buffer_before_minutes: import_zod.z.number().int().min(0).max(120).optional().describe("Minutes of buffer before each event (0\u2013120)"),
306
+ buffer_after_minutes: import_zod.z.number().int().min(0).max(120).optional().describe("Minutes of buffer after each event (0\u2013120)"),
307
+ working_hours: workingHoursSchema.optional().describe("Per-day working hours map in the calendar's timezone; omit keys for off-days. Pass null to remove any working-hours constraint."),
308
+ timezone: import_zod.z.string().min(1).max(64).optional().describe("IANA timezone used to interpret working_hours (e.g. America/New_York)")
309
+ });
310
+ var GetAvailabilityRulesSchema = import_zod.z.object({
311
+ calendar_id: import_zod.z.string().describe("Calendar to read")
312
+ });
313
+ var ClearAvailabilityRulesSchema = import_zod.z.object({
314
+ calendar_id: import_zod.z.string().describe("Calendar whose rules should be cleared")
315
+ });
316
+ var CreateScopedKeySchema = import_zod.z.object({
317
+ agent_id: import_zod.z.string().regex(/^agt_/).describe("Agent ID this key is scoped to"),
318
+ label: import_zod.z.string().min(1).max(100).optional().describe("Human-readable label for the key")
319
+ });
320
+ var ListScopedKeysSchema = import_zod.z.object({});
321
+ var RevokeScopedKeySchema = import_zod.z.object({
322
+ key_id: import_zod.z.string().describe("ID of the scoped key to revoke")
323
+ });
324
+ var GetAuditLogSchema = import_zod.z.object({
325
+ from: import_zod.z.string().optional().describe("Start of the window (ISO 8601). Silently clamped to the plan retention window if older."),
326
+ to: import_zod.z.string().optional().describe("End of the window (ISO 8601)"),
327
+ action: import_zod.z.string().min(1).max(64).optional().describe("Filter by action name (e.g. event.created)"),
328
+ actor_key_prefix: import_zod.z.string().min(1).max(32).optional().describe("Filter by the API key prefix that performed the action"),
329
+ cursor: import_zod.z.string().min(1).max(256).optional().describe("Opaque pagination cursor from a previous response"),
330
+ limit: import_zod.z.number().int().min(1).max(200).optional().describe("Max results to return (default 50)")
331
+ });
332
+ var AcceptTermsSchema = import_zod.z.object({
333
+ tos_version: import_zod.z.string().min(1).describe("The terms-of-service version to accept; must match the current version")
334
+ });
159
335
  var ListWebhooksSchema = import_zod.z.object({
160
336
  limit: import_zod.z.number().int().min(1).max(100).optional().describe("Max results per page (default 20)"),
161
337
  offset: import_zod.z.number().int().min(0).optional().describe("Pagination offset (default 0)")
@@ -185,11 +361,18 @@ var ListICalSubscriptionsSchema = import_zod.z.object({
185
361
  var GetICalSubscriptionSchema = import_zod.z.object({
186
362
  subscription_id: import_zod.z.string().describe("The iCal subscription ID to retrieve")
187
363
  });
188
- var CreateICalSubscriptionSchema = import_zod.z.object({
189
- agent_id: import_zod.z.string().describe("Agent ID to create the subscription for"),
190
- calendar_id: import_zod.z.string().describe("Calendar ID to import events into"),
191
- url: import_zod.z.string().describe("HTTPS URL of the iCal feed to subscribe to"),
192
- label: import_zod.z.string().optional().describe("Human-readable label for the subscription")
364
+ var SubscribeICalSchema = import_zod.z.object({
365
+ agent_id: import_zod.z.string().describe("Agent ID that will own this subscription"),
366
+ calendar_id: import_zod.z.string().describe("Calendar ID to sync external events into"),
367
+ url: import_zod.z.string().url().describe("HTTPS URL of the iCal feed (.ics) to subscribe to"),
368
+ label: import_zod.z.string().optional().describe("Optional label for this subscription")
369
+ });
370
+ var ListWebhookDeliveriesSchema = import_zod.z.object({
371
+ webhook_id: import_zod.z.string().describe("Webhook subscription whose deliveries to list"),
372
+ limit: import_zod.z.number().int().min(1).max(100).optional().describe("Max results to return (default 20)"),
373
+ offset: import_zod.z.number().int().min(0).optional().describe("Pagination offset (default 0)"),
374
+ status: import_zod.z.enum(["pending", "delivered", "failed"]).optional().describe("Filter to a single delivery status"),
375
+ include_payload: import_zod.z.boolean().optional().describe("Include the full event payload sent on each delivery")
193
376
  });
194
377
  var UpdateICalSubscriptionSchema = import_zod.z.object({
195
378
  subscription_id: import_zod.z.string().describe("The iCal subscription ID to update"),
@@ -242,6 +425,7 @@ var createCalendar = safeFunc(async (ctx) => {
242
425
  name: params.name,
243
426
  timezone: params.timezone,
244
427
  agentId: params.agent_id,
428
+ default_reminders: params.default_reminders,
245
429
  metadata: params.metadata
246
430
  });
247
431
  });
@@ -280,13 +464,99 @@ var updateEvent = safeFunc(async (ctx) => {
280
464
  const { calendar_id, event_id, ...updates } = params;
281
465
  return client.events.update(calendar_id, event_id, updates);
282
466
  });
283
- var deleteEvent = safeFunc(async (ctx) => {
467
+ var cancelEvent = safeFunc(async (ctx) => {
284
468
  await ctx.client.events.delete(ctx.params.calendar_id, ctx.params.event_id);
285
469
  return void 0;
286
470
  });
287
- var checkAvailability = safeFunc(async (ctx) => {
471
+ var confirmEvent = safeFunc(async (ctx) => {
472
+ return ctx.client.events.confirm(ctx.params.event_id);
473
+ });
474
+ var releaseEvent = safeFunc(async (ctx) => {
475
+ return ctx.client.events.release(ctx.params.event_id);
476
+ });
477
+ var createAgent = safeFunc(async (ctx) => {
478
+ return ctx.client.agents.create(ctx.params);
479
+ });
480
+ var listAgents = safeFunc(async (ctx) => {
481
+ const { client, params } = ctx;
482
+ const iter = client.agents.list({ type: params.type, status: params.status, limit: params.limit });
483
+ return fetchPage(iter, params.offset, params.limit);
484
+ });
485
+ var getAgent = safeFunc(async (ctx) => {
486
+ return ctx.client.agents.get(ctx.params.agent_id);
487
+ });
488
+ var updateAgent = safeFunc(async (ctx) => {
489
+ const { client, params } = ctx;
490
+ const { agent_id, ...updates } = params;
491
+ return client.agents.update(agent_id, updates);
492
+ });
493
+ var deleteAgent = safeFunc(async (ctx) => {
494
+ await ctx.client.agents.delete(ctx.params.agent_id);
495
+ return void 0;
496
+ });
497
+ var getAvailability = safeFunc(async (ctx) => {
498
+ const { client, params } = ctx;
499
+ return client.availability.forAgent(params.agent_id, {
500
+ start: params.start,
501
+ end: params.end,
502
+ slot_duration: params.slot_duration,
503
+ include_busy: params.include_busy
504
+ });
505
+ });
506
+ var findMeetingTime = safeFunc(async (ctx) => {
288
507
  return ctx.client.availability.check(ctx.params);
289
508
  });
509
+ var getCalendarContext = safeFunc(async (ctx) => {
510
+ return ctx.client.calendars.getContext(ctx.params.calendar_id);
511
+ });
512
+ var createProposal = safeFunc(async (ctx) => {
513
+ return ctx.client.scheduling.create(ctx.params);
514
+ });
515
+ var listProposals = safeFunc(async (ctx) => {
516
+ const { client, params } = ctx;
517
+ const iter = client.scheduling.list({
518
+ status: params.status,
519
+ organizer_agent_id: params.organizer_agent_id,
520
+ limit: params.limit
521
+ });
522
+ return fetchPage(iter, params.offset, params.limit);
523
+ });
524
+ var getProposal = safeFunc(async (ctx) => {
525
+ return ctx.client.scheduling.get(ctx.params.proposal_id);
526
+ });
527
+ var respondToProposal = safeFunc(async (ctx) => {
528
+ const { client, params } = ctx;
529
+ const { proposal_id, ...body } = params;
530
+ return client.scheduling.respond(proposal_id, body);
531
+ });
532
+ var resolveProposal = safeFunc(async (ctx) => {
533
+ return ctx.client.scheduling.resolve(ctx.params.proposal_id);
534
+ });
535
+ var cancelProposal = safeFunc(async (ctx) => {
536
+ return ctx.client.scheduling.cancel(ctx.params.proposal_id);
537
+ });
538
+ var setAvailabilityRules = safeFunc(async (ctx) => {
539
+ const { client, params } = ctx;
540
+ const { calendar_id, ...rules } = params;
541
+ return client.calendars.setAvailabilityRules(calendar_id, rules);
542
+ });
543
+ var getAvailabilityRules = safeFunc(async (ctx) => {
544
+ return ctx.client.calendars.getAvailabilityRules(ctx.params.calendar_id);
545
+ });
546
+ var clearAvailabilityRules = safeFunc(async (ctx) => {
547
+ await ctx.client.calendars.deleteAvailabilityRules(ctx.params.calendar_id);
548
+ return void 0;
549
+ });
550
+ var createScopedKey = safeFunc(async (ctx) => {
551
+ return ctx.client.keys.create(ctx.params);
552
+ });
553
+ var listScopedKeys = safeFunc(async (ctx) => {
554
+ return ctx.client.keys.list();
555
+ });
556
+ var revokeScopedKey = safeFunc(async (ctx) => {
557
+ await ctx.client.keys.delete(ctx.params.key_id);
558
+ return void 0;
559
+ });
290
560
  var listWebhooks = safeFunc(async (ctx) => {
291
561
  const { client, params } = ctx;
292
562
  const iter = client.webhooks.list({ limit: params.limit });
@@ -307,6 +577,17 @@ var deleteWebhook = safeFunc(async (ctx) => {
307
577
  await ctx.client.webhooks.delete(ctx.params.webhook_id);
308
578
  return void 0;
309
579
  });
580
+ var listWebhookDeliveries = safeFunc(async (ctx) => {
581
+ const { client, params } = ctx;
582
+ const { webhook_id, ...query } = params;
583
+ return client.webhooks.listDeliveries(webhook_id, query);
584
+ });
585
+ var getAuditLog = safeFunc(async (ctx) => {
586
+ return ctx.client.auditLog.list(ctx.params);
587
+ });
588
+ var acceptTerms = safeFunc(async (ctx) => {
589
+ return ctx.client.terms.accept(ctx.params);
590
+ });
310
591
  var listICalSubscriptions = safeFunc(async (ctx) => {
311
592
  const { client, params } = ctx;
312
593
  const iter = client.icalSubscriptions.list({
@@ -319,7 +600,7 @@ var listICalSubscriptions = safeFunc(async (ctx) => {
319
600
  var getICalSubscription = safeFunc(async (ctx) => {
320
601
  return ctx.client.icalSubscriptions.get(ctx.params.subscription_id);
321
602
  });
322
- var createICalSubscription = safeFunc(async (ctx) => {
603
+ var subscribeICal = safeFunc(async (ctx) => {
323
604
  const { client, params } = ctx;
324
605
  const { agent_id, ...subParams } = params;
325
606
  return client.icalSubscriptions.create(agent_id, subParams);
@@ -350,12 +631,19 @@ var HOSTED_API_MCP_TOOL_NAMES = [
350
631
  "create_calendar",
351
632
  "create_event",
352
633
  "list_events",
634
+ "get_event",
635
+ "update_event",
353
636
  "get_availability",
354
637
  "find_meeting_time",
355
638
  "cancel_event",
356
639
  "confirm_event",
357
640
  "release_event",
358
641
  "subscribe_ical",
642
+ "list_ical_subscriptions",
643
+ "get_ical_subscription",
644
+ "update_ical_subscription",
645
+ "delete_ical_subscription",
646
+ "sync_ical_subscription",
359
647
  "get_calendar_context",
360
648
  "create_proposal",
361
649
  "list_proposals",
@@ -365,7 +653,26 @@ var HOSTED_API_MCP_TOOL_NAMES = [
365
653
  "cancel_proposal",
366
654
  "set_availability_rules",
367
655
  "get_availability_rules",
368
- "clear_availability_rules"
656
+ "clear_availability_rules",
657
+ "create_scoped_key",
658
+ "list_scoped_keys",
659
+ "revoke_scoped_key",
660
+ "create_webhook",
661
+ "list_webhooks",
662
+ "get_webhook",
663
+ "update_webhook",
664
+ "delete_webhook",
665
+ "list_webhook_deliveries",
666
+ "get_agent",
667
+ "update_agent",
668
+ "delete_agent",
669
+ "list_calendars",
670
+ "get_calendar",
671
+ "update_calendar",
672
+ "delete_calendar",
673
+ "get_usage",
674
+ "get_audit_log",
675
+ "accept_terms"
369
676
  ];
370
677
  var TOOL_DEFINITIONS = [
371
678
  // ── Calendars ──────────────────────────────────────────────────
@@ -434,19 +741,149 @@ var TOOL_DEFINITIONS = [
434
741
  execute: createExecutor(updateEvent)
435
742
  },
436
743
  {
437
- name: "delete_event",
438
- description: "Delete an event from a calendar. This frees the agent's availability during that time.",
439
- schema: DeleteEventSchema,
440
- annotations: { title: "Delete Event", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
441
- execute: createExecutor(deleteEvent)
744
+ name: "cancel_event",
745
+ description: "Delete or cancel an event from a calendar. The event is marked cancelled and excluded from future availability calculations.",
746
+ schema: CancelEventSchema,
747
+ annotations: { title: "Cancel Event", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
748
+ execute: createExecutor(cancelEvent)
749
+ },
750
+ {
751
+ name: "confirm_event",
752
+ description: 'Promote a held event to a confirmed booking. The event must currently have status="hold" and its hold_expires_at must not have passed.',
753
+ schema: ConfirmEventSchema,
754
+ annotations: { title: "Confirm Event", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
755
+ execute: createExecutor(confirmEvent)
756
+ },
757
+ {
758
+ name: "release_event",
759
+ description: 'Manually release a held event before its hold_expires_at. The event must currently have status="hold". Frees the slot for other agents to book.',
760
+ schema: ReleaseEventSchema,
761
+ annotations: { title: "Release Event", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
762
+ execute: createExecutor(releaseEvent)
763
+ },
764
+ // ── Agents ─────────────────────────────────────────────────────
765
+ {
766
+ name: "create_agent",
767
+ description: "Register your agent (AI assistant, human participant, or resource) with Chronary so it can own calendars, events, and webhooks.",
768
+ schema: CreateAgentSchema,
769
+ annotations: { title: "Create Agent", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
770
+ execute: createExecutor(createAgent)
771
+ },
772
+ {
773
+ name: "list_agents",
774
+ description: "List all agents in your organization. Returns paginated results.",
775
+ schema: ListAgentsSchema,
776
+ annotations: { title: "List Agents", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
777
+ execute: createExecutor(listAgents)
778
+ },
779
+ {
780
+ name: "get_agent",
781
+ description: "Fetch a single agent by ID. An agent represents an AI assistant, human, or shared resource (e.g. a meeting room).",
782
+ schema: GetAgentSchema,
783
+ annotations: { title: "Get Agent", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
784
+ execute: createExecutor(getAgent)
785
+ },
786
+ {
787
+ name: "update_agent",
788
+ description: "Update an agent's name, description, metadata, or status (active/paused). Requires an org-level API key.",
789
+ schema: UpdateAgentSchema,
790
+ annotations: { title: "Update Agent", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
791
+ execute: createExecutor(updateAgent)
792
+ },
793
+ {
794
+ name: "delete_agent",
795
+ description: "Decommission an agent. This marks the agent as decommissioned and revokes all of its scoped API keys. Requires an org-level API key.",
796
+ schema: DeleteAgentSchema,
797
+ annotations: { title: "Delete Agent", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
798
+ execute: createExecutor(deleteAgent)
442
799
  },
443
800
  // ── Availability ───────────────────────────────────────────────
444
801
  {
445
- name: "check_availability",
446
- description: "Check free/busy availability across one or more agents within a time range. Returns available time slots and optionally busy blocks.",
447
- schema: CheckAvailabilitySchema,
448
- annotations: { title: "Check Availability", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
449
- execute: createExecutor(checkAvailability)
802
+ name: "get_availability",
803
+ description: "Check when a single agent is free within a time range. Returns available time slots and optionally busy blocks.",
804
+ schema: GetAvailabilitySchema,
805
+ annotations: { title: "Get Availability", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
806
+ execute: createExecutor(getAvailability)
807
+ },
808
+ {
809
+ name: "find_meeting_time",
810
+ description: "Find time slots when multiple agents are all free simultaneously. All agents must be free during the returned slots.",
811
+ schema: FindMeetingTimeSchema,
812
+ annotations: { title: "Find Meeting Time", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
813
+ execute: createExecutor(findMeetingTime)
814
+ },
815
+ // ── Calendar context ───────────────────────────────────────────
816
+ {
817
+ name: "get_calendar_context",
818
+ description: "Get a calendar's temporal context in a single call: the current event, the next upcoming event, recent past events, a short upcoming window, and the owning agent's status.",
819
+ schema: GetCalendarContextSchema,
820
+ annotations: { title: "Get Calendar Context", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
821
+ execute: createExecutor(getCalendarContext)
822
+ },
823
+ // ── Scheduling proposals ───────────────────────────────────────
824
+ {
825
+ name: "create_proposal",
826
+ description: "Create a scheduling proposal \u2014 send candidate time slots to one or more participant agents so they can accept, decline, or counter-propose. Requires an org-level API key. Pro plan only.",
827
+ schema: CreateProposalSchema,
828
+ annotations: { title: "Create Proposal", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
829
+ execute: createExecutor(createProposal)
830
+ },
831
+ {
832
+ name: "list_proposals",
833
+ description: "List scheduling proposals for the org. Filter by status or organizer_agent_id. Requires an org-level API key.",
834
+ schema: ListProposalsSchema,
835
+ annotations: { title: "List Proposals", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
836
+ execute: createExecutor(listProposals)
837
+ },
838
+ {
839
+ name: "get_proposal",
840
+ description: "Get a scheduling proposal by id, including its slots and per-participant responses. Requires an org-level API key.",
841
+ schema: GetProposalSchema,
842
+ annotations: { title: "Get Proposal", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
843
+ execute: createExecutor(getProposal)
844
+ },
845
+ {
846
+ name: "respond_to_proposal",
847
+ description: "Submit a response (accept / decline / counter) on behalf of one participant agent to an open proposal. Requires an org-level API key. Pro plan only.",
848
+ schema: RespondToProposalSchema,
849
+ annotations: { title: "Respond To Proposal", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
850
+ execute: createExecutor(respondToProposal)
851
+ },
852
+ {
853
+ name: "resolve_proposal",
854
+ description: "Force-resolve an open proposal using responses collected so far. Picks the highest-scoring slot and creates a confirmed calendar event. Requires an org-level API key. Pro plan only.",
855
+ schema: ResolveProposalSchema,
856
+ annotations: { title: "Resolve Proposal", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
857
+ execute: createExecutor(resolveProposal)
858
+ },
859
+ {
860
+ name: "cancel_proposal",
861
+ description: 'Cancel an open proposal. Fires a proposal.cancelled webhook with reason="organizer_cancelled". Requires an org-level API key. Pro plan only.',
862
+ schema: CancelProposalSchema,
863
+ annotations: { title: "Cancel Proposal", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
864
+ execute: createExecutor(cancelProposal)
865
+ },
866
+ // ── Availability rules ─────────────────────────────────────────
867
+ {
868
+ name: "set_availability_rules",
869
+ description: "Set or replace the availability rules on a calendar \u2014 buffer times before/after events and optional per-day working hours. Upsert: overwrites any existing rules.",
870
+ schema: SetAvailabilityRulesSchema,
871
+ annotations: { title: "Set Availability Rules", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
872
+ execute: createExecutor(setAvailabilityRules)
873
+ },
874
+ {
875
+ name: "get_availability_rules",
876
+ description: "Read the buffer times and working-hours rules configured on a calendar. Returns the rules row, or an error if none are set.",
877
+ schema: GetAvailabilityRulesSchema,
878
+ annotations: { title: "Get Availability Rules", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
879
+ execute: createExecutor(getAvailabilityRules)
880
+ },
881
+ {
882
+ name: "clear_availability_rules",
883
+ description: "Remove the availability rules from a calendar, reverting to the default (no buffers, no working-hours mask).",
884
+ schema: ClearAvailabilityRulesSchema,
885
+ annotations: { title: "Clear Availability Rules", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
886
+ execute: createExecutor(clearAvailabilityRules)
450
887
  },
451
888
  // ── Webhooks ───────────────────────────────────────────────────
452
889
  {
@@ -484,6 +921,13 @@ var TOOL_DEFINITIONS = [
484
921
  annotations: { title: "Delete Webhook", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
485
922
  execute: createExecutor(deleteWebhook)
486
923
  },
924
+ {
925
+ name: "list_webhook_deliveries",
926
+ description: "List delivery attempts for a webhook subscription, with per-status counts (pending/delivered/failed). Use this to debug failing deliveries. Requires an org-level API key.",
927
+ schema: ListWebhookDeliveriesSchema,
928
+ annotations: { title: "List Webhook Deliveries", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
929
+ execute: createExecutor(listWebhookDeliveries)
930
+ },
487
931
  // ── iCal Subscriptions ─────────────────────────────────────────
488
932
  {
489
933
  name: "list_ical_subscriptions",
@@ -500,11 +944,11 @@ var TOOL_DEFINITIONS = [
500
944
  execute: createExecutor(getICalSubscription)
501
945
  },
502
946
  {
503
- name: "create_ical_subscription",
504
- description: "Import an external calendar by subscribing to an iCal feed URL. Events are synced every 30 minutes.",
505
- schema: CreateICalSubscriptionSchema,
506
- annotations: { title: "Create iCal Subscription", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
507
- execute: createExecutor(createICalSubscription)
947
+ name: "subscribe_ical",
948
+ description: "Link an external iCal feed (e.g. a human's Google Calendar) to an agent's calendar so external events appear in availability calculations. Events are synced every 30 minutes.",
949
+ schema: SubscribeICalSchema,
950
+ annotations: { title: "Subscribe iCal", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
951
+ execute: createExecutor(subscribeICal)
508
952
  },
509
953
  {
510
954
  name: "update_ical_subscription",
@@ -527,6 +971,44 @@ var TOOL_DEFINITIONS = [
527
971
  annotations: { title: "Sync iCal Subscription", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
528
972
  execute: createExecutor(syncICalSubscription)
529
973
  },
974
+ // ── Scoped keys ────────────────────────────────────────────────
975
+ {
976
+ name: "create_scoped_key",
977
+ description: "Create an agent-scoped API key (chr_ak_*) that can only act on behalf of a single agent. The plaintext key is returned exactly once. Requires an org-level API key.",
978
+ schema: CreateScopedKeySchema,
979
+ annotations: { title: "Create Scoped Key", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
980
+ execute: createExecutor(createScopedKey)
981
+ },
982
+ {
983
+ name: "list_scoped_keys",
984
+ description: "List all live (non-revoked) agent-scoped API keys for this org. Returns key metadata only \u2014 never the plaintext secret. Requires an org-level API key.",
985
+ schema: ListScopedKeysSchema,
986
+ annotations: { title: "List Scoped Keys", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
987
+ execute: createExecutor(listScopedKeys)
988
+ },
989
+ {
990
+ name: "revoke_scoped_key",
991
+ 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.",
992
+ schema: RevokeScopedKeySchema,
993
+ annotations: { title: "Revoke Scoped Key", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
994
+ execute: createExecutor(revokeScopedKey)
995
+ },
996
+ // ── Audit log ──────────────────────────────────────────────────
997
+ {
998
+ name: "get_audit_log",
999
+ description: "List audit-log entries for the calling org \u2014 mutating operations and auth-lifecycle events, newest first. Results are clamped to the plan's retention window. Requires an org-level API key.",
1000
+ schema: GetAuditLogSchema,
1001
+ annotations: { title: "Get Audit Log", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
1002
+ execute: createExecutor(getAuditLog)
1003
+ },
1004
+ // ── Terms ──────────────────────────────────────────────────────
1005
+ {
1006
+ name: "accept_terms",
1007
+ description: "Re-accept the current Chronary terms of service on behalf of the calling org. Use this when responses carry the Chronary-Terms-Upgrade-Required header. Requires an org-level API key.",
1008
+ schema: AcceptTermsSchema,
1009
+ annotations: { title: "Accept Terms", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
1010
+ execute: createExecutor(acceptTerms)
1011
+ },
530
1012
  // ── Usage ──────────────────────────────────────────────────────
531
1013
  {
532
1014
  name: "get_usage",