Skip to main content

formal_ai/
lib.rs

1extern crate alloc;
2
3pub mod agent;
4pub mod agentic_coding;
5pub mod anthropic;
6pub mod arithmetic;
7pub mod associative_package;
8pub mod associative_persistence;
9pub mod attachment_context;
10pub(crate) mod calculation;
11pub(crate) mod calculation_time;
12pub(crate) mod calculation_word_problem;
13pub mod change_request;
14pub mod client_integrations;
15pub(crate) mod code_editing;
16pub(crate) mod coding;
17pub(crate) mod concepts;
18pub mod context_capacity;
19pub mod cue_lexicon;
20pub mod dialog_log;
21pub mod document_formats;
22pub mod dreaming;
23pub mod dreaming_application;
24pub mod dreaming_runtime;
25pub mod engine;
26pub(crate) mod engine_assistant_name;
27pub(crate) mod engine_responses;
28pub mod event_log;
29pub(crate) mod fuzzy;
30pub mod gemini;
31pub mod github_logs;
32pub mod google_trends_catalog;
33pub mod google_trends_learning;
34pub mod intent_formalization;
35pub mod json_lino;
36pub mod knowledge;
37pub mod language;
38pub mod learning_ledger;
39pub mod lexeme_import;
40pub mod link_store;
41pub(crate) mod links_format;
42pub mod links_query;
43pub mod links_substitution_query;
44pub(crate) mod mcp;
45pub mod memory;
46pub mod memory_sync;
47pub mod meta_construction;
48pub(crate) mod meta_core;
49pub mod meta_frame;
50pub(crate) mod meta_method_dispatch;
51pub mod meta_reasoning;
52pub mod meta_self_improvement;
53pub mod method_registry;
54pub(crate) mod network_endpoint;
55pub mod normal_markov;
56pub mod option_evidence;
57pub mod option_network;
58pub mod probability;
59pub(crate) mod program_coreference;
60pub mod program_plan;
61pub mod promotion;
62pub mod proof_engine;
63pub mod protocol;
64pub(crate) mod protocol_memory;
65pub(crate) mod protocol_policy;
66pub(crate) mod protocol_responses;
67pub mod proxy;
68pub mod question_generation;
69pub mod rebuild_plan;
70pub mod recipe_interpreter;
71pub mod relative_meta_logic;
72pub mod repair_strategy;
73pub mod requirement_contradiction;
74pub(crate) mod responses_stream;
75pub mod route_method_alias;
76pub(crate) mod rule_synthesis;
77pub mod seed;
78pub mod selection;
79pub mod self_ast_census;
80pub mod self_explanation;
81pub mod self_healing;
82pub mod self_improvement;
83pub mod self_source_links;
84pub mod server;
85pub mod shared_dialog;
86pub mod shared_memory;
87pub mod skill_compiler;
88pub mod skill_ledger;
89pub mod solution_evidence;
90pub mod solver;
91pub(crate) mod solver_diagnostics;
92pub(crate) mod solver_dispatch;
93pub(crate) mod solver_formalization;
94pub(crate) mod solver_handler_docs;
95pub(crate) mod solver_handler_how;
96pub(crate) mod solver_handler_oracle;
97pub(crate) mod solver_handler_units;
98pub(crate) mod solver_handlers;
99pub(crate) mod solver_handlers_policy;
100pub(crate) mod solver_helpers;
101pub(crate) mod solver_search;
102pub(crate) mod solver_synthesis;
103pub(crate) mod solver_terminal;
104pub(crate) mod solver_unknown_reasoning;
105pub mod statement_audit;
106pub mod statement_verification;
107pub mod storage_policy;
108pub mod substitution;
109pub mod summarization;
110pub mod telegram;
111pub mod telegram_runtime;
112pub mod thinking;
113pub mod translation;
114pub(crate) mod unknown_opener;
115pub mod web_engine_core;
116pub mod web_search_core;
117pub mod world_model;
118
119pub use agent::{
120    parse_agent_plan, run_agent_plan, AgentAction, AgentActionKind, AgentActionStatus,
121    AgentCommandResult, AgentError, AgentRun, AgentRunStatus, AgentWorkspace, AgentWorkspaceConfig,
122    PlannedAgentAction,
123};
124pub use anthropic::{
125    anthropic_message_sse, create_anthropic_message_with_solver,
126    create_anthropic_message_with_solver_and_memory, AnthropicContentBlock, AnthropicMessage,
127    AnthropicMessageInput, AnthropicMessagesRequest, AnthropicUsage,
128};
129pub use associative_package::{
130    default_associative_packages, default_package_store, AssociativePackage, PackageDependency,
131    PackageHandler, PackageImportError, PackageInstallError, PackagePermission,
132    PackagePermissionDecision, PackageReplay, PackageStore, PackageTrigger,
133};
134pub use associative_persistence::{
135    AssociativeMemory, PersistedExpression, RetentionWeights, ScoredExpression,
136};
137pub use change_request::{canonical_change_request, AcceptedChange, ChangeRejected, ChangeRequest};
138pub use client_integrations::{run_with_formal_ai, ClientProtocol, WithFormalAiArgs};
139pub use document_formats::{
140    canonical_document_format_label, convert_document_format, cross_format_document_concepts,
141    document_format_capabilities, document_package_is_recognized, document_profile_is_recognized,
142    supported_document_formats, DocumentConversion, DocumentFormatCapabilities,
143    DOCUMENT_FORMAT_ENGINE,
144};
145pub use dreaming::{
146    apply_dreaming_plan, compose_recipe_with_amendments, plan_memory_dreaming,
147    render_dreaming_plan, DreamingAction, DreamingActionKind, DreamingConfig, DreamingDurability,
148    DreamingEventObservation, DreamingOutcome, DreamingPlan, DreamingSynthesizedTask,
149    LearnedRequirement, MetaAlgorithmAmendment, TopicFrequency,
150};
151pub use dreaming_application::{
152    amended_answer, apply_retained_amendments, replay_answer_with_amendments, retained_amendments,
153    solve_with_amendment_records, solve_with_standing_requirements, topic_matches,
154    RetainedAmendment,
155};
156pub use dreaming_runtime::{
157    core_is_idle, dreaming_disabled, run_core_dreaming_once, ForegroundActivity,
158};
159pub use engine::{
160    humanize_meta_identifier, knowledge_links_notation, naturalize_thinking_step,
161    render_thinking_steps, thinking_language_label, thinking_narrative, FormalAiEngine,
162    SymbolicAnswer, ThinkingStep, DEFAULT_MODEL,
163};
164pub use event_log::{Event, EventLog};
165pub use github_logs::{
166    collect_github_logs, collect_github_logs_with_runner, github_log_capture_plan,
167    render_github_log_plan, GithubLogCapture, GithubLogCapturedFile, GithubLogCollectionSummary,
168    GithubLogCollectorConfig,
169};
170pub use google_trends_catalog::{
171    google_trends_catalog, parse_google_trends_rss, render_google_trends_snapshot_lino,
172    GoogleTrendNewsItem, GoogleTrendPromptAnswer, GoogleTrendPromptVariant, GoogleTrendTopic,
173    GoogleTrendsCatalog, GoogleTrendsParseError, GOOGLE_TRENDS_TOP_LIMIT,
174};
175pub use google_trends_learning::{
176    trending_learning_report, TrendingFrontierEntry, TrendingLearningReport,
177};
178pub use intent_formalization::{
179    formalize_intent, impulse_id_for, IntentFormalization, IntentFormalizationCache,
180    IntentFormalizationCacheEntry, IntentKind,
181};
182pub use knowledge::{
183    cache_capacity, within_cache_capacity, CodingOracle, KnowledgeSource, OracleSnippet,
184    KNOWLEDGE_CACHE_FLOOR,
185};
186pub use language::{detect as detect_language, Language};
187pub use learning_ledger::{
188    canonical_ledger, HumanApproval, LearningLedger, LedgerEntry, PromotionRejected,
189};
190#[cfg(feature = "doublets-native")]
191pub use link_store::DoubletsLinkStore;
192pub use link_store::{
193    default_native_link_store, memory_event_to_link_record, memory_events_to_link_records,
194    selected_link_store_backend, validate_memory_links_notation, DefaultNativeLinkStore,
195    DoubletLink, LinkRecord, LinkStore, LinkStoreBackend, LinkStoreError,
196};
197pub use links_query::{
198    parse_links_query, run_links_query, run_links_query_against, EdgePattern, Field, Filter,
199    FilterOp, LinksQuery, LinksQueryError, LinksQueryResult, NodePattern,
200};
201pub use memory::{
202    export_bundle as export_memory_bundle, export_full_memory as export_memory_full,
203    export_links_notation, export_links_notation as export_memory_links_notation,
204    extract_memory_from_bundle, import_full_memory as import_memory_full,
205    parse_links_notation as parse_memory_links_notation, seed_cache_events,
206    suggest_migrations as suggest_memory_migrations, write_locked_atomic, BundleInfo, MemoryEvent,
207    MemoryStore, ParsedBundle,
208};
209pub use memory_sync::{
210    configured_memory_path, events_since, merge_event, merge_union_by_id, SyncStore,
211};
212pub use probability::{
213    rank_probability_candidates, symbolic_cosine_similarity, ProbabilityCandidate,
214    ProbabilityDecisionPolicy, ProbabilityEvidence, ProbabilityModel, ProbabilityRanking,
215    ProbabilityRankingConfig, ProbabilitySourceProvenance, ProbabilityStore,
216    RankedProbabilityCandidate, SimilarEvidence,
217};
218pub use promotion::{
219    apply_promotions, demonstration_promotion_proposals, demonstration_promotion_run,
220    parse_promotion_proposals, promotions_from_learning_run, render_promotion_proposals,
221    replay_promotion_gates, replay_promotion_gates_with, AppliedSeedEdit, GateCommandOutput,
222    PromotionApplyOutcome, PromotionBranchPlan, PromotionOutcome, PromotionProposal,
223    PromotionRatchet, PromotionRecord, PromotionRun, SeedEdit, LEARNED_PROGRAM_RULES_SEED_FILE,
224};
225pub use protocol::{
226    create_chat_completion, create_chat_completion_with_solver,
227    create_chat_completion_with_solver_and_memory, create_response, create_response_with_solver,
228    create_response_with_solver_and_memory, ChatChoice, ChatCompletion, ChatCompletionRequest,
229    ChatMessage, FunctionCall, MessageContent, MessageContentPart, ResponseFunctionToolCall,
230    ResponseObject, ResponseOutputContent, ResponseOutputItem, ResponseOutputMessage,
231    ResponseUsage, ResponseWebSearchAction, ResponseWebSearchToolCall, ResponsesRequest,
232    TokenUsage, ToolCall,
233};
234pub use proxy::{
235    run_proxy, summarize_proxy_exchange, ProxyConfig, ProxyExchangeLog, ProxyToolCallLog,
236};
237pub use question_generation::{
238    generated_question_answers, question_lexicon_summary, question_lexicon_summary_for_language,
239    GeneratedQuestion, GeneratedQuestionAnswer, GeneratedQuestionAnswerStream,
240    GeneratedQuestionClass, LogicalMeaningClass, QuestionAcceptance, QuestionGenerationConfig,
241    QuestionGenerator, QuestionGrammarClass, QuestionLexiconSummary, QuestionWord,
242};
243pub use rebuild_plan::{canonical_rebuild_plan, ReattachArtifact, RebuildPlan, RebuildStep};
244pub use relative_meta_logic::{
245    Aggregator, RelativeEvidence, SourceTier, Stance, StatementAssessment, TruthValue,
246    ASSUMED_TRUE_PRIOR,
247};
248pub use repair_strategy::{canonical_strategies, RepairStrategy, RepairTarget};
249pub use seed::{
250    agent_info, canonical_model_id, concepts as seed_concepts, environment_directory,
251    environment_records, intent_routing, language_rules, merged_bundle, model_aliases,
252    multilingual_responses, operation_vocabulary, parse_bundle, projects_registry, prompt_patterns,
253    resolve_model_id, response_for, seed_files, supported_languages, try_resolve_model_id,
254    EnvironmentDirectory, EnvironmentRecord, IntentRouting, LocalizedProject, MigrationFlow,
255    ModelAliasRegistry, OperationLanguageForms, OperationTrigger, OperationVocabulary,
256    ProjectRecord, ProjectStatement, ProjectsRegistry,
257};
258pub use self_ast_census::{
259    drift_report, scan_symbols, CensusDrift, CensusFidelity, CensusResolution, ModuleCensus,
260    SymbolSpan, WorkspaceCensus,
261};
262pub use self_explanation::{
263    canonical_explanation, Citation, CitationKind, ExplanationSection, SystemExplanation,
264};
265pub use self_healing::{
266    canonical_case, canonical_failure_trace, RepairCase, RepairOutcome, SourceRoundTrip,
267};
268pub use self_improvement::{
269    learn_rules_from_unknown_traces, BenchmarkGateReport, LearnedRuleAdoption, LearnedRuleProposal,
270    LearningRejection, LearningRun, UnknownTrace,
271};
272pub use self_source_links::{
273    owned_file_count, owned_manifest, owned_manifest_content_id, owned_manifest_notation,
274    owned_source_files, owned_total_bytes, SourceLinks, SourceModuleDigest, SourceModuleProjection,
275};
276pub use server::{
277    enable_http_agent_mode_for_current_process, handle_api_request, handle_api_request_with_auth,
278    handle_api_request_with_headers, serve, ApiAuthConfig, ApiHttpResponse,
279};
280pub use shared_dialog::{
281    convert_shared_dialog_to_demo_memory, parse_shared_dialog, shared_dialog_to_memory_events,
282    SharedDialog, SharedDialogError, SharedDialogFormat, SharedDialogMetadata, SharedDialogTurn,
283};
284pub use shared_memory::{
285    ensure_shared_memory_file, resolve_memory_path_from, shared_memory_path, MEMORY_PATH_ENV,
286};
287pub use skill_compiler::{
288    compile_natural_language_skill, CompiledSkillEffect, CompiledSkillExpectedTest,
289    CompiledSkillHandlerStub, CompiledSkillInput, CompiledSkillPackage, CompiledSkillPermission,
290    CompiledSkillPrecondition, CompiledSkillReplay, CompiledSkillStep, SkillCompileError,
291};
292pub use solver::{
293    solve, solve_with_history, BlueprintComposition, ConversationRole, ConversationTurn,
294    ExecutionSurface, SolverConfig, UniversalSolver,
295};
296pub use solver_handlers::{answer_memory_recall, execute_memory_query, MemoryQueryExecution};
297pub use solver_helpers::humanize_url;
298pub use statement_verification::{
299    assess_market_price_claims, extract_market_price_claims, MarketPriceAssessment,
300    MarketPriceClaim,
301};
302pub use storage_policy::{
303    apply_auto_free_space_for_write, apply_auto_free_space_with_snapshot, auto_free_space_choice,
304    auto_free_space_enabled, auto_free_space_preference_path, measure_storage,
305    persist_auto_free_space_choice, plan_for_real_storage, AutoFreeSpaceChoice, StorageSnapshot,
306};
307pub use substitution::{
308    CrudEvent, LinkPattern, SubstitutionAction, SubstitutionGraph, SubstitutionLink,
309    SubstitutionRule, SubstitutionRuleError, SubstitutionRuleSet, SubstitutionTrace,
310    SubstitutionTraceReport,
311};
312pub use summarization::{
313    apply_compound_words, apply_semantic_primes, classify_sentence, deformalize, describe_project,
314    describe_readme, formalize, formalize_dialog, formalize_markdown,
315    formalize_repository_directory, formalize_repository_file, formalize_repository_resource,
316    generate_chat_title, strip_markdown_noise, summarize, summarize_dialog,
317    summarize_repository_file, summarize_repository_resource, to_topic, DialogTurn,
318    EmbeddedGrammarFormalization, MetaLanguageFormalization, RepositoryDirectoryFormalization,
319    RepositoryEntry, RepositoryFileFormalization, RepositoryResourceFormalization, Statement,
320    StatementKind, SummarizationConfig, SummarizationMode, DEFAULT_MAX_STATEMENTS,
321};
322pub use telegram::{
323    handle_telegram_webhook, parse_get_updates_response, telegram_html_from_markdown,
324    ParsedUpdatesBatch, TelegramPollingConfig, TelegramPollingError, TelegramPollingReply,
325    TelegramReplyParameters, TelegramWebhookError, TelegramWebhookReply,
326};
327pub use telegram_runtime::{
328    run_telegram_polling, run_telegram_polling_with_transport, run_telegram_webhook_server,
329    CurlTelegramTransport, TelegramPollingRuntimeError, TelegramTransport,
330};
331pub use unknown_opener::unknown_answer_variation_for;
332pub use web_engine_core::{
333    detect_language as detect_prompt_language, evaluate_arithmetic_expression,
334    normalize_prompt as normalize_prompt_text, tokenize_prompt,
335};
336pub use web_search_core::{
337    build_request_evidence as build_web_search_request_evidence, default_search_plan_ids,
338    parse_rrf_input, reciprocal_rank_fusion, serialize_rrf_output, FusedEntry, ProviderCategory,
339    ProviderRanking, ProviderSpec, WEB_SEARCH_CONCURRENCY_PER_CATEGORY, WEB_SEARCH_PROVIDERS,
340    WEB_SEARCH_PROVIDER_LIMIT, WEB_SEARCH_PROVIDER_REGISTRY, WEB_SEARCH_RRF_K,
341};
342pub use world_model::{
343    Action, Context, ContextDiff, Dependency, LinkConflict, Prediction, RecalculationReport,
344    Statement as WorldStatement, StatementChange, WorldModel,
345};