1#![allow(clippy::result_large_err, clippy::cloned_ref_to_slice_refs)]
2
3pub mod agent_events;
4pub mod agent_sessions;
5pub mod bridge;
6pub mod checkpoint;
7mod chunk;
8mod compiler;
9pub mod events;
10mod http;
11pub mod jsonrpc;
12pub mod llm;
13pub mod llm_config;
14pub mod mcp;
15pub mod mcp_server;
16pub mod metadata;
17pub mod orchestration;
18pub mod runtime_paths;
19pub mod schema;
20pub mod stdlib;
21pub mod stdlib_modules;
22pub mod store;
23pub mod tool_annotations;
24pub mod tracing;
25pub mod value;
26pub mod visible_text;
27mod vm;
28
29pub use checkpoint::register_checkpoint_builtins;
30pub use chunk::*;
31pub use compiler::*;
32pub use http::{register_http_builtins, reset_http_state};
33pub use llm::register_llm_builtins;
34pub use mcp::{
35 connect_mcp_server, connect_mcp_server_from_json, connect_mcp_server_from_spec,
36 register_mcp_builtins,
37};
38pub use mcp_server::{
39 take_mcp_serve_prompts, take_mcp_serve_registry, take_mcp_serve_resource_templates,
40 take_mcp_serve_resources, tool_registry_to_mcp_tools, McpServer,
41};
42pub use metadata::{register_metadata_builtins, register_scan_builtins};
43pub use stdlib::host::{clear_host_call_bridge, set_host_call_bridge, HostCallBridge};
44pub use stdlib::template::{
45 lookup_prompt_consumers, lookup_prompt_span, prompt_render_indices, record_prompt_render_index,
46 PromptSourceSpan, PromptSpanKind,
47};
48pub use stdlib::{
49 register_agent_stdlib, register_core_stdlib, register_io_stdlib, register_vm_stdlib,
50};
51pub use store::register_store_builtins;
52pub use value::*;
53pub use vm::*;
54
55pub fn compile_source(source: &str) -> Result<Chunk, String> {
60 let program = harn_parser::check_source_strict(source).map_err(|e| e.to_string())?;
61 Compiler::new().compile(&program).map_err(|e| e.to_string())
62}
63
64pub fn reset_thread_local_state() {
66 llm::reset_llm_state();
67 http::reset_http_state();
68 stdlib::reset_stdlib_state();
69 events::reset_event_sinks();
70 agent_events::reset_all_sinks();
71 agent_sessions::reset_session_store();
72}