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;
51#[cfg(feature = "terminal-session")]
52pub mod terminal_session;
53pub mod tools;
54pub mod verdict;
55
56mod json;
57mod registry;
58mod text;
59mod value_args;
60
61pub use error::HostlibError;
62pub use host_conditions::{
63 HostConditionObservation, HostConditionStatus, HostConditionsCapability,
64 HostConditionsSnapshot, HostConditionsSource, HostContentionQuestion, HostEnvironment,
65 InjectedHostConditionsSource, LocalHostConditionsSource, HOST_CONDITIONS_SCHEMA_VERSION,
66};
67pub use host_lease::{
68 HostLeaseAcquireReceipt, HostLeaseAcquireStatus, HostLeaseCargoExecutionContext,
69 HostLeaseDeferReason, HostLeaseDeferReceipt, HostLeaseError, HostLeaseExecutionContext,
70 HostLeaseHandle, HostLeaseMetadataUpdateReceipt, HostLeaseOperationKind, HostLeasePathIdentity,
71 HostLeasePriorityClass, HostLeaseProcessExit, HostLeaseReleaseReceipt, HostLeaseRenewReceipt,
72 HostLeaseRequest, HostLeaseResourceClass, HostLeaseResourceDefinition, HostLeaseResourceKey,
73 HostLeaseRunLaunchFailure, HostLeaseRunReceipt, HostLeaseRunReleaseOutcome,
74 HostLeaseRunStartFailure, HostLeaseRunState, HostLeaseState, HostLeaseStore,
75 DEFAULT_HOST_LEASE_DOMAIN, HOST_LEASE_ROOT_ENV,
76};
77pub use registry::{BuiltinRegistry, HostlibCapability, HostlibRegistry, RegisteredBuiltin};
78
79pub fn install_default(vm: &mut harn_vm::Vm) -> HostlibRegistry {
87 let mut registry = HostlibRegistry::new();
88 #[cfg(feature = "ast")]
92 {
93 let code_index = code_index::CodeIndexCapability::new();
94 registry = registry
95 .with(ast::AstCapabilityWithCodeIndex::new(code_index.shared()))
96 .with(code_index);
97 }
98 registry = registry
99 .with(scanner::ScannerCapability)
100 .with(embed::EmbedCapability::default())
101 .with(fs::FsCapability)
102 .with(fs_snapshot::FsSnapshotCapability)
103 .with(fs_watch::FsWatchCapability)
104 .with(tools::ToolsCapability)
105 .with(secret_store::SecretStoreCapability)
106 .with(verdict::VerdictCapability)
107 .with(host_conditions::HostConditionsCapability::default())
108 .with(host_lease_capability::HostLeaseCapability);
109 #[cfg(feature = "terminal-session")]
110 {
111 registry = registry.with(terminal_session::TerminalSessionCapability::new());
112 }
113 #[cfg(feature = "computer")]
121 {
122 registry = registry.with(computer::ComputerUseCapability::new());
123 }
124 registry.register_into_vm(vm);
125 registry
126}