import { IntentRouterCommand, PikaCommand, IntentRouterFeature } from './chatbot-types.js'; export { IntentRouterCommandEvent, IntentRouterCommandExecution, IntentRouterDirectExecution, IntentRouterDispatchExecution, IntentRouterHandler, IntentRouterHandlerResult, PikaCloseCanvasCommand, PikaCloseDialogCommand, PikaCloseHeroCommand, PikaCustomCommand, PikaHideHeroCommand, PikaNavigateToCommand, PikaRenderTagCommand, PikaShowHeroCommand, PikaShowToastCommand } from './chatbot-types.js'; import '@aws-sdk/client-bedrock-agent-runtime'; import '@aws-sdk/client-bedrock-agentcore'; /** * Intent Router Types - Server-side Internal Types * * Client-facing types (PikaCommand, IntentRouterCommand, IntentRouterHandler, etc.) * are defined in chatbot-types.ts and should be imported from there. * * This file contains only server-side internal types used by the Intent Router module. * * @since 0.18.0 */ /** * Result of intent classification. */ interface IntentClassificationResult { /** Whether a command was matched */ matched: boolean; /** The matched command (if any) */ command?: IntentRouterCommand; /** The tag definition that owns this command */ tagId?: string; /** Classification confidence (0-1) */ confidence: number; /** Reasoning for the match (for tracing) */ reasoning?: string; } /** * Result of routing a user message. */ type IntentRouteResult = IntentRoutePassthrough | IntentRouteDirectAction | IntentRouteDispatch | IntentRouteEnrich; interface IntentRoutePassthrough { type: 'passthrough'; /** Why we're passing through (no match, low confidence, etc.) */ reason: string; } interface IntentRouteDirectAction { type: 'direct'; /** The matched command */ command: IntentRouterCommand; /** The tag that owns this command */ tagId: string; /** The PikaCommand to execute */ pikaCommand: PikaCommand; /** Response to stream */ response: string; /** Classification confidence */ confidence: number; /** Whether to continue to Bedrock after */ passToAgent: boolean; } interface IntentRouteDispatch { type: 'dispatch'; /** The matched command */ command: IntentRouterCommand; /** The tag that owns this command */ tagId: string; /** Handler widget tag ID */ handlerTagId: string; /** Payload for handler */ payload?: Record; /** Response to show user (e.g., "Opening jobs...") */ response?: string; /** Classification confidence */ confidence: number; } interface IntentRouteEnrich { type: 'enrich'; /** Context injection for the prompt */ contextInjection: string; /** Reason for enrichment */ reason: string; } /** * Aggregated command with its source tag information. */ interface AggregatedCommand { /** The command definition */ command: IntentRouterCommand; /** Source tag ID (scope.tag) */ tagId: string; /** Effective priority (base + any chat app boost) */ effectivePriority: number; } /** * Request to the Intent Router. */ interface IntentRouterRequest { /** Chat app ID */ chatAppId: string; /** User ID */ userId: string; /** Session ID */ sessionId: string; /** The user's message */ message: string; /** Context from widgets (llmContextItems converted to key-value) */ context: Record; /** Intent Router configuration for this chat app */ config: IntentRouterFeature; } /** * Validation error with detailed context. * @since 0.18.0 */ interface CommandValidationError { /** Field path where the error occurred (e.g., "execution.command.tagId") */ field: string; /** Human-readable error message */ message: string; /** The invalid value (for debugging) */ value?: unknown; } /** * Result of validating a single command. * @since 0.18.0 */ interface CommandValidationResult { valid: boolean; errors: CommandValidationError[]; } /** * Result of validating multiple commands. * @since 0.18.0 */ interface CommandsValidationResult { valid: boolean; errors: Array; } export { type AggregatedCommand, type CommandValidationError, type CommandValidationResult, type CommandsValidationResult, type IntentClassificationResult, type IntentRouteDirectAction, type IntentRouteDispatch, type IntentRouteEnrich, type IntentRoutePassthrough, type IntentRouteResult, IntentRouterCommand, IntentRouterFeature, type IntentRouterRequest, PikaCommand };