Skip to main content

gglib_core/
lib.rs

1#![doc = include_str!(concat!(env!("OUT_DIR"), "/README_GENERATED.md"))]
2#![deny(unused_crate_dependencies)]
3
4pub mod cache_config;
5pub mod cache_metrics;
6pub mod contracts;
7pub mod cors;
8pub mod domain;
9pub mod download;
10pub mod events;
11pub mod is_local_origin;
12pub mod normalize;
13pub mod paths;
14pub mod ports;
15pub mod request_pipeline;
16pub mod retry;
17pub mod server_config;
18pub mod services;
19pub mod settings;
20pub mod sse;
21pub mod telemetry;
22pub mod utils;
23
24// Re-export commonly used types for convenience
25pub use cors::CorsConfig;
26pub use domain::{
27    AGENT_EVENT_CHANNEL_CAPACITY, AgentConfig, AgentConfigError, AgentEvent, AgentMessage,
28    ApprovalKind, AssistantContent, ChatMessage, Conversation, ConversationUpdate, CouncilEvent,
29    DEFAULT_MAX_ITERATIONS, DEFAULT_MAX_PARALLEL_TOOLS, DEFAULT_MAX_STAGNATION_STEPS, HitlMode,
30    LlmStreamEvent, MAX_DEPTH, MAX_ITERATIONS_CEILING, MAX_NODES, MAX_PARALLEL_TOOLS_CEILING,
31    MAX_TOOL_TIMEOUT_MS_CEILING, MIN_CONTEXT_BUDGET_CHARS, MIN_TOOL_TIMEOUT_MS, McpEnvEntry,
32    McpLifecycle, McpServer, McpServerConfig, McpServerStatus, McpServerType, McpTool,
33    McpToolResult, Message, MessageContent, MessageRole, Model, ModelCapabilities,
34    ModelFilterOptions, NameSource, NewConversation, NewMcpServer, NewMessage, NewModel, NodeId,
35    NodeStatus, RangeValues, SEARCH_RESULTS_CAP, TaskGraph, TaskGraphError, TaskNode, ToolCall,
36    ToolDefinition, ToolIndex, ToolResult, ToolSummary, UNKNOWN_MODEL_NAME, UpdateMcpServer,
37    capabilities_from_architecture, declared_name, infer_from_chat_template, repo_short_name,
38    resolve_model_name, strip_gguf_suffix, transform_messages_for_capabilities,
39};
40pub use download::{
41    AttemptCounts, CompletionDetail, CompletionKey, CompletionKind, DownloadError, DownloadEvent,
42    DownloadId, DownloadResult, DownloadStatus, DownloadSummary, FailedDownload, Quantization,
43    QueueRunSummary, QueueSnapshot, QueuedDownload, ShardInfo,
44};
45pub use events::{AppEvent, McpServerSummary, ModelSummary, ServerSnapshotEntry};
46pub use ports::{
47    AgentError, AgentLoopPort, AgentRunOutput, AppEventBridge, AppEventEmitter, CacheMetricsSink,
48    ChatHistoryError, ChatHistoryRepository, CompletedDownload, CoreError,
49    DownloadEventEmitterPort, DownloadManagerConfig, DownloadManagerPort, DownloadRequest,
50    DownloadStateRepositoryPort, EmptyToolExecutor, FilteredToolExecutor, GgufCapabilities,
51    GgufMetadata, GgufParseError, GgufParserPort, HfClientPort, HfFileInfo, HfPortError,
52    HfQuantInfo, HfRepoInfo, HfSearchOptions, HfSearchResult, LlmCompletionPort, McpErrorCategory,
53    McpErrorInfo, McpRepositoryError, McpServerRepository, McpServiceError, ModelRegistrarPort,
54    ModelRepository, NoopDownloadEmitter, NoopEmitter, NoopGgufParser, ProcessError, ProcessHandle,
55    ProcessRunner, QuantizationResolver, Repos, RepositoryError, Resolution, ResolvedFile,
56    ResponseFormat, ServerConfig, SettingsRepository, StructuredOutputError,
57    TOOL_NOT_AVAILABLE_MSG, ToolExecutorPort,
58};
59pub use services::{ChatHistoryService, ModelRegistrar};
60pub use settings::{
61    DEFAULT_CONTEXT_SIZE, DEFAULT_LLAMA_BASE_PORT, DEFAULT_PROXY_PORT, Settings, SettingsError,
62    SettingsUpdate, validate_settings,
63};
64
65// Re-export origin validation utility
66pub use is_local_origin::is_local_origin;
67
68// Re-export timing utility
69pub use utils::timing::{elapsed_ms, format_duration_human};
70
71// Re-export path utilities
72#[cfg(not(target_os = "windows"))]
73pub use paths::DEFAULT_MODELS_DIR_RELATIVE;
74pub use paths::{
75    DirectoryCreationStrategy, ModelsDirResolution, ModelsDirSource, PathError, data_root,
76    database_path, default_models_dir, ensure_directory, env_file_path, is_prebuilt_binary,
77    llama_config_path, llama_cpp_dir, llama_server_path, persist_env_value, persist_models_dir,
78    resolve_models_dir, resource_root, verify_writable,
79};
80
81// Silence unused dev-dependency warnings until we add mock-based tests
82#[cfg(test)]
83use mockall as _;
84#[cfg(test)]
85use tokio_test as _;