Skip to main content

Crate harn_vm

Crate harn_vm 

Source

Re-exports§

pub use checkpoint::register_checkpoint_builtins;
pub use llm::register_llm_builtins;
pub use mcp::connect_mcp_server;
pub use mcp::connect_mcp_server_from_json;
pub use mcp::connect_mcp_server_from_spec;
pub use mcp::register_mcp_builtins;
pub use mcp_card::fetch_server_card;
pub use mcp_card::load_server_card_from_path;
pub use mcp_card::CardError;
pub use mcp_registry::active_handle as mcp_active_handle;
pub use mcp_registry::ensure_active as mcp_ensure_active;
pub use mcp_registry::get_registration as mcp_get_registration;
pub use mcp_registry::install_active as mcp_install_active;
pub use mcp_registry::is_registered as mcp_is_registered;
pub use mcp_registry::register_servers as mcp_register_servers;
pub use mcp_registry::release as mcp_release;
pub use mcp_registry::reset as mcp_reset_registry;
pub use mcp_registry::snapshot_status as mcp_snapshot_status;
pub use mcp_registry::sweep_expired as mcp_sweep_expired;
pub use mcp_registry::RegisteredMcpServer;
pub use mcp_registry::RegistryStatus;
pub use mcp_server::take_mcp_serve_prompts;
pub use mcp_server::take_mcp_serve_registry;
pub use mcp_server::take_mcp_serve_resource_templates;
pub use mcp_server::take_mcp_serve_resources;
pub use mcp_server::tool_registry_to_mcp_tools;
pub use mcp_server::McpServer;
pub use metadata::register_metadata_builtins;
pub use metadata::register_scan_builtins;
pub use stdlib::host::clear_host_call_bridge;
pub use stdlib::host::set_host_call_bridge;
pub use stdlib::host::HostCallBridge;
pub use stdlib::template::lookup_prompt_consumers;
pub use stdlib::template::lookup_prompt_span;
pub use stdlib::template::prompt_render_indices;
pub use stdlib::template::record_prompt_render_index;
pub use stdlib::template::PromptSourceSpan;
pub use stdlib::template::PromptSpanKind;
pub use stdlib::register_agent_stdlib;
pub use stdlib::register_core_stdlib;
pub use stdlib::register_io_stdlib;
pub use stdlib::register_vm_stdlib;
pub use store::register_store_builtins;
pub use value::*;

Modules§

agent_events
Agent event stream — the ACP-aligned observation surface for the agent loop.
agent_sessions
First-class session storage.
bridge
JSON-RPC 2.0 bridge for host communication.
checkpoint
Checkpoint system for resilient pipeline execution.
events
Structured event emission for observability.
iter
Lazy iterator protocol for the Harn VM.
jsonrpc
Shared JSON-RPC 2.0 message construction helpers.
llm
LLM integration: API calls, streaming, agent loops, tool handling, and tracing.
llm_config
mcp
MCP (Model Context Protocol) client for connecting to external tool servers.
mcp_card
MCP Server Card consumer + publisher (2026 MCP v2.1 spec, harn#75).
mcp_registry
Process-local MCP server registry for lazy boot + skill-scoped binding (harn#75).
mcp_server
MCP server mode: expose Harn tools, resources, resource templates, and prompts as MCP capabilities over stdio.
metadata
Project metadata store for Harn’s runtime state root.
orchestration
runtime_paths
schema
skills
Filesystem-and-host skill discovery for Harn.
stdlib
Standard library builtins for the Harn VM.
stdlib_modules
store
Persistent key-value store backed by Harn’s runtime state root.
tool_annotations
Tool annotations — the single source of truth for tool semantics.
tracing
Pipeline Observability: structured tracing spans with parent/child relationships.
value
visible_text
workspace_path

Structs§

AsyncBuiltinChildVmGuard
Chunk
A compiled chunk of bytecode.
CompileError
Compile error.
CompiledFunction
A compiled function (closure body).
Compiler
Compiles an AST into bytecode.
DebugState
Information about current execution state for the debugger.
Vm
The Harn bytecode virtual machine.

Enums§

Constant
A constant value in the constant pool.
DebugAction
Debug action returned by the debug hook.
Op
Bytecode opcodes for the Harn VM.

Functions§

clone_async_builtin_child_vm
Clone the VM at the top of the async-builtin child VM stack, returning a fresh Vm instance the caller owns. Enables concurrent tool-handler execution within a single agent_loop iteration — the VM shares its heavy state (env, builtins, bridge, module_cache) via Arc/Rc, so cloning is cheap and each handler gets its own execution context.
compile_source
Lex, parse, type-check, and compile source to bytecode in one call. Bails on the first type error. For callers that need diagnostics rather than early exit, use harn_parser::check_source directly and then call Compiler::new().compile(&program).
install_async_builtin_child_vm
register_http_builtins
Register HTTP builtins on a VM.
reset_http_state
Reset thread-local HTTP mock state. Call between test runs.
reset_thread_local_state
Reset all thread-local state that can leak between test runs.
restore_async_builtin_child_vmDeprecated
Legacy no-op retained for backward compatibility.
take_async_builtin_child_vmDeprecated
Legacy API preserved for out-of-tree callers; new code should use clone_async_builtin_child_vm(). take/restore serialized concurrent callers because only one could hold the popped value at a time.