@chronary/schemas 0.4.0 → 0.7.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/events.d.ts CHANGED
@@ -263,7 +263,7 @@ declare const CrossAgentAvailabilityQuerySchema: z.ZodPipe<z.ZodObject<{
263
263
  duration?: "15m" | "30m" | "45m" | "1h" | "2h" | undefined;
264
264
  slot_duration?: "15m" | "30m" | "45m" | "1h" | "2h" | undefined;
265
265
  }>>;
266
- declare const WEBHOOK_EVENT_TYPES: readonly ["agent.created", "agent.updated", "event.created", "event.updated", "event.deleted", "event.started", "event.ended", "event.reminder", "event.hold_created", "event.hold_expired", "event.hold_released", "event.hold_confirmed", "proposal.created", "proposal.responded", "proposal.confirmed", "proposal.expired", "proposal.cancelled", "webhook.deactivated"];
266
+ declare const WEBHOOK_EVENT_TYPES: readonly ["agent.created", "agent.updated", "event.created", "event.updated", "event.deleted", "event.started", "event.ended", "event.reminder", "event.hold_created", "event.hold_expired", "event.hold_released", "event.hold_confirmed", "proposal.created", "proposal.responded", "proposal.confirmed", "proposal.expired", "proposal.cancelled", "webhook.deactivated", "org.plan_changed", "calendar_connection.reauthorization_required", "usage.threshold_crossed"];
267
267
  type WebhookEventType = (typeof WEBHOOK_EVENT_TYPES)[number];
268
268
  declare const CreateWebhookSchema: z.ZodObject<{
269
269
  url: z.ZodString;
@@ -286,6 +286,9 @@ declare const CreateWebhookSchema: z.ZodObject<{
286
286
  "proposal.expired": "proposal.expired";
287
287
  "proposal.cancelled": "proposal.cancelled";
288
288
  "webhook.deactivated": "webhook.deactivated";
289
+ "org.plan_changed": "org.plan_changed";
290
+ "calendar_connection.reauthorization_required": "calendar_connection.reauthorization_required";
291
+ "usage.threshold_crossed": "usage.threshold_crossed";
289
292
  }>>;
290
293
  }, z.core.$strip>;
291
294
  declare const UpdateWebhookSchema: z.ZodObject<{
@@ -309,6 +312,9 @@ declare const UpdateWebhookSchema: z.ZodObject<{
309
312
  "proposal.expired": "proposal.expired";
310
313
  "proposal.cancelled": "proposal.cancelled";
311
314
  "webhook.deactivated": "webhook.deactivated";
315
+ "org.plan_changed": "org.plan_changed";
316
+ "calendar_connection.reauthorization_required": "calendar_connection.reauthorization_required";
317
+ "usage.threshold_crossed": "usage.threshold_crossed";
312
318
  }>>>;
313
319
  active: z.ZodOptional<z.ZodBoolean>;
314
320
  }, z.core.$strip>;
@@ -316,11 +322,16 @@ declare const ListWebhooksQuerySchema: z.ZodObject<{
316
322
  limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
317
323
  offset: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
318
324
  }, z.core.$strip>;
319
- declare const WEBHOOK_DELIVERY_STATUSES: readonly ["pending", "delivered", "failed"];
325
+ /**
326
+ * `dropped` is a Free-plan delivery the monthly limit stopped: never sent,
327
+ * counted or retried, with `last_error_code: 'quota_exceeded'`.
328
+ */
329
+ declare const WEBHOOK_DELIVERY_STATUSES: readonly ["pending", "delivered", "failed", "dropped"];
320
330
  declare const WebhookDeliveryStatusSchema: z.ZodEnum<{
321
331
  pending: "pending";
322
332
  delivered: "delivered";
323
333
  failed: "failed";
334
+ dropped: "dropped";
324
335
  }>;
325
336
  declare const ListDeliveriesQuerySchema: z.ZodObject<{
326
337
  limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
@@ -329,11 +340,21 @@ declare const ListDeliveriesQuerySchema: z.ZodObject<{
329
340
  pending: "pending";
330
341
  delivered: "delivered";
331
342
  failed: "failed";
343
+ dropped: "dropped";
332
344
  }>>;
333
345
  include_payload: z.ZodPipe<z.ZodOptional<z.ZodEnum<{
334
346
  true: "true";
335
347
  false: "false";
336
348
  }>>, z.ZodTransform<boolean, "true" | "false" | undefined>>;
349
+ event_type: z.ZodOptional<z.ZodString>;
350
+ created_after: z.ZodOptional<z.ZodString>;
351
+ created_before: z.ZodOptional<z.ZodString>;
352
+ delivery_id: z.ZodOptional<z.ZodString>;
353
+ is_test: z.ZodOptional<z.ZodPipe<z.ZodEnum<{
354
+ true: "true";
355
+ false: "false";
356
+ }>, z.ZodTransform<boolean, "true" | "false">>>;
357
+ cursor: z.ZodOptional<z.ZodString>;
337
358
  }, z.core.$strip>;
