import type { TriageSeverity } from './types.js'; /** * A DomainProfile holds everything business-specific: the complaint categories and how to * resolve them, the product catalog, locations, currency and money limits. The core engine * reads the profile and never hardcodes a business. Adapters supply the data; the profile * supplies the vocabulary and policy. */ /** Built-in categories every profile shares. */ export declare const GENERAL_INQUIRY = "general_inquiry"; export declare const PROMPT_INJECTION = "prompt_injection"; /** Resolution the pipeline takes on its own for a category (still subject to the money gate). */ export type PolicyAction = 'refund' | 'credit' | 'create_ticket'; export interface CategoryPolicy { action: PolicyAction; /** Always use this amount and ignore any amount the customer claims (e.g. a fixed apology credit). */ fixedAmount?: number; /** When the customer names no amount, fall back to the order total. */ useOrderTotal?: boolean; /** Upper bound applied to the order-total fallback. */ maxAmount?: number; /** Used when the customer names no amount and no order total is available. */ defaultAmount?: number; } /** A string matches when the text contains it; an array matches only when the text contains every entry. */ export type KeywordRule = string | string[]; export interface CategoryDefinition { id: string; label: string; intent: string; /** Lowercase keywords used by the offline classifier. */ keywords: KeywordRule[]; severity: TriageSeverity; urgencyScore: number; policy: CategoryPolicy; /** Disable the affected item at the resource when a systemic incident forms for this category. */ disableItemOnIncident?: boolean; /** Recommended next step attached to incidents. `{resource}` is replaced with the resource ID. */ incidentPlaybook?: string; /** * Complaints in this category point at a defect in the product's own software (wrong charges, errors, * crashes). With a bug resolver attached, the pipeline hands their systemic incidents to the bug-fix loop. */ softwareDefect?: boolean; } export interface CatalogEntry { id: string; name: string; /** Lowercase phrases that identify this entry in customer text. */ aliases: string[]; } export interface CurrencyConfig { /** ISO 4217 code, e.g. 'USD', 'EUR'. */ code: string; symbol: string; /** Lowercase words customers use for the currency, e.g. ['dollars'] or ['euros']. */ aliases: string[]; } export interface MoneyPolicy { /** Refunds and credits at or below this amount execute without human approval. */ autoApproveThreshold: number; /** Hard ceiling for a single wallet credit. */ maxCreditAmount: number; /** Lifetime spend at which the voice agent treats a customer as loyal. */ loyalCustomerSpend: number; } export interface DomainLabels { /** How the business describes itself, e.g. 'online store', 'subscription app'. */ business: string; /** What an item is called, e.g. 'Product', 'Plan'. */ item: string; /** What a resource (location or operational unit) is called, e.g. 'Warehouse', 'Store'. */ resource: string; } export interface DomainProfile { id: string; name: string; labels: DomainLabels; currency: CurrencyConfig; moneyPolicy: MoneyPolicy; /** Checked in order; the first category whose keywords match wins. */ categories: CategoryDefinition[]; /** Messages matching these are logged as feedback instead of complaints. */ complimentKeywords: string[]; items: CatalogEntry[]; resources: CatalogEntry[]; /** Pattern whose first capture group is the order ID. */ orderIdPattern: RegExp; normalizeOrderId?: (raw: string) => string; } export declare function matchesKeywords(text: string, rules: KeywordRule[]): boolean; export declare function findCatalogEntry(text: string, entries: CatalogEntry[]): CatalogEntry | undefined; export declare function findCategory(profile: DomainProfile, categoryId: string): CategoryDefinition | undefined; export declare function categoryLabel(profile: DomainProfile, categoryId: string): string; export declare function formatMoney(amount: number, currency: CurrencyConfig): string; /** Finds an amount written with the profile's currency, e.g. "$40", "40 dollars", "€35", "35 euros". */ export declare function extractAmount(text: string, currency: CurrencyConfig): number | undefined; export declare function normalizeOrderId(raw: string, profile: DomainProfile): string; export declare function extractOrderId(text: string, profile: DomainProfile): string | undefined; /** * Default profile for general product businesses (e-commerce, retail, subscriptions, apps). * Businesses copy and edit it, or pass their own profile to the pipeline. */ export declare const GENERIC_PROFILE: DomainProfile;