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_harness;
40pub mod lang;
41pub mod live_session;
42#[cfg(not(target_arch = "wasm32"))]
43pub mod native_cli;
44#[cfg(not(target_arch = "wasm32"))]
45mod native_extension;
46#[cfg(not(target_arch = "wasm32"))]
47pub mod native_link;
48#[cfg(not(target_arch = "wasm32"))]
49pub mod native_module;
50#[cfg(not(target_arch = "wasm32"))]
51mod native_process;
52mod numeric;
53#[cfg(not(target_arch = "wasm32"))]
54pub mod package;
55pub mod package_catalog;
56#[cfg(not(target_arch = "wasm32"))]
57pub mod package_hta_loader;
58#[cfg(not(target_arch = "wasm32"))]
59pub mod package_manifest;
60#[cfg(not(target_arch = "wasm32"))]
61pub mod package_wasm_loader;
62#[cfg(not(target_arch = "wasm32"))]
63mod process_extension;
64#[cfg(not(target_arch = "wasm32"))]
65pub mod project;
66#[cfg(not(target_arch = "wasm32"))]
67pub mod resp;
68pub mod snapshot;
69#[cfg(not(target_arch = "wasm32"))]
70pub mod snapshot_tool;
71pub mod spec_registry;
72#[cfg(not(target_arch = "wasm32"))]
73pub mod tap;
74pub mod task;
75pub mod work;
76#[path = "work/session.rs"]
77mod work_session;
78#[cfg(all(feature = "direct-native", not(target_arch = "wasm32")))]
81pub mod direct_native;
82#[cfg(feature = "bytecode-vm")]
83#[path = "vm/schema_catalog.rs"]
84pub mod hbc_schema_catalog;
85#[cfg(feature = "bytecode-vm")]
86#[path = "vm/schema_links.rs"]
87pub mod hbc_schema_links;
88#[cfg(feature = "tracing-jit")]
89pub mod jit;
90#[cfg(feature = "bytecode-vm")]
91pub mod vm;
92#[cfg(not(target_arch = "wasm32"))]
93pub mod wasmtime_provider;
94#[cfg(feature = "whole-wasm")]
95pub mod whole_wasm;
96use crate::kernel::Form;
97use crate::lang::data::{OrderedMap as POrderedMap, Vector as PVector};
98use crate::lang::protocol::INamespaced;
99use std::cell::RefCell;
100use std::collections::{HashMap, HashSet};
101use std::rc::Rc;
102
103#[cfg(feature = "raw-wasm")]
104#[derive(Debug, Clone)]
105pub struct JsValue;
106
107#[cfg(feature = "raw-wasm")]
108impl JsValue {
109 fn from_str(_value: &str) -> Self {
110 Self
111 }
112}
113
114include!("runtime/execution_state.rs");
115include!("runtime/model.rs");
116include!("runtime/session_model.rs");
117include!("runtime/sandbox_model.rs");
118include!("runtime/session.rs");
119include!("runtime/session_live.rs");
120include!("runtime/session_instrumentation.rs");
121include!("runtime/sandbox.rs");
122include!("runtime/runtime.rs");
123include!("runtime/bytecode.rs");
124include!("runtime/evaluation.rs");
125include!("runtime/wasm.rs");
126
127#[cfg(not(target_arch = "wasm32"))]
130pub fn restricted_sandbox_runtime() -> Runtime {
131 Runtime::sandbox()
132}
133
134#[cfg(not(target_arch = "wasm32"))]
137pub fn restricted_sandbox_runtime_with_host(
138 handler: Rc<dyn Fn(String, String, Vec<core::Value>) -> Result<core::Value, String>>,
139) -> Runtime {
140 let mut runtime = Runtime::sandbox();
141 runtime
142 .namespace_registry
143 .find_or_create("std.native.Host")
144 .intern_with_origin(
145 "call",
146 core::native_type_function_value("Host", "call")
147 .expect("std.native.Host/call must have a direct implementation"),
148 kernel::VarOrigin::RuntimePrimitive,
149 );
150 runtime.install_native_host_handler(handler);
151 runtime
152}
153
154#[cfg(test)]
155#[path = "runtime/filesystem_tests.rs"]
156mod filesystem_runtime_tests;
157
158#[cfg(test)]
159mod native_behavioral_conformance_tests;