hara_native/
runtime_lib.rs1#![allow(clippy::too_many_lines)] #[cfg(not(target_arch = "wasm32"))]
3pub mod asset;
4#[cfg(all(target_arch = "wasm32", not(feature = "raw-wasm")))]
7mod browser_wasm_provider;
8mod clock;
9pub mod command;
10pub mod compiled_product;
11pub mod core;
12mod direct_wasm;
13#[cfg(not(target_arch = "wasm32"))]
14pub mod distribution;
15pub mod extension;
16pub mod file;
17#[path = "file/interface.rs"]
18pub mod filesystem;
19#[path = "runtime/filesystem_bridge.rs"]
20mod filesystem_bridge;
21#[path = "runtime/filesystem_mount.rs"]
22mod filesystem_mount;
23#[path = "runtime/filesystem_adapter.rs"]
24pub mod filesystem_runtime;
25pub mod hta;
26#[cfg(not(target_arch = "wasm32"))]
27pub mod invoke_hta;
28pub mod wasm_binding;
29#[cfg(not(target_arch = "wasm32"))]
30pub use invoke_hta::{InvokeHtaError, MAX_INVOKE_HTA_RESULT_BYTES};
31#[cfg(not(target_arch = "wasm32"))]
32pub mod identity_tool;
33pub mod instrumentation;
34pub mod interpreter_observation;
35#[cfg(feature = "evaluation-journal")]
36pub mod journal;
37pub mod json;
38pub mod kernel;
39pub mod lang;
40pub mod live_session;
41#[cfg(not(target_arch = "wasm32"))]
42pub mod native_cli;
43#[cfg(not(target_arch = "wasm32"))]
44mod native_extension;
45#[cfg(not(target_arch = "wasm32"))]
46pub mod native_link;
47#[cfg(not(target_arch = "wasm32"))]
48pub mod native_module;
49#[cfg(not(target_arch = "wasm32"))]
50mod native_process;
51mod numeric;
52#[cfg(not(target_arch = "wasm32"))]
53pub mod package;
54pub mod package_catalog;
55#[cfg(not(target_arch = "wasm32"))]
56pub mod package_hta_loader;
57#[cfg(not(target_arch = "wasm32"))]
58pub mod package_manifest;
59#[cfg(not(target_arch = "wasm32"))]
60pub mod package_wasm_loader;
61#[cfg(not(target_arch = "wasm32"))]
62mod process_extension;
63#[cfg(not(target_arch = "wasm32"))]
64pub mod project;
65#[cfg(not(target_arch = "wasm32"))]
66pub mod resp;
67pub mod snapshot;
68#[cfg(not(target_arch = "wasm32"))]
69pub mod snapshot_tool;
70pub mod spec_registry;
71#[cfg(not(target_arch = "wasm32"))]
72pub mod tap;
73pub mod task;
74pub mod work;
75#[path = "work/session.rs"]
76mod work_session;
77#[cfg(all(feature = "direct-native", not(target_arch = "wasm32")))]
80pub mod direct_native;
81#[cfg(feature = "bytecode-vm")]
82#[path = "vm/schema_catalog.rs"]
83pub mod hbc_schema_catalog;
84#[cfg(feature = "bytecode-vm")]
85#[path = "vm/schema_links.rs"]
86pub mod hbc_schema_links;
87#[cfg(feature = "tracing-jit")]
88pub mod jit;
89#[cfg(feature = "bytecode-vm")]
90pub mod vm;
91#[cfg(not(target_arch = "wasm32"))]
92pub mod wasmtime_provider;
93#[cfg(feature = "whole-wasm")]
94pub mod whole_wasm;
95use crate::kernel::Form;
96use crate::lang::data::{OrderedMap as POrderedMap, Vector as PVector};
97use crate::lang::protocol::INamespaced;
98use std::cell::RefCell;
99use std::collections::{HashMap, HashSet};
100use std::rc::Rc;
101
102#[cfg(feature = "raw-wasm")]
103#[derive(Debug, Clone)]
104pub struct JsValue;
105
106#[cfg(feature = "raw-wasm")]
107impl JsValue {
108 fn from_str(_value: &str) -> Self {
109 Self
110 }
111}
112
113include!("runtime/execution_state.rs");
114include!("runtime/model.rs");
115include!("runtime/session_model.rs");
116include!("runtime/sandbox_model.rs");
117include!("runtime/session.rs");
118include!("runtime/session_live.rs");
119include!("runtime/session_instrumentation.rs");
120include!("runtime/sandbox.rs");
121include!("runtime/runtime.rs");
122include!("runtime/bytecode.rs");
123include!("runtime/evaluation.rs");
124include!("runtime/wasm.rs");
125
126#[cfg(not(target_arch = "wasm32"))]
129pub fn restricted_sandbox_runtime() -> Runtime {
130 Runtime::sandbox()
131}
132
133#[cfg(not(target_arch = "wasm32"))]
136pub fn restricted_sandbox_runtime_with_host(
137 handler: Rc<dyn Fn(String, String, Vec<core::Value>) -> Result<core::Value, String>>,
138) -> Runtime {
139 let mut runtime = Runtime::sandbox();
140 runtime
141 .namespace_registry
142 .find_or_create("std.native.Host")
143 .intern_with_origin(
144 "call",
145 core::native_type_function_value("Host", "call")
146 .expect("std.native.Host/call must have a direct implementation"),
147 kernel::VarOrigin::RuntimePrimitive,
148 );
149 runtime.install_native_host_handler(handler);
150 runtime
151}
152
153#[cfg(test)]
154#[path = "runtime/filesystem_tests.rs"]
155mod filesystem_runtime_tests;
156
157#[cfg(test)]
158mod native_behavioral_conformance_tests;