/** * ReceptionistAgent - Prefab agent that greets callers, collects basic info, * and transfers them to the appropriate department. * * Ported from the Python SDK `signalwire.prefabs.receptionist.ReceptionistAgent`. * Preserves TS-specific enhancements (`companyName`, visitor check-in) as * additive features. */ import { AgentBase } from '../AgentBase.js'; import type { AgentOptions } from '../types.js'; /** A department the receptionist can route callers to. */ export interface ReceptionistDepartment { /** Department identifier (e.g. `"sales"`, `"support"`). */ name: string; /** Description of the department's purpose (shown to the AI). */ description: string; /** Phone number (or SIP address) used by `transfer_call`. */ number: string; } /** Configuration for the {@link ReceptionistAgent}. */ export interface ReceptionistConfig { /** Departments the agent can transfer callers to. */ departments: ReceptionistDepartment[]; /** Agent display name (defaults to `"receptionist"`). */ name?: string; /** HTTP route for this agent (defaults to `"/receptionist"`). */ route?: string; /** Initial greeting message. Defaults to the Python receptionist greeting. */ greeting?: string; /** Voice identifier passed to `addLanguage`. Defaults to `"rime.spore"`. */ voice?: string; /** Optional company name. Appended to the greeting when provided. */ companyName?: string; /** Whether visitor check-in functionality is enabled. Default `false`. */ checkInEnabled?: boolean; /** Callback fired when a visitor checks in. */ onVisitorCheckIn?: (visitor: Record) => void | Promise; /** Additional AgentBase options forwarded to super(). */ agentOptions?: Partial; } /** * Prefab agent that greets callers, collects basic information, and transfers them to the correct department. * * Optionally supports visitor check-in — when enabled, the agent can collect a visitor's name * and purpose-of-visit and invoke a callback (e.g., notify reception via Slack, write to a * database). If not transferring, the call ends after check-in. * * @example * ```ts * import { ReceptionistAgent } from '@signalwire/sdk'; * * const agent = new ReceptionistAgent({ * companyName: 'Acme Co', * greeting: 'Thanks for calling Acme! How can I direct your call?', * departments: [ * { name: 'sales', description: 'New customer inquiries', number: '+15551112222' }, * { name: 'support', description: 'Existing customer help', number: '+15553334444' }, * { name: 'billing', description: 'Billing and payments', number: '+15555556666' }, * ], * checkInEnabled: true, * onVisitorCheckIn: async (visitor) => { * await notifyFrontDesk(visitor); * }, * }); * * await agent.serve({ port: 3000 }); * ``` */ export declare class ReceptionistAgent extends AgentBase { private readonly greeting; private readonly departments; private readonly companyName; private readonly checkInEnabled; private readonly onVisitorCheckInCallback?; private readonly sessions; /** * Create a ReceptionistAgent with the specified departments. * @param config - Configuration including departments (name/description/number), greeting, and voice. */ constructor(config: ReceptionistConfig); private static validateDepartments; private buildPrompt; private configureAgentSettings; private getSession; /** * Register the `collect_caller_info` and `transfer_call` SWAIG tools * (Python parity). When `checkInEnabled` is `true`, also registers the * TS-specific `check_in_visitor` tool. */ protected defineTools(): void; /** * Python-style receptionist summary hook. Default is a no-op; subclasses * may override to persist the summary. Mirrors Python `on_summary` * (receptionist.py lines 278–287). */ onSummary(_summary: Record | null, _rawData: Record): void | Promise; } /** * Factory function that creates and returns a new ReceptionistAgent. * @param config - Configuration for the receptionist agent. * @returns A configured ReceptionistAgent instance. */ export declare function createReceptionistAgent(config: ReceptionistConfig): ReceptionistAgent; export default ReceptionistAgent;