Skip to main content

sim_run_core/
lib.rs

1#![forbid(unsafe_code)]
2#![deny(missing_docs)]
3//! Core command entry API for the SIM bootloader.
4//!
5//! # Bootloader frame
6//!
7//! The shipped `sim` binary is a **bootloader frame, not a batteries-included
8//! runtime**. [`run`] builds a [`LoadSession`] whose only registered loader is
9//! the in-process [`LoadSession::add_host_factory`] host loader: with no host
10//! factory and no injected artifact loader it can boot **no codec and no
11//! library**, so `run(["sim", "run"])` fails with `no codec 'lisp' available`.
12//! This is by design: behavior lives in loadable libraries, not baked into the
13//! frame. The default frame loads a codec when an explicit source, cache
14//! artifact, registry resolver, or host factory supplies it.
15//!
16//! A working session therefore comes from one of:
17//!
18//! - an explicitly provided source: `--load path/to/artifact.simlib` (needs an
19//!   artifact loader registered via [`LoadSession::with_loader`]), or
20//! - a seeded cache resolved by the cache-only [`CratesIoResolver`] (it never
21//!   reaches the network unless an explicit registry resolver is installed; the
22//!   cache must otherwise already hold the artifact), or
23//! - a host factory registered through [`LoadSession::with_host_factory`] and
24//!   driven via [`run_with_session`] -- the path every functional test uses.
25//!
26//! The `registry` feature adds a git registry artifact resolver, but it is active
27//! only when the host installs it. Nothing here bakes in a codec.
28
29mod args;
30mod boot;
31mod bootloader;
32mod codec_boot;
33mod command;
34mod config;
35mod crates_io;
36mod device_host;
37pub mod device_options;
38mod envelope;
39mod exit;
40#[cfg(feature = "registry")]
41mod git_registry;
42mod handoff;
43mod host;
44mod introspect;
45mod load;
46mod platform_bundle;
47mod receipt;
48mod report;
49mod source;
50
51#[cfg(test)]
52mod bootstrap_tests;
53#[cfg(test)]
54mod codec_boot_tests;
55#[cfg(test)]
56mod config_report_tests;
57#[cfg(test)]
58mod config_site_tests;
59#[cfg(test)]
60mod config_tests;
61#[cfg(test)]
62mod device_host_tests;
63#[cfg(test)]
64mod handoff_tests;
65#[cfg(test)]
66mod introspect_tests;
67#[cfg(test)]
68mod lib_tests;
69#[cfg(test)]
70mod load_tests;
71#[cfg(test)]
72mod publish_tests;
73#[cfg(test)]
74mod scenario_tests;
75
76pub use args::{CliCommand, parse_args};
77pub use boot::{CliBoot, CliEnvelope, Payload};
78pub use bootloader::Bootloader;
79pub use codec_boot::{DEFAULT_CODEC_NAME, boot_codec_name, codec_lib_symbol};
80pub use command::{
81    CliError, run, run_command_with_session, run_command_with_session_at_version,
82    run_supplied_bootstrap, run_with_session, version_line, version_line_for,
83};
84pub use config::{
85    ConfigLoadOptions, RuntimeConfigState, load_config_sources, load_config_sources_with_probes,
86    run_config_probe,
87};
88pub use crates_io::{CratesIoResolver, CratesIoSpec, ResolvedCratesIoSource, VersionReq};
89pub use device_host::{
90    AdapterTick, DeviceAdapterLoopPlan, DeviceConsentPolicy, DeviceEdgeSession, DeviceHostSpec,
91    DeviceHostStalePolicy, DevicePlacement, DevicePlacementError, DeviceProfile, DeviceProvider,
92    DeviceProviderKind, DeviceRateClass, DeviceSession, DeviceSite, DeviceSiteLocality,
93    DeviceSurfaceHubJoin, RouteArg, StubProvider, StubSession, compose_device_host,
94    compose_device_host_with_provider, derive_device_rate_class, install_device_bases,
95};
96pub use envelope::cli_envelope_args;
97#[cfg(feature = "registry")]
98pub use git_registry::{GIT_REGISTRY_ENDPOINT_ENV, GitRegistryResolver};
99pub use handoff::{CLI_MAIN_ENTRYPOINT, CliEntrypoint, cli_main_entrypoint_symbol};
100pub use load::LoadSession;
101pub use platform_bundle::{BootLoadRequest, boot_load_requests};
102pub use receipt::{LoadReceipt, LoadReceiptRole};
103pub use report::{
104    ConfigReportKind, ConfigReportRequest, ConfigSourceReport, LoadedLibReport, LoadedStateReport,
105    SourceStatus, format_config_sources, format_config_sources_json, format_config_status,
106    format_config_status_json, format_effective_config, format_effective_config_json,
107    render_config_report,
108};
109pub use sim_platform_bootstrap::{BootstrapEnvelope, BootstrappedCapsule};
110pub use source::LibSourceSpec;