Skip to main content

wist_api/action_plan/
mod.rs

1//! `agent/action-plan` seam(gateway → agentd,动作下发 + 回执)的报文。
2//!
3//! 报文引用的**领域类型** `ActionPlan` 仍留在 `wist-contracts`;这里 re-export,
4//! 调用方从 `wist_api::action_plan` 一处取齐。版本并存约定同 [`crate::enrollment`]
5//! (见 `wist-design/doc/design/foundation/api-seam-inventory.md` §7)。
6
7pub use wist_contracts::action_plan::ActionPlan;
8
9pub mod v1;
10pub use v1::*;
11
12/// 当前线上版本。新代码从这里取版本口径;并存期由路由/协商决定。
13pub const CURRENT: &str = v1::API_VERSION;
14
15#[cfg(test)]
16mod tests {
17    use super::*;
18
19    /// `CURRENT` 必须钉在 `v1`(与路由 `/api/v1/…` 一致),并与版本子模块同源。
20    #[test]
21    fn current_matches_the_live_wire_version() {
22        assert_eq!(CURRENT, "v1");
23        assert_eq!(CURRENT, v1::API_VERSION);
24    }
25
26    /// 编译期身份断言:本模块 re-export 的领域类型**就是** `wist-contracts` 的那一个
27    /// (若有人另抄一份,下面的函数体将类型不匹配而编译失败)。
28    #[test]
29    fn domain_types_are_the_contracts_ones() {
30        #[allow(dead_code)]
31        fn assert_identity() {
32            fn plan(v: wist_contracts::action_plan::ActionPlan) -> ActionPlan {
33                v
34            }
35            let _ = plan;
36        }
37        assert_identity();
38    }
39}