1#![deny(rust_2018_idioms)]
28#![warn(missing_docs)]
29
30#[cfg(feature = "ast")]
31pub mod ast;
32#[cfg(feature = "ast")]
33pub mod code_index;
34#[cfg(feature = "computer")]
35pub mod computer;
36pub mod embed;
37pub mod error;
38pub mod fs;
39pub mod fs_snapshot;
40pub mod fs_watch;
41pub mod host_conditions;
42pub mod host_env_custody;
43pub mod host_lease;
44pub mod host_lease_capability;
45pub mod process;
46mod process_liveness;
47pub mod sandbox;
48pub mod scanner;
49pub mod schemas;
50pub mod secret_store;
51pub mod session;
52#[cfg(feature = "terminal-session")]
53pub mod terminal_session;
54pub mod tools;
55pub mod verdict;
56
57mod json;
58mod registry;
59mod text;
60mod value_args;
61
62pub use error::HostlibError;
63pub use host_conditions::{
64 HostConditionObservation, HostConditionStatus, HostConditionsCapability,
65 HostConditionsSnapshot, HostConditionsSource, HostContentionQuestion, HostEnvironment,
66 InjectedHostConditionsSource, LocalHostConditionsSource, HOST_CONDITIONS_SCHEMA_VERSION,
67};
68pub use host_lease::{
69 HostLeaseAcquireReceipt, HostLeaseAcquireStatus, HostLeaseCargoExecutionContext,
70 HostLeaseDeferReason, HostLeaseDeferReceipt, HostLeaseError, HostLeaseExecutionContext,
71 HostLeaseHandle, HostLeaseMetadataUpdateReceipt, HostLeaseOperationKind, HostLeasePathIdentity,
72 HostLeasePriorityClass, HostLeaseProcessExit, HostLeaseReleaseReceipt, HostLeaseRenewReceipt,
73 HostLeaseRequest, HostLeaseResourceClass, HostLeaseResourceDefinition, HostLeaseResourceKey,
74 HostLeaseRunLaunchFailure, HostLeaseRunReceipt, HostLeaseRunReleaseOutcome,
75 HostLeaseRunStartFailure, HostLeaseRunState, HostLeaseState, HostLeaseStore,
76 DEFAULT_HOST_LEASE_DOMAIN, HOST_LEASE_ROOT_ENV,
77};
78pub use registry::{BuiltinRegistry, HostlibCapability, HostlibRegistry, RegisteredBuiltin};
79
80pub fn install_default(vm: &mut harn_vm::Vm) -> HostlibRegistry {
88 let mut registry = HostlibRegistry::new();
89 let embed = embed::EmbedCapability::default();
90 let session = session::SessionCapability::with_embedder(embed.embedder().clone());
91 #[cfg(feature = "ast")]
95 {
96 let code_index = code_index::CodeIndexCapability::new();
97 registry = registry
98 .with(ast::AstCapabilityWithCodeIndex::new(code_index.shared()))
99 .with(code_index);
100 }
101 registry = registry
102 .with(scanner::ScannerCapability)
103 .with(embed)
104 .with(session)
105 .with(fs::FsCapability)
106 .with(fs_snapshot::FsSnapshotCapability)
107 .with(fs_watch::FsWatchCapability)
108 .with(tools::ToolsCapability)
109 .with(secret_store::SecretStoreCapability)
110 .with(verdict::VerdictCapability)
111 .with(host_conditions::HostConditionsCapability::default())
112 .with(host_lease_capability::HostLeaseCapability);
113 #[cfg(feature = "terminal-session")]
114 {
115 registry = registry.with(terminal_session::TerminalSessionCapability::new());
116 }
117 #[cfg(feature = "computer")]
125 {
126 registry = registry.with(computer::ComputerUseCapability::new());
127 }
128 registry.register_into_vm(vm);
129 registry
130}