338
359
  declare const CreateICalSubscriptionSchema: z.ZodObject<{
339
360
  calendar_id: z.ZodString;
@@ -494,9 +515,44 @@ declare const ProposalCancelledPayloadSchema: z.ZodObject<{
494
515
  declare const ProposalExpiredPayloadSchema: z.ZodObject<{
495
516
  proposal_id: z.ZodString;
496
517
  }, z.core.$loose>;
518
+ declare const OrgPlanChangedPayloadSchema: z.ZodObject<{
519
+ org_id: z.ZodString;
520
+ previous_plan: z.ZodString;
521
+ plan: z.ZodString;
522
+ source: z.ZodEnum<{
523
+ subscription: "subscription";
524
+ founding_expiry: "founding_expiry";
525
+ admin_override: "admin_override";
526
+ soft_launch_toggle: "soft_launch_toggle";
527
+ system: "system";
528
+ }>;
529
+ subscription_status: z.ZodNullable<z.ZodString>;
530
+ interval: z.ZodNullable<z.ZodEnum<{
531
+ month: "month";
532
+ year: "year";
533
+ }>>;
534
+ upgrade_request_id: z.ZodNullable<z.ZodString>;
535
+ }, z.core.$loose>;
536
+ declare const CalendarConnectionReauthorizationRequiredPayloadSchema: z.ZodObject<{
537
+ connection_id: z.ZodString;
538
+ provider: z.ZodString;
539
+ reauthorization_reason: z.ZodString;
540
+ impacted_agent_count: z.ZodNumber;
541
+ occurred_at: z.ZodString;
542
+ }, z.core.$loose>;
543
+ declare const UsageThresholdCrossedPayloadSchema: z.ZodObject<{
544
+ metric: z.ZodString;
545
+ used: z.ZodNumber;
546
+ limit: z.ZodNumber;
547
+ threshold_pct: z.ZodNumber;
548
+ period: z.ZodString;
549
+ resets_at: z.ZodString;
550
+ }, z.core.$loose>;
497
551
  declare const WebhookDeactivatedPayloadSchema: z.ZodObject<{
498
552
  webhook_id: z.ZodString;
499
- url: z.ZodString;
553
+ webhook_origin: z.ZodOptional<z.ZodString>;
554
+ webhook_path: z.ZodOptional<z.ZodString>;
555
+ url: z.ZodOptional<z.ZodString>;
500
556
  reason: z.ZodString;
501
557
  }, z.core.$loose>;
502
558
  declare const PAYLOAD_SCHEMAS: {
@@ -579,9 +635,44 @@ declare const PAYLOAD_SCHEMAS: {
579
635
  }, z.core.$loose>;
580
636
  'webhook.deactivated': z.ZodObject<{
581
637
  webhook_id: z.ZodString;
582
- url: z.ZodString;
638
+ webhook_origin: z.ZodOptional<z.ZodString>;
639
+ webhook_path: z.ZodOptional<z.ZodString>;
640
+ url: z.ZodOptional<z.ZodString>;
583
641
  reason: z.ZodString;
584
642
  }, z.core.$loose>;
643
+ 'org.plan_changed': z.ZodObject<{
644
+ org_id: z.ZodString;
645
+ previous_plan: z.ZodString;
646
+ plan: z.ZodString;
647
+ source: z.ZodEnum<{
648
+ subscription: "subscription";
649
+ founding_expiry: "founding_expiry";
650
+ admin_override: "admin_override";
651
+ soft_launch_toggle: "soft_launch_toggle";
652
+ system: "system";
653
+ }>;
654
+ subscription_status: z.ZodNullable<z.ZodString>;
655
+ interval: z.ZodNullable<z.ZodEnum<{
656
+ month: "month";
657
+ year: "year";
658
+ }>>;
659
+ upgrade_request_id: z.ZodNullable<z.ZodString>;
660
+ }, z.core.$loose>;
661
+ 'calendar_connection.reauthorization_required': z.ZodObject<{
662
+ connection_id: z.ZodString;
663
+ provider: z.ZodString;
664
+ reauthorization_reason: z.ZodString;
665
+ impacted_agent_count: z.ZodNumber;
666
+ occurred_at: z.ZodString;
667
+ }, z.core.$loose>;
668
+ 'usage.threshold_crossed': z.ZodObject<{
669
+ metric: z.ZodString;
670
+ used: z.ZodNumber;
671
+ limit: z.ZodNumber;
672
+ threshold_pct: z.ZodNumber;
673
+ period: z.ZodString;
674
+ resets_at: z.ZodString;
675
+ }, z.core.$loose>;
585
676
  };
586
677
 
587
678
  /**
@@ -619,4 +710,5 @@ declare function parseWebhookEvent(eventType: string | null | undefined, body: u
619
710
  error: string;
620
711
  };
621
712
 
622
- export { WorkingHoursSchema as $, type AvailabilityQuery as A, AgentCreatedPayloadSchema, AgentUpdatedPayloadSchema, REMINDER_MAX_MINUTES as B, type CreateAgentInput as C, DEFAULT_EVENT_REMINDERS as D, EVENT_STATUSES as E, EventCreatedPayloadSchema, EventDeletedPayloadSchema, EventEndedPayloadSchema, EventHoldConfirmedPayloadSchema, EventHoldCreatedPayloadSchema, EventHoldExpiredPayloadSchema, EventHoldReleasedPayloadSchema, EventReminderPayloadSchema, EventStartedPayloadSchema, EventUpdatedPayloadSchema, REMINDER_MIN_MINUTES as F, RemindersSchema as G, type RespondToProposalInput as H, RespondToProposalSchema as I, UpdateAgentSchema as J, type UpdateAvailabilityRules as K, type ListAgentsQuery as L, UpdateAvailabilityRulesSchema as M, type UpdateCalendarInput as N, UpdateCalendarSchema as O, type UpdateEventInput as P, ProposalCancelledPayloadSchema, ProposalConfirmedPayloadSchema, ProposalCreatedPayloadSchema, ProposalExpiredPayloadSchema, ProposalRespondedPayloadSchema, UpdateEventSchema as Q, REMINDER_MAX_COUNT as R, type UpdateICalSubscriptionInput as S, UpdateICalSubscriptionSchema as T, type UpdateAgentInput as U, type UpdateWebhookInput as V, UpdateWebhookSchema as W, WEBHOOK_EVENT_TYPES, WebhookDeactivatedPayloadSchema, type WebhookEvent, type WebhookEventType, WEBHOOK_DELIVERY_STATUSES as X, type WebhookDeliveryStatus as Y, WebhookDeliveryStatusSchema as Z, type WorkingHours as _, AvailabilityQuerySchema as a, CreateAgentSchema as b, type CreateCalendarInput as c, CreateCalendarSchema as d, type CreateEventInput as e, CreateEventSchema as f, type CreateICalSubscriptionInput as g, CreateICalSubscriptionSchema as h, type CreateProposalInput as i, CreateProposalSchema as j, type CreateWebhookInput as k, CreateWebhookSchema as l, type CrossAgentAvailabilityQuery as m, CrossAgentAvailabilityQuerySchema as n, type EventStatus as o, ListAgentsQuerySchema as p, parseWebhookEvent, type ListCalendarsQuery as q, ListCalendarsQuerySchema as r, type ListDeliveriesQuery as s, ListDeliveriesQuerySchema as t, type ListEventsQuery as u, ListEventsQuerySchema as v, type ListICalSubscriptionsQuery as w, ListICalSubscriptionsQuerySchema as x, type ListWebhooksQuery as y, ListWebhooksQuerySchema as z };
713
+ export { WorkingHoursSchema as $, AgentCreatedPayloadSchema, AgentUpdatedPayloadSchema, REMINDER_MAX_MINUTES as B, CalendarConnectionReauthorizationRequiredPayloadSchema, DEFAULT_EVENT_REMINDERS as D, EVENT_STATUSES as E, EventCreatedPayloadSchema, EventDeletedPayloadSchema, EventEndedPayloadSchema, EventHoldConfirmedPayloadSchema, EventHoldCreatedPayloadSchema, EventHoldExpiredPayloadSchema, EventHoldReleasedPayloadSchema, EventReminderPayloadSchema, EventStartedPayloadSchema, EventUpdatedPayloadSchema, REMINDER_MIN_MINUTES as F, RemindersSchema as G, RespondToProposalSchema as I, UpdateAgentSchema as J, UpdateAvailabilityRulesSchema as M, UpdateCalendarSchema as O, OrgPlanChangedPayloadSchema, ProposalCancelledPayloadSchema, ProposalConfirmedPayloadSchema, ProposalCreatedPayloadSchema, ProposalExpiredPayloadSchema, ProposalRespondedPayloadSchema, UpdateEventSchema as Q, REMINDER_MAX_COUNT as R, UpdateICalSubscriptionSchema as T, UsageThresholdCrossedPayloadSchema, UpdateWebhookSchema as W, WEBHOOK_EVENT_TYPES, WebhookDeactivatedPayloadSchema, WEBHOOK_DELIVERY_STATUSES as X, WebhookDeliveryStatusSchema as Z, AvailabilityQuerySchema as a, CreateAgentSchema as b, CreateCalendarSchema as d, CreateEventSchema as f, CreateICalSubscriptionSchema as h, CreateProposalSchema as j, CreateWebhookSchema as l, CrossAgentAvailabilityQuerySchema as n, ListAgentsQuerySchema as p, parseWebhookEvent, ListCalendarsQuerySchema as r, ListDeliveriesQuerySchema as t, ListEventsQuerySchema as v, ListICalSubscriptionsQuerySchema as x, ListWebhooksQuerySchema as z };
714
+ export type { AvailabilityQuery as A, CreateAgentInput as C, RespondToProposalInput as H, UpdateAvailabilityRules as K, ListAgentsQuery as L, UpdateCalendarInput as N, UpdateEventInput as P, UpdateICalSubscriptionInput as S, UpdateAgentInput as U, UpdateWebhookInput as V, WebhookEvent, WebhookEventType, WebhookDeliveryStatus as Y, WorkingHours as _, CreateCalendarInput as c, CreateEventInput as e, CreateICalSubscriptionInput as g, CreateProposalInput as i, CreateWebhookInput as k, CrossAgentAvailabilityQuery as m, EventStatus as o, ListCalendarsQuery as q, ListDeliveriesQuery as s, ListEventsQuery as u, ListICalSubscriptionsQuery as w, ListWebhooksQuery as y };
package/dist/events.js CHANGED
@@ -7,12 +7,12 @@ var metadataSchema = z.record(z.string(), z.unknown()).refine((v) => JSON.string
7
7
  var CreateAgentSchema = z.object({
8
8
  name: z.string().min(1).max(255),
9
9
  type: z.enum(["ai", "human", "resource"]),
10
- description: z.string().optional(),
10
+ description: z.string().max(5e3).optional(),
11
11
  metadata: metadataSchema.optional()
12
12
  });
13
13
  var UpdateAgentSchema = z.object({
14
14
  name: z.string().min(1).max(255).optional(),
15
- description: z.string().nullable().optional(),
15
+ description: z.string().max(5e3).nullable().optional(),
16
16
  metadata: metadataSchema.optional(),
17
17
  status: z.enum(["active", "paused"]).optional()
18
18
  }).refine((v) => Object.keys(v).length > 0, "request body must include at least one field");
@@ -29,7 +29,7 @@ var REMINDER_MAX_COUNT = 5;
29
29
  var RemindersSchema = z.array(z.number().int().min(REMINDER_MIN_MINUTES).max(REMINDER_MAX_MINUTES)).max(REMINDER_MAX_COUNT, `at most ${REMINDER_MAX_COUNT} reminders allowed`).transform((arr) => Array.from(new Set(arr)).sort((a, b) => a - b));
30
30
  var CreateCalendarSchema = z.object({
31
31
  name: z.string().min(1).max(255),
32
- timezone: z.string().min(1),
32
+ timezone: z.string().min(1).max(64),
33
33
  agent_status: AgentStatusEnum.optional(),
34
34
  // Default reminders inherited by events on this calendar that don't set their
35
35
  // own. `null` means "use the system default"; `[]` means "no reminders".
@@ -38,7 +38,7 @@ var CreateCalendarSchema = z.object({
38
38
  });
39
39
  var UpdateCalendarSchema = z.object({
40
40
  name: z.string().min(1).max(255).optional(),
41
- timezone: z.string().min(1).optional(),
41
+ timezone: z.string().min(1).max(64).optional(),
42
42
  agent_status: AgentStatusEnum.optional(),
43
43
  default_reminders: RemindersSchema.nullable().optional(),
44
44
  metadata: metadataSchema.optional()
@@ -55,7 +55,7 @@ var CreateEventSchema = z.object({
55
55
  title: z.string().min(1).max(500),
56
56
  start_time: z.string().datetime(),
57
57
  end_time: z.string().datetime(),
58
- description: z.string().optional(),
58
+ description: z.string().max(1e4).optional(),
59
59
  all_day: z.boolean().default(false),
60
60
  status: z.enum(EVENT_STATUSES).default("confirmed"),
61
61
  metadata: metadataSchema.optional(),
@@ -106,7 +106,7 @@ var CreateEventSchema = z.object({
106
106
  });
107
107
  var UpdateEventSchema = z.object({
108
108
  title: z.string().min(1).max(500).optional(),
109
- description: z.string().nullable().optional(),
109
+ description: z.string().max(1e4).nullable().optional(),
110
110
  start_time: z.string().datetime().optional(),
111
111
  end_time: z.string().datetime().optional(),
112
112
  all_day: z.boolean().optional(),
@@ -193,14 +193,17 @@ var WEBHOOK_EVENT_TYPES = [
193
193
  "proposal.confirmed",
194
194
  "proposal.expired",
195
195
  "proposal.cancelled",
196
- "webhook.deactivated"
196
+ "webhook.deactivated",
197
+ "org.plan_changed",
198
+ "calendar_connection.reauthorization_required",
199
+ "usage.threshold_crossed"
197
200
  ];
198
201
  var CreateWebhookSchema = z.object({
199
- url: z.string().url("Must be a valid URL"),
202
+ url: z.string().url("Must be a valid URL").max(2048),
200
203
  events: z.array(z.enum(WEBHOOK_EVENT_TYPES)).min(1, "At least one event type must be specified")
201
204
  });
202
205
  var UpdateWebhookSchema = z.object({
203
- url: z.string().url("Must be a valid URL").optional(),
206
+ url: z.string().url("Must be a valid URL").max(2048).optional(),
204
207
  events: z.array(z.enum(WEBHOOK_EVENT_TYPES)).optional(),
205
208
  active: z.boolean().optional()
206
209
  });
@@ -208,22 +211,37 @@ var ListWebhooksQuerySchema = z.object({
208
211
  limit: z.coerce.number().int().min(1).max(100).default(20),
209
212
  offset: z.coerce.number().int().min(0).default(0)
210
213
  });
211
- var WEBHOOK_DELIVERY_STATUSES = ["pending", "delivered", "failed"];
214
+ var WEBHOOK_DELIVERY_STATUSES = ["pending", "delivered", "failed", "dropped"];
212
215
  var WebhookDeliveryStatusSchema = z.enum(WEBHOOK_DELIVERY_STATUSES);
213
216
  var ListDeliveriesQuerySchema = z.object({
214
217
  limit: z.coerce.number().int().min(1).max(100).default(20),
215
218
  offset: z.coerce.number().int().min(0).default(0),
216
219
  status: WebhookDeliveryStatusSchema.optional(),
217
- include_payload: z.enum(["true", "false"]).optional().transform((v) => v === "true")
220
+ include_payload: z.enum(["true", "false"]).optional().transform((v) => v === "true"),
221
+ /** An exact event type (`event.created`) or a prefix ending in a dot (`event.`). */
222
+ event_type: z.string().max(100).regex(/^[a-z_]+\.(?:[a-z_]+)?$/).optional(),
223
+ created_after: z.string().datetime().optional(),
224
+ created_before: z.string().datetime().optional(),
225
+ delivery_id: z.string().max(100).regex(/^whd_[A-Za-z0-9_-]+$/).optional(),
226
+ is_test: z.enum(["true", "false"]).transform((v) => v === "true").optional(),
227
+ /** The `next_cursor` from the previous page; cannot be combined with a non-zero `offset`. */
228
+ cursor: z.string().min(1).max(1024).optional()
229
+ }).superRefine((v, ctx) => {
230
+ if (v.cursor !== void 0 && v.offset > 0) {
231
+ ctx.addIssue({ code: "custom", path: ["cursor"], message: "cursor and offset cannot be combined" });
232
+ }
233
+ if (v.created_after !== void 0 && v.created_before !== void 0 && Date.parse(v.created_after) >= Date.parse(v.created_before)) {
234
+ ctx.addIssue({ code: "custom", path: ["created_after"], message: "created_after must be before created_before" });
235
+ }
218
236
  });
