/**
 * Agent Host Protocol — Type Definitions
 *
 * @module agent-host-protocol
 * @description Canonical TypeScript type definitions for the Agent Host Protocol.
 * These types are the source of truth from which documentation and JSON Schema
 * are generated.
 */

// State types
export type {
  URI,
  StringOrMarkdown,
  RootState,
  RootConfigState,
  AgentInfo,
  ProtectedResourceMetadata,
  ProjectInfo,
  SessionModelInfo,
  ModelSelection,
  AgentSelection,
  SessionState,
  SessionSummary,
  ChangesSummary,
  SessionConfigState,
  Turn,
  ActiveTurn,
  Message,
  MessageAttachment,
  MessageAttachmentBase,
  TextPosition,
  TextRange,
  TextSelection,
  SimpleMessageAttachment,
  MessageEmbeddedResourceAttachment,
  MessageResourceAttachment,
  MessageAnnotationsAttachment,
  MarkdownResponsePart,
  ContentRef,
  ToolCallResponsePart,
  ReasoningResponsePart,
  SystemNotificationResponsePart,
  ResponsePart,
  ToolCallResult,
  ToolCallStreamingState,
  ToolCallPendingConfirmationState,
  ToolCallRunningState,
  ToolCallPendingResultConfirmationState,
  ToolCallCompletedState,
  ToolCallCancelledState,
  ToolCallState,
  ConfirmationOption,
  ToolDefinition,
  ToolAnnotations,
  ToolResultTextContent,
  ToolResultEmbeddedResourceContent,
  ToolResultResourceContent,
  ToolResultContent,
  FileEdit,
  ToolResultFileEditContent,
  ToolResultTerminalContent,
  ToolResultSubagentContent,
  SessionActiveClient,
  PendingMessage,
  SessionInputAnswer,
  SessionInputAnswerValue,
  SessionInputTextAnswerValue,
  SessionInputNumberAnswerValue,
  SessionInputBooleanAnswerValue,
  SessionInputSelectedAnswerValue,
  SessionInputSelectedManyAnswerValue,
  SessionInputAnswered,
  SessionInputSkipped,
  SessionInputOption,
  SessionInputQuestion,
  SessionInputTextQuestion,
  SessionInputNumberQuestion,
  SessionInputBooleanQuestion,
  SessionInputSingleSelectQuestion,
  SessionInputMultiSelectQuestion,
  SessionInputRequest,
  UsageInfo,
  ErrorInfo,
  Snapshot,
  TerminalInfo,
  TerminalClientClaim,
  TerminalSessionClaim,
  TerminalClaim,
  TerminalState,
  TerminalContentPart,
  TerminalUnclassifiedPart,
  TerminalCommandPart,
  Changeset,
  ChangesetState,
  ChangesetFile,
  ChangesetOperation,
  AnnotationsSummary,
  AnnotationsState,
  Annotation,
  AnnotationEntry,
  TelemetryCapabilities,
  ResourceWatchState,
  ResourceChange,
} from './state.js';

export {
  PolicyState,
  SessionLifecycle,
  SessionStatus,
  TurnState,
  MessageAttachmentKind,
  ResponsePartKind,
  ToolCallStatus,
  ToolCallConfirmationReason,
  ToolCallCancellationReason,
  ConfirmationOptionKind,
  ToolResultContentType,
  PendingMessageKind,
  SessionInputAnswerState,
  SessionInputAnswerValueKind,
  SessionInputQuestionKind,
  SessionInputResponseKind,
  TerminalClaimKind,
  ChangesetStatus,
  ChangesetOperationStatus,
  ChangesetOperationScope,
  ResourceChangeType,
} from './state.js';

// Action types
export type {
  ActionEnvelope,
  ActionOrigin,
  RootAgentsChangedAction,
  RootActiveSessionsChangedAction,
  SessionReadyAction,
  SessionCreationFailedAction,
  SessionTurnStartedAction,
  SessionDeltaAction,
  SessionResponsePartAction,
  SessionToolCallStartAction,
  SessionToolCallDeltaAction,
  SessionToolCallReadyAction,
  SessionToolCallApprovedAction,
  SessionToolCallDeniedAction,
  SessionToolCallConfirmedAction,
  SessionToolCallCompleteAction,
  SessionToolCallResultConfirmedAction,
  SessionToolCallContentChangedAction,
  SessionTurnCompleteAction,
  SessionTurnCancelledAction,
  SessionErrorAction,
  SessionTitleChangedAction,
  SessionUsageAction,
  SessionReasoningAction,
  SessionModelChangedAction,
  SessionAgentChangedAction,
  SessionServerToolsChangedAction,
  SessionActiveClientChangedAction,
  SessionActiveClientToolsChangedAction,
  SessionPendingMessageSetAction,
  SessionPendingMessageRemovedAction,
  SessionQueuedMessagesReorderedAction,
  SessionInputAnswerChangedAction,
  SessionInputCompletedAction,
  SessionInputRequestedAction,
  SessionTruncatedAction,
  SessionIsReadChangedAction,
  SessionIsArchivedChangedAction,
  SessionActivityChangedAction,
  SessionConfigChangedAction,
  ChangesetStatusChangedAction,
  ChangesetFileSetAction,
  ChangesetFileRemovedAction,
  ChangesetOperationsChangedAction,
  ChangesetOperationStatusChangedAction,
  ChangesetClearedAction,
  AnnotationsSetAction,
  AnnotationsRemovedAction,
  AnnotationsEntrySetAction,
  AnnotationsEntryRemovedAction,
  StateAction,
  RootTerminalsChangedAction,
  RootConfigChangedAction,
  TerminalDataAction,
  TerminalInputAction,
  TerminalResizedAction,
  TerminalClaimedAction,
  TerminalTitleChangedAction,
  TerminalCwdChangedAction,
  TerminalExitedAction,
  TerminalClearedAction,
  TerminalCommandExecutedAction,
  TerminalCommandFinishedAction,
  TerminalCommandDetectionAvailableAction,
  ResourceWatchChangedAction,
} from './actions.js';

