export { Agent } from './core/agent.js';
export type { AgentChatOptions, ToolStartInfo, ToolEndInfo, DoomLoopInfo } from './core/agent.js';

// Doom Loop Detection
export {
  createDoomLoopDetector,
  DOOM_LOOP_THRESHOLD,
  DOOM_LOOP_WARNING,
  MAX_STEPS_WARNING,
} from './core/doom-loop.js';
export type { DoomLoopDetector } from './core/doom-loop.js';
export { toolRegistry, todoManager, initTaskContext, updateTaskDescription, updateSkillDescription } from './tools/index.js';
export { loadConfig, loadVisionConfig, buildConfigFromModelConfig, ConfigurationError } from './utils/config.js';
export type { VisionConfig } from './utils/config.js';

// Context compression
export {
  CompressionManager,
  CompressionStatus,
  DEFAULT_COMPRESSION_CONFIG,
} from './context/index.js';
export type {
  TokenUsage,
  CompressionConfig,
  DetailedCompressionResult,
} from './context/index.js';
// Session - 新的三层存储结构
export { SessionManager } from './session/index.js';
export type { SessionData, SessionSummary, ProjectMetadata } from './session/index.js';

// Session Storage API
export {
  SessionStorage,
  MessageStorage,
  PartStorage,
  TodoStorage,
  initStorage,
  getStorageDir,
  StorageNotFoundError,
} from './session/index.js';

export type {
  SessionInfo,
  MessageInfo,
  Part,
  PartType,
  ToolStatus,
  TodoItem,
  TodoList,
} from './session/index.js';

// Types
export type { UserInput, ChatResult } from './types/index.js';

// Permission
export { getPermissionManager } from './permission/index.js';
export type {
  PermissionContext,
  PermissionDecision,
  PermissionCheckResult,
  FilePermissionContext,
  GitPermissionContext,
  WebPermissionContext,
} from './permission/index.js';

// LSP
export { initLSP, shutdownLSP } from './lsp/index.js';
export {
  printServerList,
  installServer,
  installAllServers,
  showServerInfo,
} from './lsp/cli.js';

// Skills
export { getSkillRegistry } from './skills/index.js';

// Image utils
export {
  extractImageReferences,
  loadImages,
  loadImage,
  formatFileSize,
  isImagePath,
  IMAGE_EXTENSIONS,
} from './utils/image.js';
export type { ImageInfo, ImageLoadResult } from './utils/image.js';

// Commands
export { getCommandRegistry, createCommandExecutor, createCommandManager } from './commands/index.js';
export type {
  Command,
  CommandInput,
  CommandExecutionResult,
  CreateCommandInput,
  UpdateCommandInput,
  CommandContent,
  CommandOperationResult,
} from './commands/index.js';

// Checkpoint
export {
  CheckpointManager,
  getCheckpointManager,
  initCheckpointManager,
  resetCheckpointManager,
  ShadowGit,
  createShadowGit,
  hashWorkingDir,
  CheckpointSafetyChecker,
  createSafetyChecker,
  SessionTracker,
  createSessionTracker,
  CheckpointLock,
  LFSPatternLoader,
  createLFSPatternLoader,
  isCommonLargeFile,
  COMMON_LARGE_FILE_EXTENSIONS,
  WorkspacePathValidator,
  createPathValidator,
  CommitMessageGenerator,
  createCommitMessageGenerator,
  RestoreMode,
  DEFAULT_CHECKPOINT_CONFIG,
} from './checkpoint/index.js';

export type {
  CheckpointMetadata,
  CheckpointConfig,
  CheckpointTrigger,
  FileChange,
  FileChangeType,
  DiffInfo,
  FileDiff,
  RollbackOptions,
  RollbackResult,
  CheckpointEvent,
  CheckpointEventType,
  CheckpointEventListener,
  RollbackRecord,
  UnrevertResult,
  SafetyCheckResult,
  SessionState,
  SessionStats,
  PathValidationResult,
} from './checkpoint/index.js';

// Hooks
export {
  HookManager,
  getHookManager,
  initHookManager,
  resetHookManager,
  loadProjectConfig,
  loadHookConfig,
  loadPluginList,
  createDefaultConfig,
  getConfigFilePath,
} from './hooks/index.js';

export type {
  HookType,
  HookConfig,
  HookEvent,
  HookEventListener,
  ShellCommandConfig,
  FileHookConfig,
  Hooks,
  Plugin,
  PluginInput,
  ToolExecuteBeforeInput,
  ToolExecuteBeforeOutput,
  ToolExecuteAfterInput,
  ToolExecuteAfterOutput,
  SessionStartInput,
  SessionEndInput,
  MessageBeforeInput,
  MessageBeforeOutput,
  MessageAfterInput,
  FileChangeInput,
  FileChangeOutput,
  ProjectConfig,
} from './hooks/index.js';

// Agent Registry & Presets
export { agentRegistry, AgentRegistry } from './agent/index.js';
export { loadAgentConfig, saveAgentConfig, getConfigTemplate } from './agent/index.js';
export { presetAgents, isPresetAgent, getPresetAgentNames } from './agent/index.js';
export type {
  AgentMode,
  AgentInfo,
  AgentConfigFile,
  AgentModelConfig,
  AgentToolConfig,
  AgentPermission,
} from './agent/index.js';

// MCP
export {
  getMCPManager,
  loadMCPConfig,
  createMCPToolAdapter,
} from './mcp/index.js';

// Provider
export {
  ProviderRegistry,
  providerRegistry,
  getProviderRegistry,
  builtinProviders,
  getBuiltinProviders,
  getBuiltinProvider,
  isBuiltinProvider,
  loadProvidersConfig,
  saveProvidersConfig,
  resolveApiKey,
  testOpenAICompatibleConnection,
  createOpenAICompatibleFactory,
  isValidProviderId,
  isValidUrl,
} from './provider/index.js';

export type {
  BuiltinProviderType,
  ProviderType,
  ModelCapabilities,
  ModelInfo,
  ProviderInfo,
  ProviderConfig,
  CustomProviderDefinition,
  ConnectionTestResult,
  ProviderFactory,
  RegisteredProvider,
  ProvidersConfigFile,
  ProviderListItem,
  ProviderDetail,
} from './provider/index.js';

// File Index
export {
  getFileIndex,
  searchFiles,
  refreshFileIndex,
  getFileIndexStats,
} from './file-index/index.js';

export type {
  FileIndexEntry,
  FileSearchOptions,
} from './file-index/index.js';

// Constants - 统一存储路径
export {
  APP_DIR_NAME,
  getAppDir,
  getConfigDir,
  getDataDir,
  getCheckpointsDir,
  getCacheDir,
  getLogsDir,
} from './constants/index.js';