219
237
  var CreateICalSubscriptionSchema = z.object({
220
238
  calendar_id: z.string().min(1),
221
- url: z.string().url().startsWith("https://", "URL must use HTTPS"),
239
+ url: z.string().url().max(2048).refine((u) => u.startsWith("https://"), "URL must use HTTPS"),
222
240
  label: z.string().min(1).max(255).optional()
223
241
  });
224
242
  var UpdateICalSubscriptionSchema = z.object({
225
243
  label: z.string().min(1).max(255).optional(),
226
- url: z.string().url().startsWith("https://", "URL must use HTTPS").optional()
244
+ url: z.string().url().max(2048).refine((u) => u.startsWith("https://"), "URL must use HTTPS").optional()
227
245
  }).refine((v) => Object.keys(v).length > 0, "request body must include at least one field");
228
246
  var ListICalSubscriptionsQuerySchema = z.object({
229
247
  status: z.enum(["active", "error", "paused"]).optional(),
@@ -329,9 +347,36 @@ var ProposalCancelledPayloadSchema = z2.object({
329
347
  var ProposalExpiredPayloadSchema = z2.object({
330
348
  proposal_id: z2.string()
331
349
  }).passthrough();
350
+ var OrgPlanChangedPayloadSchema = z2.object({
351
+ org_id: z2.string(),
352
+ previous_plan: z2.string(),
353
+ plan: z2.string(),
354
+ source: z2.enum(["subscription", "founding_expiry", "admin_override", "soft_launch_toggle", "system"]),
355
+ subscription_status: z2.string().nullable(),
356
+ interval: z2.enum(["month", "year"]).nullable(),
357
+ upgrade_request_id: z2.string().nullable()
358
+ }).passthrough();
359
+ var CalendarConnectionReauthorizationRequiredPayloadSchema = z2.object({
360
+ connection_id: z2.string(),
361
+ provider: z2.string(),
362
+ reauthorization_reason: z2.string(),
363
+ impacted_agent_count: z2.number().int().nonnegative(),
364
+ occurred_at: z2.string()
365
+ }).passthrough();
366
+ var UsageThresholdCrossedPayloadSchema = z2.object({
367
+ metric: z2.string(),
368
+ used: z2.number().int().nonnegative(),
369
+ limit: z2.number().int().nonnegative(),
370
+ threshold_pct: z2.number().int(),
371
+ period: z2.string(),
372
+ resets_at: z2.string()
373
+ }).passthrough();
332
374
  var WebhookDeactivatedPayloadSchema = z2.object({
333
375
  webhook_id: z2.string(),
334
- url: z2.string(),
376
+ webhook_origin: z2.string().optional(),
377
+ webhook_path: z2.string().optional(),
378
+ /** @deprecated Deliveries send `webhook_origin` and `webhook_path` instead. */
379
+ url: z2.string().optional(),
335
380
  reason: z2.string()
336
381
  }).passthrough();
337
382
  var PAYLOAD_SCHEMAS = {
@@ -352,7 +397,10 @@ var PAYLOAD_SCHEMAS = {
352
397
  "proposal.confirmed": ProposalConfirmedPayloadSchema,
353
398
  "proposal.expired": ProposalExpiredPayloadSchema,
354
399
  "proposal.cancelled": ProposalCancelledPayloadSchema,
355
- "webhook.deactivated": WebhookDeactivatedPayloadSchema
400
+ "webhook.deactivated": WebhookDeactivatedPayloadSchema,
401
+ "org.plan_changed": OrgPlanChangedPayloadSchema,
402
+ "calendar_connection.reauthorization_required": CalendarConnectionReauthorizationRequiredPayloadSchema,
403
+ "usage.threshold_crossed": UsageThresholdCrossedPayloadSchema
356
404
  };
357
405
  function parseWebhookEvent(eventType, body) {
358
406
  if (!eventType) {
@@ -383,6 +431,7 @@ function parseWebhookEvent(eventType, body) {
383
431
  export {
384
432
  AgentCreatedPayloadSchema,
385
433
  AgentUpdatedPayloadSchema,
434
+ CalendarConnectionReauthorizationRequiredPayloadSchema,
386
435
  EventCreatedPayloadSchema,
387
436
  EventDeletedPayloadSchema,
388
437
  EventEndedPayloadSchema,
@@ -393,11 +442,13 @@ export {
393
442
  EventReminderPayloadSchema,
394
443
  EventStartedPayloadSchema,
395
444
  EventUpdatedPayloadSchema,
445
+ OrgPlanChangedPayloadSchema,
396
446
  ProposalCancelledPayloadSchema,
397
447
  ProposalConfirmedPayloadSchema,
398
448
  ProposalCreatedPayloadSchema,
399
449
  ProposalExpiredPayloadSchema,
400
450
  ProposalRespondedPayloadSchema,
451
+ UsageThresholdCrossedPayloadSchema,
401
452
  WEBHOOK_EVENT_TYPES,
402
453
  WebhookDeactivatedPayloadSchema,
403
454
  parseWebhookEvent
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/events.ts","../src/shared.ts"],"sourcesContent":["/**\n * Webhook event payload schemas and discriminator.\n *\n * The Chronary webhook wire format puts the event type in the\n * `X-Chronary-Event-Type` header and a raw payload object in the body.\n * Use {@link parseWebhookEvent} to combine the two into a typed,\n * discriminated object.\n */\n\nimport { z } from 'zod';\n\nimport { WEBHOOK_EVENT_TYPES, type WebhookEventType } from './shared';\n\nexport { WEBHOOK_EVENT_TYPES } from './shared';\nexport type { WebhookEventType } from './shared';\n\n// Each payload schema uses .passthrough() so forward-compatible field\n// additions on the API side don't break consumers. Known fields are\n// validated strictly; unknown fields are preserved.\n\nconst AgentCreatedPayloadSchema = z\n .object({\n agent: z.object({}).passthrough(),\n })\n .passthrough();\n\nconst AgentUpdatedPayloadSchema = z\n .object({\n agent: z.object({}).passthrough(),\n })\n .passthrough();\n\nconst EventCreatedPayloadSchema = z\n .object({\n event: z.object({}).passthrough(),\n // Present when the event was created through a public booking page\n // (#1036). Lets consumers correlate an inbound booking to the page that\n // produced it. Absent for events created via the normal API/MCP paths.\n booking_page_id: z.string().optional(),\n })\n .passthrough();\n\nconst EventUpdatedPayloadSchema = z\n .object({\n event: z.object({}).passthrough(),\n })\n .passthrough();\n\nconst EventDeletedPayloadSchema = z\n .object({\n event_id: z.string(),\n calendar_id: z.string(),\n })\n .passthrough();\n\nconst EventLifecyclePayloadSchema = z\n .object({\n event_id: z.string(),\n calendar_id: z.string(),\n title: z.string(),\n start_time: z.string(),\n end_time: z.string(),\n // Present when the fire is for one occurrence of a recurring series (#996).\n // The ISO start of that occurrence; start_time/end_time are the occurrence's\n // own times, and event_id is the series master's id.\n occurrence_start: z.string().optional(),\n })\n .passthrough();\n\nconst EventHoldCreatedPayloadSchema = EventLifecyclePayloadSchema;\nconst EventStartedPayloadSchema = EventLifecyclePayloadSchema;\nconst EventEndedPayloadSchema = EventLifecyclePayloadSchema;\nconst EventReminderPayloadSchema = z\n .object({\n event_id: z.string(),\n calendar_id: z.string(),\n title: z.string(),\n start_time: z.string(),\n end_time: z.string(),\n reminder_minutes: z.number().int(),\n // See EventLifecyclePayloadSchema — set for recurring-occurrence reminders.\n occurrence_start: z.string().optional(),\n })\n .passthrough();\nconst EventHoldExpiredPayloadSchema = z\n .object({\n event_id: z.string(),\n })\n .passthrough();\nconst EventHoldReleasedPayloadSchema = z\n .object({\n event_id: z.string(),\n })\n .passthrough();\nconst EventHoldConfirmedPayloadSchema = z\n .object({\n event_id: z.string(),\n })\n .passthrough();\n\nconst ProposalCreatedPayloadSchema = z\n .object({\n proposal: z.object({}).passthrough(),\n })\n .passthrough();\n\nconst ProposalRespondedPayloadSchema = z\n .object({\n proposal_id: z.string(),\n agent_id: z.string(),\n response: z.string(),\n })\n .passthrough();\n\nconst ProposalConfirmedPayloadSchema = z\n .object({\n proposal_id: z.string(),\n })\n .passthrough();\n\nconst ProposalCancelledPayloadSchema = z\n .object({\n proposal_id: z.string(),\n reason: z.string().optional(),\n })\n .passthrough();\n\nconst ProposalExpiredPayloadSchema = z\n .object({\n proposal_id: z.string(),\n })\n .passthrough();\n\nconst WebhookDeactivatedPayloadSchema = z\n .object({\n webhook_id: z.string(),\n url: z.string(),\n reason: z.string(),\n })\n .passthrough();\n\nconst PAYLOAD_SCHEMAS = {\n 'agent.created': AgentCreatedPayloadSchema,\n 'agent.updated': AgentUpdatedPayloadSchema,\n 'event.created': EventCreatedPayloadSchema,\n 'event.updated': EventUpdatedPayloadSchema,\n 'event.deleted': EventDeletedPayloadSchema,\n 'event.started': EventStartedPayloadSchema,\n 'event.ended': EventEndedPayloadSchema,\n 'event.reminder': EventReminderPayloadSchema,\n 'event.hold_created': EventHoldCreatedPayloadSchema,\n 'event.hold_expired': EventHoldExpiredPayloadSchema,\n 'event.hold_released': EventHoldReleasedPayloadSchema,\n 'event.hold_confirmed': EventHoldConfirmedPayloadSchema,\n 'proposal.created': ProposalCreatedPayloadSchema,\n 'proposal.responded': ProposalRespondedPayloadSchema,\n 'proposal.confirmed': ProposalConfirmedPayloadSchema,\n 'proposal.expired': ProposalExpiredPayloadSchema,\n 'proposal.cancelled': ProposalCancelledPayloadSchema,\n 'webhook.deactivated': WebhookDeactivatedPayloadSchema,\n} satisfies Record<WebhookEventType, z.ZodType>;\n\nexport {\n AgentCreatedPayloadSchema,\n AgentUpdatedPayloadSchema,\n EventCreatedPayloadSchema,\n EventUpdatedPayloadSchema,\n EventDeletedPayloadSchema,\n EventStartedPayloadSchema,\n EventEndedPayloadSchema,\n EventReminderPayloadSchema,\n EventHoldCreatedPayloadSchema,\n EventHoldExpiredPayloadSchema,\n EventHoldReleasedPayloadSchema,\n EventHoldConfirmedPayloadSchema,\n ProposalCreatedPayloadSchema,\n ProposalRespondedPayloadSchema,\n ProposalConfirmedPayloadSchema,\n ProposalCancelledPayloadSchema,\n ProposalExpiredPayloadSchema,\n WebhookDeactivatedPayloadSchema,\n};\n\n/**\n * A webhook event combines the event type (from the\n * `X-Chronary-Event-Type` header) with the parsed payload body.\n *\n * Use discriminated narrowing on `type`:\n * ```ts\n * const event = parseWebhookEvent(\n * req.header('x-chronary-event-type'),\n * req.body,\n * );\n * if (event.type === 'event.created') {\n * // ^ narrowed to { type: 'event.created'; data: EventCreatedPayload }\n * }\n * ```\n */\nexport type WebhookEvent = {\n [K in WebhookEventType]: {\n type: K;\n data: z.infer<(typeof PAYLOAD_SCHEMAS)[K]>;\n };\n}[WebhookEventType];\n\n/**\n * Parse an incoming webhook into a typed, discriminated event.\n *\n * Returns a Zod-style `SafeParseReturnType`-shaped object for ergonomic\n * handling of unknown event types + invalid payloads.\n */\nexport function parseWebhookEvent(\n eventType: string | null | undefined,\n body: unknown,\n):\n | { success: true; event: WebhookEvent }\n | { success: false; error: string } {\n if (!eventType) {\n return {\n success: false,\n error: 'Missing X-Chronary-Event-Type header.',\n };\n }\n\n if (!WEBHOOK_EVENT_TYPES.includes(eventType as WebhookEventType)) {\n return {\n success: false,\n error: `Unknown event type: ${eventType}`,\n };\n }\n\n const schema = PAYLOAD_SCHEMAS[eventType as WebhookEventType];\n const result = schema.safeParse(body);\n if (!result.success) {\n return {\n success: false,\n error: `Invalid payload for ${eventType}: ${result.error.message}`,\n };\n }\n\n return {\n success: true,\n event: { type: eventType, data: result.data } as WebhookEvent,\n };\n}\n","import { z } from 'zod';\n\nconst metadataSchema = z\n .record(z.string(), z.unknown())\n .refine((v) => JSON.stringify(v).length <= 16_384, 'metadata exceeds 16KB');\n\nexport const CreateAgentSchema = z.object({\n name: z.string().min(1).max(255),\n type: z.enum(['ai', 'human', 'resource']),\n description: z.string().optional(),\n metadata: metadataSchema.optional(),\n});\n\nexport const UpdateAgentSchema = z\n .object({\n name: z.string().min(1).max(255).optional(),\n description: z.string().nullable().optional(),\n metadata: metadataSchema.optional(),\n status: z.enum(['active', 'paused']).optional(),\n })\n .refine((v) => Object.keys(v).length > 0, 'request body must include at least one field');\n\nexport const ListAgentsQuerySchema = z.object({\n type: z.enum(['ai', 'human', 'resource']).optional(),\n status: z.enum(['active', 'paused', 'decommissioned']).optional(),\n limit: z.coerce.number().int().min(1).max(200).default(50),\n offset: z.coerce.number().int().min(0).default(0),\n});\n\nexport const AgentStatusEnum = z.enum(['idle', 'working', 'waiting', 'error']);\n\n// Reminders — minutes before an event's start_time at which an `event.reminder`\n// webhook fires. The system default applies when neither the event nor its\n// calendar sets a value.\nexport const REMINDER_MIN_MINUTES = 1;\nexport const REMINDER_MAX_MINUTES = 40_320; // 28 days\nexport const REMINDER_MAX_COUNT = 5;\nexport const DEFAULT_EVENT_REMINDERS: readonly number[] = [10];\n\n// Array of \"minutes before start\". Deduped and sorted ascending. An empty array\n// means \"explicitly no reminders\"; `null` (on an event/calendar) means \"inherit\".\nexport const RemindersSchema = z\n .array(z.number().int().min(REMINDER_MIN_MINUTES).max(REMINDER_MAX_MINUTES))\n .max(REMINDER_MAX_COUNT, `at most ${REMINDER_MAX_COUNT} reminders allowed`)\n .transform((arr) => Array.from(new Set(arr)).sort((a, b) => a - b));\n\nexport const CreateCalendarSchema = z.object({\n name: z.string().min(1).max(255),\n timezone: z.string().min(1),\n agent_status: AgentStatusEnum.optional(),\n // Default reminders inherited by events on this calendar that don't set their\n // own. `null` means \"use the system default\"; `[]` means \"no reminders\".\n default_reminders: RemindersSchema.nullable().optional(),\n metadata: metadataSchema.optional(),\n});\n\nexport const UpdateCalendarSchema = z\n .object({\n name: z.string().min(1).max(255).optional(),\n timezone: z.string().min(1).optional(),\n agent_status: AgentStatusEnum.optional(),\n default_reminders: RemindersSchema.nullable().optional(),\n metadata: metadataSchema.optional(),\n })\n .refine((v) => Object.keys(v).length > 0, 'request body must include at least one field');\n\nexport const ListCalendarsQuerySchema = z.object({\n include: z.enum(['all']).optional(),\n limit: z.coerce.number().int().min(1).max(200).default(50),\n offset: z.coerce.number().int().min(0).default(0),\n});\n\nexport const EVENT_STATUSES = ['confirmed', 'tentative', 'cancelled', 'hold'] as const;\nexport type EventStatus = (typeof EVENT_STATUSES)[number];\n\nexport const HOLD_TTL_MIN_SECONDS = 30;\nexport const HOLD_TTL_MAX_SECONDS = 15 * 60;\n\nexport const CreateEventSchema = z\n .object({\n title: z.string().min(1).max(500),\n start_time: z.string().datetime(),\n end_time: z.string().datetime(),\n description: z.string().optional(),\n all_day: z.boolean().default(false),\n status: z.enum(EVENT_STATUSES).default('confirmed'),\n metadata: metadataSchema.optional(),\n reminders: RemindersSchema.nullable().optional(),\n hold_expires_at: z.string().datetime().optional(),\n hold_priority: z.number().int().min(0).max(100).optional(),\n })\n .refine((v) => new Date(v.end_time) > new Date(v.start_time), 'end_time must be after start_time')\n .superRefine((v, ctx) => {\n if (v.status === 'hold') {\n if (!v.hold_expires_at) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['hold_expires_at'],\n message: 'hold_expires_at is required when status is \"hold\"',\n });\n return;\n }\n const ttlMs = new Date(v.hold_expires_at).getTime() - Date.now();\n if (ttlMs < HOLD_TTL_MIN_SECONDS * 1000) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['hold_expires_at'],\n message: `hold_expires_at must be at least ${HOLD_TTL_MIN_SECONDS}s in the future`,\n });\n }\n if (ttlMs > HOLD_TTL_MAX_SECONDS * 1000) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['hold_expires_at'],\n message: `hold_expires_at must be at most ${HOLD_TTL_MAX_SECONDS}s (${HOLD_TTL_MAX_SECONDS / 60} min) in the future`,\n });\n }\n } else {\n if (v.hold_expires_at !== undefined) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['hold_expires_at'],\n message: 'hold_expires_at is only valid when status is \"hold\"',\n });\n }\n if (v.hold_priority !== undefined) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['hold_priority'],\n message: 'hold_priority is only valid when status is \"hold\"',\n });\n }\n }\n });\n\nexport const UpdateEventSchema = z\n .object({\n title: z.string().min(1).max(500).optional(),\n description: z.string().nullable().optional(),\n start_time: z.string().datetime().optional(),\n end_time: z.string().datetime().optional(),\n all_day: z.boolean().optional(),\n status: z.enum(['confirmed', 'tentative', 'cancelled']).optional(),\n metadata: metadataSchema.optional(),\n reminders: RemindersSchema.nullable().optional(),\n })\n .refine((v) => Object.keys(v).length > 0, 'request body must include at least one field');\n\nexport const ListEventsQuerySchema = z.object({\n start_after: z.string().datetime().optional(),\n start_before: z.string().datetime().optional(),\n status: z.enum(EVENT_STATUSES).optional(),\n source: z.enum(['internal', 'external_ical']).optional(),\n limit: z.coerce.number().int().min(1).max(200).default(50),\n offset: z.coerce.number().int().min(0).default(0),\n});\n\nconst WorkingHoursDaySchema = z\n .object({\n start: z.string().regex(/^\\d{2}:\\d{2}$/, 'must be HH:MM'),\n end: z.string().regex(/^\\d{2}:\\d{2}$/, 'must be HH:MM'),\n })\n .refine((v) => v.end > v.start, 'end must be after start');\n\nexport const WorkingHoursSchema = z\n .object({\n mon: WorkingHoursDaySchema.optional(),\n tue: WorkingHoursDaySchema.optional(),\n wed: WorkingHoursDaySchema.optional(),\n thu: WorkingHoursDaySchema.optional(),\n fri: WorkingHoursDaySchema.optional(),\n sat: WorkingHoursDaySchema.optional(),\n sun: WorkingHoursDaySchema.optional(),\n })\n .refine((v) => Object.keys(v).length > 0, 'at least one day must be specified');\n\nexport const UpdateAvailabilityRulesSchema = z.object({\n buffer_before_minutes: z.number().int().min(0).max(120).default(0),\n buffer_after_minutes: z.number().int().min(0).max(120).default(0),\n working_hours: WorkingHoursSchema.nullable().default(null),\n timezone: z.string().min(1).max(64).default('UTC'),\n});\n\nconst SLOT_DURATIONS = ['15m', '30m', '45m', '1h', '2h'] as const;\ntype SlotDuration = (typeof SLOT_DURATIONS)[number];\nconst DEFAULT_SLOT_DURATION: SlotDuration = '30m';\n\nconst DurationEnum = z.enum(SLOT_DURATIONS);\n\n// `duration` is the preferred public parameter for the requested slot length;\n// `slot_duration` is a deprecated backward-compatible alias. Callers may send\n// either (or both, if identical). Both are optional at the boundary and are\n// coalesced into the canonical internal `slot_duration` — so downstream\n// services keep reading `query.slot_duration` unchanged. Sending both with\n// DIFFERENT values is a 400 rather than a silent pick, so an agent that\n// disagrees with itself gets told instead of getting the wrong slot length.\nconst durationFields = {\n duration: DurationEnum.optional(),\n slot_duration: DurationEnum.optional(),\n};\n\nfunction refineDurationConflict(\n v: { duration?: SlotDuration; slot_duration?: SlotDuration },\n ctx: z.RefinementCtx,\n): void {\n if (\n v.duration !== undefined &&\n v.slot_duration !== undefined &&\n v.duration !== v.slot_duration\n ) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message:\n \"`duration` and `slot_duration` conflict; send only one (they are aliases). `slot_duration` is deprecated — prefer `duration`.\",\n path: ['duration'],\n });\n }\n}\n\nfunction resolveDuration<T extends { duration?: SlotDuration; slot_duration?: SlotDuration }>(\n v: T,\n): Omit<T, 'duration'> & { slot_duration: SlotDuration } {\n const { duration, ...rest } = v;\n return { ...rest, slot_duration: duration ?? v.slot_duration ?? DEFAULT_SLOT_DURATION };\n}\n\nexport const AvailabilityQuerySchema = z\n .object({\n start: z.string().datetime(),\n end: z.string().datetime(),\n ...durationFields,\n include_busy: z\n .enum(['true', 'false'])\n .default('false')\n .transform((v) => v === 'true'),\n })\n .superRefine(refineDurationConflict)\n .transform(resolveDuration)\n .refine((v) => new Date(v.end) > new Date(v.start), 'end must be after start');\n\nexport const CrossAgentAvailabilityQuerySchema = z\n .object({\n agents: z.string().min(1).transform((v) => v.split(',')),\n start: z.string().datetime(),\n end: z.string().datetime(),\n ...durationFields,\n calendars: z.string().transform((v) => v.split(',')).optional(),\n include_busy: z\n .enum(['true', 'false'])\n .default('false')\n .transform((v) => v === 'true'),\n })\n .superRefine(refineDurationConflict)\n .transform(resolveDuration)\n .refine((v) => new Date(v.end) > new Date(v.start), 'end must be after start');\n\nexport const WEBHOOK_EVENT_TYPES = [\n 'agent.created',\n 'agent.updated',\n 'event.created',\n 'event.updated',\n 'event.deleted',\n 'event.started',\n 'event.ended',\n 'event.reminder',\n 'event.hold_created',\n 'event.hold_expired',\n 'event.hold_released',\n 'event.hold_confirmed',\n 'proposal.created',\n 'proposal.responded',\n 'proposal.confirmed',\n 'proposal.expired',\n 'proposal.cancelled',\n 'webhook.deactivated',\n] as const;\n\nexport type WebhookEventType = (typeof WEBHOOK_EVENT_TYPES)[number];\n\nexport const CreateWebhookSchema = z.object({\n url: z.string().url('Must be a valid URL'),\n events: z.array(z.enum(WEBHOOK_EVENT_TYPES)).min(1, 'At least one event type must be specified'),\n});\n\nexport const UpdateWebhookSchema = z.object({\n url: z.string().url('Must be a valid URL').optional(),\n events: z.array(z.enum(WEBHOOK_EVENT_TYPES)).optional(),\n active: z.boolean().optional(),\n});\n\nexport const ListWebhooksQuerySchema = z.object({\n limit: z.coerce.number().int().min(1).max(100).default(20),\n offset: z.coerce.number().int().min(0).default(0),\n});\n\nexport const WEBHOOK_DELIVERY_STATUSES = ['pending', 'delivered', 'failed'] as const;\nexport const WebhookDeliveryStatusSchema = z.enum(WEBHOOK_DELIVERY_STATUSES);\n\nexport const ListDeliveriesQuerySchema = z.object({\n limit: z.coerce.number().int().min(1).max(100).default(20),\n offset: z.coerce.number().int().min(0).default(0),\n status: WebhookDeliveryStatusSchema.optional(),\n include_payload: z\n .enum(['true', 'false'])\n .optional()\n .transform((v) => v === 'true'),\n});\n\nexport const CreateICalSubscriptionSchema = z.object({\n calendar_id: z.string().min(1),\n url: z.string().url().startsWith('https://', 'URL must use HTTPS'),\n label: z.string().min(1).max(255).optional(),\n});\n\nexport const UpdateICalSubscriptionSchema = z\n .object({\n label: z.string().min(1).max(255).optional(),\n url: z.string().url().startsWith('https://', 'URL must use HTTPS').optional(),\n })\n .refine((v) => Object.keys(v).length > 0, 'request body must include at least one field');\n\nexport const ListICalSubscriptionsQuerySchema = z.object({\n status: z.enum(['active', 'error', 'paused']).optional(),\n limit: z.coerce.number().int().min(1).max(200).default(50),\n offset: z.coerce.number().int().min(0).default(0),\n});\n\nconst proposalMetadataSchema = metadataSchema.optional().default({});\n\nexport const ProposalSlotSchema = z.object({\n start_time: z.string().datetime(),\n end_time: z.string().datetime(),\n weight: z.number().min(0).max(10).default(1.0).optional(),\n calendar_id: z.string().optional(),\n});\n\nexport const CreateProposalSchema = z.object({\n title: z.string().min(1).max(500),\n description: z.string().max(5000).optional(),\n organizer_agent_id: z.string(),\n participant_agent_ids: z.array(z.string()).min(1).max(50),\n calendar_id: z.string(),\n slots: z.array(ProposalSlotSchema).min(1).max(20),\n expires_at: z.string().datetime().optional(),\n metadata: proposalMetadataSchema,\n});\n\nexport const RespondToProposalSchema = z\n .object({\n agent_id: z.string(),\n response: z.enum(['accept', 'decline', 'counter']),\n selected_slot_id: z.string().optional(),\n counter_slots: z.array(ProposalSlotSchema).max(20).optional(),\n message: z.string().max(2000).optional(),\n })\n .refine((d) => d.response !== 'accept' || d.selected_slot_id !== undefined, {\n message: 'selected_slot_id is required when response is \"accept\"',\n });\n\nexport type CreateAgentInput = z.input<typeof CreateAgentSchema>;\nexport type UpdateAgentInput = z.input<typeof UpdateAgentSchema>;\nexport type ListAgentsQuery = z.infer<typeof ListAgentsQuerySchema>;\nexport type CreateCalendarInput = z.input<typeof CreateCalendarSchema>;\nexport type UpdateCalendarInput = z.input<typeof UpdateCalendarSchema>;\nexport type ListCalendarsQuery = z.infer<typeof ListCalendarsQuerySchema>;\nexport type CreateEventInput = z.input<typeof CreateEventSchema>;\nexport type UpdateEventInput = z.input<typeof UpdateEventSchema>;\nexport type ListEventsQuery = z.infer<typeof ListEventsQuerySchema>;\nexport type WorkingHours = z.infer<typeof WorkingHoursSchema>;\nexport type UpdateAvailabilityRules = z.infer<typeof UpdateAvailabilityRulesSchema>;\nexport type AvailabilityQuery = z.infer<typeof AvailabilityQuerySchema>;\nexport type CrossAgentAvailabilityQuery = z.infer<typeof CrossAgentAvailabilityQuerySchema>;\nexport type CreateWebhookInput = z.input<typeof CreateWebhookSchema>;\nexport type UpdateWebhookInput = z.input<typeof UpdateWebhookSchema>;\nexport type ListWebhooksQuery = z.infer<typeof ListWebhooksQuerySchema>;\nexport type ListDeliveriesQuery = z.infer<typeof ListDeliveriesQuerySchema>;\nexport type WebhookDeliveryStatus = z.infer<typeof WebhookDeliveryStatusSchema>;\nexport type CreateICalSubscriptionInput = z.input<typeof CreateICalSubscriptionSchema>;\nexport type UpdateICalSubscriptionInput = z.input<typeof UpdateICalSubscriptionSchema>;\nexport type ListICalSubscriptionsQuery = z.infer<typeof ListICalSubscriptionsQuerySchema>;\nexport type CreateProposalInput = z.input<typeof CreateProposalSchema>;\nexport type RespondToProposalInput = z.input<typeof RespondToProposalSchema>;\n"],"mappings":";AASA,SAAS,KAAAA,UAAS;;;ACTlB,SAAS,SAAS;AAElB,IAAM,iBAAiB,EACpB,OAAO,EAAE,OAAO,GAAG,EAAE,QAAQ,CAAC,EAC9B,OAAO,CAAC,MAAM,KAAK,UAAU,CAAC,EAAE,UAAU,OAAQ,uBAAuB;AAErE,IAAM,oBAAoB,EAAE,OAAO;AAAA,EACxC,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG;AAAA,EAC/B,MAAM,EAAE,KAAK,CAAC,MAAM,SAAS,UAAU,CAAC;AAAA,EACxC,aAAa,EAAE,OAAO,EAAE,SAAS;AAAA,EACjC,UAAU,eAAe,SAAS;AACpC,CAAC;AAEM,IAAM,oBAAoB,EAC9B,OAAO;AAAA,EACN,MAAM,EAAE,OA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,OAAO,UAAU,IAAI;AACpC,MAAI,CAAC,OAAO,SAAS;AACnB,WAAO;AAAA,MACL,SAAS;AAAA,MACT,OAAO,uBAAuB,SAAS,KAAK,OAAO,MAAM,OAAO;AAAA,IAClE;AAAA,EACF;AAEA,SAAO;AAAA,IACL,SAAS;AAAA,IACT,OAAO,EAAE,MAAM,WAAW,MAAM,OAAO,KAAK;AAAA,EAC9C;AACF;","names":["z","z"]}
1
+ {"version":3,"sources":["../src/events.ts","../src/shared.ts"],"sourcesContent":["/**\n * Webhook event payload schemas and discriminator.\n *\n * The Chronary webhook wire format puts the event type in the\n * `X-Chronary-Event-Type` header and a raw payload object in the body.\n * Use {@link parseWebhookEvent} to combine the two into a typed,\n * discriminated object.\n */\n\nimport { z } from 'zod';\n\nimport { WEBHOOK_EVENT_TYPES, type WebhookEventType } from './shared';\n\nexport { WEBHOOK_EVENT_TYPES } from './shared';\nexport type { WebhookEventType } from './shared';\n\n// Each payload schema uses .passthrough() so forward-compatible field\n// additions on the API side don't break consumers. Known fields are\n// validated strictly; unknown fields are preserved.\n\nconst AgentCreatedPayloadSchema = z\n .object({\n agent: z.object({}).passthrough(),\n })\n .passthrough();\n\nconst AgentUpdatedPayloadSchema = z\n .object({\n agent: z.object({}).passthrough(),\n })\n .passthrough();\n\nconst EventCreatedPayloadSchema = z\n .object({\n event: z.object({}).passthrough(),\n // Present when the event was created through a public booking page\n // (#1036). Lets consumers correlate an inbound booking to the page that\n // produced it. Absent for events created via the normal API/MCP paths.\n booking_page_id: z.string().optional(),\n })\n .passthrough();\n\nconst EventUpdatedPayloadSchema = z\n .object({\n event: z.object({}).passthrough(),\n })\n .passthrough();\n\nconst EventDeletedPayloadSchema = z\n .object({\n event_id: z.string(),\n calendar_id: z.string(),\n })\n .passthrough();\n\nconst EventLifecyclePayloadSchema = z\n .object({\n event_id: z.string(),\n calendar_id: z.string(),\n title: z.string(),\n start_time: z.string(),\n end_time: z.string(),\n // Present when the fire is for one occurrence of a recurring series (#996).\n // The ISO start of that occurrence; start_time/end_time are the occurrence's\n // own times, and event_id is the series master's id.\n occurrence_start: z.string().optional(),\n })\n .passthrough();\n\nconst EventHoldCreatedPayloadSchema = EventLifecyclePayloadSchema;\nconst EventStartedPayloadSchema = EventLifecyclePayloadSchema;\nconst EventEndedPayloadSchema = EventLifecyclePayloadSchema;\nconst EventReminderPayloadSchema = z\n .object({\n event_id: z.string(),\n calendar_id: z.string(),\n title: z.string(),\n start_time: z.string(),\n end_time: z.string(),\n reminder_minutes: z.number().int(),\n // See EventLifecyclePayloadSchema — set for recurring-occurrence reminders.\n occurrence_start: z.string().optional(),\n })\n .passthrough();\nconst EventHoldExpiredPayloadSchema = z\n .object({\n event_id: z.string(),\n })\n .passthrough();\nconst EventHoldReleasedPayloadSchema = z\n .object({\n event_id: z.string(),\n })\n .passthrough();\nconst EventHoldConfirmedPayloadSchema = z\n .object({\n event_id: z.string(),\n })\n .passthrough();\n\nconst ProposalCreatedPayloadSchema = z\n .object({\n proposal: z.object({}).passthrough(),\n })\n .passthrough();\n\nconst ProposalRespondedPayloadSchema = z\n .object({\n proposal_id: z.string(),\n agent_id: z.string(),\n response: z.string(),\n })\n .passthrough();\n\nconst ProposalConfirmedPayloadSchema = z\n .object({\n proposal_id: z.string(),\n })\n .passthrough();\n\nconst ProposalCancelledPayloadSchema = z\n .object({\n proposal_id: z.string(),\n reason: z.string().optional(),\n })\n .passthrough();\n\nconst ProposalExpiredPayloadSchema = z\n .object({\n proposal_id: z.string(),\n })\n .passthrough();\n\n// org.plan_changed (#1130) — the org's plan changed (upgrade, downgrade,\n// subscription end). Never carries payment-provider ids.\nconst OrgPlanChangedPayloadSchema = z\n .object({\n org_id: z.string(),\n previous_plan: z.string(),\n plan: z.string(),\n source: z.enum(['subscription', 'founding_expiry', 'admin_override', 'soft_launch_toggle', 'system']),\n subscription_status: z.string().nullable(),\n interval: z.enum(['month', 'year']).nullable(),\n upgrade_request_id: z.string().nullable(),\n })\n .passthrough();\n\n// calendar_connection.reauthorization_required (#1196) — a human calendar the\n// org connected stopped accepting Chronary's access. Never carries the\n// account label or email: agents never receive account identities.\nconst CalendarConnectionReauthorizationRequiredPayloadSchema = z\n .object({\n connection_id: z.string(),\n provider: z.string(),\n reauthorization_reason: z.string(),\n impacted_agent_count: z.number().int().nonnegative(),\n occurred_at: z.string(),\n })\n .passthrough();\n\n// usage.threshold_crossed (#1211) — a monthly usage metric reached a threshold\n// of the plan limit (50, 80, 90, 95 or 100). Fires once per metric, period and\n// threshold. `resets_at` is the next UTC month start, when the counter resets.\nconst UsageThresholdCrossedPayloadSchema = z\n .object({\n metric: z.string(),\n used: z.number().int().nonnegative(),\n limit: z.number().int().nonnegative(),\n threshold_pct: z.number().int(),\n period: z.string(),\n resets_at: z.string(),\n })\n .passthrough();\n\n// webhook.deactivated — an endpoint was disabled (circuit breaker or an unsafe\n// destination). Deliveries carry the endpoint's origin and path with the query\n// string removed, never the full URL. `url` is deprecated: no delivery sends it,\n// and it stays optional only so older fixtures still parse.\nconst WebhookDeactivatedPayloadSchema = z\n .object({\n webhook_id: z.string(),\n webhook_origin: z.string().optional(),\n webhook_path: z.string().optional(),\n /** @deprecated Deliveries send `webhook_origin` and `webhook_path` instead. */\n url: z.string().optional(),\n reason: z.string(),\n })\n .passthrough();\n\nconst PAYLOAD_SCHEMAS = {\n 'agent.created': AgentCreatedPayloadSchema,\n 'agent.updated': AgentUpdatedPayloadSchema,\n 'event.created': EventCreatedPayloadSchema,\n 'event.updated': EventUpdatedPayloadSchema,\n 'event.deleted': EventDeletedPayloadSchema,\n 'event.started': EventStartedPayloadSchema,\n 'event.ended': EventEndedPayloadSchema,\n 'event.reminder': EventReminderPayloadSchema,\n 'event.hold_created': EventHoldCreatedPayloadSchema,\n 'event.hold_expired': EventHoldExpiredPayloadSchema,\n 'event.hold_released': EventHoldReleasedPayloadSchema,\n 'event.hold_confirmed': EventHoldConfirmedPayloadSchema,\n 'proposal.created': ProposalCreatedPayloadSchema,\n 'proposal.responded': ProposalRespondedPayloadSchema,\n 'proposal.confirmed': ProposalConfirmedPayloadSchema,\n 'proposal.expired': ProposalExpiredPayloadSchema,\n 'proposal.cancelled': ProposalCancelledPayloadSchema,\n 'webhook.deactivated': WebhookDeactivatedPayloadSchema,\n 'org.plan_changed': OrgPlanChangedPayloadSchema,\n 'calendar_connection.reauthorization_required': CalendarConnectionReauthorizationRequiredPayloadSchema,\n 'usage.threshold_crossed': UsageThresholdCrossedPayloadSchema,\n} satisfies Record<WebhookEventType, z.ZodType>;\n\nexport {\n AgentCreatedPayloadSchema,\n AgentUpdatedPayloadSchema,\n EventCreatedPayloadSchema,\n EventUpdatedPayloadSchema,\n EventDeletedPayloadSchema,\n EventStartedPayloadSchema,\n EventEndedPayloadSchema,\n EventReminderPayloadSchema,\n EventHoldCreatedPayloadSchema,\n EventHoldExpiredPayloadSchema,\n EventHoldReleasedPayloadSchema,\n EventHoldConfirmedPayloadSchema,\n ProposalCreatedPayloadSchema,\n ProposalRespondedPayloadSchema,\n ProposalConfirmedPayloadSchema,\n ProposalCancelledPayloadSchema,\n ProposalExpiredPayloadSchema,\n WebhookDeactivatedPayloadSchema,\n OrgPlanChangedPayloadSchema,\n CalendarConnectionReauthorizationRequiredPayloadSchema,\n UsageThresholdCrossedPayloadSchema,\n};\n\n/**\n * A webhook event combines the event type (from the\n * `X-Chronary-Event-Type` header) with the parsed payload body.\n *\n * Use discriminated narrowing on `type`:\n * ```ts\n * const event = parseWebhookEvent(\n * req.header('x-chronary-event-type'),\n * req.body,\n * );\n * if (event.type === 'event.created') {\n * // ^ narrowed to { type: 'event.created'; data: EventCreatedPayload }\n * }\n * ```\n */\nexport type WebhookEvent = {\n [K in WebhookEventType]: {\n type: K;\n data: z.infer<(typeof PAYLOAD_SCHEMAS)[K]>;\n };\n}[WebhookEventType];\n\n/**\n * Parse an incoming webhook into a typed, discriminated event.\n *\n * Returns a Zod-style `SafeParseReturnType`-shaped object for ergonomic\n * handling of unknown event types + invalid payloads.\n */\nexport function parseWebhookEvent(\n eventType: string | null | undefined,\n body: unknown,\n):\n | { success: true; event: WebhookEvent }\n | { success: false; error: string } {\n if (!eventType) {\n return {\n success: false,\n error: 'Missing X-Chronary-Event-Type header.',\n };\n }\n\n if (!WEBHOOK_EVENT_TYPES.includes(eventType as WebhookEventType)) {\n return {\n success: false,\n error: `Unknown event type: ${eventType}`,\n };\n }\n\n const schema = PAYLOAD_SCHEMAS[eventType as WebhookEventType];\n const result = schema.safeParse(body);\n if (!result.success) {\n return {\n success: false,\n error: `Invalid payload for ${eventType}: ${result.error.message}`,\n };\n }\n\n return {\n success: true,\n event: { type: eventType, data: result.data } as WebhookEvent,\n };\n}\n","import { z } from 'zod';\n\nconst metadataSchema = z\n .record(z.string(), z.unknown())\n .refine((v) => JSON.stringify(v).length <= 16_384, 'metadata exceeds 16KB');\n\nexport const CreateAgentSchema = z.object({\n name: z.string().min(1).max(255),\n type: z.enum(['ai', 'human', 'resource']),\n description: z.string().max(5_000).optional(),\n metadata: metadataSchema.optional(),\n});\n\nexport const UpdateAgentSchema = z\n .object({\n name: z.string().min(1).max(255).optional(),\n description: z.string().max(5_000).nullable().optional(),\n metadata: metadataSchema.optional(),\n status: z.enum(['active', 'paused']).optional(),\n })\n .refine((v) => Object.keys(v).length > 0, 'request body must include at least one field');\n\nexport const ListAgentsQuerySchema = z.object({\n type: z.enum(['ai', 'human', 'resource']).optional(),\n status: z.enum(['active', 'paused', 'decommissioned']).optional(),\n limit: z.coerce.number().int().min(1).max(200).default(50),\n offset: z.coerce.number().int().min(0).default(0),\n});\n\nexport const AgentStatusEnum = z.enum(['idle', 'working', 'waiting', 'error']);\n\n// Reminders — minutes before an event's start_time at which an `event.reminder`\n// webhook fires. The system default applies when neither the event nor its\n// calendar sets a value.\nexport const REMINDER_MIN_MINUTES = 1;\nexport const REMINDER_MAX_MINUTES = 40_320; // 28 days\nexport const REMINDER_MAX_COUNT = 5;\nexport const DEFAULT_EVENT_REMINDERS: readonly number[] = [10];\n\n// Array of \"minutes before start\". Deduped and sorted ascending. An empty array\n// means \"explicitly no reminders\"; `null` (on an event/calendar) means \"inherit\".\nexport const RemindersSchema = z\n .array(z.number().int().min(REMINDER_MIN_MINUTES).max(REMINDER_MAX_MINUTES))\n .max(REMINDER_MAX_COUNT, `at most ${REMINDER_MAX_COUNT} reminders allowed`)\n .transform((arr) => Array.from(new Set(arr)).sort((a, b) => a - b));\n\nexport const CreateCalendarSchema = z.object({\n name: z.string().min(1).max(255),\n timezone: z.string().min(1).max(64),\n agent_status: AgentStatusEnum.optional(),\n // Default reminders inherited by events on this calendar that don't set their\n // own. `null` means \"use the system default\"; `[]` means \"no reminders\".\n default_reminders: RemindersSchema.nullable().optional(),\n metadata: metadataSchema.optional(),\n});\n\nexport const UpdateCalendarSchema = z\n .object({\n name: z.string().min(1).max(255).optional(),\n timezone: z.string().min(1).max(64).optional(),\n agent_status: AgentStatusEnum.optional(),\n default_reminders: RemindersSchema.nullable().optional(),\n metadata: metadataSchema.optional(),\n })\n .refine((v) => Object.keys(v).length > 0, 'request body must include at least one field');\n\nexport const ListCalendarsQuerySchema = z.object({\n include: z.enum(['all']).optional(),\n limit: z.coerce.number().int().min(1).max(200).default(50),\n offset: z.coerce.number().int().min(0).default(0),\n});\n\nexport const EVENT_STATUSES = ['confirmed', 'tentative', 'cancelled', 'hold'] as const;\nexport type EventStatus = (typeof EVENT_STATUSES)[number];\n\nexport const HOLD_TTL_MIN_SECONDS = 30;\nexport const HOLD_TTL_MAX_SECONDS = 15 * 60;\n\nexport const CreateEventSchema = z\n .object({\n title: z.string().min(1).max(500),\n start_time: z.string().datetime(),\n end_time: z.string().datetime(),\n description: z.string().max(10_000).optional(),\n all_day: z.boolean().default(false),\n status: z.enum(EVENT_STATUSES).default('confirmed'),\n metadata: metadataSchema.optional(),\n reminders: RemindersSchema.nullable().optional(),\n hold_expires_at: z.string().datetime().optional(),\n hold_priority: z.number().int().min(0).max(100).optional(),\n })\n .refine((v) => new Date(v.end_time) > new Date(v.start_time), 'end_time must be after start_time')\n .superRefine((v, ctx) => {\n if (v.status === 'hold') {\n if (!v.hold_expires_at) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['hold_expires_at'],\n message: 'hold_expires_at is required when status is \"hold\"',\n });\n return;\n }\n const ttlMs = new Date(v.hold_expires_at).getTime() - Date.now();\n if (ttlMs < HOLD_TTL_MIN_SECONDS * 1000) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['hold_expires_at'],\n message: `hold_expires_at must be at least ${HOLD_TTL_MIN_SECONDS}s in the future`,\n });\n }\n if (ttlMs > HOLD_TTL_MAX_SECONDS * 1000) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['hold_expires_at'],\n message: `hold_expires_at must be at most ${HOLD_TTL_MAX_SECONDS}s (${HOLD_TTL_MAX_SECONDS / 60} min) in the future`,\n });\n }\n } else {\n if (v.hold_expires_at !== undefined) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['hold_expires_at'],\n message: 'hold_expires_at is only valid when status is \"hold\"',\n });\n }\n if (v.hold_priority !== undefined) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['hold_priority'],\n message: 'hold_priority is only valid when status is \"hold\"',\n });\n }\n }\n });\n\nexport const UpdateEventSchema = z\n .object({\n title: z.string().min(1).max(500).optional(),\n description: z.string().max(10_000).nullable().optional(),\n start_time: z.string().datetime().optional(),\n end_time: z.string().datetime().optional(),\n all_day: z.boolean().optional(),\n status: z.enum(['confirmed', 'tentative', 'cancelled']).optional(),\n metadata: metadataSchema.optional(),\n reminders: RemindersSchema.nullable().optional(),\n })\n .refine((v) => Object.keys(v).length > 0, 'request body must include at least one field');\n\nexport const ListEventsQuerySchema = z.object({\n start_after: z.string().datetime().optional(),\n start_before: z.string().datetime().optional(),\n status: z.enum(EVENT_STATUSES).optional(),\n source: z.enum(['internal', 'external_ical']).optional(),\n limit: z.coerce.number().int().min(1).max(200).default(50),\n offset: z.coerce.number().int().min(0).default(0),\n});\n\nconst WorkingHoursDaySchema = z\n .object({\n start: z.string().regex(/^\\d{2}:\\d{2}$/, 'must be HH:MM'),\n end: z.string().regex(/^\\d{2}:\\d{2}$/, 'must be HH:MM'),\n })\n .refine((v) => v.end > v.start, 'end must be after start');\n\nexport const WorkingHoursSchema = z\n .object({\n mon: WorkingHoursDaySchema.optional(),\n tue: WorkingHoursDaySchema.optional(),\n wed: WorkingHoursDaySchema.optional(),\n thu: WorkingHoursDaySchema.optional(),\n fri: WorkingHoursDaySchema.optional(),\n sat: WorkingHoursDaySchema.optional(),\n sun: WorkingHoursDaySchema.optional(),\n })\n .refine((v) => Object.keys(v).length > 0, 'at least one day must be specified');\n\nexport const UpdateAvailabilityRulesSchema = z.object({\n buffer_before_minutes: z.number().int().min(0).max(120).default(0),\n buffer_after_minutes: z.number().int().min(0).max(120).default(0),\n working_hours: WorkingHoursSchema.nullable().default(null),\n timezone: z.string().min(1).max(64).default('UTC'),\n});\n\nconst SLOT_DURATIONS = ['15m', '30m', '45m', '1h', '2h'] as const;\ntype SlotDuration = (typeof SLOT_DURATIONS)[number];\nconst DEFAULT_SLOT_DURATION: SlotDuration = '30m';\n\nconst DurationEnum = z.enum(SLOT_DURATIONS);\n\n// `duration` is the preferred public parameter for the requested slot length;\n// `slot_duration` is a deprecated backward-compatible alias. Callers may send\n// either (or both, if identical). Both are optional at the boundary and are\n// coalesced into the canonical internal `slot_duration` — so downstream\n// services keep reading `query.slot_duration` unchanged. Sending both with\n// DIFFERENT values is a 400 rather than a silent pick, so an agent that\n// disagrees with itself gets told instead of getting the wrong slot length.\nconst durationFields = {\n duration: DurationEnum.optional(),\n slot_duration: DurationEnum.optional(),\n};\n\nfunction refineDurationConflict(\n v: { duration?: SlotDuration; slot_duration?: SlotDuration },\n ctx: z.RefinementCtx,\n): void {\n if (\n v.duration !== undefined &&\n v.slot_duration !== undefined &&\n v.duration !== v.slot_duration\n ) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message:\n \"`duration` and `slot_duration` conflict; send only one (they are aliases). `slot_duration` is deprecated — prefer `duration`.\",\n path: ['duration'],\n });\n }\n}\n\nfunction resolveDuration<T extends { duration?: SlotDuration; slot_duration?: SlotDuration }>(\n v: T,\n): Omit<T, 'duration'> & { slot_duration: SlotDuration } {\n const { duration, ...rest } = v;\n return { ...rest, slot_duration: duration ?? v.slot_duration ?? DEFAULT_SLOT_DURATION };\n}\n\nexport const AvailabilityQuerySchema = z\n .object({\n start: z.string().datetime(),\n end: z.string().datetime(),\n ...durationFields,\n include_busy: z\n .enum(['true', 'false'])\n .default('false')\n .transform((v) => v === 'true'),\n })\n .superRefine(refineDurationConflict)\n .transform(resolveDuration)\n .refine((v) => new Date(v.end) > new Date(v.start), 'end must be after start');\n\nexport const CrossAgentAvailabilityQuerySchema = z\n .object({\n agents: z.string().min(1).transform((v) => v.split(',')),\n start: z.string().datetime(),\n end: z.string().datetime(),\n ...durationFields,\n calendars: z.string().transform((v) => v.split(',')).optional(),\n include_busy: z\n .enum(['true', 'false'])\n .default('false')\n .transform((v) => v === 'true'),\n })\n .superRefine(refineDurationConflict)\n .transform(resolveDuration)\n .refine((v) => new Date(v.end) > new Date(v.start), 'end must be after start');\n\nexport const WEBHOOK_EVENT_TYPES = [\n 'agent.created',\n 'agent.updated',\n 'event.created',\n 'event.updated',\n 'event.deleted',\n 'event.started',\n 'event.ended',\n 'event.reminder',\n 'event.hold_created',\n 'event.hold_expired',\n 'event.hold_released',\n 'event.hold_confirmed',\n 'proposal.created',\n 'proposal.responded',\n 'proposal.confirmed',\n 'proposal.expired',\n 'proposal.cancelled',\n 'webhook.deactivated',\n 'org.plan_changed',\n 'calendar_connection.reauthorization_required',\n 'usage.threshold_crossed',\n] as const;\n\nexport type WebhookEventType = (typeof WEBHOOK_EVENT_TYPES)[number];\n\nexport const CreateWebhookSchema = z.object({\n url: z.string().url('Must be a valid URL').max(2_048),\n events: z.array(z.enum(WEBHOOK_EVENT_TYPES)).min(1, 'At least one event type must be specified'),\n});\n\nexport const UpdateWebhookSchema = z.object({\n url: z.string().url('Must be a valid URL').max(2_048).optional(),\n events: z.array(z.enum(WEBHOOK_EVENT_TYPES)).optional(),\n active: z.boolean().optional(),\n});\n\nexport const ListWebhooksQuerySchema = z.object({\n limit: z.coerce.number().int().min(1).max(100).default(20),\n offset: z.coerce.number().int().min(0).default(0),\n});\n\n/**\n * `dropped` is a Free-plan delivery the monthly limit stopped: never sent,\n * counted or retried, with `last_error_code: 'quota_exceeded'`.\n */\nexport const WEBHOOK_DELIVERY_STATUSES = ['pending', 'delivered', 'failed', 'dropped'] as const;\nexport const WebhookDeliveryStatusSchema = z.enum(WEBHOOK_DELIVERY_STATUSES);\n\nexport const ListDeliveriesQuerySchema = z\n .object({\n limit: z.coerce.number().int().min(1).max(100).default(20),\n offset: z.coerce.number().int().min(0).default(0),\n status: WebhookDeliveryStatusSchema.optional(),\n include_payload: z\n .enum(['true', 'false'])\n .optional()\n .transform((v) => v === 'true'),\n /** An exact event type (`event.created`) or a prefix ending in a dot (`event.`). */\n event_type: z.string().max(100).regex(/^[a-z_]+\\.(?:[a-z_]+)?$/).optional(),\n created_after: z.string().datetime().optional(),\n created_before: z.string().datetime().optional(),\n delivery_id: z.string().max(100).regex(/^whd_[A-Za-z0-9_-]+$/).optional(),\n is_test: z.enum(['true', 'false']).transform((v) => v === 'true').optional(),\n /** The `next_cursor` from the previous page; cannot be combined with a non-zero `offset`. */\n cursor: z.string().min(1).max(1024).optional(),\n })\n .superRefine((v, ctx) => {\n if (v.cursor !== undefined && v.offset > 0) {\n ctx.addIssue({ code: 'custom', path: ['cursor'], message: 'cursor and offset cannot be combined' });\n }\n if (\n v.created_after !== undefined &&\n v.created_before !== undefined &&\n Date.parse(v.created_after) >= Date.parse(v.created_before)\n ) {\n ctx.addIssue({ code: 'custom', path: ['created_after'], message: 'created_after must be before created_before' });\n }\n });\n\n// HTTPS via `.refine`, not `.startsWith`: zod 4's startsWith overwrites the\n// string `format` ('uri' → 'starts_with'), so JSON Schema consumers (MCP\n// clients, agent frameworks) would lose `format: uri`.\nexport const CreateICalSubscriptionSchema = z.object({\n calendar_id: z.string().min(1),\n url: z.string().url().max(2_048).refine((u) => u.startsWith('https://'), 'URL must use HTTPS'),\n label: z.string().min(1).max(255).optional(),\n});\n\nexport const UpdateICalSubscriptionSchema = z\n .object({\n label: z.string().min(1).max(255).optional(),\n url: z.string().url().max(2_048).refine((u) => u.startsWith('https://'), 'URL must use HTTPS').optional(),\n })\n .refine((v) => Object.keys(v).length > 0, 'request body must include at least one field');\n\nexport const ListICalSubscriptionsQuerySchema = z.object({\n status: z.enum(['active', 'error', 'paused']).optional(),\n limit: z.coerce.number().int().min(1).max(200).default(50),\n offset: z.coerce.number().int().min(0).default(0),\n});\n\nconst proposalMetadataSchema = metadataSchema.optional().default({});\n\nexport const ProposalSlotSchema = z.object({\n start_time: z.string().datetime(),\n end_time: z.string().datetime(),\n weight: z.number().min(0).max(10).default(1.0).optional(),\n calendar_id: z.string().optional(),\n});\n\nexport const CreateProposalSchema = z.object({\n title: z.string().min(1).max(500),\n description: z.string().max(5000).optional(),\n organizer_agent_id: z.string(),\n participant_agent_ids: z.array(z.string()).min(1).max(50),\n calendar_id: z.string(),\n slots: z.array(ProposalSlotSchema).min(1).max(20),\n expires_at: z.string().datetime().optional(),\n metadata: proposalMetadataSchema,\n});\n\nexport const RespondToProposalSchema = z\n .object({\n agent_id: z.string(),\n response: z.enum(['accept', 'decline', 'counter']),\n selected_slot_id: z.string().optional(),\n counter_slots: z.array(ProposalSlotSchema).max(20).optional(),\n message: z.string().max(2000).optional(),\n })\n .refine((d) => d.response !== 'accept' || d.selected_slot_id !== undefined, {\n message: 'selected_slot_id is required when response is \"accept\"',\n });\n\nexport type CreateAgentInput = z.input<typeof CreateAgentSchema>;\nexport type UpdateAgentInput = z.input<typeof UpdateAgentSchema>;\nexport type ListAgentsQuery = z.infer<typeof ListAgentsQuerySchema>;\nexport type CreateCalendarInput = z.input<typeof CreateCalendarSchema>;\nexport type UpdateCalendarInput = z.input<typeof UpdateCalendarSchema>;\nexport type ListCalendarsQuery = z.infer<typeof ListCalendarsQuerySchema>;\nexport type CreateEventInput = z.input<typeof CreateEventSchema>;\nexport type UpdateEventInput = z.input<typeof UpdateEventSchema>;\nexport type ListEventsQuery = z.infer<typeof ListEventsQuerySchema>;\nexport type WorkingHours = z.infer<typeof WorkingHoursSchema>;\nexport type UpdateAvailabilityRules = z.infer<typeof UpdateAvailabilityRulesSchema>;\nexport type AvailabilityQuery = z.infer<typeof AvailabilityQuerySchema>;\nexport type CrossAgentAvailabilityQuery = z.infer<typeof CrossAgentAvailabilityQuerySchema>;\nexport type CreateWebhookInput = z.input<typeof CreateWebhookSchema>;\nexport type UpdateWebhookInput = z.input<typeof UpdateWebhookSchema>;\nexport type ListWebhooksQuery = z.infer<typeof ListWebhooksQuerySchema>;\nexport type ListDeliveriesQuery = z.infer<typeof ListDeliveriesQuerySchema>;\nexport type WebhookDeliveryStatus = z.infer<typeof WebhookDeliveryStatusSchema>;\nexport type CreateICalSubscriptionInput = z.input<typeof CreateICalSubscriptionSchema>;\nexport type UpdateICalSubscriptionInput = z.input<typeof UpdateICalSubscriptionSchema>;\nexport type ListICalSubscriptionsQuery = z.infer<typeof ListICalSubscriptionsQuerySchema>;\nexport type CreateProposalInput = z.input<typeof CreateProposalSchema>;\nexport type RespondToProposalInput = z.input<typeof RespondToProposalSchema>;\n"],"mappings":";AASA,SAAS,KAAAA,UAAS;;;ACTlB,SAAS,SAAS;AAElB,IAAM,iBAAiB,EACpB,OAAO,EAAE,OAAO,GAAG,EAAE,QAAQ,CAAC,EAC9B,OAAO,CAAC,MAAM,KAAK,UAAU,CAAC,EAAE,UAAU,OAAQ,uBAAuB;AAErE,IAAM,oBAAoB,EAAE,OAAO;AAAA,EACxC,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG;AAAA,EAC/B,MAAM,EAAE,KAAK,CAAC,MAAM,SAA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