export { ActionType } from './actions.js';

// Generated action origin types
export type {
  RootAction,
  SessionAction,
  ClientSessionAction,
  ServerSessionAction,
  TerminalAction,
  ClientTerminalAction,
  ServerTerminalAction,
  ChangesetAction,
  ClientChangesetAction,
  ServerChangesetAction,
  AnnotationsAction,
  ClientAnnotationsAction,
  ServerAnnotationsAction,
  ResourceWatchAction,
  ClientResourceWatchAction,
  ServerResourceWatchAction,
} from './action-origin.generated.js';

export { IS_CLIENT_DISPATCHABLE } from './action-origin.generated.js';

// Reducer functions
export {
  rootReducer,
  sessionReducer,
  terminalReducer,
  changesetReducer,
  annotationsReducer,
  resourceWatchReducer,
  isClientDispatchable,
} from './reducers.js';

// Command types
export type {
  InitializeParams,
  InitializeResult,
  ClientCapabilities,
  PingParams,
  ReconnectParams,
  ReconnectReplayResult,
  ReconnectSnapshotResult,
  ReconnectResult,
  SubscribeParams,
  SubscribeResult,
  CreateSessionParams,
  SessionForkSource,
  DisposeSessionParams,
  CreateTerminalParams,
  DisposeTerminalParams,
  ListSessionsParams,
  ListSessionsResult,
  ResourceReadParams,
  ResourceReadResult,
  ResourceWriteParams,
  ResourceWriteResult,
  ResourceListParams,
  DirectoryEntry,
  ResourceListResult,
  ResourceCopyParams,
  ResourceCopyResult,
  ResourceDeleteParams,
  ResourceDeleteResult,
  ResourceMoveParams,
  ResourceMoveResult,
  ResourceResolveParams,
  ResourceResolveResult,
  ResourceMkdirParams,
  ResourceMkdirResult,
  ResourceRequestParams,
  ResourceRequestResult,
  CreateResourceWatchParams,
  CreateResourceWatchResult,
  FetchTurnsParams,
  FetchTurnsResult,
  UnsubscribeParams,
  DispatchActionParams,
  AuthenticateParams,
  AuthenticateResult,
  ResolveSessionConfigParams,
  ResolveSessionConfigResult,
  ConfigPropertySchema,
  ConfigSchema,
  SessionConfigPropertySchema,
  SessionConfigSchema,
  SessionConfigCompletionsParams,
  SessionConfigCompletionsResult,
  SessionConfigValueItem,
  CompletionsParams,
  CompletionsResult,
  CompletionItem,
  InvokeChangesetOperationParams,
  InvokeChangesetOperationResult,
  ChangesetOperationTarget,
  ChangesetOperationFollowUp,
} from './commands.js';

export { ReconnectResultType, ContentEncoding, CompletionItemKind, ResourceType, ResourceWriteMode } from './commands.js';

// Notification types
export type {
  SessionAddedParams,
  SessionRemovedParams,
  SessionSummaryChangedParams,
  AuthRequiredParams,
  OtlpExportLogsParams,
  OtlpExportTracesParams,
  OtlpExportMetricsParams,
} from './notifications.js';

export { AuthRequiredReason } from './notifications.js';

// Message types (JSON-RPC wire format)
export type {
  JsonRpcRequest,
  JsonRpcSuccessResponse,
  JsonRpcErrorResponse,
  JsonRpcResponse,
  JsonRpcNotification,
  AhpErrorResponse,
  CommandMap,
  ServerCommandMap,
  ClientNotificationMap,
  ServerNotificationMap,
  AhpRequest,
  AhpServerRequest,
  AhpSuccessResponse,
  AhpServerSuccessResponse,
  AhpResponse,
  AhpServerResponse,
  AhpNotification,
  AhpClientNotification,
  AhpServerNotification,
  ProtocolMessage,
} from './messages.js';

// Error codes
export {
  JsonRpcErrorCodes,
  AhpErrorCodes,
} from './errors.js';
export type {
  AhpErrorCode,
  JsonRpcErrorCode,
  AhpError,
  AhpErrorCodeWithData,
  AhpErrorDetailsMap,
  AuthRequiredErrorData,
  PermissionDeniedErrorData,
} from './errors.js';

// Version registry
export {
  PROTOCOL_VERSION,
  SUPPORTED_PROTOCOL_VERSIONS,
  ACTION_INTRODUCED_IN,
  NOTIFICATION_INTRODUCED_IN,
  isActionKnownToVersion,
  isNotificationKnownToVersion,
  compareProtocolVersions,
} from './version/registry.js';
