Skip to main content

helix_driver_native/
lib.rs

1//! # helix-driver-native
2//!
3//! tokio shell + shared host storage/network implementations for helix-core ports.
4//!
5//! ## tokio::spawn 在此
6//!
7//! helix-core 不含任何运行时依赖。`tokio::spawn` 在此 crate 的 `engine_loop.rs`,
8//! 不在 helix-core。
9//!
10//! ## 错误翻译(ACL-2)
11//!
12//! 具体 I/O crate 错误在 driver/host 边界翻译为 helix_core::PortError,
13//! 不让具体类型穿透 port 边界。
14
15pub mod bus_guard;
16pub mod clock;
17pub mod engine_loop;
18pub mod event_sink;
19pub mod http;
20pub mod storage;
21pub mod transport;
22
23// 公共 API 再导出(方便 helix-tauri / 测试直接 use helix_driver_native::*)
24pub use bus_guard::{guard_bus_envelope, is_emittable_channel, GuardedEnvelope};
25pub use clock::NativeClock;
26pub use engine_loop::{
27    rows_from_reply_bytes, rows_to_reply_bytes, run_engine_loop, run_engine_loop_stamped,
28    run_engine_loop_with_transports, run_engine_loop_with_transports_and_trace,
29    run_engine_loop_with_transports_and_trace_stamped, EngineConfig, TransportTable,
30};
31pub use event_sink::{
32    bus_event_name, to_bus_envelope, EventReceiver, NativeEventSink, RecvOutcome, BUS_CHANNEL,
33};
34// 候选 WDIO 真实验收通过此窄接口装配一次性 posts/create 故障,不改变生产调用路径。
35pub use http::{configure_wdio_fail_next_post_create, NativeHttp};
36pub use storage::NativeStorage;
37pub use transport::NativeTransport;
38// TimerRegistry 已下沉 host(pump 核统一);native re-export 保持公开路径兼容。
39pub use helix_driver_host::TimerRegistry;
40// 共享 host I/O 配置(ADR-010):Go base 由 new() 注入,Java/default base 必须再经
41// with_default_api_base_url() 显式注入;禁止从 Go URL 推测。re-export 免直依 driver-host。
42pub use helix_driver_host::HostNetworkConfig;
43// P1.5 出站横切层:装配 NativeHttp::with_crosscut 时注入真鉴权 token 源(re-export 免直依 driver-host)。
44pub use helix_driver_host::AuthTokenRegistry;
45// 共享 HTTP client 句柄:host 装配 NativeHttp::with_crosscut 需先 SharedHttpClient::new(config),
46// 再连同 event_sink + AuthTokenRegistry 包进横切层(re-export 免直依 driver-host)。
47pub use helix_driver_host::SharedHttpClient;
48// 共享本地文件上传器:host-cli / shell 通过 native 装配 `EngineConfig.uploader`,免直依 driver-host。
49pub use helix_driver_host::SharedFileUploader;
50pub use helix_driver_host::{
51    tick_ingress_channel, tick_ingress_channel_observed, TickIngressReceiver, TickIngressSender,
52};
53// lifecycle context 由 host engine 生成,native 只 re-export 合同,不引入 exporter/WASM 实现。
54pub use helix_driver_host::{
55    LifecycleCapability, LifecycleContext, LifecycleObservation, LifecycleStage, LifecycleState,
56    LifecycleStatus, LifecycleTraceSink, LifecycleTraceStats, LifecycleTracker, TickId,
57    LIFECYCLE_LINK_CAPACITY, LIFECYCLE_TRACE_QUEUE_CAPACITY,
58};