@chronary/toolkit 1.6.1 → 1.6.2

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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/adapters/mastra.ts","../src/base.ts","../src/schemas.ts","../src/safe.ts","../src/functions.ts","../src/untrusted.ts","../src/definitions.ts"],"sourcesContent":["import { MapToolkit } from '../base';\nimport type { ToolDefinition, ChronaryToolkitConfig } from '../types';\n\nexport interface MastraTool {\n id: string;\n description: string;\n inputSchema: ToolDefinition['schema'];\n execute: (context: { context: Record<string, unknown> }) => Promise<unknown>;\n}\n\n/**\n * Mastra adapter.\n *\n * Returns tools compatible with Mastra's tool format.\n *\n * @example\n * ```ts\n * import { ChronaryToolkit } from '@chronary/toolkit/mastra';\n *\n * const toolkit = new ChronaryToolkit({ apiKey: process.env.CHRONARY_API_KEY });\n * const tools = toolkit.getTools();\n * ```\n */\nexport class ChronaryToolkit extends MapToolkit<MastraTool> {\n constructor(config: ChronaryToolkitConfig) {\n super(config);\n }\n\n protected buildTool(def: ToolDefinition): MastraTool {\n const client = this.client;\n return {\n id: def.name,\n description: def.description,\n inputSchema: def.schema,\n execute: async ({ context }: { context: Record<string, unknown> }) => {\n const result = await def.execute(client, context);\n if (result.isError) throw new Error(typeof result.result === 'string' ? result.result : JSON.stringify(result.result));\n return result.result;\n },\n };\n }\n}\n","import { Chronary } from '@chronary/sdk';\nimport type { ToolDefinition, ToolName, ChronaryToolkitConfig } from './types';\nimport { TOOL_DEFINITIONS } from './definitions';\n\nfunction resolveClient(config: ChronaryToolkitConfig): Chronary {\n if ('client' in config && config.client) return config.client;\n const { tools: _tools, ...sdkConfig } = config as {\n apiKey?: string;\n baseUrl?: string;\n tools?: ToolName[];\n extraHeaders?: Record<string, string>;\n };\n return new Chronary(sdkConfig);\n}\n\nexport abstract class BaseToolkit<T> {\n protected readonly client: Chronary;\n protected readonly definitions: ToolDefinition[];\n\n constructor(config: ChronaryToolkitConfig) {\n this.client = resolveClient(config);\n this.definitions = config.tools\n ? TOOL_DEFINITIONS.filter((d) => (config.tools as ToolName[]).includes(d.name))\n : [...TOOL_DEFINITIONS];\n }\n\n /** Convert a framework-agnostic ToolDefinition into the adapter's native format */\n protected abstract buildTool(def: ToolDefinition): T;\n\n abstract getTools(): T[] | Record<string, T>;\n}\n\nexport abstract class ListToolkit<T> extends BaseToolkit<T> {\n getTools(): T[] {\n return this.definitions.map((def) => this.buildTool(def));\n }\n}\n\nexport abstract class MapToolkit<T> extends BaseToolkit<T> {\n getTools(): Record<string, T> {\n const map: Record<string, T> = {};\n for (const def of this.definitions) {\n map[def.name] = this.buildTool(def);\n }\n return map;\n }\n}\n","import { z } from 'zod';\n\n// Webhook event types and delivery statuses — kept in lockstep with the hosted\n// MCP server's `@chronary/shared` WEBHOOK_EVENT_TYPES / WEBHOOK_DELIVERY_STATUSES.\n// Inlined here because the toolkit deliberately does not depend on @chronary/shared.\nconst 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\nconst WEBHOOK_DELIVERY_STATUSES = ['pending', 'delivered', 'failed', 'dropped'] as const;\n\n// ── Calendars ──────────────────────────────────────────────────\n\nexport const ListCalendarsSchema = z.object({\n agent_id: z.string().optional().describe('Filter to calendars owned by this agent. Organization keys only — Agent keys are always limited to their own agent and ignore this.'),\n include: z.enum(['all']).optional().describe('Pass \"all\" to include calendars across all agents (Organization keys only)'),\n limit: z.number().int().min(1).max(200).default(50).describe('Max results to return'),\n offset: z.number().int().min(0).default(0).describe('Pagination offset'),\n});\n\nexport const GetCalendarSchema = z.object({\n calendar_id: z.string().describe('Calendar ID to fetch'),\n});\n\nexport const CreateCalendarSchema = z.object({\n name: z.string().min(1).max(255).describe('Calendar name'),\n agent_id: z.string().optional().describe('Agent ID to own this calendar (omit for org-level)'),\n timezone: z.string().min(1).max(64).describe('IANA timezone (e.g. America/New_York)'),\n default_reminders: z.array(z.number().int().min(1).max(40320)).max(5).nullable().optional().describe('Default reminder offsets in minutes before start, inherited by events on this calendar that don\\'t set their own. Omit or null to use the system default (10 min); [] for no reminders.'),\n});\n\nexport const UpdateCalendarSchema = z.object({\n calendar_id: z.string().describe('Calendar ID to update'),\n name: z.string().min(1).max(255).optional().describe('New calendar name'),\n timezone: z.string().min(1).max(64).optional().describe('New IANA timezone (e.g. America/New_York)'),\n agent_status: z.enum(['idle', 'working', 'waiting', 'error']).optional().describe('Owning agent\\'s status'),\n default_reminders: z.array(z.number().int().min(1).max(40320)).max(5).nullable().optional().describe('Default reminder offsets in minutes; null for system default, [] for none'),\n metadata: z.record(z.string(), z.unknown()).optional().describe('Arbitrary metadata (max 16KB)'),\n});\n\nexport const DeleteCalendarSchema = z.object({\n calendar_id: z.string().describe('Calendar ID to delete'),\n});\n\n// ── Booking pages ──────────────────────────────────────────────\n\nexport const ListBookingPagesSchema = z.object({\n limit: z.number().int().min(1).max(200).default(50).describe('Max results to return'),\n offset: z.number().int().min(0).default(0).describe('Pagination offset'),\n});\n\nexport const GetBookingPageSchema = z.object({\n booking_page_id: z.string().describe('Booking page ID to fetch (bkp_...)'),\n});\n\nexport const CreateBookingPageSchema = z.object({\n calendar_id: z.string().describe('Calendar a booking resolves to (from create_calendar/list_calendars).'),\n title: z.string().min(1).max(200).describe('Meeting title shown on the page.'),\n description: z.string().max(2000).optional().describe('Optional description shown to the booker.'),\n duration_minutes: z.number().int().min(5).max(480).optional().describe('Slot length in minutes (default 30).'),\n buffer_minutes: z.number().int().min(0).max(120).optional().describe('Padding before/after existing events (default 0).'),\n window_days: z.number().int().min(1).max(365).optional().describe('How far ahead bookings are allowed (default 14).'),\n min_notice_minutes: z.number().int().min(0).max(40320).optional().describe('Minimum lead time before a bookable slot (default 0).'),\n timezone: z.string().min(1).max(64).optional().describe('IANA timezone for display + working hours (default UTC).'),\n availability_constraints: z\n .record(z.string(), z.object({ start: z.string(), end: z.string() }))\n .nullable()\n .optional()\n .describe('Weekly working hours, e.g. {\"mon\":{\"start\":\"09:00\",\"end\":\"17:00\"}}. Omit/null for any time in the window.'),\n active: z.boolean().optional().describe('Whether the page accepts bookings (default true).'),\n});\n\nexport const DeleteBookingPageSchema = z.object({\n booking_page_id: z.string().describe('Booking page ID to delete (bkp_...)'),\n});\n\n// ── Events ─────────────────────────────────────────────────────\n\nexport const ListEventsSchema = z.object({\n calendar_id: z.string().optional().describe('Calendar ID to list events from. Provide this or agent_id.'),\n agent_id: z.string().optional().describe('Agent ID to list events for across all of the agent\\'s calendars. Provide this or calendar_id.'),\n start_after: z.string().datetime().optional().describe('Only events starting after this ISO 8601 time'),\n start_before: z.string().datetime().optional().describe('Only events starting before this ISO 8601 time'),\n status: z.enum(['confirmed', 'tentative', 'cancelled', 'hold']).optional().describe('Filter by event status'),\n source: z.enum(['internal', 'external_ical']).optional().describe('Filter by source: \"internal\" (created via the API) or \"external_ical\" (synced from an iCal subscription)'),\n limit: z.number().int().min(1).max(200).default(50).describe('Max results to return'),\n offset: z.number().int().min(0).default(0).describe('Pagination offset'),\n expand: z.boolean().default(false).describe('Expand recurring series into individual occurrence instances within the window. Requires both start_after and start_before (max 366 days apart). Instances carry recurringEventId + originalStartTime.'),\n});\n\nexport const ListOrgEventsSchema = z.object({\n calendar_ids: z.array(z.string()).max(50).optional().describe('Only these calendar IDs (at most 50)'),\n agent_id: z.string().optional().describe('Only this agent\\'s calendars'),\n start_after: z.string().datetime().optional().describe('Only events starting at or after this ISO 8601 time'),\n start_before: z.string().datetime().optional().describe('Only events starting at or before this ISO 8601 time'),\n status: z.enum(['confirmed', 'tentative', 'cancelled', 'hold']).optional().describe('Filter by event status'),\n source: z.enum(['internal', 'external_ical']).optional().describe('Filter by source: \"internal\" (created via the API) or \"external_ical\" (synced from an iCal subscription)'),\n q: z.string().optional().describe('Case-insensitive title search. Requires start_after and start_before at most 31 days apart'),\n expand: z.boolean().default(false).describe('Expand recurring series into individual occurrences within the window. Requires both start_after and start_before (max 366 days apart).'),\n limit: z.number().int().min(1).max(100).default(50).describe('Max results to return (1-100)'),\n offset: z.number().int().min(0).default(0).describe('Pagination offset'),\n});\n\nexport const GetEventSchema = z.object({\n event_id: z.string().describe('Event ID to retrieve'),\n calendar_id: z.string().optional().describe('Calendar ID that owns the event. Optional — if omitted the calendar is resolved from the event.'),\n});\n\nexport const CreateEventSchema = z.object({\n calendar_id: z.string().describe('Calendar ID to add the event to'),\n title: z.string().min(1).max(500).describe('Event title'),\n start_time: z.string().datetime().describe('Start time (ISO 8601)'),\n end_time: z.string().datetime().describe('End time (ISO 8601)'),\n description: z.string().max(10_000).optional().describe('Optional event description'),\n all_day: z.boolean().default(false).describe('Whether this is an all-day event'),\n status: z.enum(['confirmed', 'tentative', 'hold']).optional().describe('Event status. \"hold\" creates a tentative reservation that auto-expires at hold_expires_at. Defaults to \"confirmed\".'),\n reminders: z.array(z.number().int().min(1).max(40320)).max(5).nullable().optional().describe('Reminder offsets in minutes before start_time (e.g. [10, 1440]). Each fires an event.reminder webhook and shows as an alarm in the iCal feed. Omit or null to inherit the calendar default (then the system default of 10 min); [] for no reminders.'),\n hold_expires_at: z.string().datetime().optional().describe('Required when status=\"hold\". ISO 8601 timestamp 30s-15min in the future. Auto-releases the hold when reached.'),\n hold_priority: z.number().int().min(0).max(100).optional().describe('Only valid with status=\"hold\". Higher-priority overlapping holds pre-empt lower-priority ones. Defaults to 0.'),\n recurrence_rule: z.string().max(256).optional().describe('Make this a recurring series (RFC 5545 RRULE subset, no \"RRULE:\" prefix), e.g. \"FREQ=WEEKLY;BYDAY=MO,WE;COUNT=12\". Supports FREQ=DAILY/WEEKLY/MONTHLY/YEARLY, INTERVAL, COUNT (max 730) or UNTIL, BYDAY (weekly list or monthly ordinal like 2TU/-1FR), BYMONTHDAY (1-28 or -1). start_time must match the rule pattern; expansion is UTC-only. Not allowed with status=\"hold\". Free plan: max 5 recurring events, series must end within 90 days.'),\n});\n\nexport const UpdateEventSchema = z.object({\n event_id: z.string().describe('Event ID to update'),\n calendar_id: z.string().optional().describe('Calendar ID that owns the event. Optional — if omitted the calendar is resolved from the event.'),\n title: z.string().min(1).max(500).optional().describe('New event title'),\n description: z.string().max(10_000).nullable().optional().describe('New description, or null to clear it'),\n start_time: z.string().datetime().optional().describe('New start time (ISO 8601)'),\n end_time: z.string().datetime().optional().describe('New end time (ISO 8601)'),\n all_day: z.boolean().optional().describe('Whether this is an all-day event'),\n status: z.enum(['confirmed', 'tentative', 'cancelled']).optional().describe('New event status'),\n metadata: z.record(z.string(), z.unknown()).optional().describe('Replacement metadata object'),\n reminders: z.array(z.number().int().min(1).max(40320)).max(5).nullable().optional().describe('Reminder offsets in minutes before start_time. Omit to leave unchanged, null to inherit the calendar default, [] for no reminders.'),\n recurrence_rule: z.string().max(256).nullable().optional().describe('Set/change the recurring series rule (RFC 5545 RRULE subset, full-series semantics), or null to make the event a one-off. Changing the rule or start_time resets cancelled occurrences.'),\n});\n\nexport const CancelEventSchema = z.object({\n event_id: z.string().describe('Event ID to cancel'),\n calendar_id: z.string().optional().describe('Calendar ID that owns the event. Optional — if omitted the calendar is resolved from the event. Matches the asymmetry with confirm_event / release_event which never required this arg.'),\n occurrence_start: z.string().datetime().optional().describe('For recurring events only: ISO 8601 start of the single occurrence to cancel. The rest of the series is unaffected.'),\n});\n\nexport const ConfirmEventSchema = z.object({\n event_id: z.string().describe('Event ID of the hold to confirm'),\n});\n\nexport const ReleaseEventSchema = z.object({\n event_id: z.string().describe('Event ID of the hold to release'),\n});\n\n// ── Agents ─────────────────────────────────────────────────────\n\nexport const CreateAgentSchema = z.object({\n name: z.string().min(1).max(255).describe('Display name for the agent'),\n type: z.enum(['ai', 'human', 'resource']).describe('Agent type'),\n description: z.string().max(5_000).optional().describe('Optional description'),\n});\n\nexport const ListAgentsSchema = z.object({\n type: z.enum(['ai', 'human', 'resource']).optional().describe('Filter by agent type'),\n status: z.enum(['active', 'paused', 'decommissioned']).optional().describe('Filter by status'),\n limit: z.number().int().min(1).max(200).default(50).describe('Max results to return'),\n offset: z.number().int().min(0).default(0).describe('Pagination offset'),\n});\n\nexport const GetAgentSchema = z.object({\n agent_id: z.string().describe('Agent ID to fetch'),\n});\n\nexport const UpdateAgentSchema = z.object({\n agent_id: z.string().describe('Agent ID to update'),\n name: z.string().min(1).max(255).optional().describe('New display name'),\n description: z.string().max(5_000).nullable().optional().describe('New description (null to clear)'),\n metadata: z.record(z.string(), z.unknown()).optional().describe('Arbitrary metadata (max 16KB)'),\n status: z.enum(['active', 'paused']).optional().describe('Operational status'),\n});\n\nexport const DeleteAgentSchema = z.object({\n agent_id: z.string().describe('Agent ID to decommission'),\n});\n\n// ── Availability ───────────────────────────────────────────────\n\nexport const GetAvailabilitySchema = z.object({\n agent_id: z.string().describe('Agent ID to check availability for'),\n start: z.string().datetime().optional().describe('Range start (ISO 8601). Alias: start_time.'),\n end: z.string().datetime().optional().describe('Range end (ISO 8601). Alias: end_time.'),\n start_time: z.string().datetime().optional().describe('Alias for `start` (matches REST events naming).'),\n end_time: z.string().datetime().optional().describe('Alias for `end` (matches REST events naming).'),\n duration: z.enum(['15m', '30m', '45m', '1h', '2h']).optional().describe('Requested slot length (15m/30m/45m/1h/2h). Preferred over the deprecated slot_duration. Defaults to 30m.'),\n slot_duration: z.enum(['15m', '30m', '45m', '1h', '2h']).optional().describe('Deprecated alias for `duration` — minimum slot length. Prefer `duration`.'),\n include_busy: z.boolean().default(false).describe('Include busy blocks in response'),\n});\n\nexport const FindMeetingTimeSchema = z.object({\n agents: z.array(z.string()).min(1).optional().describe('Array of agent IDs to find common free time for. All agents must be free during the returned slots. Alias: agent_ids.'),\n agent_ids: z.array(z.string()).min(1).optional().describe('Alias for `agents` (matches REST/scheduling-proposal naming).'),\n start: z.string().datetime().optional().describe('Search range start (ISO 8601). Alias: start_time.'),\n end: z.string().datetime().optional().describe('Search range end (ISO 8601). Alias: end_time.'),\n start_time: z.string().datetime().optional().describe('Alias for `start` (matches REST events naming).'),\n end_time: z.string().datetime().optional().describe('Alias for `end` (matches REST events naming).'),\n duration: z.enum(['15m', '30m', '45m', '1h', '2h']).optional().describe('Requested slot length (15m/30m/45m/1h/2h). Preferred over the deprecated slot_duration. Defaults to 30m.'),\n slot_duration: z.enum(['15m', '30m', '45m', '1h', '2h']).optional().describe('Deprecated alias for `duration` — minimum slot length. Prefer `duration`.'),\n calendars: z.array(z.string()).optional().describe('Additional shared calendar IDs to treat as busy'),\n include_busy: z.boolean().default(false).describe('Include per-agent busy blocks in response'),\n});\n\nexport const CreateConnectionLinkSchema = z.object({\n calendar_id: z.string().startsWith('cal_').describe('Chronary calendar whose owning agent will receive authorized availability'),\n capabilities: z.array(z.enum(['availability', 'publishing'])).min(1).max(2).default(['availability']).describe('Request opaque availability, plus optional opt-in event publishing permission'),\n publication_policy: z.enum(['none', 'confirmed', 'confirmed_tentative']).default('none').describe('Desired publishing policy; a human still chooses the destination'),\n});\n\nexport const GetConnectionLinkSchema = z.object({\n connection_link_id: z.string().startsWith('csl_').describe('Connection setup link ID'),\n});\n\nexport const CancelConnectionLinkSchema = GetConnectionLinkSchema;\n\n// ── Calendar context ───────────────────────────────────────────\n\nexport const GetCalendarContextSchema = z.object({\n calendar_id: z.string().describe('Calendar ID'),\n});\n\n// ── Scheduling proposals ───────────────────────────────────────\n\nconst proposalSlotSchema = z.object({\n start_time: z.string().datetime().describe('Slot start time (ISO 8601)'),\n end_time: z.string().datetime().describe('Slot end time (ISO 8601), after start_time'),\n weight: z.number().min(0).max(10).default(1.0).optional().describe('Preference for this slot, 0–10 (higher = more preferred). Used to rank candidate slots when the proposal is resolved. Defaults to 1.'),\n calendar_id: z.string().optional().describe('Calendar to create the event on if this slot is chosen. Defaults to the proposal\\'s top-level calendar_id.'),\n});\n\nexport const CreateProposalSchema = z.object({\n title: z.string().min(1).max(500).describe('Short description of what the meeting is about'),\n description: z.string().max(5000).optional().describe('Longer context/agenda'),\n organizer_agent_id: z.string().describe('Agent ID proposing the meeting'),\n participant_agent_ids: z.array(z.string()).min(1).max(50).describe('Agent IDs invited to respond'),\n calendar_id: z.string().describe('Calendar the resolved event will be created on'),\n slots: z.array(proposalSlotSchema).min(1).max(20).describe('Candidate time slots (up to 20)'),\n expires_at: z.string().datetime().optional().describe('Auto-cancel cutoff if unresolved'),\n});\n\nexport const ListProposalsSchema = z.object({\n status: z.enum(['pending', 'resolving', 'confirmed', 'expired', 'cancelled']).optional().describe('Filter by proposal status'),\n organizer_agent_id: z.string().optional().describe('Filter by organizer agent'),\n limit: z.number().int().min(1).max(200).optional().describe('Max results (default 50)'),\n offset: z.number().int().min(0).optional().describe('Pagination offset (default 0)'),\n});\n\nexport const GetProposalSchema = z.object({\n proposal_id: z.string().describe('Proposal to fetch'),\n});\n\nexport const RespondToProposalSchema = z.object({\n proposal_id: z.string().describe('Proposal to respond to'),\n agent_id: z.string().describe('Participant agent responding'),\n response: z.enum(['accept', 'decline', 'counter']).describe('Decision from this agent'),\n selected_slot_id: z.string().optional().describe('Required when response is \"accept\"'),\n counter_slots: z.array(proposalSlotSchema).max(20).optional().describe('Alternative slots when response is \"counter\"'),\n message: z.string().max(2000).optional().describe('Optional note for the organizer'),\n});\n\nexport const ResolveProposalSchema = z.object({\n proposal_id: z.string().describe('Proposal to resolve'),\n});\n\nexport const CancelProposalSchema = z.object({\n proposal_id: z.string().describe('Proposal to cancel'),\n});\n\n// ── Availability rules ─────────────────────────────────────────\n\nconst timeOfDay = z.string().regex(/^([01]\\d|2[0-3]):[0-5]\\d$/, 'must be HH:MM in 24-hour time');\n\nconst workingHoursDaySchema = z.object({\n start: timeOfDay.describe('Start of the working window, HH:MM 24-hour, in the rules timezone (e.g. \"09:00\")'),\n end: timeOfDay.describe('End of the working window, HH:MM 24-hour, after start (e.g. \"17:00\")'),\n})\n .refine((v) => v.end > v.start, 'end must be after start')\n .describe('A single day\\'s working hours window');\n\nconst workingHoursSchema = z.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 .nullable();\n\nexport const SetAvailabilityRulesSchema = z.object({\n calendar_id: z.string().describe('Calendar to configure'),\n buffer_before_minutes: z.number().int().min(0).max(120).default(0).describe('Minutes of buffer before each event (0–120)'),\n buffer_after_minutes: z.number().int().min(0).max(120).default(0).describe('Minutes of buffer after each event (0–120)'),\n working_hours: workingHoursSchema.default(null).describe('Per-day working hours map in the calendar\\'s timezone; omit keys for off-days. Pass null to remove any working-hours constraint.'),\n timezone: z.string().min(1).max(64).default('UTC').describe('IANA timezone used to interpret working_hours (e.g. America/New_York)'),\n});\n\nexport const GetAvailabilityRulesSchema = z.object({\n calendar_id: z.string().describe('Calendar to read'),\n});\n\nexport const ClearAvailabilityRulesSchema = z.object({\n calendar_id: z.string().describe('Calendar whose rules should be cleared'),\n});\n\n// ── Scoped keys ────────────────────────────────────────────────\n\nexport const CreateScopedKeySchema = z.object({\n agent_id: z.string().regex(/^agt_/).describe('Agent ID this key is scoped to'),\n label: z.string().min(1).max(100).optional().describe('Human-readable label for the key'),\n expires_in: z\n .enum(['30d', '60d', '90d', '180d', '365d'])\n .optional()\n .describe('When the key stops working, from now. Omit for a key that never expires. After it expires, requests fail with 401 key_expired.'),\n});\n\nexport const ListScopedKeysSchema = z.object({});\n\nexport const RevokeScopedKeySchema = z.object({\n key_id: z.string().describe('ID of the scoped key to revoke'),\n});\n\n// ── Audit log ──────────────────────────────────────────────────\n\nexport const GetAuditLogSchema = z.object({\n from: z.string().datetime({ offset: true }).optional().describe('Start of the window (ISO 8601). Silently clamped to the plan retention window if older.'),\n to: z.string().datetime({ offset: true }).optional().describe('End of the window (ISO 8601)'),\n action: z.string().min(1).max(64).optional().describe('Filter by action name (e.g. event.create, agent_key.revoke). Legacy names are matched by their current names.'),\n actor_key_prefix: z.string().min(1).max(32).optional().describe('Filter by the API key prefix that performed the action'),\n actor_type: z.enum(['session', 'org_key', 'agent_key', 'system']).optional().describe('Filter by who acted: session (console), org_key, agent_key or system'),\n actor_id: z.string().min(1).max(64).optional().describe('Filter by actor id (an API key id, or the org id for console sessions)'),\n request_id: z.string().min(1).max(64).optional().describe('Filter by request id (the X-Request-Id of the original call)'),\n resource: z.string().max(64).regex(/^[a-z]{2,5}_[A-Za-z0-9_-]*$/).optional().describe('Filter by an entity id or id prefix the request touched (e.g. cal_abc123 or cal_)'),\n status_class: z.enum(['2xx', '3xx', '4xx', '5xx']).optional().describe('Filter by response status class: 2xx, 3xx, 4xx or 5xx'),\n category: z.enum(['account', 'keys', 'agents', 'calendars', 'events', 'scheduling', 'webhooks', 'human_calendars', 'billing', 'security']).optional().describe('Filter by action category (e.g. keys, calendars, billing, security)'),\n cursor: z.string().min(1).max(256).optional().describe('Opaque pagination cursor from a previous response'),\n limit: z.number().int().min(1).max(200).optional().describe('Max results to return (default 50)'),\n});\n\n// ── Terms ──────────────────────────────────────────────────────\n\nexport const AcceptTermsSchema = z.object({\n tos_version: z.string().min(1).describe('The terms-of-service version to accept; must match the current version'),\n});\n\n// ── Webhooks ───────────────────────────────────────────────────\n\nexport const ListWebhooksSchema = z.object({\n limit: z.number().int().min(1).max(100).default(20).describe('Max results to return'),\n offset: z.number().int().min(0).default(0).describe('Pagination offset'),\n});\n\nexport const GetWebhookSchema = z.object({\n webhook_id: z.string().describe('Webhook subscription to fetch'),\n});\n\nexport const CreateWebhookSchema = z.object({\n url: z.string().url().max(2_048).describe('HTTPS endpoint that will receive event deliveries'),\n events: z.array(z.enum(WEBHOOK_EVENT_TYPES)).min(1).describe('Event types to subscribe to'),\n});\n\nexport const UpdateWebhookSchema = z.object({\n webhook_id: z.string().describe('Webhook subscription to update'),\n url: z.string().url().max(2_048).optional().describe('New HTTPS delivery endpoint'),\n events: z.array(z.enum(WEBHOOK_EVENT_TYPES)).min(1).optional().describe('Replacement set of event types to subscribe to'),\n active: z.boolean().optional().describe('Set false to pause deliveries, true to resume'),\n});\n\nexport const DeleteWebhookSchema = z.object({\n webhook_id: z.string().describe('Webhook subscription to delete'),\n});\n\nexport const ListWebhookDeliveriesSchema = z.object({\n webhook_id: z.string().describe('Webhook subscription whose deliveries to list'),\n limit: z.number().int().min(1).max(100).default(20).describe('Max results to return'),\n offset: z.number().int().min(0).default(0).describe('Pagination offset. Cannot be combined with cursor'),\n status: z.enum(WEBHOOK_DELIVERY_STATUSES).optional().describe('Filter to a single delivery status'),\n include_payload: z.boolean().optional().describe('Include the full event payload sent on each delivery'),\n event_type: z\n .string()\n .max(100)\n .regex(/^[a-z_]+\\.(?:[a-z_]+)?$/)\n .optional()\n .describe('An exact event type (event.created), or a prefix ending in a dot (event.) for a whole group'),\n created_after: z.string().datetime().optional().describe('Only deliveries created at or after this time (ISO 8601, UTC)'),\n created_before: z.string().datetime().optional().describe('Only deliveries created before this time (ISO 8601, UTC)'),\n delivery_id: z.string().max(100).regex(/^whd_[A-Za-z0-9_-]+$/).optional().describe('Only the delivery with this id'),\n is_test: z.boolean().optional().describe('true for test events only, false to leave them out'),\n cursor: z.string().min(1).max(1024).optional().describe('The next_cursor from the previous page'),\n});\n\nexport const GetWebhookDeliverySchema = z.object({\n webhook_id: z.string().describe('Webhook subscription the delivery belongs to'),\n delivery_id: z.string().describe('Delivery ID (whd_...) from list_webhook_deliveries'),\n});\n\nexport const SendTestWebhookSchema = z.object({\n webhook_id: z.string().describe('Webhook subscription to send the test event to'),\n event_type: z.enum(WEBHOOK_EVENT_TYPES).describe('Event type whose sample payload to send'),\n});\n\nexport const ReplayWebhookDeliverySchema = z.object({\n webhook_id: z.string().describe('Webhook subscription the delivery belongs to'),\n delivery_id: z.string().describe('Delivery to replay (whd_...)'),\n});\n\n// ── iCal Subscriptions ─────────────────────────────────────────\n\nexport const ListICalSubscriptionsSchema = z.object({\n agent_id: z.string().describe('Agent ID whose iCal subscriptions to list'),\n status: z.enum(['active', 'error', 'paused']).optional().describe('Filter by subscription status'),\n limit: z.number().int().min(1).max(200).default(50).describe('Max results to return'),\n offset: z.number().int().min(0).default(0).describe('Pagination offset'),\n});\n\nexport const GetICalSubscriptionSchema = z.object({\n subscription_id: z.string().describe('iCal subscription ID to fetch'),\n});\n\nexport const SubscribeICalSchema = z.object({\n agent_id: z.string().describe('Agent ID that will own this subscription'),\n calendar_id: z.string().describe('Calendar ID to sync external events into'),\n url: z.string().url().max(2_048).describe('HTTPS URL of the iCal feed (.ics) to subscribe to'),\n label: z.string().optional().describe('Optional label for this subscription'),\n});\n\nexport const UpdateICalSubscriptionSchema = z.object({\n subscription_id: z.string().describe('iCal subscription ID to update'),\n label: z.string().min(1).max(255).optional().describe('New label for this subscription'),\n url: z.string().url().max(2_048).refine((u) => u.startsWith('https://'), 'URL must use HTTPS').optional().describe('New HTTPS URL of the iCal feed (.ics)'),\n});\n\nexport const DeleteICalSubscriptionSchema = z.object({\n subscription_id: z.string().describe('iCal subscription ID to delete'),\n});\n\nexport const SyncICalSubscriptionSchema = z.object({\n subscription_id: z.string().describe('iCal subscription ID to sync'),\n});\n\nexport const PauseICalSubscriptionSchema = z.object({\n subscription_id: z.string().describe('iCal subscription ID to pause'),\n});\n\nexport const ResumeICalSubscriptionSchema = z.object({\n subscription_id: z.string().describe('iCal subscription ID to resume'),\n});\n\n// ── Usage ──────────────────────────────────────────────────────\n\nexport const GetUsageSchema = z.object({});\n\nexport const GetUsageHistorySchema = z.object({\n months: z.number().int().min(1).max(12).optional().describe('Number of UTC calendar months to return, 1-12 (default 6)'),\n});\n\n// ── Billing ────────────────────────────────────────────────────\n\nexport const GetBillingSchema = z.object({});\n\nexport const RequestUpgradeSchema = z.object({\n interval: z.enum(['month', 'year']).optional().describe('Billing interval to request. Defaults to month.'),\n reason: z.string().max(500).optional().describe('Why the upgrade is needed (max 500 chars). Shown to your human as plain text.'),\n feature: z.string().optional().describe('Plan-gated feature that was blocked, e.g. scoped_keys (from a plan_required error).'),\n metric: z.string().optional().describe('Quota metric that was exhausted, e.g. api_calls (from a quota_exceeded error).'),\n});\n\nexport const GetUpgradeRequestSchema = z.object({\n id: z.string().describe('Upgrade request ID (upr_...)'),\n});\n\nexport const CancelUpgradeRequestSchema = GetUpgradeRequestSchema;\n","import { ChronaryError } from '@chronary/sdk';\nimport type { ToolResult } from './types';\n\n/**\n * Structured error payload returned to the model. Plan/quota fields let an\n * agent act on `plan_required` / `quota_exceeded` (call get_billing, then\n * request_upgrade) instead of retrying in a loop.\n */\nexport interface ToolErrorPayload {\n error: string;\n message: string;\n upgrade_url?: string;\n docs_url?: string;\n required_plan?: string;\n feature?: string;\n metric?: string;\n limit?: number;\n}\n\n/** Serialize a thrown value into the structured error payload (undefined fields omitted). */\nexport function toErrorPayload(err: unknown): ToolErrorPayload {\n if (err instanceof ChronaryError) {\n const payload: ToolErrorPayload = {\n error: err.errorType ?? err.name,\n message: err.message,\n };\n if (err.upgradeUrl !== undefined) payload.upgrade_url = err.upgradeUrl;\n if (err.docsUrl !== undefined) payload.docs_url = err.docsUrl;\n if (err.requiredPlan !== undefined) payload.required_plan = err.requiredPlan;\n if (err.feature !== undefined) payload.feature = err.feature;\n if (err.metric !== undefined) payload.metric = err.metric;\n if (err.limit !== undefined) payload.limit = err.limit;\n return payload;\n }\n return { error: 'error', message: err instanceof Error ? err.message : String(err) };\n}\n\n/**\n * Wraps an async function so SDK errors become structured ToolResult objects\n * instead of thrown exceptions. LLMs see a structured error object, never\n * stack traces.\n */\nexport function safeFunc<TParams>(\n fn: (params: TParams) => Promise<unknown>,\n): (params: TParams) => Promise<ToolResult> {\n return async (params: TParams): Promise<ToolResult> => {\n try {\n const result = await fn(params);\n return { result: result ?? { success: true }, isError: false };\n } catch (err) {\n return { result: toErrorPayload(err), isError: true };\n }\n };\n}\n","import type { Chronary, KeyExpiresIn, ListAuditLogParams } from '@chronary/sdk';\nimport { safeFunc } from './safe';\nimport type { ToolResult } from './types';\n\ninterface Ctx<P = Record<string, unknown>> {\n client: Chronary;\n params: P;\n}\n\n// Helper to consume a PageIterator's first page\nasync function fetchPage(\n iterator: AsyncIterable<unknown> & { getPage(offset?: number, limit?: number): Promise<{ data: unknown[]; total: number; hasMore: boolean }> },\n offset?: number,\n limit?: number,\n) {\n const page = await iterator.getPage(offset ?? 0, limit);\n return { data: page.data, total: page.total, has_more: page.hasMore };\n}\n\n// ── Calendars ──────────────────────────────────────────────────\n\nexport const listCalendars = safeFunc(async (ctx: Ctx<{\n agent_id?: string; include?: 'all'; limit?: number; offset?: number;\n}>) => {\n const { client, params } = ctx;\n const iter = client.calendars.list({ agentId: params.agent_id, include: params.include, limit: params.limit });\n return fetchPage(iter, params.offset, params.limit);\n});\n\nexport const getCalendar = safeFunc(async (ctx: Ctx<{ calendar_id: string }>) => {\n return ctx.client.calendars.get(ctx.params.calendar_id);\n});\n\nexport const createCalendar = safeFunc(async (ctx: Ctx<{\n name: string; timezone: string; agent_id?: string; default_reminders?: number[] | null; metadata?: Record<string, unknown>;\n}>) => {\n const { client, params } = ctx;\n return client.calendars.create({\n name: params.name,\n timezone: params.timezone,\n agentId: params.agent_id,\n default_reminders: params.default_reminders,\n metadata: params.metadata,\n });\n});\n\nexport const updateCalendar = safeFunc(async (ctx: Ctx<{\n calendar_id: string; name?: string; timezone?: string;\n agent_status?: 'idle' | 'working' | 'waiting' | 'error';\n default_reminders?: number[] | null; metadata?: Record<string, unknown>;\n}>) => {\n const { client, params } = ctx;\n const { calendar_id, ...updates } = params;\n return client.calendars.update(calendar_id, updates);\n});\n\nexport const deleteCalendar = safeFunc(async (ctx: Ctx<{ calendar_id: string }>) => {\n await ctx.client.calendars.delete(ctx.params.calendar_id);\n return undefined; // safeFunc normalizes to { success: true }\n});\n\n// ── Booking pages ──────────────────────────────────────────────\n\nexport const listBookingPages = safeFunc(async (ctx: Ctx<{ limit?: number; offset?: number }>) => {\n const { client, params } = ctx;\n const iter = client.bookingPages.list({ limit: params.limit });\n return fetchPage(iter, params.offset, params.limit);\n});\n\nexport const getBookingPage = safeFunc(async (ctx: Ctx<{ booking_page_id: string }>) => {\n return ctx.client.bookingPages.get(ctx.params.booking_page_id);\n});\n\nexport const createBookingPage = safeFunc(async (ctx: Ctx<{\n calendar_id: string; title: string; description?: string; duration_minutes?: number;\n buffer_minutes?: number; window_days?: number; min_notice_minutes?: number; timezone?: string;\n availability_constraints?: Record<string, { start: string; end: string }> | null; active?: boolean;\n}>) => {\n const { client, params } = ctx;\n return client.bookingPages.create({\n calendar_id: params.calendar_id,\n title: params.title,\n description: params.description,\n duration_minutes: params.duration_minutes,\n buffer_minutes: params.buffer_minutes,\n window_days: params.window_days,\n min_notice_minutes: params.min_notice_minutes,\n timezone: params.timezone,\n availability_constraints: params.availability_constraints,\n active: params.active,\n });\n});\n\nexport const deleteBookingPage = safeFunc(async (ctx: Ctx<{ booking_page_id: string }>) => {\n await ctx.client.bookingPages.delete(ctx.params.booking_page_id);\n return undefined; // safeFunc normalizes to { success: true }\n});\n\n// ── Events ─────────────────────────────────────────────────────\n\nexport const listEvents = safeFunc(async (ctx: Ctx<{\n calendar_id?: string; agent_id?: string; start_after?: string; start_before?: string;\n status?: 'confirmed' | 'tentative' | 'cancelled' | 'hold'; source?: 'internal' | 'external_ical';\n limit?: number; offset?: number; expand?: boolean;\n}>) => {\n const { client, params } = ctx;\n if (!params.calendar_id && !params.agent_id) {\n throw new Error('Provide calendar_id or agent_id');\n }\n const iter = client.events.list({\n calendarId: params.calendar_id,\n agentId: params.agent_id,\n start_after: params.start_after,\n start_before: params.start_before,\n status: params.status,\n source: params.source,\n expand: params.expand,\n limit: params.limit,\n });\n return fetchPage(iter, params.offset, params.limit);\n});\n\nexport const listOrgEvents = safeFunc(async (ctx: Ctx<{\n calendar_ids?: string[]; agent_id?: string; start_after?: string; start_before?: string;\n status?: 'confirmed' | 'tentative' | 'cancelled' | 'hold'; source?: 'internal' | 'external_ical';\n q?: string; expand?: boolean; limit?: number; offset?: number;\n}>) => {\n const { client, params } = ctx;\n const iter = client.events.listAll({\n calendar_id: params.calendar_ids,\n agent_id: params.agent_id,\n start_after: params.start_after,\n start_before: params.start_before,\n status: params.status,\n source: params.source,\n q: params.q,\n expand: params.expand,\n limit: params.limit,\n });\n return fetchPage(iter, params.offset, params.limit);\n});\n\nexport const getEvent = safeFunc(async (ctx: Ctx<{ calendar_id?: string; event_id: string }>) => {\n const { calendar_id, event_id } = ctx.params;\n return calendar_id\n ? ctx.client.events.get(calendar_id, event_id)\n : ctx.client.events.getById(event_id);\n});\n\nexport const createEvent = safeFunc(async (ctx: Ctx<{\n calendar_id: string; title: string; start_time: string; end_time: string;\n description?: string; all_day?: boolean;\n status?: 'confirmed' | 'tentative' | 'hold'; reminders?: number[] | null; metadata?: Record<string, unknown>;\n hold_expires_at?: string; hold_priority?: number; recurrence_rule?: string;\n}>) => {\n const { client, params } = ctx;\n const { calendar_id, ...eventParams } = params;\n return client.events.create(calendar_id, eventParams);\n});\n\nexport const updateEvent = safeFunc(async (ctx: Ctx<{\n calendar_id?: string; event_id: string; title?: string; description?: string | null;\n start_time?: string; end_time?: string; all_day?: boolean;\n status?: 'confirmed' | 'tentative' | 'cancelled'; reminders?: number[] | null; metadata?: Record<string, unknown>;\n recurrence_rule?: string | null;\n}>) => {\n const { client, params } = ctx;\n const { calendar_id, event_id, ...updates } = params;\n return calendar_id\n ? client.events.update(calendar_id, event_id, updates)\n : client.events.updateById(event_id, updates);\n});\n\nexport const cancelEvent = safeFunc(async (ctx: Ctx<{ calendar_id?: string; event_id: string; occurrence_start?: string }>) => {\n const { calendar_id, event_id, occurrence_start } = ctx.params;\n if (occurrence_start) {\n // Single-occurrence cancel on a recurring series (#996): the API EXDATEs\n // that occurrence and returns the updated series master (the rest of the\n // series is unaffected). Mirrors the hosted MCP tool's response shape.\n const event = calendar_id\n ? await ctx.client.events.delete(calendar_id, event_id, { occurrence_start })\n : await ctx.client.events.deleteById(event_id, { occurrence_start });\n return { occurrence_cancelled: true, id: event_id, occurrence_start, event };\n }\n if (calendar_id) {\n await ctx.client.events.delete(calendar_id, event_id);\n } else {\n await ctx.client.events.deleteById(event_id);\n }\n return undefined;\n});\n\nexport const confirmEvent = safeFunc(async (ctx: Ctx<{ event_id: string }>) => {\n return ctx.client.events.confirm(ctx.params.event_id);\n});\n\nexport const releaseEvent = safeFunc(async (ctx: Ctx<{ event_id: string }>) => {\n return ctx.client.events.release(ctx.params.event_id);\n});\n\n// ── Agents ─────────────────────────────────────────────────────\n\nexport const createAgent = safeFunc(async (ctx: Ctx<{\n name: string; type: 'ai' | 'human' | 'resource'; description?: string; metadata?: Record<string, unknown>;\n}>) => {\n return ctx.client.agents.create(ctx.params);\n});\n\nexport const listAgents = safeFunc(async (ctx: Ctx<{\n type?: 'ai' | 'human' | 'resource'; status?: 'active' | 'paused' | 'decommissioned'; limit?: number; offset?: number;\n}>) => {\n const { client, params } = ctx;\n const iter = client.agents.list({ type: params.type, status: params.status, limit: params.limit });\n return fetchPage(iter, params.offset, params.limit);\n});\n\nexport const getAgent = safeFunc(async (ctx: Ctx<{ agent_id: string }>) => {\n return ctx.client.agents.get(ctx.params.agent_id);\n});\n\nexport const updateAgent = safeFunc(async (ctx: Ctx<{\n agent_id: string; name?: string; description?: string | null; metadata?: Record<string, unknown>; status?: 'active' | 'paused';\n}>) => {\n const { client, params } = ctx;\n const { agent_id, ...updates } = params;\n return client.agents.update(agent_id, updates);\n});\n\nexport const deleteAgent = safeFunc(async (ctx: Ctx<{ agent_id: string }>) => {\n await ctx.client.agents.delete(ctx.params.agent_id);\n return undefined;\n});\n\n// ── Availability ───────────────────────────────────────────────\n\nexport const getAvailability = safeFunc(async (ctx: Ctx<{\n agent_id: string; start?: string; end?: string; start_time?: string; end_time?: string;\n duration?: '15m' | '30m' | '45m' | '1h' | '2h';\n slot_duration?: '15m' | '30m' | '45m' | '1h' | '2h'; include_busy?: boolean;\n}>) => {\n const { client, params } = ctx;\n // Resolve the `start`/`end` canonical names from their REST aliases, mirroring\n // the hosted MCP tool's validation. `duration`/`slot_duration` are forwarded\n // as-is; the API coalesces them (and rejects conflicting values with a 400).\n const start = params.start ?? params.start_time;\n const end = params.end ?? params.end_time;\n if (!start || !end) {\n throw new Error('start (or start_time) and end (or end_time) are required');\n }\n return client.availability.forAgent(params.agent_id, {\n start,\n end,\n duration: params.duration,\n slot_duration: params.slot_duration,\n include_busy: params.include_busy,\n });\n});\n\nexport const findMeetingTime = safeFunc(async (ctx: Ctx<{\n agents?: string[]; agent_ids?: string[];\n start?: string; end?: string; start_time?: string; end_time?: string;\n duration?: '15m' | '30m' | '45m' | '1h' | '2h';\n slot_duration?: '15m' | '30m' | '45m' | '1h' | '2h';\n calendars?: string[]; include_busy?: boolean;\n}>) => {\n const { client, params } = ctx;\n // Resolve the canonical `agents`/`start`/`end` from their REST/scheduling\n // aliases, mirroring the hosted MCP tool's validation. `duration`/`slot_duration`\n // are forwarded as-is; the API coalesces them (400 on conflicting values).\n const agents = params.agents ?? params.agent_ids;\n const start = params.start ?? params.start_time;\n const end = params.end ?? params.end_time;\n if (!agents || !start || !end) {\n throw new Error('agents (or agent_ids), start (or start_time), and end (or end_time) are required');\n }\n return client.availability.check({\n agents,\n start,\n end,\n duration: params.duration,\n slot_duration: params.slot_duration,\n calendars: params.calendars,\n include_busy: params.include_busy,\n });\n});\n\nexport const createConnectionLink = safeFunc(async (ctx: Ctx<{\n calendar_id: string;\n capabilities: Array<'availability' | 'publishing'>;\n publication_policy?: 'none' | 'confirmed' | 'confirmed_tentative';\n}>) => {\n const { calendar_id, ...params } = ctx.params;\n return ctx.client.connectionLinks.create(calendar_id, params);\n});\n\nexport const getConnectionLink = safeFunc(async (ctx: Ctx<{ connection_link_id: string }>) =>\n ctx.client.connectionLinks.get(ctx.params.connection_link_id));\n\nexport const cancelConnectionLink = safeFunc(async (ctx: Ctx<{ connection_link_id: string }>) => {\n await ctx.client.connectionLinks.cancel(ctx.params.connection_link_id);\n return { cancelled: true, id: ctx.params.connection_link_id };\n});\n\n// ── Calendar context ───────────────────────────────────────────\n\nexport const getCalendarContext = safeFunc(async (ctx: Ctx<{ calendar_id: string }>) => {\n return ctx.client.calendars.getContext(ctx.params.calendar_id);\n});\n\n// ── Scheduling proposals ───────────────────────────────────────\n\ninterface ProposalSlotInput {\n start_time: string;\n end_time: string;\n weight?: number;\n calendar_id?: string;\n}\n\nexport const createProposal = safeFunc(async (ctx: Ctx<{\n title: string; description?: string; organizer_agent_id: string;\n participant_agent_ids: string[]; calendar_id: string;\n slots: ProposalSlotInput[]; expires_at?: string;\n}>) => {\n return ctx.client.scheduling.create(ctx.params);\n});\n\nexport const listProposals = safeFunc(async (ctx: Ctx<{\n status?: 'pending' | 'confirmed' | 'expired' | 'cancelled'; organizer_agent_id?: string; limit?: number; offset?: number;\n}>) => {\n const { client, params } = ctx;\n const iter = client.scheduling.list({\n status: params.status,\n organizer_agent_id: params.organizer_agent_id,\n limit: params.limit,\n });\n return fetchPage(iter, params.offset, params.limit);\n});\n\nexport const getProposal = safeFunc(async (ctx: Ctx<{ proposal_id: string }>) => {\n return ctx.client.scheduling.get(ctx.params.proposal_id);\n});\n\nexport const respondToProposal = safeFunc(async (ctx: Ctx<{\n proposal_id: string; agent_id: string; response: 'accept' | 'decline' | 'counter';\n selected_slot_id?: string; counter_slots?: ProposalSlotInput[]; message?: string;\n}>) => {\n const { client, params } = ctx;\n const { proposal_id, ...body } = params;\n return client.scheduling.respond(proposal_id, body);\n});\n\nexport const resolveProposal = safeFunc(async (ctx: Ctx<{ proposal_id: string }>) => {\n return ctx.client.scheduling.resolve(ctx.params.proposal_id);\n});\n\nexport const cancelProposal = safeFunc(async (ctx: Ctx<{ proposal_id: string }>) => {\n return ctx.client.scheduling.cancel(ctx.params.proposal_id);\n});\n\n// ── Availability rules ─────────────────────────────────────────\n\ninterface WorkingHoursDayInput { start: string; end: string; }\ntype WorkingHoursInput = {\n mon?: WorkingHoursDayInput; tue?: WorkingHoursDayInput; wed?: WorkingHoursDayInput;\n thu?: WorkingHoursDayInput; fri?: WorkingHoursDayInput; sat?: WorkingHoursDayInput; sun?: WorkingHoursDayInput;\n} | null;\n\nexport const setAvailabilityRules = safeFunc(async (ctx: Ctx<{\n calendar_id: string; buffer_before_minutes?: number; buffer_after_minutes?: number;\n working_hours?: WorkingHoursInput; timezone?: string;\n}>) => {\n const { client, params } = ctx;\n const { calendar_id, ...rules } = params;\n return client.calendars.setAvailabilityRules(calendar_id, rules);\n});\n\nexport const getAvailabilityRules = safeFunc(async (ctx: Ctx<{ calendar_id: string }>) => {\n return ctx.client.calendars.getAvailabilityRules(ctx.params.calendar_id);\n});\n\nexport const clearAvailabilityRules = safeFunc(async (ctx: Ctx<{ calendar_id: string }>) => {\n await ctx.client.calendars.deleteAvailabilityRules(ctx.params.calendar_id);\n return undefined;\n});\n\n// ── Scoped keys ────────────────────────────────────────────────\n\nexport const createScopedKey = safeFunc(async (ctx: Ctx<{ agent_id: string; label?: string; expires_in?: KeyExpiresIn }>) => {\n return ctx.client.keys.create(ctx.params);\n});\n\nexport const listScopedKeys = safeFunc(async (ctx: Ctx) => {\n return ctx.client.keys.list();\n});\n\nexport const revokeScopedKey = safeFunc(async (ctx: Ctx<{ key_id: string }>) => {\n await ctx.client.keys.delete(ctx.params.key_id);\n return undefined;\n});\n\n// ── Webhooks ───────────────────────────────────────────────────\n\nexport const listWebhooks = safeFunc(async (ctx: Ctx<{ limit?: number; offset?: number }>) => {\n const { client, params } = ctx;\n const iter = client.webhooks.list({ limit: params.limit });\n return fetchPage(iter, params.offset, params.limit);\n});\n\nexport const getWebhook = safeFunc(async (ctx: Ctx<{ webhook_id: string }>) => {\n return ctx.client.webhooks.get(ctx.params.webhook_id);\n});\n\nexport const createWebhook = safeFunc(async (ctx: Ctx<{ url: string; events: string[] }>) => {\n return ctx.client.webhooks.create(ctx.params);\n});\n\nexport const updateWebhook = safeFunc(async (ctx: Ctx<{\n webhook_id: string; url?: string; events?: string[]; active?: boolean;\n}>) => {\n const { client, params } = ctx;\n const { webhook_id, ...updates } = params;\n return client.webhooks.update(webhook_id, updates);\n});\n\nexport const deleteWebhook = safeFunc(async (ctx: Ctx<{ webhook_id: string }>) => {\n await ctx.client.webhooks.delete(ctx.params.webhook_id);\n return undefined;\n});\n\nexport const listWebhookDeliveries = safeFunc(async (ctx: Ctx<{\n webhook_id: string; limit?: number; offset?: number;\n status?: 'pending' | 'delivered' | 'failed' | 'dropped'; include_payload?: boolean;\n event_type?: string; created_after?: string; created_before?: string;\n delivery_id?: string; is_test?: boolean; cursor?: string;\n}>) => {\n const { client, params } = ctx;\n const { webhook_id, ...query } = params;\n return client.webhooks.listDeliveries(webhook_id, query);\n});\n\nexport const getWebhookDelivery = safeFunc(async (ctx: Ctx<{ webhook_id: string; delivery_id: string }>) => {\n return ctx.client.webhooks.getDelivery(ctx.params.webhook_id, ctx.params.delivery_id);\n});\n\nexport const sendTestWebhook = safeFunc(async (ctx: Ctx<{ webhook_id: string; event_type: string }>) => {\n return ctx.client.webhooks.sendTest(ctx.params.webhook_id, { event_type: ctx.params.event_type });\n});\n\nexport const replayWebhookDelivery = safeFunc(async (ctx: Ctx<{ webhook_id: string; delivery_id: string }>) => {\n return ctx.client.webhooks.replayDelivery(ctx.params.webhook_id, ctx.params.delivery_id);\n});\n\n// ── Audit log ──────────────────────────────────────────────────\n\nexport const getAuditLog = safeFunc(async (ctx: Ctx<ListAuditLogParams>) => {\n return ctx.client.auditLog.list(ctx.params);\n});\n\n// ── Terms ──────────────────────────────────────────────────────\n\nexport const acceptTerms = safeFunc(async (ctx: Ctx<{ tos_version: string }>) => {\n return ctx.client.terms.accept(ctx.params);\n});\n\n// ── iCal Subscriptions ─────────────────────────────────────────\n\nexport const listICalSubscriptions = safeFunc(async (ctx: Ctx<{\n agent_id: string; status?: 'active' | 'error' | 'paused'; limit?: number; offset?: number;\n}>) => {\n const { client, params } = ctx;\n const iter = client.icalSubscriptions.list({\n agentId: params.agent_id,\n status: params.status,\n limit: params.limit,\n });\n return fetchPage(iter, params.offset, params.limit);\n});\n\nexport const getICalSubscription = safeFunc(async (ctx: Ctx<{ subscription_id: string }>) => {\n return ctx.client.icalSubscriptions.get(ctx.params.subscription_id);\n});\n\nexport const subscribeICal = safeFunc(async (ctx: Ctx<{\n agent_id: string; calendar_id: string; url: string; label?: string;\n}>) => {\n const { client, params } = ctx;\n const { agent_id, ...subParams } = params;\n return client.icalSubscriptions.create(agent_id, subParams);\n});\n\nexport const updateICalSubscription = safeFunc(async (ctx: Ctx<{\n subscription_id: string; label?: string; url?: string;\n}>) => {\n const { client, params } = ctx;\n const { subscription_id, ...updates } = params;\n return client.icalSubscriptions.update(subscription_id, updates);\n});\n\nexport const deleteICalSubscription = safeFunc(async (ctx: Ctx<{ subscription_id: string }>) => {\n await ctx.client.icalSubscriptions.delete(ctx.params.subscription_id);\n return undefined;\n});\n\nexport const syncICalSubscription = safeFunc(async (ctx: Ctx<{ subscription_id: string }>) => {\n return ctx.client.icalSubscriptions.sync(ctx.params.subscription_id);\n});\n\nexport const pauseICalSubscription = safeFunc(async (ctx: Ctx<{ subscription_id: string }>) => {\n return ctx.client.icalSubscriptions.pause(ctx.params.subscription_id);\n});\n\nexport const resumeICalSubscription = safeFunc(async (ctx: Ctx<{ subscription_id: string }>) => {\n return ctx.client.icalSubscriptions.resume(ctx.params.subscription_id);\n});\n\n// ── Usage ──────────────────────────────────────────────────────\n\nexport const getUsage = safeFunc(async (ctx: Ctx) => {\n return ctx.client.usage.get();\n});\n\nexport const getUsageHistory = safeFunc(async (ctx: Ctx<{ months?: number }>) => {\n return ctx.client.usage.history({ months: ctx.params.months });\n});\n\n// ── Billing ────────────────────────────────────────────────────\n// Read-only for agents: a summary plus \"ask your human to upgrade\". Agents\n// cannot pay, cancel, or change payment methods.\n\nexport const getBilling = safeFunc(async (ctx: Ctx) => {\n return ctx.client.billing.get();\n});\n\nexport const requestUpgrade = safeFunc(async (ctx: Ctx<{\n interval?: 'month' | 'year'; reason?: string; feature?: string; metric?: string;\n}>) => {\n return ctx.client.billing.upgradeRequests.create(ctx.params);\n});\n\nexport const getUpgradeRequest = safeFunc(async (ctx: Ctx<{ id: string }>) => {\n return ctx.client.billing.upgradeRequests.get(ctx.params.id);\n});\n\nexport const cancelUpgradeRequest = safeFunc(async (ctx: Ctx<{ id: string }>) => {\n return ctx.client.billing.upgradeRequests.cancel(ctx.params.id);\n});\n\n// ── Factory ────────────────────────────────────────────────────\n\n/** Map of tool name → executor function. Used by definitions.ts to wire up execute(). */\nexport function createExecutor(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n fn: (ctx: { client: Chronary; params: any }) => Promise<ToolResult>,\n): (client: Chronary, params: Record<string, unknown>) => Promise<ToolResult> {\n return (client, params) => fn({ client, params });\n}\n","import type { ToolDefinition, ToolResult } from './types';\n\n/**\n * Event fields whose text can come from outside the org: a public booking\n * page writes the booker's name into `title` and their notes into\n * `description` and `metadata.invitee_notes` (`metadata.source` is\n * `booking_page`). Kept equal to the hosted MCP server's list.\n */\nexport const EVENT_UNTRUSTED_FIELDS = ['title', 'description', 'metadata'] as const;\n\n/**\n * Webhook delivery fields with third-party text: `payload` carries event text,\n * `response_body` is whatever the receiving server answered.\n */\nexport const WEBHOOK_DELIVERY_UNTRUSTED_FIELDS = ['payload', 'response_body'] as const;\n\n/**\n * Prefix `untrusted_fields` to a successful JSON object result. Arrays,\n * primitives and errors are returned unchanged.\n */\nexport function withUntrustedFields(result: ToolResult, fields: readonly string[]): ToolResult {\n const body = result.result;\n if (result.isError || typeof body !== 'object' || body === null || Array.isArray(body)) return result;\n return { ...result, result: { untrusted_fields: [...fields], ...(body as Record<string, unknown>) } };\n}\n\n/** Wrap a definition's `execute` so its results carry `untrusted_fields`. */\nexport function markUntrusted(def: ToolDefinition): ToolDefinition {\n const fields = def.untrustedFields;\n if (!fields || fields.length === 0) return def;\n const execute = def.execute;\n return { ...def, execute: async (client, params) => withUntrustedFields(await execute(client, params), fields) };\n}\n","import type { ToolDefinition } from './types';\nimport * as schemas from './schemas';\nimport * as fns from './functions';\nimport { createExecutor } from './functions';\nimport { EVENT_UNTRUSTED_FIELDS, WEBHOOK_DELIVERY_UNTRUSTED_FIELDS, markUntrusted } from './untrusted';\n\nexport const HOSTED_API_MCP_TOOL_NAMES = [\n 'create_agent',\n 'list_agents',\n 'create_calendar',\n 'create_event',\n 'list_events',\n 'list_org_events',\n 'get_event',\n 'update_event',\n 'get_availability',\n 'find_meeting_time',\n 'create_connection_link',\n 'get_connection_link',\n 'cancel_connection_link',\n 'cancel_event',\n 'confirm_event',\n 'release_event',\n 'subscribe_ical',\n 'list_ical_subscriptions',\n 'get_ical_subscription',\n 'update_ical_subscription',\n 'delete_ical_subscription',\n 'sync_ical_subscription',\n 'pause_ical_subscription',\n 'resume_ical_subscription',\n 'get_calendar_context',\n 'create_proposal',\n 'list_proposals',\n 'get_proposal',\n 'respond_to_proposal',\n 'resolve_proposal',\n 'cancel_proposal',\n 'set_availability_rules',\n 'get_availability_rules',\n 'clear_availability_rules',\n 'create_scoped_key',\n 'list_scoped_keys',\n 'revoke_scoped_key',\n 'create_webhook',\n 'list_webhooks',\n 'get_webhook',\n 'update_webhook',\n 'delete_webhook',\n 'list_webhook_deliveries',\n 'get_webhook_delivery',\n 'send_test_webhook',\n 'replay_webhook_delivery',\n 'get_agent',\n 'update_agent',\n 'delete_agent',\n 'list_calendars',\n 'get_calendar',\n 'update_calendar',\n 'delete_calendar',\n 'create_booking_page',\n 'list_booking_pages',\n 'get_booking_page',\n 'delete_booking_page',\n 'get_usage',\n 'get_usage_history',\n 'get_audit_log',\n 'accept_terms',\n 'get_billing',\n 'request_upgrade',\n 'get_upgrade_request',\n 'cancel_upgrade_request',\n] as const;\n\nconst RAW_TOOL_DEFINITIONS: ToolDefinition[] = [\n // ── Calendars ──────────────────────────────────────────────────\n {\n name: 'list_calendars',\n description: 'List calendars in the org. Organization keys see every calendar (agent-owned and shared); Agent keys see only their own agent\\'s calendars. Use this to discover calendar IDs before creating or listing events.',\n schema: schemas.ListCalendarsSchema,\n annotations: { title: 'List Calendars', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.listCalendars),\n },\n {\n name: 'get_calendar',\n description: 'Fetch a single calendar by ID, including its name, timezone, agent status, and default reminders. Agent keys may only read calendars owned by their agent.',\n schema: schemas.GetCalendarSchema,\n annotations: { title: 'Get Calendar', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.getCalendar),\n },\n {\n name: 'create_calendar',\n description: 'Create a calendar to hold events and track availability. Calendars are required before creating events — call this first when setting up a new agent. An agent can have multiple calendars (e.g. \"Work\", \"Personal\"). Org-level calendars (no agent_id) can be used as shared resources like meeting rooms.',\n schema: schemas.CreateCalendarSchema,\n annotations: { title: 'Create Calendar', readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },\n execute: createExecutor(fns.createCalendar),\n },\n {\n name: 'update_calendar',\n description: 'Update a calendar\\'s name, timezone, agent status, default reminders, or metadata. Agent keys may only update calendars owned by their agent.',\n schema: schemas.UpdateCalendarSchema,\n annotations: { title: 'Update Calendar', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.updateCalendar),\n },\n {\n name: 'delete_calendar',\n description: 'Delete a calendar (soft delete). Its events are no longer returned and it stops contributing to availability. Agent keys may only delete calendars owned by their agent.',\n schema: schemas.DeleteCalendarSchema,\n annotations: { title: 'Delete Calendar', readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.deleteCalendar),\n },\n\n // ── Booking pages ──────────────────────────────────────────────\n {\n name: 'create_booking_page',\n description: 'Create a public booking page (a hosted scheduling link) for a calendar. Returns a booking_url to send to a human; when they pick a slot, a confirmed event is created on the calendar and an event.created webhook fires with a booking_page_id field. Set availability_constraints to restrict to weekly working hours; existing calendar events always block slots.',\n schema: schemas.CreateBookingPageSchema,\n annotations: { title: 'Create Booking Page', readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },\n execute: createExecutor(fns.createBookingPage),\n },\n {\n name: 'list_booking_pages',\n description: 'List booking pages in the org. Agent keys see only pages on their own agent\\'s calendars.',\n schema: schemas.ListBookingPagesSchema,\n annotations: { title: 'List Booking Pages', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.listBookingPages),\n },\n {\n name: 'get_booking_page',\n description: 'Fetch a single booking page by ID, including its public booking_url and settings.',\n schema: schemas.GetBookingPageSchema,\n annotations: { title: 'Get Booking Page', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.getBookingPage),\n },\n {\n name: 'delete_booking_page',\n description: 'Delete (deactivate) a booking page. Its hosted URL stops resolving; already-booked events are unaffected.',\n schema: schemas.DeleteBookingPageSchema,\n annotations: { title: 'Delete Booking Page', readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.deleteBookingPage),\n },\n\n // ── Events ─────────────────────────────────────────────────────\n {\n name: 'list_events',\n description: 'List events on a calendar or across an agent\\'s calendars, including internally created events and externally synced events from iCal subscriptions (e.g. Google Calendar, Outlook). Provide `calendar_id` OR `agent_id`. Narrow with `start_after`/`start_before` (time window), `status`, and `source`.',\n schema: schemas.ListEventsSchema,\n annotations: { title: 'List Events', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n untrustedFields: EVENT_UNTRUSTED_FIELDS,\n execute: createExecutor(fns.listEvents),\n },\n {\n name: 'list_org_events',\n description: 'List events across all of the organization\\'s calendars in one call, ordered by start time (an Agent key sees only its agent\\'s calendars). Narrow with `calendar_ids`, `agent_id`, a `start_after`/`start_before` window, `status` and `source`. `q` searches titles (case-insensitive) and needs both window bounds at most 31 days apart. Use list_events for one calendar.',\n schema: schemas.ListOrgEventsSchema,\n annotations: { title: 'List Organization Events', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n untrustedFields: EVENT_UNTRUSTED_FIELDS,\n execute: createExecutor(fns.listOrgEvents),\n },\n {\n name: 'get_event',\n description: 'Retrieve a single event by ID, including its title, times, status, location, reminders, and metadata. Works for both internally created events and externally synced iCal events. `calendar_id` is optional — if omitted the calendar is resolved from the event. Provide `calendar_id` to fail fast on cross-calendar typos.',\n schema: schemas.GetEventSchema,\n annotations: { title: 'Get Event', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n untrustedFields: EVENT_UNTRUSTED_FIELDS,\n execute: createExecutor(fns.getEvent),\n },\n {\n name: 'create_event',\n description: 'Create a booking, appointment, meeting, hold, or any scheduled event on a calendar. The calendar_id comes from create_calendar or list_events. Once created, this event blocks the agent\\'s availability during that time and appears in availability queries. Use status=\"hold\" with hold_expires_at to tentatively reserve a slot that auto-releases on TTL.',\n schema: schemas.CreateEventSchema,\n annotations: { title: 'Create Event', readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },\n execute: createExecutor(fns.createEvent),\n },\n {\n name: 'update_event',\n description: 'Reschedule or edit an event — change its title, description, start/end times, location, status, reminders, or metadata. Use this to move an appointment to a new time or update its details. Provide only the fields you want to change. Holds cannot be edited via this tool (use confirm_event / release_event). External iCal events are read-only. `calendar_id` is optional — if omitted it is resolved from the event.',\n schema: schemas.UpdateEventSchema,\n annotations: { title: 'Update Event', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n untrustedFields: EVENT_UNTRUSTED_FIELDS,\n execute: createExecutor(fns.updateEvent),\n },\n {\n name: 'cancel_event',\n description: 'Delete or cancel an event from a calendar. Use this to remove, cancel, or delete any scheduled event or appointment. The event is marked cancelled and excluded from future availability calculations. For a recurring series, pass `occurrence_start` to cancel just that one occurrence (the series continues); omit it to cancel the whole series. `calendar_id` is optional — if omitted the calendar is looked up from the event. Provide `calendar_id` to fail fast on cross-calendar typos.',\n schema: schemas.CancelEventSchema,\n annotations: { title: 'Cancel Event', readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },\n untrustedFields: EVENT_UNTRUSTED_FIELDS,\n execute: createExecutor(fns.cancelEvent),\n },\n {\n name: 'confirm_event',\n 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. After confirmation, event.started and event.ended lifecycle webhooks fire at the scheduled times.',\n schema: schemas.ConfirmEventSchema,\n annotations: { title: 'Confirm Event', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n untrustedFields: EVENT_UNTRUSTED_FIELDS,\n execute: createExecutor(fns.confirmEvent),\n },\n {\n name: 'release_event',\n 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.',\n schema: schemas.ReleaseEventSchema,\n annotations: { title: 'Release Event', readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.releaseEvent),\n },\n\n // ── Agents ─────────────────────────────────────────────────────\n {\n name: 'create_agent',\n description: 'Register your agent (AI assistant, human participant, or resource) with Chronary so it can own calendars, events, and webhooks.',\n schema: schemas.CreateAgentSchema,\n annotations: { title: 'Create Agent', readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },\n execute: createExecutor(fns.createAgent),\n },\n {\n name: 'list_agents',\n description: 'List all agents in your organization',\n schema: schemas.ListAgentsSchema,\n annotations: { title: 'List Agents', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.listAgents),\n },\n {\n name: 'get_agent',\n description: 'Fetch a single agent by ID. An agent represents an AI assistant, human, or shared resource (e.g. a meeting room). Agent keys may only read their own agent.',\n schema: schemas.GetAgentSchema,\n annotations: { title: 'Get Agent', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.getAgent),\n },\n {\n name: 'update_agent',\n description: 'Update an agent\\'s name, description, metadata, or status (active/paused). Requires an Organization key — Agent keys cannot mutate agents.',\n schema: schemas.UpdateAgentSchema,\n annotations: { title: 'Update Agent', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.updateAgent),\n },\n {\n name: 'delete_agent',\n description: 'Decommission an agent. This marks the agent as decommissioned and revokes all of its Agent keys. Requires an Organization key — Agent keys cannot delete agents.',\n schema: schemas.DeleteAgentSchema,\n annotations: { title: 'Delete Agent', readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.deleteAgent),\n },\n\n // ── Availability ───────────────────────────────────────────────\n {\n name: 'get_availability',\n description: 'Check when a single agent is free across its Chronary calendars and any human calendars authorized for that agent. This tool is fail-closed: always inspect `availability_state` and `warnings` before using slots. Accepts `start`/`end` or the `start_time`/`end_time` aliases.',\n schema: schemas.GetAvailabilitySchema,\n annotations: { title: 'Get Availability', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.getAvailability),\n },\n {\n name: 'find_meeting_time',\n description: 'Find slots when multiple agents are free across Chronary calendars and any human calendars authorized for each agent. This tool is fail-closed: always inspect `availability_state` and `warnings` before using slots. Accepts `agents`/`start`/`end` or their aliases.',\n schema: schemas.FindMeetingTimeSchema,\n annotations: { title: 'Find Meeting Time', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.findMeetingTime),\n },\n {\n name: 'create_connection_link',\n description: 'Request human setup of Google Calendar or Microsoft Outlook for a Chronary calendar. Give setup_url to a human; the agent never receives OAuth credentials, provider calendar names, or event data. When the human finishes, the linked account becomes a Connection, listed under Human calendars in the Chronary console. The secret URL is returned only on first creation. If reused=true and setup_url is null, retain the original URL or cancel this link and create a replacement.',\n schema: schemas.CreateConnectionLinkSchema,\n annotations: { title: 'Create Human Calendar Setup Link', readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },\n execute: createExecutor(fns.createConnectionLink),\n },\n {\n name: 'get_connection_link',\n description: 'Poll a human-calendar setup request. Returns provider-neutral status and, when complete, the ID of the resulting Connection (the human sees it under Human calendars in the Chronary console), but never replays the bearer setup URL or exposes human calendar data.',\n schema: schemas.GetConnectionLinkSchema,\n annotations: { title: 'Get Human Calendar Setup Status', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.getConnectionLink),\n },\n {\n name: 'cancel_connection_link',\n description: 'Cancel a pending human-calendar setup request. This invalidates the setup URL and does not disconnect a Connection that was already completed; the human manages Connections under Human calendars in the Chronary console.',\n schema: schemas.CancelConnectionLinkSchema,\n annotations: { title: 'Cancel Human Calendar Setup Link', readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.cancelConnectionLink),\n },\n\n // ── Calendar context ───────────────────────────────────────────\n {\n name: 'get_calendar_context',\n description: 'Get a calendar\\'s temporal context in a single call: the current event (if one is happening now), the next upcoming event, recent past events, a short upcoming window, and the owning agent\\'s status (idle/working/waiting/error). Use this to answer \"what is this agent doing right now?\" without issuing multiple list_events queries.',\n schema: schemas.GetCalendarContextSchema,\n annotations: { title: 'Get Calendar Context', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n untrustedFields: EVENT_UNTRUSTED_FIELDS,\n execute: createExecutor(fns.getCalendarContext),\n },\n\n // ── Scheduling proposals ───────────────────────────────────────\n {\n name: 'create_proposal',\n description: 'Create a scheduling proposal — send a set of candidate time slots to one or more participant agents so they can accept, decline, or counter-propose. The organizer agent owns the proposal; once every participant responds, the system auto-resolves to the highest-scoring slot (or cancels if all decline). Requires an Organization key. Pro plan only.',\n schema: schemas.CreateProposalSchema,\n annotations: { title: 'Create Proposal', readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },\n execute: createExecutor(fns.createProposal),\n },\n {\n name: 'list_proposals',\n description: 'List scheduling proposals for the org. Filter by status (pending|confirmed|expired|cancelled) or organizer_agent_id. Requires an Organization key.',\n schema: schemas.ListProposalsSchema,\n annotations: { title: 'List Proposals', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.listProposals),\n },\n {\n name: 'get_proposal',\n description: 'Get a scheduling proposal by id, including its slots and per-participant responses. Requires an Organization key.',\n schema: schemas.GetProposalSchema,\n annotations: { title: 'Get Proposal', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.getProposal),\n },\n {\n name: 'respond_to_proposal',\n description: 'Submit a response (accept / decline / counter) on behalf of one participant agent to an open proposal. An \"accept\" requires the slot id from the proposal; a \"counter\" can suggest alternative slots. When all participants have responded the proposal auto-resolves — no separate resolve call needed in the normal flow. Requires an Organization key. Pro plan only.',\n schema: schemas.RespondToProposalSchema,\n annotations: { title: 'Respond To Proposal', readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },\n execute: createExecutor(fns.respondToProposal),\n },\n {\n name: 'resolve_proposal',\n description: 'Force-resolve an open proposal using responses collected so far. Picks the highest-scoring slot among those accepted by the most participants and creates a confirmed calendar event. If every response was \"decline\", the proposal is cancelled instead. Use when you want to close out a proposal without waiting for every participant. Requires an Organization key. Pro plan only.',\n schema: schemas.ResolveProposalSchema,\n annotations: { title: 'Resolve Proposal', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.resolveProposal),\n },\n {\n name: 'cancel_proposal',\n description: 'Cancel an open proposal. Fires a proposal.cancelled webhook with reason=\"organizer_cancelled\". Requires an Organization key. Pro plan only.',\n schema: schemas.CancelProposalSchema,\n annotations: { title: 'Cancel Proposal', readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.cancelProposal),\n },\n\n // ── Availability rules ─────────────────────────────────────────\n {\n name: 'set_availability_rules',\n description: 'Set or replace the availability rules on a calendar — buffer times before/after events and optional per-day working hours. When these rules are set, every availability query on this calendar automatically applies them (busy-block expansion for buffers, masking outside working hours). Upsert: overwrites any existing rules.',\n schema: schemas.SetAvailabilityRulesSchema,\n annotations: { title: 'Set Availability Rules', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.setAvailabilityRules),\n },\n {\n name: 'get_availability_rules',\n description: 'Read the buffer times and working-hours rules configured on a calendar. Returns the rules row, or an error if none are set.',\n schema: schemas.GetAvailabilityRulesSchema,\n annotations: { title: 'Get Availability Rules', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.getAvailabilityRules),\n },\n {\n name: 'clear_availability_rules',\n description: 'Remove the availability rules from a calendar, reverting to the default (no buffers, no working-hours mask). Returns the deleted row, or an error if none were set.',\n schema: schemas.ClearAvailabilityRulesSchema,\n annotations: { title: 'Clear Availability Rules', readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.clearAvailabilityRules),\n },\n\n // ── Webhooks ───────────────────────────────────────────────────\n {\n name: 'list_webhooks',\n description: 'List the org\\'s webhook subscriptions with their subscribed event types and active state. Signing secrets are never returned. Requires an Organization key.',\n schema: schemas.ListWebhooksSchema,\n annotations: { title: 'List Webhooks', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.listWebhooks),\n },\n {\n name: 'get_webhook',\n description: 'Get a single webhook subscription by id, including its subscribed event types and active state. The signing secret is never returned. Requires an Organization key.',\n schema: schemas.GetWebhookSchema,\n annotations: { title: 'Get Webhook', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.getWebhook),\n },\n {\n name: 'create_webhook',\n description: 'Create a webhook subscription so the org receives HTTP POST notifications when events occur (e.g. event.created, proposal.confirmed). The signing secret is returned ONCE in this response — store it to verify the HMAC-SHA256 signature on delivered payloads. Requires an Organization key.',\n schema: schemas.CreateWebhookSchema,\n annotations: { title: 'Create Webhook', readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },\n execute: createExecutor(fns.createWebhook),\n },\n {\n name: 'update_webhook',\n description: 'Update a webhook subscription — change its delivery URL, the set of subscribed event types, or pause/resume it via active. At least one field must be supplied. Requires an Organization key.',\n schema: schemas.UpdateWebhookSchema,\n annotations: { title: 'Update Webhook', readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: true },\n execute: createExecutor(fns.updateWebhook),\n },\n {\n name: 'delete_webhook',\n description: 'Permanently delete a webhook subscription. This frees its endpoint slot against the per-plan cap. Requires an Organization key.',\n schema: schemas.DeleteWebhookSchema,\n annotations: { title: 'Delete Webhook', readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.deleteWebhook),\n },\n {\n name: 'list_webhook_deliveries',\n description: 'List delivery attempts for a webhook subscription, newest first, with per-status counts (pending/delivered/failed/dropped). Filter by status, event type, creation time, delivery id or test flag, and page with next_cursor. `dropped` deliveries were stopped by the Free plan monthly limit. Use this to debug failing deliveries. Requires an Organization key.',\n schema: schemas.ListWebhookDeliveriesSchema,\n annotations: { title: 'List Webhook Deliveries', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n untrustedFields: WEBHOOK_DELIVERY_UNTRUSTED_FIELDS,\n execute: createExecutor(fns.listWebhookDeliveries),\n },\n {\n name: 'get_webhook_delivery',\n description: 'Get one webhook delivery with its payload and every attempt, oldest first: HTTP status, duration, the first 2 KB of the response body and an error code (timeout, connection_error, tls_error, redirect_not_followed, unsafe_destination_url, non_2xx). Use this to find out why a delivery failed. Requires an Organization key.',\n schema: schemas.GetWebhookDeliverySchema,\n annotations: { title: 'Get Webhook Delivery', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n untrustedFields: WEBHOOK_DELIVERY_UNTRUSTED_FIELDS,\n execute: createExecutor(fns.getWebhookDelivery),\n },\n {\n name: 'send_test_webhook',\n description: 'Send a signed sample payload of one event type to a webhook endpoint, to check that it receives and verifies deliveries. The delivery is marked is_test, carries the X-Chronary-Test: 1 header, makes one attempt, does not count toward the monthly delivery quota and is sent even when the endpoint is paused or disabled. The endpoint must subscribe to the event type. Poll get_webhook_delivery with the returned delivery_id for the result. Limited to 10 per minute. Requires an Organization key.',\n schema: schemas.SendTestWebhookSchema,\n annotations: { title: 'Send Test Webhook', readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },\n execute: createExecutor(fns.sendTestWebhook),\n },\n {\n name: 'replay_webhook_delivery',\n description: \"Send a failed or dropped webhook delivery again, as a new delivery with a new delivery_id. The stored payload goes out unchanged (same event id), signed with the endpoint's current secret, with an X-Chronary-Replay-Of header naming the original delivery. Only failed or dropped deliveries that are not test events can be replayed, the endpoint must be active, and the payload must still be stored (30 days). The replay follows the normal retry schedule and counts toward the monthly delivery quota. Poll get_webhook_delivery with the returned delivery_id for the result. Limited to 30 per minute. Requires a Developer or Pro plan and an Organization key.\",\n schema: schemas.ReplayWebhookDeliverySchema,\n annotations: { title: 'Replay Webhook Delivery', readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },\n execute: createExecutor(fns.replayWebhookDelivery),\n },\n\n // ── iCal Subscriptions ─────────────────────────────────────────\n {\n name: 'list_ical_subscriptions',\n description: \"List an agent's external iCal feed subscriptions (e.g. linked Google Calendar / Outlook feeds), including their sync status and last sync time.\",\n schema: schemas.ListICalSubscriptionsSchema,\n annotations: { title: 'List iCal Subscriptions', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.listICalSubscriptions),\n },\n {\n name: 'get_ical_subscription',\n description: 'Get a single external iCal feed subscription by id, including its sync status, last sync time, and last error.',\n schema: schemas.GetICalSubscriptionSchema,\n annotations: { title: 'Get iCal Subscription', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.getICalSubscription),\n },\n {\n name: 'subscribe_ical',\n 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. The target calendar must be owned by the specified agent — create the calendar with that agent_id first (org-level calendars without an agent_id cannot host external iCal subscriptions; create a dedicated per-agent calendar for sync targets).\",\n schema: schemas.SubscribeICalSchema,\n annotations: { title: 'Subscribe iCal', readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },\n execute: createExecutor(fns.subscribeICal),\n },\n {\n name: 'update_ical_subscription',\n description: 'Update an external iCal feed subscription — change its label or its feed URL. Changing the URL forces a full re-sync on the next poll.',\n schema: schemas.UpdateICalSubscriptionSchema,\n annotations: { title: 'Update iCal Subscription', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },\n execute: createExecutor(fns.updateICalSubscription),\n },\n {\n name: 'delete_ical_subscription',\n description: 'Delete an external iCal feed subscription. Events previously synced from the feed are no longer refreshed.',\n schema: schemas.DeleteICalSubscriptionSchema,\n annotations: { title: 'Delete iCal Subscription', readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.deleteICalSubscription),\n },\n {\n name: 'sync_ical_subscription',\n description: 'Start an immediate fetch of an external iCal feed instead of waiting for the next scheduled poll. Returns {\"status\":\"syncing\"} as soon as the fetch has started; call get_ical_subscription a few seconds later to read last_synced_at and last_error. A paused feed must be resumed first; one manual sync per feed per minute.',\n schema: schemas.SyncICalSubscriptionSchema,\n annotations: { title: 'Sync iCal Subscription', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },\n execute: createExecutor(fns.syncICalSubscription),\n },\n {\n name: 'pause_ical_subscription',\n description: 'Pause an external iCal feed subscription: scheduled polls skip it and manual syncs are refused until it is resumed. Busy blocks already imported stay. Pausing a paused feed changes nothing. Returns the subscription.',\n schema: schemas.PauseICalSubscriptionSchema,\n annotations: { title: 'Pause iCal Subscription', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.pauseICalSubscription),\n },\n {\n name: 'resume_ical_subscription',\n description: 'Resume a paused or failing external iCal feed subscription: it returns to scheduled polling and its last_error is cleared. Resuming an active feed changes nothing. Returns the subscription.',\n schema: schemas.ResumeICalSubscriptionSchema,\n annotations: { title: 'Resume iCal Subscription', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.resumeICalSubscription),\n },\n\n // ── Scoped keys ────────────────────────────────────────────────\n {\n name: 'create_scoped_key',\n description: 'Create an Agent key (chr_ak_*) that can only act on behalf of a single agent. Use this to self-provision or rotate per-agent credentials. The plaintext key is returned exactly once in the response — store it immediately, it cannot be retrieved later. Requires an Organization key.',\n schema: schemas.CreateScopedKeySchema,\n annotations: { title: 'Create Scoped Key', readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },\n execute: createExecutor(fns.createScopedKey),\n },\n {\n name: 'list_scoped_keys',\n description: 'List all live (non-revoked) Agent keys for this org. Returns key metadata only (id, prefix, agent_id, label, created_at) — never the plaintext secret. Requires an Organization key.',\n schema: schemas.ListScopedKeysSchema,\n annotations: { title: 'List Scoped Keys', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.listScopedKeys),\n },\n {\n name: 'revoke_scoped_key',\n description: 'Revoke an Agent key by ID. Revocation is permanent (cannot be un-revoked); the key stops authenticating within about a minute. Requires an Organization key.',\n schema: schemas.RevokeScopedKeySchema,\n annotations: { title: 'Revoke Scoped Key', readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.revokeScopedKey),\n },\n\n // ── Audit log ──────────────────────────────────────────────────\n {\n name: 'get_audit_log',\n description: 'List audit-log entries for the calling org — mutating operations and auth-lifecycle events, newest first. Results are clamped to the plan\\'s retention window. Requires an Organization key (chr_sk_*); Agent keys cannot read the org-wide audit log.',\n schema: schemas.GetAuditLogSchema,\n annotations: { title: 'Get Audit Log', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.getAuditLog),\n },\n\n // ── Terms ──────────────────────────────────────────────────────\n {\n name: 'accept_terms',\n 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 — a material ToS bump otherwise leaves MCP-only agents stuck without a console session. Pass the current tos_version (read it from GET /v1/auth/terms/current). Requires an Organization key (chr_sk_*); Agent keys cannot accept org-wide terms.',\n schema: schemas.AcceptTermsSchema,\n annotations: { title: 'Accept Terms', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.acceptTerms),\n },\n\n // ── Usage ──────────────────────────────────────────────────────\n {\n name: 'get_usage',\n description: 'Get the calling org\\'s current-period usage and plan limits (agents, calendars, events, API calls, webhook deliveries, webhook endpoints, availability queries, iCal subscriptions, proposals, recurring events, booking pages, scoped keys, holds, cross-calendar queries) and when the monthly counters reset (resets_at, 00:00 UTC on the 1st). Requires an Organization key (chr_sk_*); Agent keys cannot read org-wide usage.',\n schema: schemas.GetUsageSchema,\n annotations: { title: 'Get Usage', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.getUsage),\n },\n {\n name: 'get_usage_history',\n description: 'Get the calling org\\'s monthly usage totals for the last 1-12 UTC calendar months (default 6), oldest first, ending with the current partial month. Each month lists every monthly counter (api_calls, events, webhook_deliveries, availability_queries, proposals, holds_created, holds_confirmed, holds_expired, cross_calendar_queries); limits are the current plan\\'s (null = unlimited). Requires an Organization key (chr_sk_*); Agent keys cannot read org-wide usage.',\n schema: schemas.GetUsageHistorySchema,\n annotations: { title: 'Get Usage History', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.getUsageHistory),\n },\n\n // ── Billing ────────────────────────────────────────────────────\n {\n name: 'get_billing',\n description: 'Get the org\\'s plan and billing status: plan, subscription status, renewal/cancellation dates, upgrade options, and any pending upgrade request. Read-only — agents cannot pay, cancel, or change payment methods. Requires an Organization key (chr_sk_*).',\n schema: schemas.GetBillingSchema,\n annotations: { title: 'Get Billing', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.getBilling),\n },\n {\n name: 'request_upgrade',\n description: 'Ask your human to upgrade this Chronary account to Pro. Returns approval_url — give it to your human; only a human can pay. If reused=true a request is already pending — do not call again; poll get_upgrade_request at most once a minute. The link opens the Billing page in the Chronary console.',\n schema: schemas.RequestUpgradeSchema,\n annotations: { title: 'Request Upgrade', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.requestUpgrade),\n },\n {\n name: 'get_upgrade_request',\n description: 'Poll an upgrade request by ID. status is pending, completed, declined, canceled, or expired. Poll at most once a minute; after completed, retry the blocked call about 15 seconds later. Requires an Organization key (chr_sk_*).',\n schema: schemas.GetUpgradeRequestSchema,\n annotations: { title: 'Get Upgrade Request', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.getUpgradeRequest),\n },\n {\n name: 'cancel_upgrade_request',\n description: 'Withdraw a pending upgrade request (for example, the blocker went away). The approval URL stops working. Fails with upgrade_request_not_pending if the request is already completed, declined, canceled, or expired.',\n schema: schemas.CancelUpgradeRequestSchema,\n annotations: { title: 'Cancel Upgrade Request', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.cancelUpgradeRequest),\n },\n];\n\n// Results of tools with third-party text start with `untrusted_fields` (#1621).\nexport const TOOL_DEFINITIONS: ToolDefinition[] = RAW_TOOL_DEFINITIONS.map(markUntrusted);\n\nconst toolkitToolNames = new Set<string>(TOOL_DEFINITIONS.map((tool) => tool.name));\nconst hostedToolNames = new Set<string>(HOSTED_API_MCP_TOOL_NAMES);\n\nexport const TOOLKIT_MCP_PARITY = {\n hostedToolNames: HOSTED_API_MCP_TOOL_NAMES,\n missingHostedTools: HOSTED_API_MCP_TOOL_NAMES.filter((name) => !toolkitToolNames.has(name)),\n toolkitOnlyTools: TOOL_DEFINITIONS.map((tool) => tool.name).filter((name) => !hostedToolNames.has(name)),\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,cAAyB;;;ACAzB,iBAAkB;AAKlB,IAAM,sBAAsB;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,IAAM,4BAA4B,CAAC,WAAW,aAAa,UAAU,SAAS;AAIvE,IAAM,sBAAsB,aAAE,OAAO;AAAA,EAC1C,UAAU,aAAE,OAAO,EAAE,SAAS,EAAE,SAAS,0IAAqI;AAAA,EAC9K,SAAS,aAAE,KAAK,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,SAAS,4EAA4E;AAAA,EACzH,OAAO,aAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG,EAAE,QAAQ,EAAE,EAAE,SAAS,uBAAuB;AAAA,EACpF,QAAQ,aAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,QAAQ,CAAC,EAAE,SAAS,mBAAmB;AACzE,CAAC;AAEM,IAAM,oBAAoB,aAAE,OAAO;AAAA,EACxC,aAAa,aAAE,OAAO,EAAE,SAAS,sBAAsB;AACzD,CAAC;AAEM,IAAM,uBAAuB,aAAE,OAAO;AAAA,EAC3C,MAAM,aAAE,OAAO,EAAE,I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I,IAAI,KAAK,UAAU,GAAG;AAAA,IACpC;AACA,WAAO;AAAA,EACT;AACF;;;ADvBO,IAAM,kBAAN,cAA8B,WAAuB;AAAA,EAC1D,YAAY,QAA+B;AACzC,UAAM,MAAM;AAAA,EACd;AAAA,EAEU,UAAU,KAAiC;AACnD,UAAM,SAAS,KAAK;AACpB,WAAO;AAAA,MACL,IAAI,IAAI;AAAA,MACR,aAAa,IAAI;AAAA,MACjB,aAAa,IAAI;AAAA,MACjB,SAAS,OAAO,EAAE,QAAQ,MAA4C;AACpE,cAAM,SAAS,MAAM,IAAI,QAAQ,QAAQ,OAAO;AAChD,YAAI,OAAO,QAAS,OAAM,IAAI,MAAM,OAAO,OAAO,WAAW,WAAW,OAAO,SAAS,KAAK,UAAU,OAAO,MAAM,CAAC;AACrH,eAAO,OAAO;AAAA,MAChB;AAAA,IACF;AAAA,EACF;AACF;","names":["import_sdk"]}
1
+ {"version":3,"sources":["../src/adapters/mastra.ts","../src/base.ts","../src/schemas.ts","../src/safe.ts","../src/functions.ts","../src/untrusted.ts","../src/definitions.ts"],"sourcesContent":["import { MapToolkit } from '../base';\nimport type { ToolDefinition, ChronaryToolkitConfig } from '../types';\n\nexport interface MastraTool {\n id: string;\n description: string;\n inputSchema: ToolDefinition['schema'];\n execute: (context: { context: Record<string, unknown> }) => Promise<unknown>;\n}\n\n/**\n * Mastra adapter.\n *\n * Returns tools compatible with Mastra's tool format.\n *\n * @example\n * ```ts\n * import { ChronaryToolkit } from '@chronary/toolkit/mastra';\n *\n * const toolkit = new ChronaryToolkit({ apiKey: process.env.CHRONARY_API_KEY });\n * const tools = toolkit.getTools();\n * ```\n */\nexport class ChronaryToolkit extends MapToolkit<MastraTool> {\n constructor(config: ChronaryToolkitConfig) {\n super(config);\n }\n\n protected buildTool(def: ToolDefinition): MastraTool {\n const client = this.client;\n return {\n id: def.name,\n description: def.description,\n inputSchema: def.schema,\n execute: async ({ context }: { context: Record<string, unknown> }) => {\n const result = await def.execute(client, context);\n if (result.isError) throw new Error(typeof result.result === 'string' ? result.result : JSON.stringify(result.result));\n return result.result;\n },\n };\n }\n}\n","import { Chronary } from '@chronary/sdk';\nimport type { ToolDefinition, ToolName, ChronaryToolkitConfig } from './types';\nimport { TOOL_DEFINITIONS } from './definitions';\n\nfunction resolveClient(config: ChronaryToolkitConfig): Chronary {\n if ('client' in config && config.client) return config.client;\n const { tools: _tools, ...sdkConfig } = config as {\n apiKey?: string;\n baseUrl?: string;\n tools?: ToolName[];\n extraHeaders?: Record<string, string>;\n };\n return new Chronary(sdkConfig);\n}\n\nexport abstract class BaseToolkit<T> {\n protected readonly client: Chronary;\n protected readonly definitions: ToolDefinition[];\n\n constructor(config: ChronaryToolkitConfig) {\n this.client = resolveClient(config);\n this.definitions = config.tools\n ? TOOL_DEFINITIONS.filter((d) => (config.tools as ToolName[]).includes(d.name))\n : [...TOOL_DEFINITIONS];\n }\n\n /** Convert a framework-agnostic ToolDefinition into the adapter's native format */\n protected abstract buildTool(def: ToolDefinition): T;\n\n abstract getTools(): T[] | Record<string, T>;\n}\n\nexport abstract class ListToolkit<T> extends BaseToolkit<T> {\n getTools(): T[] {\n return this.definitions.map((def) => this.buildTool(def));\n }\n}\n\nexport abstract class MapToolkit<T> extends BaseToolkit<T> {\n getTools(): Record<string, T> {\n const map: Record<string, T> = {};\n for (const def of this.definitions) {\n map[def.name] = this.buildTool(def);\n }\n return map;\n }\n}\n","import { z } from 'zod';\n\n// Webhook event types and delivery statuses — kept in lockstep with the hosted\n// MCP server's `@chronary/shared` WEBHOOK_EVENT_TYPES / WEBHOOK_DELIVERY_STATUSES.\n// Inlined here because the toolkit deliberately does not depend on @chronary/shared.\nconst 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\nconst WEBHOOK_DELIVERY_STATUSES = ['pending', 'delivered', 'failed', 'dropped'] as const;\n\n// ── Calendars ──────────────────────────────────────────────────\n\nexport const ListCalendarsSchema = z.object({\n agent_id: z.string().optional().describe('Filter to calendars owned by this agent. Organization keys only — Agent keys are always limited to their own agent and ignore this.'),\n include: z.enum(['all']).optional().describe('Pass \"all\" to include calendars across all agents (Organization keys only)'),\n limit: z.number().int().min(1).max(200).default(50).describe('Max results to return'),\n offset: z.number().int().min(0).default(0).describe('Pagination offset'),\n});\n\nexport const GetCalendarSchema = z.object({\n calendar_id: z.string().describe('Calendar ID to fetch'),\n});\n\nexport const CreateCalendarSchema = z.object({\n name: z.string().min(1).max(255).describe('Calendar name'),\n agent_id: z.string().optional().describe('Agent ID to own this calendar (omit for org-level)'),\n timezone: z.string().min(1).max(64).describe('IANA timezone (e.g. America/New_York)'),\n default_reminders: z.array(z.number().int().min(1).max(40320)).max(5).nullable().optional().describe('Default reminder offsets in minutes before start, inherited by events on this calendar that don\\'t set their own. Omit or null to use the system default (10 min); [] for no reminders.'),\n});\n\nexport const UpdateCalendarSchema = z.object({\n calendar_id: z.string().describe('Calendar ID to update'),\n name: z.string().min(1).max(255).optional().describe('New calendar name'),\n timezone: z.string().min(1).max(64).optional().describe('New IANA timezone (e.g. America/New_York)'),\n agent_status: z.enum(['idle', 'working', 'waiting', 'error']).optional().describe('Owning agent\\'s status'),\n default_reminders: z.array(z.number().int().min(1).max(40320)).max(5).nullable().optional().describe('Default reminder offsets in minutes; null for system default, [] for none'),\n metadata: z.record(z.string(), z.unknown()).optional().describe('Arbitrary metadata (max 16KB)'),\n});\n\nexport const DeleteCalendarSchema = z.object({\n calendar_id: z.string().describe('Calendar ID to delete'),\n});\n\n// ── Booking pages ──────────────────────────────────────────────\n\nexport const ListBookingPagesSchema = z.object({\n limit: z.number().int().min(1).max(200).default(50).describe('Max results to return'),\n offset: z.number().int().min(0).default(0).describe('Pagination offset'),\n});\n\nexport const GetBookingPageSchema = z.object({\n booking_page_id: z.string().describe('Booking page ID to fetch (bkp_...)'),\n});\n\nexport const CreateBookingPageSchema = z.object({\n calendar_id: z.string().describe('Calendar a booking resolves to (from create_calendar/list_calendars).'),\n title: z.string().min(1).max(200).describe('Meeting title shown on the page.'),\n description: z.string().max(2000).optional().describe('Optional description shown to the booker.'),\n duration_minutes: z.number().int().min(5).max(480).optional().describe('Slot length in minutes (default 30).'),\n buffer_minutes: z.number().int().min(0).max(120).optional().describe('Padding before/after existing events (default 0).'),\n window_days: z.number().int().min(1).max(365).optional().describe('How far ahead bookings are allowed (default 14).'),\n min_notice_minutes: z.number().int().min(0).max(40320).optional().describe('Minimum lead time before a bookable slot (default 0).'),\n timezone: z.string().min(1).max(64).optional().describe('IANA timezone for display + working hours (default UTC).'),\n availability_constraints: z\n .record(z.string(), z.object({ start: z.string(), end: z.string() }))\n .nullable()\n .optional()\n .describe('Weekly working hours, e.g. {\"mon\":{\"start\":\"09:00\",\"end\":\"17:00\"}}. Omit/null for any time in the window.'),\n active: z.boolean().optional().describe('Whether the page accepts bookings (default true).'),\n});\n\nexport const DeleteBookingPageSchema = z.object({\n booking_page_id: z.string().describe('Booking page ID to delete (bkp_...)'),\n});\n\n// ── Events ─────────────────────────────────────────────────────\n\nexport const ListEventsSchema = z.object({\n calendar_id: z.string().optional().describe('Calendar ID to list events from. Provide this or agent_id.'),\n agent_id: z.string().optional().describe('Agent ID to list events for across all of the agent\\'s calendars. Provide this or calendar_id.'),\n start_after: z.string().datetime().optional().describe('Only events starting after this ISO 8601 time'),\n start_before: z.string().datetime().optional().describe('Only events starting before this ISO 8601 time'),\n status: z.enum(['confirmed', 'tentative', 'cancelled', 'hold']).optional().describe('Filter by event status'),\n source: z.enum(['internal', 'external_ical']).optional().describe('Filter by source: \"internal\" (created via the API) or \"external_ical\" (synced from an iCal subscription)'),\n limit: z.number().int().min(1).max(200).default(50).describe('Max results to return'),\n offset: z.number().int().min(0).default(0).describe('Pagination offset'),\n expand: z.boolean().default(false).describe('Expand recurring series into individual occurrence instances within the window. Requires both start_after and start_before (max 366 days apart). Instances carry recurringEventId + originalStartTime.'),\n});\n\nexport const ListOrgEventsSchema = z.object({\n calendar_ids: z.array(z.string()).max(50).optional().describe('Only these calendar IDs (at most 50)'),\n agent_id: z.string().optional().describe('Only this agent\\'s calendars'),\n start_after: z.string().datetime().optional().describe('Only events starting at or after this ISO 8601 time'),\n start_before: z.string().datetime().optional().describe('Only events starting at or before this ISO 8601 time'),\n status: z.enum(['confirmed', 'tentative', 'cancelled', 'hold']).optional().describe('Filter by event status'),\n source: z.enum(['internal', 'external_ical']).optional().describe('Filter by source: \"internal\" (created via the API) or \"external_ical\" (synced from an iCal subscription)'),\n q: z.string().optional().describe('Case-insensitive title search. Requires start_after and start_before at most 31 days apart'),\n expand: z.boolean().default(false).describe('Expand recurring series into individual occurrences within the window. Requires both start_after and start_before (max 366 days apart).'),\n limit: z.number().int().min(1).max(100).default(50).describe('Max results to return (1-100)'),\n offset: z.number().int().min(0).default(0).describe('Pagination offset'),\n});\n\nexport const GetEventSchema = z.object({\n event_id: z.string().describe('Event ID to retrieve'),\n calendar_id: z.string().optional().describe('Calendar ID that owns the event. Optional — if omitted the calendar is resolved from the event.'),\n});\n\nexport const CreateEventSchema = z.object({\n calendar_id: z.string().describe('Calendar ID to add the event to'),\n title: z.string().min(1).max(500).describe('Event title'),\n start_time: z.string().datetime().describe('Start time (ISO 8601)'),\n end_time: z.string().datetime().describe('End time (ISO 8601)'),\n description: z.string().max(10_000).optional().describe('Optional event description'),\n all_day: z.boolean().default(false).describe('Whether this is an all-day event'),\n status: z.enum(['confirmed', 'tentative', 'hold']).optional().describe('Event status. \"hold\" creates a tentative reservation that auto-expires at hold_expires_at. Defaults to \"confirmed\".'),\n reminders: z.array(z.number().int().min(1).max(40320)).max(5).nullable().optional().describe('Reminder offsets in minutes before start_time (e.g. [10, 1440]). Each fires an event.reminder webhook and shows as an alarm in the iCal feed. Omit or null to inherit the calendar default (then the system default of 10 min); [] for no reminders.'),\n hold_expires_at: z.string().datetime().optional().describe('Required when status=\"hold\". ISO 8601 timestamp 30s-15min in the future. Auto-releases the hold when reached.'),\n hold_priority: z.number().int().min(0).max(100).optional().describe('Only valid with status=\"hold\". Higher-priority overlapping holds pre-empt lower-priority ones. Defaults to 0.'),\n recurrence_rule: z.string().max(256).optional().describe('Make this a recurring series (RFC 5545 RRULE subset, no \"RRULE:\" prefix), e.g. \"FREQ=WEEKLY;BYDAY=MO,WE;COUNT=12\". Supports FREQ=DAILY/WEEKLY/MONTHLY/YEARLY, INTERVAL, COUNT (max 730) or UNTIL, BYDAY (weekly list or monthly ordinal like 2TU/-1FR), BYMONTHDAY (1-28 or -1). start_time must match the rule pattern; expansion is UTC-only. Not allowed with status=\"hold\". Free plan: 1 recurring series, must end within 90 days.'),\n});\n\nexport const UpdateEventSchema = z.object({\n event_id: z.string().describe('Event ID to update'),\n calendar_id: z.string().optional().describe('Calendar ID that owns the event. Optional — if omitted the calendar is resolved from the event.'),\n title: z.string().min(1).max(500).optional().describe('New event title'),\n description: z.string().max(10_000).nullable().optional().describe('New description, or null to clear it'),\n start_time: z.string().datetime().optional().describe('New start time (ISO 8601)'),\n end_time: z.string().datetime().optional().describe('New end time (ISO 8601)'),\n all_day: z.boolean().optional().describe('Whether this is an all-day event'),\n status: z.enum(['confirmed', 'tentative', 'cancelled']).optional().describe('New event status'),\n metadata: z.record(z.string(), z.unknown()).optional().describe('Replacement metadata object'),\n reminders: z.array(z.number().int().min(1).max(40320)).max(5).nullable().optional().describe('Reminder offsets in minutes before start_time. Omit to leave unchanged, null to inherit the calendar default, [] for no reminders.'),\n recurrence_rule: z.string().max(256).nullable().optional().describe('Set/change the recurring series rule (RFC 5545 RRULE subset, full-series semantics), or null to make the event a one-off. Changing the rule or start_time resets cancelled occurrences.'),\n});\n\nexport const CancelEventSchema = z.object({\n event_id: z.string().describe('Event ID to cancel'),\n calendar_id: z.string().optional().describe('Calendar ID that owns the event. Optional — if omitted the calendar is resolved from the event. Matches the asymmetry with confirm_event / release_event which never required this arg.'),\n occurrence_start: z.string().datetime().optional().describe('For recurring events only: ISO 8601 start of the single occurrence to cancel. The rest of the series is unaffected.'),\n});\n\nexport const ConfirmEventSchema = z.object({\n event_id: z.string().describe('Event ID of the hold to confirm'),\n});\n\nexport const ReleaseEventSchema = z.object({\n event_id: z.string().describe('Event ID of the hold to release'),\n});\n\n// ── Agents ─────────────────────────────────────────────────────\n\nexport const CreateAgentSchema = z.object({\n name: z.string().min(1).max(255).describe('Display name for the agent'),\n type: z.enum(['ai', 'human', 'resource']).describe('Agent type'),\n description: z.string().max(5_000).optional().describe('Optional description'),\n});\n\nexport const ListAgentsSchema = z.object({\n type: z.enum(['ai', 'human', 'resource']).optional().describe('Filter by agent type'),\n status: z.enum(['active', 'paused', 'decommissioned']).optional().describe('Filter by status'),\n limit: z.number().int().min(1).max(200).default(50).describe('Max results to return'),\n offset: z.number().int().min(0).default(0).describe('Pagination offset'),\n});\n\nexport const GetAgentSchema = z.object({\n agent_id: z.string().describe('Agent ID to fetch'),\n});\n\nexport const UpdateAgentSchema = z.object({\n agent_id: z.string().describe('Agent ID to update'),\n name: z.string().min(1).max(255).optional().describe('New display name'),\n description: z.string().max(5_000).nullable().optional().describe('New description (null to clear)'),\n metadata: z.record(z.string(), z.unknown()).optional().describe('Arbitrary metadata (max 16KB)'),\n status: z.enum(['active', 'paused']).optional().describe('Operational status'),\n});\n\nexport const DeleteAgentSchema = z.object({\n agent_id: z.string().describe('Agent ID to decommission'),\n});\n\n// ── Availability ───────────────────────────────────────────────\n\nexport const GetAvailabilitySchema = z.object({\n agent_id: z.string().describe('Agent ID to check availability for'),\n start: z.string().datetime().optional().describe('Range start (ISO 8601). Alias: start_time.'),\n end: z.string().datetime().optional().describe('Range end (ISO 8601). Alias: end_time.'),\n start_time: z.string().datetime().optional().describe('Alias for `start` (matches REST events naming).'),\n end_time: z.string().datetime().optional().describe('Alias for `end` (matches REST events naming).'),\n duration: z.enum(['15m', '30m', '45m', '1h', '2h']).optional().describe('Requested slot length (15m/30m/45m/1h/2h). Preferred over the deprecated slot_duration. Defaults to 30m.'),\n slot_duration: z.enum(['15m', '30m', '45m', '1h', '2h']).optional().describe('Deprecated alias for `duration` — minimum slot length. Prefer `duration`.'),\n include_busy: z.boolean().default(false).describe('Include busy blocks in response'),\n});\n\nexport const FindMeetingTimeSchema = z.object({\n agents: z.array(z.string()).min(1).optional().describe('Array of agent IDs to find common free time for. All agents must be free during the returned slots. Alias: agent_ids.'),\n agent_ids: z.array(z.string()).min(1).optional().describe('Alias for `agents` (matches REST/scheduling-proposal naming).'),\n start: z.string().datetime().optional().describe('Search range start (ISO 8601). Alias: start_time.'),\n end: z.string().datetime().optional().describe('Search range end (ISO 8601). Alias: end_time.'),\n start_time: z.string().datetime().optional().describe('Alias for `start` (matches REST events naming).'),\n end_time: z.string().datetime().optional().describe('Alias for `end` (matches REST events naming).'),\n duration: z.enum(['15m', '30m', '45m', '1h', '2h']).optional().describe('Requested slot length (15m/30m/45m/1h/2h). Preferred over the deprecated slot_duration. Defaults to 30m.'),\n slot_duration: z.enum(['15m', '30m', '45m', '1h', '2h']).optional().describe('Deprecated alias for `duration` — minimum slot length. Prefer `duration`.'),\n calendars: z.array(z.string()).optional().describe('Additional shared calendar IDs to treat as busy'),\n include_busy: z.boolean().default(false).describe('Include per-agent busy blocks in response'),\n});\n\nexport const CreateConnectionLinkSchema = z.object({\n calendar_id: z.string().startsWith('cal_').describe('Chronary calendar whose owning agent will receive authorized availability'),\n capabilities: z.array(z.enum(['availability', 'publishing'])).min(1).max(2).default(['availability']).describe('Request opaque availability, plus optional opt-in event publishing permission'),\n publication_policy: z.enum(['none', 'confirmed', 'confirmed_tentative']).default('none').describe('Desired publishing policy; a human still chooses the destination'),\n});\n\nexport const GetConnectionLinkSchema = z.object({\n connection_link_id: z.string().startsWith('csl_').describe('Connection setup link ID'),\n});\n\nexport const CancelConnectionLinkSchema = GetConnectionLinkSchema;\n\n// ── Calendar context ───────────────────────────────────────────\n\nexport const GetCalendarContextSchema = z.object({\n calendar_id: z.string().describe('Calendar ID'),\n});\n\n// ── Scheduling proposals ───────────────────────────────────────\n\nconst proposalSlotSchema = z.object({\n start_time: z.string().datetime().describe('Slot start time (ISO 8601)'),\n end_time: z.string().datetime().describe('Slot end time (ISO 8601), after start_time'),\n weight: z.number().min(0).max(10).default(1.0).optional().describe('Preference for this slot, 0–10 (higher = more preferred). Used to rank candidate slots when the proposal is resolved. Defaults to 1.'),\n calendar_id: z.string().optional().describe('Calendar to create the event on if this slot is chosen. Defaults to the proposal\\'s top-level calendar_id.'),\n});\n\nexport const CreateProposalSchema = z.object({\n title: z.string().min(1).max(500).describe('Short description of what the meeting is about'),\n description: z.string().max(5000).optional().describe('Longer context/agenda'),\n organizer_agent_id: z.string().describe('Agent ID proposing the meeting'),\n participant_agent_ids: z.array(z.string()).min(1).max(50).describe('Agent IDs invited to respond'),\n calendar_id: z.string().describe('Calendar the resolved event will be created on'),\n slots: z.array(proposalSlotSchema).min(1).max(20).describe('Candidate time slots (up to 20)'),\n expires_at: z.string().datetime().optional().describe('Auto-cancel cutoff if unresolved'),\n});\n\nexport const ListProposalsSchema = z.object({\n status: z.enum(['pending', 'resolving', 'confirmed', 'expired', 'cancelled']).optional().describe('Filter by proposal status'),\n organizer_agent_id: z.string().optional().describe('Filter by organizer agent'),\n limit: z.number().int().min(1).max(200).optional().describe('Max results (default 50)'),\n offset: z.number().int().min(0).optional().describe('Pagination offset (default 0)'),\n});\n\nexport const GetProposalSchema = z.object({\n proposal_id: z.string().describe('Proposal to fetch'),\n});\n\nexport const RespondToProposalSchema = z.object({\n proposal_id: z.string().describe('Proposal to respond to'),\n agent_id: z.string().describe('Participant agent responding'),\n response: z.enum(['accept', 'decline', 'counter']).describe('Decision from this agent'),\n selected_slot_id: z.string().optional().describe('Required when response is \"accept\"'),\n counter_slots: z.array(proposalSlotSchema).max(20).optional().describe('Alternative slots when response is \"counter\"'),\n message: z.string().max(2000).optional().describe('Optional note for the organizer'),\n});\n\nexport const ResolveProposalSchema = z.object({\n proposal_id: z.string().describe('Proposal to resolve'),\n});\n\nexport const CancelProposalSchema = z.object({\n proposal_id: z.string().describe('Proposal to cancel'),\n});\n\n// ── Availability rules ─────────────────────────────────────────\n\nconst timeOfDay = z.string().regex(/^([01]\\d|2[0-3]):[0-5]\\d$/, 'must be HH:MM in 24-hour time');\n\nconst workingHoursDaySchema = z.object({\n start: timeOfDay.describe('Start of the working window, HH:MM 24-hour, in the rules timezone (e.g. \"09:00\")'),\n end: timeOfDay.describe('End of the working window, HH:MM 24-hour, after start (e.g. \"17:00\")'),\n})\n .refine((v) => v.end > v.start, 'end must be after start')\n .describe('A single day\\'s working hours window');\n\nconst workingHoursSchema = z.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 .nullable();\n\nexport const SetAvailabilityRulesSchema = z.object({\n calendar_id: z.string().describe('Calendar to configure'),\n buffer_before_minutes: z.number().int().min(0).max(120).default(0).describe('Minutes of buffer before each event (0–120)'),\n buffer_after_minutes: z.number().int().min(0).max(120).default(0).describe('Minutes of buffer after each event (0–120)'),\n working_hours: workingHoursSchema.default(null).describe('Per-day working hours map in the calendar\\'s timezone; omit keys for off-days. Pass null to remove any working-hours constraint.'),\n timezone: z.string().min(1).max(64).default('UTC').describe('IANA timezone used to interpret working_hours (e.g. America/New_York)'),\n});\n\nexport const GetAvailabilityRulesSchema = z.object({\n calendar_id: z.string().describe('Calendar to read'),\n});\n\nexport const ClearAvailabilityRulesSchema = z.object({\n calendar_id: z.string().describe('Calendar whose rules should be cleared'),\n});\n\n// ── Scoped keys ────────────────────────────────────────────────\n\nexport const CreateScopedKeySchema = z.object({\n agent_id: z.string().regex(/^agt_/).describe('Agent ID this key is scoped to'),\n label: z.string().min(1).max(100).optional().describe('Human-readable label for the key'),\n expires_in: z\n .enum(['30d', '60d', '90d', '180d', '365d'])\n .optional()\n .describe('When the key stops working, from now. Omit for a key that never expires. After it expires, requests fail with 401 key_expired.'),\n});\n\nexport const ListScopedKeysSchema = z.object({});\n\nexport const RevokeScopedKeySchema = z.object({\n key_id: z.string().describe('ID of the scoped key to revoke'),\n});\n\n// ── Audit log ──────────────────────────────────────────────────\n\nexport const GetAuditLogSchema = z.object({\n from: z.string().datetime({ offset: true }).optional().describe('Start of the window (ISO 8601). Silently clamped to the plan retention window if older.'),\n to: z.string().datetime({ offset: true }).optional().describe('End of the window (ISO 8601)'),\n action: z.string().min(1).max(64).optional().describe('Filter by action name (e.g. event.create, agent_key.revoke). Legacy names are matched by their current names.'),\n actor_key_prefix: z.string().min(1).max(32).optional().describe('Filter by the API key prefix that performed the action'),\n actor_type: z.enum(['session', 'org_key', 'agent_key', 'system']).optional().describe('Filter by who acted: session (console), org_key, agent_key or system'),\n actor_id: z.string().min(1).max(64).optional().describe('Filter by actor id (an API key id, or the org id for console sessions)'),\n request_id: z.string().min(1).max(64).optional().describe('Filter by request id (the X-Request-Id of the original call)'),\n resource: z.string().max(64).regex(/^[a-z]{2,5}_[A-Za-z0-9_-]*$/).optional().describe('Filter by an entity id or id prefix the request touched (e.g. cal_abc123 or cal_)'),\n status_class: z.enum(['2xx', '3xx', '4xx', '5xx']).optional().describe('Filter by response status class: 2xx, 3xx, 4xx or 5xx'),\n category: z.enum(['account', 'keys', 'agents', 'calendars', 'events', 'scheduling', 'webhooks', 'human_calendars', 'billing', 'security']).optional().describe('Filter by action category (e.g. keys, calendars, billing, security)'),\n cursor: z.string().min(1).max(256).optional().describe('Opaque pagination cursor from a previous response'),\n limit: z.number().int().min(1).max(200).optional().describe('Max results to return (default 50)'),\n});\n\n// ── Terms ──────────────────────────────────────────────────────\n\nexport const AcceptTermsSchema = z.object({\n tos_version: z.string().min(1).describe('The terms-of-service version to accept; must match the current version'),\n});\n\n// ── Webhooks ───────────────────────────────────────────────────\n\nexport const ListWebhooksSchema = z.object({\n limit: z.number().int().min(1).max(100).default(20).describe('Max results to return'),\n offset: z.number().int().min(0).default(0).describe('Pagination offset'),\n});\n\nexport const GetWebhookSchema = z.object({\n webhook_id: z.string().describe('Webhook subscription to fetch'),\n});\n\nexport const CreateWebhookSchema = z.object({\n url: z.string().url().max(2_048).describe('HTTPS endpoint that will receive event deliveries'),\n events: z.array(z.enum(WEBHOOK_EVENT_TYPES)).min(1).describe('Event types to subscribe to'),\n});\n\nexport const UpdateWebhookSchema = z.object({\n webhook_id: z.string().describe('Webhook subscription to update'),\n url: z.string().url().max(2_048).optional().describe('New HTTPS delivery endpoint'),\n events: z.array(z.enum(WEBHOOK_EVENT_TYPES)).min(1).optional().describe('Replacement set of event types to subscribe to'),\n active: z.boolean().optional().describe('Set false to pause deliveries, true to resume'),\n});\n\nexport const DeleteWebhookSchema = z.object({\n webhook_id: z.string().describe('Webhook subscription to delete'),\n});\n\nexport const ListWebhookDeliveriesSchema = z.object({\n webhook_id: z.string().describe('Webhook subscription whose deliveries to list'),\n limit: z.number().int().min(1).max(100).default(20).describe('Max results to return'),\n offset: z.number().int().min(0).default(0).describe('Pagination offset. Cannot be combined with cursor'),\n status: z.enum(WEBHOOK_DELIVERY_STATUSES).optional().describe('Filter to a single delivery status'),\n include_payload: z.boolean().optional().describe('Include the full event payload sent on each delivery'),\n event_type: z\n .string()\n .max(100)\n .regex(/^[a-z_]+\\.(?:[a-z_]+)?$/)\n .optional()\n .describe('An exact event type (event.created), or a prefix ending in a dot (event.) for a whole group'),\n created_after: z.string().datetime().optional().describe('Only deliveries created at or after this time (ISO 8601, UTC)'),\n created_before: z.string().datetime().optional().describe('Only deliveries created before this time (ISO 8601, UTC)'),\n delivery_id: z.string().max(100).regex(/^whd_[A-Za-z0-9_-]+$/).optional().describe('Only the delivery with this id'),\n is_test: z.boolean().optional().describe('true for test events only, false to leave them out'),\n cursor: z.string().min(1).max(1024).optional().describe('The next_cursor from the previous page'),\n});\n\nexport const GetWebhookDeliverySchema = z.object({\n webhook_id: z.string().describe('Webhook subscription the delivery belongs to'),\n delivery_id: z.string().describe('Delivery ID (whd_...) from list_webhook_deliveries'),\n});\n\nexport const SendTestWebhookSchema = z.object({\n webhook_id: z.string().describe('Webhook subscription to send the test event to'),\n event_type: z.enum(WEBHOOK_EVENT_TYPES).describe('Event type whose sample payload to send'),\n});\n\nexport const ReplayWebhookDeliverySchema = z.object({\n webhook_id: z.string().describe('Webhook subscription the delivery belongs to'),\n delivery_id: z.string().describe('Delivery to replay (whd_...)'),\n});\n\n// ── iCal Subscriptions ─────────────────────────────────────────\n\nexport const ListICalSubscriptionsSchema = z.object({\n agent_id: z.string().describe('Agent ID whose iCal subscriptions to list'),\n status: z.enum(['active', 'error', 'paused']).optional().describe('Filter by subscription status'),\n limit: z.number().int().min(1).max(200).default(50).describe('Max results to return'),\n offset: z.number().int().min(0).default(0).describe('Pagination offset'),\n});\n\nexport const GetICalSubscriptionSchema = z.object({\n subscription_id: z.string().describe('iCal subscription ID to fetch'),\n});\n\nexport const SubscribeICalSchema = z.object({\n agent_id: z.string().describe('Agent ID that will own this subscription'),\n calendar_id: z.string().describe('Calendar ID to sync external events into'),\n url: z.string().url().max(2_048).describe('HTTPS URL of the iCal feed (.ics) to subscribe to'),\n label: z.string().optional().describe('Optional label for this subscription'),\n});\n\nexport const UpdateICalSubscriptionSchema = z.object({\n subscription_id: z.string().describe('iCal subscription ID to update'),\n label: z.string().min(1).max(255).optional().describe('New label for this subscription'),\n url: z.string().url().max(2_048).refine((u) => u.startsWith('https://'), 'URL must use HTTPS').optional().describe('New HTTPS URL of the iCal feed (.ics)'),\n});\n\nexport const DeleteICalSubscriptionSchema = z.object({\n subscription_id: z.string().describe('iCal subscription ID to delete'),\n});\n\nexport const SyncICalSubscriptionSchema = z.object({\n subscription_id: z.string().describe('iCal subscription ID to sync'),\n});\n\nexport const PauseICalSubscriptionSchema = z.object({\n subscription_id: z.string().describe('iCal subscription ID to pause'),\n});\n\nexport const ResumeICalSubscriptionSchema = z.object({\n subscription_id: z.string().describe('iCal subscription ID to resume'),\n});\n\n// ── Usage ──────────────────────────────────────────────────────\n\nexport const GetUsageSchema = z.object({});\n\nexport const GetUsageHistorySchema = z.object({\n months: z.number().int().min(1).max(12).optional().describe('Number of UTC calendar months to return, 1-12 (default 6)'),\n});\n\n// ── Billing ────────────────────────────────────────────────────\n\nexport const GetBillingSchema = z.object({});\n\nexport const RequestUpgradeSchema = z.object({\n interval: z.enum(['month', 'year']).optional().describe('Billing interval to request. Defaults to month.'),\n reason: z.string().max(500).optional().describe('Why the upgrade is needed (max 500 chars). Shown to your human as plain text.'),\n feature: z.string().optional().describe('Plan-gated feature that was blocked, e.g. scoped_keys (from a plan_required error).'),\n metric: z.string().optional().describe('Quota metric that was exhausted, e.g. api_calls (from a quota_exceeded error).'),\n});\n\nexport const GetUpgradeRequestSchema = z.object({\n id: z.string().describe('Upgrade request ID (upr_...)'),\n});\n\nexport const CancelUpgradeRequestSchema = GetUpgradeRequestSchema;\n","import { ChronaryError } from '@chronary/sdk';\nimport type { ToolResult } from './types';\n\n/**\n * Structured error payload returned to the model. Plan/quota fields let an\n * agent act on `plan_required` / `quota_exceeded` (call get_billing, then\n * request_upgrade) instead of retrying in a loop.\n */\nexport interface ToolErrorPayload {\n error: string;\n message: string;\n upgrade_url?: string;\n docs_url?: string;\n required_plan?: string;\n feature?: string;\n metric?: string;\n limit?: number;\n}\n\n/** Serialize a thrown value into the structured error payload (undefined fields omitted). */\nexport function toErrorPayload(err: unknown): ToolErrorPayload {\n if (err instanceof ChronaryError) {\n const payload: ToolErrorPayload = {\n error: err.errorType ?? err.name,\n message: err.message,\n };\n if (err.upgradeUrl !== undefined) payload.upgrade_url = err.upgradeUrl;\n if (err.docsUrl !== undefined) payload.docs_url = err.docsUrl;\n if (err.requiredPlan !== undefined) payload.required_plan = err.requiredPlan;\n if (err.feature !== undefined) payload.feature = err.feature;\n if (err.metric !== undefined) payload.metric = err.metric;\n if (err.limit !== undefined) payload.limit = err.limit;\n return payload;\n }\n return { error: 'error', message: err instanceof Error ? err.message : String(err) };\n}\n\n/**\n * Wraps an async function so SDK errors become structured ToolResult objects\n * instead of thrown exceptions. LLMs see a structured error object, never\n * stack traces.\n */\nexport function safeFunc<TParams>(\n fn: (params: TParams) => Promise<unknown>,\n): (params: TParams) => Promise<ToolResult> {\n return async (params: TParams): Promise<ToolResult> => {\n try {\n const result = await fn(params);\n return { result: result ?? { success: true }, isError: false };\n } catch (err) {\n return { result: toErrorPayload(err), isError: true };\n }\n };\n}\n","import type { Chronary, KeyExpiresIn, ListAuditLogParams } from '@chronary/sdk';\nimport { safeFunc } from './safe';\nimport type { ToolResult } from './types';\n\ninterface Ctx<P = Record<string, unknown>> {\n client: Chronary;\n params: P;\n}\n\n// Helper to consume a PageIterator's first page\nasync function fetchPage(\n iterator: AsyncIterable<unknown> & { getPage(offset?: number, limit?: number): Promise<{ data: unknown[]; total: number; hasMore: boolean }> },\n offset?: number,\n limit?: number,\n) {\n const page = await iterator.getPage(offset ?? 0, limit);\n return { data: page.data, total: page.total, has_more: page.hasMore };\n}\n\n// ── Calendars ──────────────────────────────────────────────────\n\nexport const listCalendars = safeFunc(async (ctx: Ctx<{\n agent_id?: string; include?: 'all'; limit?: number; offset?: number;\n}>) => {\n const { client, params } = ctx;\n const iter = client.calendars.list({ agentId: params.agent_id, include: params.include, limit: params.limit });\n return fetchPage(iter, params.offset, params.limit);\n});\n\nexport const getCalendar = safeFunc(async (ctx: Ctx<{ calendar_id: string }>) => {\n return ctx.client.calendars.get(ctx.params.calendar_id);\n});\n\nexport const createCalendar = safeFunc(async (ctx: Ctx<{\n name: string; timezone: string; agent_id?: string; default_reminders?: number[] | null; metadata?: Record<string, unknown>;\n}>) => {\n const { client, params } = ctx;\n return client.calendars.create({\n name: params.name,\n timezone: params.timezone,\n agentId: params.agent_id,\n default_reminders: params.default_reminders,\n metadata: params.metadata,\n });\n});\n\nexport const updateCalendar = safeFunc(async (ctx: Ctx<{\n calendar_id: string; name?: string; timezone?: string;\n agent_status?: 'idle' | 'working' | 'waiting' | 'error';\n default_reminders?: number[] | null; metadata?: Record<string, unknown>;\n}>) => {\n const { client, params } = ctx;\n const { calendar_id, ...updates } = params;\n return client.calendars.update(calendar_id, updates);\n});\n\nexport const deleteCalendar = safeFunc(async (ctx: Ctx<{ calendar_id: string }>) => {\n await ctx.client.calendars.delete(ctx.params.calendar_id);\n return undefined; // safeFunc normalizes to { success: true }\n});\n\n// ── Booking pages ──────────────────────────────────────────────\n\nexport const listBookingPages = safeFunc(async (ctx: Ctx<{ limit?: number; offset?: number }>) => {\n const { client, params } = ctx;\n const iter = client.bookingPages.list({ limit: params.limit });\n return fetchPage(iter, params.offset, params.limit);\n});\n\nexport const getBookingPage = safeFunc(async (ctx: Ctx<{ booking_page_id: string }>) => {\n return ctx.client.bookingPages.get(ctx.params.booking_page_id);\n});\n\nexport const createBookingPage = safeFunc(async (ctx: Ctx<{\n calendar_id: string; title: string; description?: string; duration_minutes?: number;\n buffer_minutes?: number; window_days?: number; min_notice_minutes?: number; timezone?: string;\n availability_constraints?: Record<string, { start: string; end: string }> | null; active?: boolean;\n}>) => {\n const { client, params } = ctx;\n return client.bookingPages.create({\n calendar_id: params.calendar_id,\n title: params.title,\n description: params.description,\n duration_minutes: params.duration_minutes,\n buffer_minutes: params.buffer_minutes,\n window_days: params.window_days,\n min_notice_minutes: params.min_notice_minutes,\n timezone: params.timezone,\n availability_constraints: params.availability_constraints,\n active: params.active,\n });\n});\n\nexport const deleteBookingPage = safeFunc(async (ctx: Ctx<{ booking_page_id: string }>) => {\n await ctx.client.bookingPages.delete(ctx.params.booking_page_id);\n return undefined; // safeFunc normalizes to { success: true }\n});\n\n// ── Events ─────────────────────────────────────────────────────\n\nexport const listEvents = safeFunc(async (ctx: Ctx<{\n calendar_id?: string; agent_id?: string; start_after?: string; start_before?: string;\n status?: 'confirmed' | 'tentative' | 'cancelled' | 'hold'; source?: 'internal' | 'external_ical';\n limit?: number; offset?: number; expand?: boolean;\n}>) => {\n const { client, params } = ctx;\n if (!params.calendar_id && !params.agent_id) {\n throw new Error('Provide calendar_id or agent_id');\n }\n const iter = client.events.list({\n calendarId: params.calendar_id,\n agentId: params.agent_id,\n start_after: params.start_after,\n start_before: params.start_before,\n status: params.status,\n source: params.source,\n expand: params.expand,\n limit: params.limit,\n });\n return fetchPage(iter, params.offset, params.limit);\n});\n\nexport const listOrgEvents = safeFunc(async (ctx: Ctx<{\n calendar_ids?: string[]; agent_id?: string; start_after?: string; start_before?: string;\n status?: 'confirmed' | 'tentative' | 'cancelled' | 'hold'; source?: 'internal' | 'external_ical';\n q?: string; expand?: boolean; limit?: number; offset?: number;\n}>) => {\n const { client, params } = ctx;\n const iter = client.events.listAll({\n calendar_id: params.calendar_ids,\n agent_id: params.agent_id,\n start_after: params.start_after,\n start_before: params.start_before,\n status: params.status,\n source: params.source,\n q: params.q,\n expand: params.expand,\n limit: params.limit,\n });\n return fetchPage(iter, params.offset, params.limit);\n});\n\nexport const getEvent = safeFunc(async (ctx: Ctx<{ calendar_id?: string; event_id: string }>) => {\n const { calendar_id, event_id } = ctx.params;\n return calendar_id\n ? ctx.client.events.get(calendar_id, event_id)\n : ctx.client.events.getById(event_id);\n});\n\nexport const createEvent = safeFunc(async (ctx: Ctx<{\n calendar_id: string; title: string; start_time: string; end_time: string;\n description?: string; all_day?: boolean;\n status?: 'confirmed' | 'tentative' | 'hold'; reminders?: number[] | null; metadata?: Record<string, unknown>;\n hold_expires_at?: string; hold_priority?: number; recurrence_rule?: string;\n}>) => {\n const { client, params } = ctx;\n const { calendar_id, ...eventParams } = params;\n return client.events.create(calendar_id, eventParams);\n});\n\nexport const updateEvent = safeFunc(async (ctx: Ctx<{\n calendar_id?: string; event_id: string; title?: string; description?: string | null;\n start_time?: string; end_time?: string; all_day?: boolean;\n status?: 'confirmed' | 'tentative' | 'cancelled'; reminders?: number[] | null; metadata?: Record<string, unknown>;\n recurrence_rule?: string | null;\n}>) => {\n const { client, params } = ctx;\n const { calendar_id, event_id, ...updates } = params;\n return calendar_id\n ? client.events.update(calendar_id, event_id, updates)\n : client.events.updateById(event_id, updates);\n});\n\nexport const cancelEvent = safeFunc(async (ctx: Ctx<{ calendar_id?: string; event_id: string; occurrence_start?: string }>) => {\n const { calendar_id, event_id, occurrence_start } = ctx.params;\n if (occurrence_start) {\n // Single-occurrence cancel on a recurring series (#996): the API EXDATEs\n // that occurrence and returns the updated series master (the rest of the\n // series is unaffected). Mirrors the hosted MCP tool's response shape.\n const event = calendar_id\n ? await ctx.client.events.delete(calendar_id, event_id, { occurrence_start })\n : await ctx.client.events.deleteById(event_id, { occurrence_start });\n return { occurrence_cancelled: true, id: event_id, occurrence_start, event };\n }\n if (calendar_id) {\n await ctx.client.events.delete(calendar_id, event_id);\n } else {\n await ctx.client.events.deleteById(event_id);\n }\n return undefined;\n});\n\nexport const confirmEvent = safeFunc(async (ctx: Ctx<{ event_id: string }>) => {\n return ctx.client.events.confirm(ctx.params.event_id);\n});\n\nexport const releaseEvent = safeFunc(async (ctx: Ctx<{ event_id: string }>) => {\n return ctx.client.events.release(ctx.params.event_id);\n});\n\n// ── Agents ─────────────────────────────────────────────────────\n\nexport const createAgent = safeFunc(async (ctx: Ctx<{\n name: string; type: 'ai' | 'human' | 'resource'; description?: string; metadata?: Record<string, unknown>;\n}>) => {\n return ctx.client.agents.create(ctx.params);\n});\n\nexport const listAgents = safeFunc(async (ctx: Ctx<{\n type?: 'ai' | 'human' | 'resource'; status?: 'active' | 'paused' | 'decommissioned'; limit?: number; offset?: number;\n}>) => {\n const { client, params } = ctx;\n const iter = client.agents.list({ type: params.type, status: params.status, limit: params.limit });\n return fetchPage(iter, params.offset, params.limit);\n});\n\nexport const getAgent = safeFunc(async (ctx: Ctx<{ agent_id: string }>) => {\n return ctx.client.agents.get(ctx.params.agent_id);\n});\n\nexport const updateAgent = safeFunc(async (ctx: Ctx<{\n agent_id: string; name?: string; description?: string | null; metadata?: Record<string, unknown>; status?: 'active' | 'paused';\n}>) => {\n const { client, params } = ctx;\n const { agent_id, ...updates } = params;\n return client.agents.update(agent_id, updates);\n});\n\nexport const deleteAgent = safeFunc(async (ctx: Ctx<{ agent_id: string }>) => {\n await ctx.client.agents.delete(ctx.params.agent_id);\n return undefined;\n});\n\n// ── Availability ───────────────────────────────────────────────\n\nexport const getAvailability = safeFunc(async (ctx: Ctx<{\n agent_id: string; start?: string; end?: string; start_time?: string; end_time?: string;\n duration?: '15m' | '30m' | '45m' | '1h' | '2h';\n slot_duration?: '15m' | '30m' | '45m' | '1h' | '2h'; include_busy?: boolean;\n}>) => {\n const { client, params } = ctx;\n // Resolve the `start`/`end` canonical names from their REST aliases, mirroring\n // the hosted MCP tool's validation. `duration`/`slot_duration` are forwarded\n // as-is; the API coalesces them (and rejects conflicting values with a 400).\n const start = params.start ?? params.start_time;\n const end = params.end ?? params.end_time;\n if (!start || !end) {\n throw new Error('start (or start_time) and end (or end_time) are required');\n }\n return client.availability.forAgent(params.agent_id, {\n start,\n end,\n duration: params.duration,\n slot_duration: params.slot_duration,\n include_busy: params.include_busy,\n });\n});\n\nexport const findMeetingTime = safeFunc(async (ctx: Ctx<{\n agents?: string[]; agent_ids?: string[];\n start?: string; end?: string; start_time?: string; end_time?: string;\n duration?: '15m' | '30m' | '45m' | '1h' | '2h';\n slot_duration?: '15m' | '30m' | '45m' | '1h' | '2h';\n calendars?: string[]; include_busy?: boolean;\n}>) => {\n const { client, params } = ctx;\n // Resolve the canonical `agents`/`start`/`end` from their REST/scheduling\n // aliases, mirroring the hosted MCP tool's validation. `duration`/`slot_duration`\n // are forwarded as-is; the API coalesces them (400 on conflicting values).\n const agents = params.agents ?? params.agent_ids;\n const start = params.start ?? params.start_time;\n const end = params.end ?? params.end_time;\n if (!agents || !start || !end) {\n throw new Error('agents (or agent_ids), start (or start_time), and end (or end_time) are required');\n }\n return client.availability.check({\n agents,\n start,\n end,\n duration: params.duration,\n slot_duration: params.slot_duration,\n calendars: params.calendars,\n include_busy: params.include_busy,\n });\n});\n\nexport const createConnectionLink = safeFunc(async (ctx: Ctx<{\n calendar_id: string;\n capabilities: Array<'availability' | 'publishing'>;\n publication_policy?: 'none' | 'confirmed' | 'confirmed_tentative';\n}>) => {\n const { calendar_id, ...params } = ctx.params;\n return ctx.client.connectionLinks.create(calendar_id, params);\n});\n\nexport const getConnectionLink = safeFunc(async (ctx: Ctx<{ connection_link_id: string }>) =>\n ctx.client.connectionLinks.get(ctx.params.connection_link_id));\n\nexport const cancelConnectionLink = safeFunc(async (ctx: Ctx<{ connection_link_id: string }>) => {\n await ctx.client.connectionLinks.cancel(ctx.params.connection_link_id);\n return { cancelled: true, id: ctx.params.connection_link_id };\n});\n\n// ── Calendar context ───────────────────────────────────────────\n\nexport const getCalendarContext = safeFunc(async (ctx: Ctx<{ calendar_id: string }>) => {\n return ctx.client.calendars.getContext(ctx.params.calendar_id);\n});\n\n// ── Scheduling proposals ───────────────────────────────────────\n\ninterface ProposalSlotInput {\n start_time: string;\n end_time: string;\n weight?: number;\n calendar_id?: string;\n}\n\nexport const createProposal = safeFunc(async (ctx: Ctx<{\n title: string; description?: string; organizer_agent_id: string;\n participant_agent_ids: string[]; calendar_id: string;\n slots: ProposalSlotInput[]; expires_at?: string;\n}>) => {\n return ctx.client.scheduling.create(ctx.params);\n});\n\nexport const listProposals = safeFunc(async (ctx: Ctx<{\n status?: 'pending' | 'confirmed' | 'expired' | 'cancelled'; organizer_agent_id?: string; limit?: number; offset?: number;\n}>) => {\n const { client, params } = ctx;\n const iter = client.scheduling.list({\n status: params.status,\n organizer_agent_id: params.organizer_agent_id,\n limit: params.limit,\n });\n return fetchPage(iter, params.offset, params.limit);\n});\n\nexport const getProposal = safeFunc(async (ctx: Ctx<{ proposal_id: string }>) => {\n return ctx.client.scheduling.get(ctx.params.proposal_id);\n});\n\nexport const respondToProposal = safeFunc(async (ctx: Ctx<{\n proposal_id: string; agent_id: string; response: 'accept' | 'decline' | 'counter';\n selected_slot_id?: string; counter_slots?: ProposalSlotInput[]; message?: string;\n}>) => {\n const { client, params } = ctx;\n const { proposal_id, ...body } = params;\n return client.scheduling.respond(proposal_id, body);\n});\n\nexport const resolveProposal = safeFunc(async (ctx: Ctx<{ proposal_id: string }>) => {\n return ctx.client.scheduling.resolve(ctx.params.proposal_id);\n});\n\nexport const cancelProposal = safeFunc(async (ctx: Ctx<{ proposal_id: string }>) => {\n return ctx.client.scheduling.cancel(ctx.params.proposal_id);\n});\n\n// ── Availability rules ─────────────────────────────────────────\n\ninterface WorkingHoursDayInput { start: string; end: string; }\ntype WorkingHoursInput = {\n mon?: WorkingHoursDayInput; tue?: WorkingHoursDayInput; wed?: WorkingHoursDayInput;\n thu?: WorkingHoursDayInput; fri?: WorkingHoursDayInput; sat?: WorkingHoursDayInput; sun?: WorkingHoursDayInput;\n} | null;\n\nexport const setAvailabilityRules = safeFunc(async (ctx: Ctx<{\n calendar_id: string; buffer_before_minutes?: number; buffer_after_minutes?: number;\n working_hours?: WorkingHoursInput; timezone?: string;\n}>) => {\n const { client, params } = ctx;\n const { calendar_id, ...rules } = params;\n return client.calendars.setAvailabilityRules(calendar_id, rules);\n});\n\nexport const getAvailabilityRules = safeFunc(async (ctx: Ctx<{ calendar_id: string }>) => {\n return ctx.client.calendars.getAvailabilityRules(ctx.params.calendar_id);\n});\n\nexport const clearAvailabilityRules = safeFunc(async (ctx: Ctx<{ calendar_id: string }>) => {\n await ctx.client.calendars.deleteAvailabilityRules(ctx.params.calendar_id);\n return undefined;\n});\n\n// ── Scoped keys ────────────────────────────────────────────────\n\nexport const createScopedKey = safeFunc(async (ctx: Ctx<{ agent_id: string; label?: string; expires_in?: KeyExpiresIn }>) => {\n return ctx.client.keys.create(ctx.params);\n});\n\nexport const listScopedKeys = safeFunc(async (ctx: Ctx) => {\n return ctx.client.keys.list();\n});\n\nexport const revokeScopedKey = safeFunc(async (ctx: Ctx<{ key_id: string }>) => {\n await ctx.client.keys.delete(ctx.params.key_id);\n return undefined;\n});\n\n// ── Webhooks ───────────────────────────────────────────────────\n\nexport const listWebhooks = safeFunc(async (ctx: Ctx<{ limit?: number; offset?: number }>) => {\n const { client, params } = ctx;\n const iter = client.webhooks.list({ limit: params.limit });\n return fetchPage(iter, params.offset, params.limit);\n});\n\nexport const getWebhook = safeFunc(async (ctx: Ctx<{ webhook_id: string }>) => {\n return ctx.client.webhooks.get(ctx.params.webhook_id);\n});\n\nexport const createWebhook = safeFunc(async (ctx: Ctx<{ url: string; events: string[] }>) => {\n return ctx.client.webhooks.create(ctx.params);\n});\n\nexport const updateWebhook = safeFunc(async (ctx: Ctx<{\n webhook_id: string; url?: string; events?: string[]; active?: boolean;\n}>) => {\n const { client, params } = ctx;\n const { webhook_id, ...updates } = params;\n return client.webhooks.update(webhook_id, updates);\n});\n\nexport const deleteWebhook = safeFunc(async (ctx: Ctx<{ webhook_id: string }>) => {\n await ctx.client.webhooks.delete(ctx.params.webhook_id);\n return undefined;\n});\n\nexport const listWebhookDeliveries = safeFunc(async (ctx: Ctx<{\n webhook_id: string; limit?: number; offset?: number;\n status?: 'pending' | 'delivered' | 'failed' | 'dropped'; include_payload?: boolean;\n event_type?: string; created_after?: string; created_before?: string;\n delivery_id?: string; is_test?: boolean; cursor?: string;\n}>) => {\n const { client, params } = ctx;\n const { webhook_id, ...query } = params;\n return client.webhooks.listDeliveries(webhook_id, query);\n});\n\nexport const getWebhookDelivery = safeFunc(async (ctx: Ctx<{ webhook_id: string; delivery_id: string }>) => {\n return ctx.client.webhooks.getDelivery(ctx.params.webhook_id, ctx.params.delivery_id);\n});\n\nexport const sendTestWebhook = safeFunc(async (ctx: Ctx<{ webhook_id: string; event_type: string }>) => {\n return ctx.client.webhooks.sendTest(ctx.params.webhook_id, { event_type: ctx.params.event_type });\n});\n\nexport const replayWebhookDelivery = safeFunc(async (ctx: Ctx<{ webhook_id: string; delivery_id: string }>) => {\n return ctx.client.webhooks.replayDelivery(ctx.params.webhook_id, ctx.params.delivery_id);\n});\n\n// ── Audit log ──────────────────────────────────────────────────\n\nexport const getAuditLog = safeFunc(async (ctx: Ctx<ListAuditLogParams>) => {\n return ctx.client.auditLog.list(ctx.params);\n});\n\n// ── Terms ──────────────────────────────────────────────────────\n\nexport const acceptTerms = safeFunc(async (ctx: Ctx<{ tos_version: string }>) => {\n return ctx.client.terms.accept(ctx.params);\n});\n\n// ── iCal Subscriptions ─────────────────────────────────────────\n\nexport const listICalSubscriptions = safeFunc(async (ctx: Ctx<{\n agent_id: string; status?: 'active' | 'error' | 'paused'; limit?: number; offset?: number;\n}>) => {\n const { client, params } = ctx;\n const iter = client.icalSubscriptions.list({\n agentId: params.agent_id,\n status: params.status,\n limit: params.limit,\n });\n return fetchPage(iter, params.offset, params.limit);\n});\n\nexport const getICalSubscription = safeFunc(async (ctx: Ctx<{ subscription_id: string }>) => {\n return ctx.client.icalSubscriptions.get(ctx.params.subscription_id);\n});\n\nexport const subscribeICal = safeFunc(async (ctx: Ctx<{\n agent_id: string; calendar_id: string; url: string; label?: string;\n}>) => {\n const { client, params } = ctx;\n const { agent_id, ...subParams } = params;\n return client.icalSubscriptions.create(agent_id, subParams);\n});\n\nexport const updateICalSubscription = safeFunc(async (ctx: Ctx<{\n subscription_id: string; label?: string; url?: string;\n}>) => {\n const { client, params } = ctx;\n const { subscription_id, ...updates } = params;\n return client.icalSubscriptions.update(subscription_id, updates);\n});\n\nexport const deleteICalSubscription = safeFunc(async (ctx: Ctx<{ subscription_id: string }>) => {\n await ctx.client.icalSubscriptions.delete(ctx.params.subscription_id);\n return undefined;\n});\n\nexport const syncICalSubscription = safeFunc(async (ctx: Ctx<{ subscription_id: string }>) => {\n return ctx.client.icalSubscriptions.sync(ctx.params.subscription_id);\n});\n\nexport const pauseICalSubscription = safeFunc(async (ctx: Ctx<{ subscription_id: string }>) => {\n return ctx.client.icalSubscriptions.pause(ctx.params.subscription_id);\n});\n\nexport const resumeICalSubscription = safeFunc(async (ctx: Ctx<{ subscription_id: string }>) => {\n return ctx.client.icalSubscriptions.resume(ctx.params.subscription_id);\n});\n\n// ── Usage ──────────────────────────────────────────────────────\n\nexport const getUsage = safeFunc(async (ctx: Ctx) => {\n return ctx.client.usage.get();\n});\n\nexport const getUsageHistory = safeFunc(async (ctx: Ctx<{ months?: number }>) => {\n return ctx.client.usage.history({ months: ctx.params.months });\n});\n\n// ── Billing ────────────────────────────────────────────────────\n// Read-only for agents: a summary plus \"ask your human to upgrade\". Agents\n// cannot pay, cancel, or change payment methods.\n\nexport const getBilling = safeFunc(async (ctx: Ctx) => {\n return ctx.client.billing.get();\n});\n\nexport const requestUpgrade = safeFunc(async (ctx: Ctx<{\n interval?: 'month' | 'year'; reason?: string; feature?: string; metric?: string;\n}>) => {\n return ctx.client.billing.upgradeRequests.create(ctx.params);\n});\n\nexport const getUpgradeRequest = safeFunc(async (ctx: Ctx<{ id: string }>) => {\n return ctx.client.billing.upgradeRequests.get(ctx.params.id);\n});\n\nexport const cancelUpgradeRequest = safeFunc(async (ctx: Ctx<{ id: string }>) => {\n return ctx.client.billing.upgradeRequests.cancel(ctx.params.id);\n});\n\n// ── Factory ────────────────────────────────────────────────────\n\n/** Map of tool name → executor function. Used by definitions.ts to wire up execute(). */\nexport function createExecutor(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n fn: (ctx: { client: Chronary; params: any }) => Promise<ToolResult>,\n): (client: Chronary, params: Record<string, unknown>) => Promise<ToolResult> {\n return (client, params) => fn({ client, params });\n}\n","import type { ToolDefinition, ToolResult } from './types';\n\n/**\n * Event fields whose text can come from outside the org: a public booking\n * page writes the booker's name into `title` and their notes into\n * `description` and `metadata.invitee_notes` (`metadata.source` is\n * `booking_page`). Kept equal to the hosted MCP server's list.\n */\nexport const EVENT_UNTRUSTED_FIELDS = ['title', 'description', 'metadata'] as const;\n\n/**\n * Webhook delivery fields with third-party text: `payload` carries event text,\n * `response_body` is whatever the receiving server answered.\n */\nexport const WEBHOOK_DELIVERY_UNTRUSTED_FIELDS = ['payload', 'response_body'] as const;\n\n/**\n * Prefix `untrusted_fields` to a successful JSON object result. Arrays,\n * primitives and errors are returned unchanged.\n */\nexport function withUntrustedFields(result: ToolResult, fields: readonly string[]): ToolResult {\n const body = result.result;\n if (result.isError || typeof body !== 'object' || body === null || Array.isArray(body)) return result;\n return { ...result, result: { untrusted_fields: [...fields], ...(body as Record<string, unknown>) } };\n}\n\n/** Wrap a definition's `execute` so its results carry `untrusted_fields`. */\nexport function markUntrusted(def: ToolDefinition): ToolDefinition {\n const fields = def.untrustedFields;\n if (!fields || fields.length === 0) return def;\n const execute = def.execute;\n return { ...def, execute: async (client, params) => withUntrustedFields(await execute(client, params), fields) };\n}\n","import type { ToolDefinition } from './types';\nimport * as schemas from './schemas';\nimport * as fns from './functions';\nimport { createExecutor } from './functions';\nimport { EVENT_UNTRUSTED_FIELDS, WEBHOOK_DELIVERY_UNTRUSTED_FIELDS, markUntrusted } from './untrusted';\n\nexport const HOSTED_API_MCP_TOOL_NAMES = [\n 'create_agent',\n 'list_agents',\n 'create_calendar',\n 'create_event',\n 'list_events',\n 'list_org_events',\n 'get_event',\n 'update_event',\n 'get_availability',\n 'find_meeting_time',\n 'create_connection_link',\n 'get_connection_link',\n 'cancel_connection_link',\n 'cancel_event',\n 'confirm_event',\n 'release_event',\n 'subscribe_ical',\n 'list_ical_subscriptions',\n 'get_ical_subscription',\n 'update_ical_subscription',\n 'delete_ical_subscription',\n 'sync_ical_subscription',\n 'pause_ical_subscription',\n 'resume_ical_subscription',\n 'get_calendar_context',\n 'create_proposal',\n 'list_proposals',\n 'get_proposal',\n 'respond_to_proposal',\n 'resolve_proposal',\n 'cancel_proposal',\n 'set_availability_rules',\n 'get_availability_rules',\n 'clear_availability_rules',\n 'create_scoped_key',\n 'list_scoped_keys',\n 'revoke_scoped_key',\n 'create_webhook',\n 'list_webhooks',\n 'get_webhook',\n 'update_webhook',\n 'delete_webhook',\n 'list_webhook_deliveries',\n 'get_webhook_delivery',\n 'send_test_webhook',\n 'replay_webhook_delivery',\n 'get_agent',\n 'update_agent',\n 'delete_agent',\n 'list_calendars',\n 'get_calendar',\n 'update_calendar',\n 'delete_calendar',\n 'create_booking_page',\n 'list_booking_pages',\n 'get_booking_page',\n 'delete_booking_page',\n 'get_usage',\n 'get_usage_history',\n 'get_audit_log',\n 'accept_terms',\n 'get_billing',\n 'request_upgrade',\n 'get_upgrade_request',\n 'cancel_upgrade_request',\n] as const;\n\nconst RAW_TOOL_DEFINITIONS: ToolDefinition[] = [\n // ── Calendars ──────────────────────────────────────────────────\n {\n name: 'list_calendars',\n description: 'List calendars in the org. Organization keys see every calendar (agent-owned and shared); Agent keys see only their own agent\\'s calendars. Use this to discover calendar IDs before creating or listing events.',\n schema: schemas.ListCalendarsSchema,\n annotations: { title: 'List Calendars', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.listCalendars),\n },\n {\n name: 'get_calendar',\n description: 'Fetch a single calendar by ID, including its name, timezone, agent status, and default reminders. Agent keys may only read calendars owned by their agent.',\n schema: schemas.GetCalendarSchema,\n annotations: { title: 'Get Calendar', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.getCalendar),\n },\n {\n name: 'create_calendar',\n description: 'Create a calendar to hold events and track availability. Calendars are required before creating events — call this first when setting up a new agent. An agent can have multiple calendars (e.g. \"Work\", \"Personal\"). Org-level calendars (no agent_id) can be used as shared resources like meeting rooms.',\n schema: schemas.CreateCalendarSchema,\n annotations: { title: 'Create Calendar', readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },\n execute: createExecutor(fns.createCalendar),\n },\n {\n name: 'update_calendar',\n description: 'Update a calendar\\'s name, timezone, agent status, default reminders, or metadata. Agent keys may only update calendars owned by their agent.',\n schema: schemas.UpdateCalendarSchema,\n annotations: { title: 'Update Calendar', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.updateCalendar),\n },\n {\n name: 'delete_calendar',\n description: 'Delete a calendar (soft delete). Its events are no longer returned and it stops contributing to availability. Agent keys may only delete calendars owned by their agent.',\n schema: schemas.DeleteCalendarSchema,\n annotations: { title: 'Delete Calendar', readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.deleteCalendar),\n },\n\n // ── Booking pages ──────────────────────────────────────────────\n {\n name: 'create_booking_page',\n description: 'Create a public booking page (a hosted scheduling link) for a calendar. Returns a booking_url to send to a human; when they pick a slot, a confirmed event is created on the calendar and an event.created webhook fires with a booking_page_id field. Set availability_constraints to restrict to weekly working hours; existing calendar events always block slots.',\n schema: schemas.CreateBookingPageSchema,\n annotations: { title: 'Create Booking Page', readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },\n execute: createExecutor(fns.createBookingPage),\n },\n {\n name: 'list_booking_pages',\n description: 'List booking pages in the org. Agent keys see only pages on their own agent\\'s calendars.',\n schema: schemas.ListBookingPagesSchema,\n annotations: { title: 'List Booking Pages', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.listBookingPages),\n },\n {\n name: 'get_booking_page',\n description: 'Fetch a single booking page by ID, including its public booking_url and settings.',\n schema: schemas.GetBookingPageSchema,\n annotations: { title: 'Get Booking Page', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.getBookingPage),\n },\n {\n name: 'delete_booking_page',\n description: 'Delete (deactivate) a booking page. Its hosted URL stops resolving; already-booked events are unaffected.',\n schema: schemas.DeleteBookingPageSchema,\n annotations: { title: 'Delete Booking Page', readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.deleteBookingPage),\n },\n\n // ── Events ─────────────────────────────────────────────────────\n {\n name: 'list_events',\n description: 'List events on a calendar or across an agent\\'s calendars, including internally created events and externally synced events from iCal subscriptions (e.g. Google Calendar, Outlook). Provide `calendar_id` OR `agent_id`. Narrow with `start_after`/`start_before` (time window), `status`, and `source`.',\n schema: schemas.ListEventsSchema,\n annotations: { title: 'List Events', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n untrustedFields: EVENT_UNTRUSTED_FIELDS,\n execute: createExecutor(fns.listEvents),\n },\n {\n name: 'list_org_events',\n description: 'List events across all of the organization\\'s calendars in one call, ordered by start time (an Agent key sees only its agent\\'s calendars). Narrow with `calendar_ids`, `agent_id`, a `start_after`/`start_before` window, `status` and `source`. `q` searches titles (case-insensitive) and needs both window bounds at most 31 days apart. Use list_events for one calendar.',\n schema: schemas.ListOrgEventsSchema,\n annotations: { title: 'List Organization Events', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n untrustedFields: EVENT_UNTRUSTED_FIELDS,\n execute: createExecutor(fns.listOrgEvents),\n },\n {\n name: 'get_event',\n description: 'Retrieve a single event by ID, including its title, times, status, location, reminders, and metadata. Works for both internally created events and externally synced iCal events. `calendar_id` is optional — if omitted the calendar is resolved from the event. Provide `calendar_id` to fail fast on cross-calendar typos.',\n schema: schemas.GetEventSchema,\n annotations: { title: 'Get Event', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n untrustedFields: EVENT_UNTRUSTED_FIELDS,\n execute: createExecutor(fns.getEvent),\n },\n {\n name: 'create_event',\n description: 'Create a booking, appointment, meeting, hold, or any scheduled event on a calendar. The calendar_id comes from create_calendar or list_events. Once created, this event blocks the agent\\'s availability during that time and appears in availability queries. Use status=\"hold\" with hold_expires_at to tentatively reserve a slot that auto-releases on TTL.',\n schema: schemas.CreateEventSchema,\n annotations: { title: 'Create Event', readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },\n execute: createExecutor(fns.createEvent),\n },\n {\n name: 'update_event',\n description: 'Reschedule or edit an event — change its title, description, start/end times, location, status, reminders, or metadata. Use this to move an appointment to a new time or update its details. Provide only the fields you want to change. Holds cannot be edited via this tool (use confirm_event / release_event). External iCal events are read-only. `calendar_id` is optional — if omitted it is resolved from the event.',\n schema: schemas.UpdateEventSchema,\n annotations: { title: 'Update Event', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n untrustedFields: EVENT_UNTRUSTED_FIELDS,\n execute: createExecutor(fns.updateEvent),\n },\n {\n name: 'cancel_event',\n description: 'Delete or cancel an event from a calendar. Use this to remove, cancel, or delete any scheduled event or appointment. The event is marked cancelled and excluded from future availability calculations. For a recurring series, pass `occurrence_start` to cancel just that one occurrence (the series continues); omit it to cancel the whole series. `calendar_id` is optional — if omitted the calendar is looked up from the event. Provide `calendar_id` to fail fast on cross-calendar typos.',\n schema: schemas.CancelEventSchema,\n annotations: { title: 'Cancel Event', readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },\n untrustedFields: EVENT_UNTRUSTED_FIELDS,\n execute: createExecutor(fns.cancelEvent),\n },\n {\n name: 'confirm_event',\n 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. After confirmation, event.started and event.ended lifecycle webhooks fire at the scheduled times.',\n schema: schemas.ConfirmEventSchema,\n annotations: { title: 'Confirm Event', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n untrustedFields: EVENT_UNTRUSTED_FIELDS,\n execute: createExecutor(fns.confirmEvent),\n },\n {\n name: 'release_event',\n 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.',\n schema: schemas.ReleaseEventSchema,\n annotations: { title: 'Release Event', readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.releaseEvent),\n },\n\n // ── Agents ─────────────────────────────────────────────────────\n {\n name: 'create_agent',\n description: 'Register your agent (AI assistant, human participant, or resource) with Chronary so it can own calendars, events, and webhooks.',\n schema: schemas.CreateAgentSchema,\n annotations: { title: 'Create Agent', readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },\n execute: createExecutor(fns.createAgent),\n },\n {\n name: 'list_agents',\n description: 'List all agents in your organization',\n schema: schemas.ListAgentsSchema,\n annotations: { title: 'List Agents', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.listAgents),\n },\n {\n name: 'get_agent',\n description: 'Fetch a single agent by ID. An agent represents an AI assistant, human, or shared resource (e.g. a meeting room). Agent keys may only read their own agent.',\n schema: schemas.GetAgentSchema,\n annotations: { title: 'Get Agent', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.getAgent),\n },\n {\n name: 'update_agent',\n description: 'Update an agent\\'s name, description, metadata, or status (active/paused). Requires an Organization key — Agent keys cannot mutate agents.',\n schema: schemas.UpdateAgentSchema,\n annotations: { title: 'Update Agent', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.updateAgent),\n },\n {\n name: 'delete_agent',\n description: 'Decommission an agent. This marks the agent as decommissioned and revokes all of its Agent keys. Requires an Organization key — Agent keys cannot delete agents.',\n schema: schemas.DeleteAgentSchema,\n annotations: { title: 'Delete Agent', readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.deleteAgent),\n },\n\n // ── Availability ───────────────────────────────────────────────\n {\n name: 'get_availability',\n description: 'Check when a single agent is free across its Chronary calendars and any human calendars authorized for that agent. This tool is fail-closed: always inspect `availability_state` and `warnings` before using slots. Accepts `start`/`end` or the `start_time`/`end_time` aliases.',\n schema: schemas.GetAvailabilitySchema,\n annotations: { title: 'Get Availability', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.getAvailability),\n },\n {\n name: 'find_meeting_time',\n description: 'Find slots when multiple agents are free across Chronary calendars and any human calendars authorized for each agent. This tool is fail-closed: always inspect `availability_state` and `warnings` before using slots. Accepts `agents`/`start`/`end` or their aliases.',\n schema: schemas.FindMeetingTimeSchema,\n annotations: { title: 'Find Meeting Time', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.findMeetingTime),\n },\n {\n name: 'create_connection_link',\n description: 'Request human setup of Google Calendar or Microsoft Outlook for a Chronary calendar. Give setup_url to a human; the agent never receives OAuth credentials, provider calendar names, or event data. When the human finishes, the linked account becomes a Connection, listed under Human calendars in the Chronary console. The secret URL is returned only on first creation. If reused=true and setup_url is null, retain the original URL or cancel this link and create a replacement.',\n schema: schemas.CreateConnectionLinkSchema,\n annotations: { title: 'Create Human Calendar Setup Link', readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },\n execute: createExecutor(fns.createConnectionLink),\n },\n {\n name: 'get_connection_link',\n description: 'Poll a human-calendar setup request. Returns provider-neutral status and, when complete, the ID of the resulting Connection (the human sees it under Human calendars in the Chronary console), but never replays the bearer setup URL or exposes human calendar data.',\n schema: schemas.GetConnectionLinkSchema,\n annotations: { title: 'Get Human Calendar Setup Status', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.getConnectionLink),\n },\n {\n name: 'cancel_connection_link',\n description: 'Cancel a pending human-calendar setup request. This invalidates the setup URL and does not disconnect a Connection that was already completed; the human manages Connections under Human calendars in the Chronary console.',\n schema: schemas.CancelConnectionLinkSchema,\n annotations: { title: 'Cancel Human Calendar Setup Link', readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.cancelConnectionLink),\n },\n\n // ── Calendar context ───────────────────────────────────────────\n {\n name: 'get_calendar_context',\n description: 'Get a calendar\\'s temporal context in a single call: the current event (if one is happening now), the next upcoming event, recent past events, a short upcoming window, and the owning agent\\'s status (idle/working/waiting/error). Use this to answer \"what is this agent doing right now?\" without issuing multiple list_events queries.',\n schema: schemas.GetCalendarContextSchema,\n annotations: { title: 'Get Calendar Context', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n untrustedFields: EVENT_UNTRUSTED_FIELDS,\n execute: createExecutor(fns.getCalendarContext),\n },\n\n // ── Scheduling proposals ───────────────────────────────────────\n {\n name: 'create_proposal',\n description: 'Create a scheduling proposal — send a set of candidate time slots to one or more participant agents so they can accept, decline, or counter-propose. The organizer agent owns the proposal; once every participant responds, the system auto-resolves to the highest-scoring slot (or cancels if all decline). Requires an Organization key. Pro plan only.',\n schema: schemas.CreateProposalSchema,\n annotations: { title: 'Create Proposal', readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },\n execute: createExecutor(fns.createProposal),\n },\n {\n name: 'list_proposals',\n description: 'List scheduling proposals for the org. Filter by status (pending|confirmed|expired|cancelled) or organizer_agent_id. Requires an Organization key.',\n schema: schemas.ListProposalsSchema,\n annotations: { title: 'List Proposals', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.listProposals),\n },\n {\n name: 'get_proposal',\n description: 'Get a scheduling proposal by id, including its slots and per-participant responses. Requires an Organization key.',\n schema: schemas.GetProposalSchema,\n annotations: { title: 'Get Proposal', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.getProposal),\n },\n {\n name: 'respond_to_proposal',\n description: 'Submit a response (accept / decline / counter) on behalf of one participant agent to an open proposal. An \"accept\" requires the slot id from the proposal; a \"counter\" can suggest alternative slots. When all participants have responded the proposal auto-resolves — no separate resolve call needed in the normal flow. Requires an Organization key. Pro plan only.',\n schema: schemas.RespondToProposalSchema,\n annotations: { title: 'Respond To Proposal', readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },\n execute: createExecutor(fns.respondToProposal),\n },\n {\n name: 'resolve_proposal',\n description: 'Force-resolve an open proposal using responses collected so far. Picks the highest-scoring slot among those accepted by the most participants and creates a confirmed calendar event. If every response was \"decline\", the proposal is cancelled instead. Use when you want to close out a proposal without waiting for every participant. Requires an Organization key. Pro plan only.',\n schema: schemas.ResolveProposalSchema,\n annotations: { title: 'Resolve Proposal', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.resolveProposal),\n },\n {\n name: 'cancel_proposal',\n description: 'Cancel an open proposal. Fires a proposal.cancelled webhook with reason=\"organizer_cancelled\". Requires an Organization key. Pro plan only.',\n schema: schemas.CancelProposalSchema,\n annotations: { title: 'Cancel Proposal', readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.cancelProposal),\n },\n\n // ── Availability rules ─────────────────────────────────────────\n {\n name: 'set_availability_rules',\n description: 'Set or replace the availability rules on a calendar — buffer times before/after events and optional per-day working hours. When these rules are set, every availability query on this calendar automatically applies them (busy-block expansion for buffers, masking outside working hours). Upsert: overwrites any existing rules.',\n schema: schemas.SetAvailabilityRulesSchema,\n annotations: { title: 'Set Availability Rules', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.setAvailabilityRules),\n },\n {\n name: 'get_availability_rules',\n description: 'Read the buffer times and working-hours rules configured on a calendar. Returns the rules row, or an error if none are set.',\n schema: schemas.GetAvailabilityRulesSchema,\n annotations: { title: 'Get Availability Rules', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.getAvailabilityRules),\n },\n {\n name: 'clear_availability_rules',\n description: 'Remove the availability rules from a calendar, reverting to the default (no buffers, no working-hours mask). Returns the deleted row, or an error if none were set.',\n schema: schemas.ClearAvailabilityRulesSchema,\n annotations: { title: 'Clear Availability Rules', readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.clearAvailabilityRules),\n },\n\n // ── Webhooks ───────────────────────────────────────────────────\n {\n name: 'list_webhooks',\n description: 'List the org\\'s webhook subscriptions with their subscribed event types and active state. Signing secrets are never returned. Requires an Organization key.',\n schema: schemas.ListWebhooksSchema,\n annotations: { title: 'List Webhooks', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.listWebhooks),\n },\n {\n name: 'get_webhook',\n description: 'Get a single webhook subscription by id, including its subscribed event types and active state. The signing secret is never returned. Requires an Organization key.',\n schema: schemas.GetWebhookSchema,\n annotations: { title: 'Get Webhook', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.getWebhook),\n },\n {\n name: 'create_webhook',\n description: 'Create a webhook subscription so the org receives HTTP POST notifications when events occur (e.g. event.created, proposal.confirmed). The signing secret is returned ONCE in this response — store it to verify the HMAC-SHA256 signature on delivered payloads. Requires an Organization key.',\n schema: schemas.CreateWebhookSchema,\n annotations: { title: 'Create Webhook', readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },\n execute: createExecutor(fns.createWebhook),\n },\n {\n name: 'update_webhook',\n description: 'Update a webhook subscription — change its delivery URL, the set of subscribed event types, or pause/resume it via active. At least one field must be supplied. Requires an Organization key.',\n schema: schemas.UpdateWebhookSchema,\n annotations: { title: 'Update Webhook', readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: true },\n execute: createExecutor(fns.updateWebhook),\n },\n {\n name: 'delete_webhook',\n description: 'Permanently delete a webhook subscription. This frees its endpoint slot against the per-plan cap. Requires an Organization key.',\n schema: schemas.DeleteWebhookSchema,\n annotations: { title: 'Delete Webhook', readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.deleteWebhook),\n },\n {\n name: 'list_webhook_deliveries',\n description: 'List delivery attempts for a webhook subscription, newest first, with per-status counts (pending/delivered/failed/dropped). Filter by status, event type, creation time, delivery id or test flag, and page with next_cursor. `dropped` deliveries were stopped by the Free plan monthly limit. Use this to debug failing deliveries. Requires an Organization key.',\n schema: schemas.ListWebhookDeliveriesSchema,\n annotations: { title: 'List Webhook Deliveries', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n untrustedFields: WEBHOOK_DELIVERY_UNTRUSTED_FIELDS,\n execute: createExecutor(fns.listWebhookDeliveries),\n },\n {\n name: 'get_webhook_delivery',\n description: 'Get one webhook delivery with its payload and every attempt, oldest first: HTTP status, duration, the first 2 KB of the response body and an error code (timeout, connection_error, tls_error, redirect_not_followed, unsafe_destination_url, non_2xx). Use this to find out why a delivery failed. Requires an Organization key.',\n schema: schemas.GetWebhookDeliverySchema,\n annotations: { title: 'Get Webhook Delivery', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n untrustedFields: WEBHOOK_DELIVERY_UNTRUSTED_FIELDS,\n execute: createExecutor(fns.getWebhookDelivery),\n },\n {\n name: 'send_test_webhook',\n description: 'Send a signed sample payload of one event type to a webhook endpoint, to check that it receives and verifies deliveries. The delivery is marked is_test, carries the X-Chronary-Test: 1 header, makes one attempt, does not count toward the monthly delivery quota and is sent even when the endpoint is paused or disabled. The endpoint must subscribe to the event type. Poll get_webhook_delivery with the returned delivery_id for the result. Limited to 10 per minute. Requires an Organization key.',\n schema: schemas.SendTestWebhookSchema,\n annotations: { title: 'Send Test Webhook', readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },\n execute: createExecutor(fns.sendTestWebhook),\n },\n {\n name: 'replay_webhook_delivery',\n description: \"Send a failed or dropped webhook delivery again, as a new delivery with a new delivery_id. The stored payload goes out unchanged (same event id), signed with the endpoint's current secret, with an X-Chronary-Replay-Of header naming the original delivery. Only failed or dropped deliveries that are not test events can be replayed, the endpoint must be active, and the payload must still be stored (30 days). The replay follows the normal retry schedule and counts toward the monthly delivery quota. Poll get_webhook_delivery with the returned delivery_id for the result. Limited to 30 per minute. Requires a Developer or Pro plan and an Organization key.\",\n schema: schemas.ReplayWebhookDeliverySchema,\n annotations: { title: 'Replay Webhook Delivery', readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },\n execute: createExecutor(fns.replayWebhookDelivery),\n },\n\n // ── iCal Subscriptions ─────────────────────────────────────────\n {\n name: 'list_ical_subscriptions',\n description: \"List an agent's external iCal feed subscriptions (e.g. linked Google Calendar / Outlook feeds), including their sync status and last sync time.\",\n schema: schemas.ListICalSubscriptionsSchema,\n annotations: { title: 'List iCal Subscriptions', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.listICalSubscriptions),\n },\n {\n name: 'get_ical_subscription',\n description: 'Get a single external iCal feed subscription by id, including its sync status, last sync time, and last error.',\n schema: schemas.GetICalSubscriptionSchema,\n annotations: { title: 'Get iCal Subscription', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.getICalSubscription),\n },\n {\n name: 'subscribe_ical',\n 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. The target calendar must be owned by the specified agent — create the calendar with that agent_id first (org-level calendars without an agent_id cannot host external iCal subscriptions; create a dedicated per-agent calendar for sync targets).\",\n schema: schemas.SubscribeICalSchema,\n annotations: { title: 'Subscribe iCal', readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },\n execute: createExecutor(fns.subscribeICal),\n },\n {\n name: 'update_ical_subscription',\n description: 'Update an external iCal feed subscription — change its label or its feed URL. Changing the URL forces a full re-sync on the next poll.',\n schema: schemas.UpdateICalSubscriptionSchema,\n annotations: { title: 'Update iCal Subscription', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },\n execute: createExecutor(fns.updateICalSubscription),\n },\n {\n name: 'delete_ical_subscription',\n description: 'Delete an external iCal feed subscription. Events previously synced from the feed are no longer refreshed.',\n schema: schemas.DeleteICalSubscriptionSchema,\n annotations: { title: 'Delete iCal Subscription', readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.deleteICalSubscription),\n },\n {\n name: 'sync_ical_subscription',\n description: 'Start an immediate fetch of an external iCal feed instead of waiting for the next scheduled poll. Returns {\"status\":\"syncing\"} as soon as the fetch has started; call get_ical_subscription a few seconds later to read last_synced_at and last_error. A paused feed must be resumed first; one manual sync per feed per minute.',\n schema: schemas.SyncICalSubscriptionSchema,\n annotations: { title: 'Sync iCal Subscription', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },\n execute: createExecutor(fns.syncICalSubscription),\n },\n {\n name: 'pause_ical_subscription',\n description: 'Pause an external iCal feed subscription: scheduled polls skip it and manual syncs are refused until it is resumed. Busy blocks already imported stay. Pausing a paused feed changes nothing. Returns the subscription.',\n schema: schemas.PauseICalSubscriptionSchema,\n annotations: { title: 'Pause iCal Subscription', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.pauseICalSubscription),\n },\n {\n name: 'resume_ical_subscription',\n description: 'Resume a paused or failing external iCal feed subscription: it returns to scheduled polling and its last_error is cleared. Resuming an active feed changes nothing. Returns the subscription.',\n schema: schemas.ResumeICalSubscriptionSchema,\n annotations: { title: 'Resume iCal Subscription', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.resumeICalSubscription),\n },\n\n // ── Scoped keys ────────────────────────────────────────────────\n {\n name: 'create_scoped_key',\n description: 'Create an Agent key (chr_ak_*) that can only act on behalf of a single agent. Use this to self-provision or rotate per-agent credentials. The plaintext key is returned exactly once in the response — store it immediately, it cannot be retrieved later. Requires an Organization key.',\n schema: schemas.CreateScopedKeySchema,\n annotations: { title: 'Create Scoped Key', readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },\n execute: createExecutor(fns.createScopedKey),\n },\n {\n name: 'list_scoped_keys',\n description: 'List all live (non-revoked) Agent keys for this org. Returns key metadata only (id, prefix, agent_id, label, created_at) — never the plaintext secret. Requires an Organization key.',\n schema: schemas.ListScopedKeysSchema,\n annotations: { title: 'List Scoped Keys', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.listScopedKeys),\n },\n {\n name: 'revoke_scoped_key',\n description: 'Revoke an Agent key by ID. Revocation is permanent (cannot be un-revoked); the key stops authenticating within about a minute. Requires an Organization key.',\n schema: schemas.RevokeScopedKeySchema,\n annotations: { title: 'Revoke Scoped Key', readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.revokeScopedKey),\n },\n\n // ── Audit log ──────────────────────────────────────────────────\n {\n name: 'get_audit_log',\n description: 'List audit-log entries for the calling org — mutating operations and auth-lifecycle events, newest first. Results are clamped to the plan\\'s retention window. Requires an Organization key (chr_sk_*); Agent keys cannot read the org-wide audit log.',\n schema: schemas.GetAuditLogSchema,\n annotations: { title: 'Get Audit Log', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.getAuditLog),\n },\n\n // ── Terms ──────────────────────────────────────────────────────\n {\n name: 'accept_terms',\n 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 — a material ToS bump otherwise leaves MCP-only agents stuck without a console session. Pass the current tos_version (read it from GET /v1/auth/terms/current). Requires an Organization key (chr_sk_*); Agent keys cannot accept org-wide terms.',\n schema: schemas.AcceptTermsSchema,\n annotations: { title: 'Accept Terms', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.acceptTerms),\n },\n\n // ── Usage ──────────────────────────────────────────────────────\n {\n name: 'get_usage',\n description: 'Get the calling org\\'s current-period usage and plan limits (agents, calendars, events, API calls, webhook deliveries, webhook endpoints, availability queries, iCal subscriptions, proposals, recurring events, booking pages, scoped keys, holds, cross-calendar queries) and when the monthly counters reset (resets_at, 00:00 UTC on the 1st). Requires an Organization key (chr_sk_*); Agent keys cannot read org-wide usage.',\n schema: schemas.GetUsageSchema,\n annotations: { title: 'Get Usage', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.getUsage),\n },\n {\n name: 'get_usage_history',\n description: 'Get the calling org\\'s monthly usage totals for the last 1-12 UTC calendar months (default 6), oldest first, ending with the current partial month. Each month lists every monthly counter (api_calls, events, webhook_deliveries, availability_queries, proposals, holds_created, holds_confirmed, holds_expired, cross_calendar_queries); limits are the current plan\\'s (null = unlimited). Requires an Organization key (chr_sk_*); Agent keys cannot read org-wide usage.',\n schema: schemas.GetUsageHistorySchema,\n annotations: { title: 'Get Usage History', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.getUsageHistory),\n },\n\n // ── Billing ────────────────────────────────────────────────────\n {\n name: 'get_billing',\n description: 'Get the org\\'s plan and billing status: plan, subscription status, renewal/cancellation dates, upgrade options, and any pending upgrade request. Read-only — agents cannot pay, cancel, or change payment methods. Requires an Organization key (chr_sk_*).',\n schema: schemas.GetBillingSchema,\n annotations: { title: 'Get Billing', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.getBilling),\n },\n {\n name: 'request_upgrade',\n description: 'Ask your human to upgrade this Chronary account to Pro. Returns approval_url — give it to your human; only a human can pay. If reused=true a request is already pending — do not call again; poll get_upgrade_request at most once a minute. The link opens the Billing page in the Chronary console.',\n schema: schemas.RequestUpgradeSchema,\n annotations: { title: 'Request Upgrade', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.requestUpgrade),\n },\n {\n name: 'get_upgrade_request',\n description: 'Poll an upgrade request by ID. status is pending, completed, declined, canceled, or expired. Poll at most once a minute; after completed, retry the blocked call about 15 seconds later. Requires an Organization key (chr_sk_*).',\n schema: schemas.GetUpgradeRequestSchema,\n annotations: { title: 'Get Upgrade Request', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.getUpgradeRequest),\n },\n {\n name: 'cancel_upgrade_request',\n description: 'Withdraw a pending upgrade request (for example, the blocker went away). The approval URL stops working. Fails with upgrade_request_not_pending if the request is already completed, declined, canceled, or expired.',\n schema: schemas.CancelUpgradeRequestSchema,\n annotations: { title: 'Cancel Upgrade Request', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.cancelUpgradeRequest),\n },\n];\n\n// Results of tools with third-party text start with `untrusted_fields` (#1621).\nexport const TOOL_DEFINITIONS: ToolDefinition[] = RAW_TOOL_DEFINITIONS.map(markUntrusted);\n\nconst toolkitToolNames = new Set<string>(TOOL_DEFINITIONS.map((tool) => tool.name));\nconst hostedToolNames = new Set<string>(HOSTED_API_MCP_TOOL_NAMES);\n\nexport const TOOLKIT_MCP_PARITY = {\n hostedToolNames: HOSTED_API_MCP_TOOL_NAMES,\n missingHostedTools: HOSTED_API_MCP_TOOL_NAMES.filter((name) => !toolkitToolNames.has(name)),\n toolkitOnlyTools: TOOL_DEFINITIONS.map((tool) => tool.name).filter((name) => !hostedToolNames.has(name)),\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,cAAyB;;;ACAzB,iBAAkB;AAKlB,IAAM,sBAAsB;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,IAAM,4BAA4B,CAAC,WAAW,aAAa,UAAU,SAAS;AAIvE,IAAM,sBAAsB,aAAE,OAAO;AAAA,EAC1C,UAAU,aAAE,OAAO,EAAE,SAAS,EAAE,SAAS,0IAAqI;AAAA,EAC9K,SAAS,aAAE,KAAK,CAAC,KAAK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