edgeweaver

    Offline-first autonomy platform for weak-network edge devices

    edge
    offline-first
    device-management
    Download zip
    Author
    Version
    0.1.0
    License
    MIT
    Last updated
    19 days ago
    Downloads
    23

    No dependencies

    #EdgeWeaver

    EdgeWeaver 是面向弱网边缘设备的 MoonBit 自治核心库与平台原型。当前版本提供节点端与控制面的共享领域模型,以及面向 Linux native 用户态进程的运行档案。

    #当前交付边界

    核心库包含登记、心跳、配置与命令模型、有界事件队列、checkpoint/restore、幂等回放、重连退避、白名单执行、离线策略预算和统一设备观测契约。disk/ 是 native 文件适配器,保存版本化 store、安全执行/策略 checkpoint 和演示用磁盘接收收据。cmd/main 是同进程模拟;cmd/recovery 验证磁盘重启;cmd/netdemo 通过两个独立进程完成本机 TCP 登记、心跳与事件确认,并提供可由 systemd 启动的本机节点回放与控制端角色;cmd/safety 展示未知执行结果的安全恢复。linux_device/ 只读 /proc/uptime 取得真实主机运行秒数。远程云边服务、真实命令运行器、物理设备驱动和 TLS 凭证仍未交付。

    KubeEdge 基于 Kubernetes,已有容器编排、设备管理、云边同步和边缘自治能力。EdgeWeaver 聚焦无 Kubernetes 前置的 MoonBit 弱网状态与安全执行规则,提供可组合、可测试的核心库;两者功能有交集,当前原型不承担 KubeEdge 的平台功能。

    #首期决策

    • 语言与后端: 使用 MoonBit,首期选择 native 后端,面向需要访问本地文件系统和网络的边缘节点进程。
    • 部署类别: 首期以标准 Linux 用户态设备为目标;具体发行版、CPU 架构和硬件型号待目标设备确认后验证。裸机 MCU、Windows 服务和浏览器/Wasm 部署不在当前范围。
    • 运行角色: node 用于边缘节点,control-plane 用于控制面;两者使用独立的数据、配置、事件日志和诊断目录。
    • 仓库远端: GitHub。
    • 许可证: MIT,详见 LICENSE。

    #部署运行档案

    deploy.mbt 定义了两个角色的默认运行档案和启动参数解析:

    • node:默认数据目录为 /var/lib/edgeweaver/node,配置路径为 /etc/edgeweaver/node.toml,允许有限的事件、日志和重连预算。
    • control-plane:默认数据目录为 /var/lib/edgeweaver/control-plane,配置路径为 /etc/edgeweaver/control-plane.toml,使用更大的事件和日志预算。

    配置样例见 deploy/。启动参数约定为 --profile node|control-plane、--data-dir <path> 和 --config <path>,由 LaunchOptions::parse 解析并由 RunProfile::validate 校验。

    本机 systemd 服务安装与恢复见 deploy/linux-service.md。该服务只连接本机 loopback,节点端回放已有 checkpoint,不执行设备采集;Kubernetes、远端监听和 TLS 凭证管理仍不在交付范围。

    弱网运行、离线自治、重连退避、事件回放和恢复验收步骤见 docs/weak-network-operations.md。 版本化消息格式见 docs/protocol-wire.md,真实本地网络双进程验收见 docs/network-loopback.md。 执行记录与离线预算的持久化边界见 docs/safety-operations.md。

    #目录职责

    • edgeweaver.mbt、moon.pkg:根 package,承载共享领域类型与接口。
    • cmd/main/:命令行程序入口,提供节点登记、心跳、事件入队、能力握手和回放的最小闭环示例。
    • cmd/recovery/:磁盘 checkpoint、进程重启和接收收据去重的可运行验收。
    • cmd/netdemo/、network/:本机 TCP 双进程示例、Linux 服务入口与 native socket 适配器。
    • cmd/device/、linux_device/:Linux 主机运行时信息的只读采集示例与 native 适配器。
    • cmd/safety/:命令结果不确定时的跨进程安全恢复示例。
    • disk/:native 文件适配器,负责版本化 checkpoint 和演示用接收收据的原子写入。
    • deploy.mbt:节点端与控制面运行档案、资源边界和启动参数解析。
    • deploy/:部署说明、不含凭证的配置样例及 systemd 单元。
    • .github/workflows/ci.yml:GitHub Actions 格式、检查、构建和测试流程。
    • LICENSE:MIT 开源许可证文本。
    • moon.mod:模块名称、版本、首选目标后端和项目元数据。
    • AGENTS.md:本仓库的代码组织、变更范围和验证约定。

    #安装与开发

    Linux 原生构建需要 C 编译器(Ubuntu 可运行 sudo apt-get install build-essential)。安装 MoonBit 工具链并克隆仓库:

    curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash -s latest export PATH="$HOME/.moon/bin:$PATH" git clone https://github.com/zyyaa125/EdgeWeaver.git cd EdgeWeaver moon version --all

    要求 moonc 不低于 v0.10.14;本项目在 Ubuntu WSL2 使用 moonc v0.10.17 验证。Windows 可使用官方 MoonBit 工具链运行纯领域代码与 native 测试,Linux 服务和 /proc/uptime 示例需在 Linux 运行。CI 的 Show toolchain 步骤记录实际版本。常用命令:

    moon fmt --check moon check --deny-warn moon test --deny-warn moon run cmd/main

    当前在 Ubuntu WSL2 实测 82 项 native 测试通过;根 package 的纯领域逻辑另在 wasm、wasm-gc、JS、native 各通过 71 项测试。moon run cmd/main 应输出 acknowledged events: 1、pending events: 0 及一行结构化诊断 JSON。设备契约和 moon run cmd/device 示例见 docs/device-adapters.md。本机 TCP 帧交换由 network/socket_wbtest.mbt 覆盖。磁盘收据格式 2 按完整消息信封判重;旧版仅有 ID 的收据会拒绝自动确认,升级时须人工核实并保留原始证据。

    磁盘重启验收在仓库根目录分别运行两个命令(第二个命令启动新进程):

    moon run cmd/recovery -- write recovery-demo.json moon run cmd/recovery -- replay recovery-demo.json

    首个进程输出 receiver accepted; local pending=1,模拟接收成功但本地确认丢失后退出;第二个进程从磁盘恢复,输出 acknowledged=0; deduplicated=1; sent=1; pending=0。接收收据在 recovery-demo.json.receipt,用于确认回放没有重复接收。同一路径可重复运行这两个命令:新消息 ID 使用 checkpoint 中递增的序号;若上一轮只有 write 而尚未 replay,程序会拒绝覆盖待处理事件。此适配器面向单写者,要求目标目录已存在,文件上限 16 MiB。网络闭环采用单独的本机 TCP 示例,仍无远程安全服务。

    每次推送和 Pull Request 都会触发 GitHub Actions,使用 MoonBit latest 工具链运行同一组格式、检查、构建和测试命令。

    后续增加行为时,为相关 package 增加针对性测试;修改公开 API 时运行 moon info 并审阅生成的接口摘要。

    AdapterError

    pub(all) suberror AdapterError {
    EmptyNodeId
    EmptyAdapterId
    EmptyUnit
    EmptyMetric
    EmptyDeviceId
    EmptyAction
    EmptyActionSet
    DuplicateAdapterId(String)
    UnknownSensor(String)
    UnknownActuator(String)
    ActionNotAllowed(String)
    InvalidTimestamp
    ReadUnavailable(String)
    } derive(Eq,
    Debug
    )

    Errors raised by device adapters and the simulator registry.

    AdapterError::equal

    AdapterError::not_equal

    fn AdapterError::not_equal(x : AdapterError, y : AdapterError) -> Bool

    CommandError

    pub(all) suberror CommandError {
    EmptyCommandId
    EmptyAction
    InvalidExpiry
    InvalidTimestamp
    InvalidTransition(String)
    EmptyResultMessage
    InvalidResultState
    } derive(Eq,
    Debug
    )

    Errors raised while creating or advancing a command.

    CommandError::equal

    CommandError::not_equal

    fn CommandError::not_equal(x : CommandError, y : CommandError) -> Bool

    ConfigError

    pub(all) suberror ConfigError {
    InvalidVersion
    EmptyContent
    } derive(Eq,
    Debug
    )

    Errors raised while constructing configuration snapshots.

    ConfigError::equal

    fn ConfigError::equal(ConfigError, ConfigError) -> Bool

    ConfigError::not_equal

    fn ConfigError::not_equal(x : ConfigError, y : ConfigError) -> Bool

    ControlError

    pub(all) suberror ControlError {
    EmptyNodeId
    InvalidTimestamp
    UnsupportedProtocol(ProtocolVersion)
    DuplicateNode(NodeId)
    UnknownNode(NodeId)
    NodeNotEnrolled(NodeId)
    RetiredNode(NodeId)
    StaleHeartbeat
    StaleConfig(ConfigVersion)
    DuplicateCommand(CommandId)
    UnknownCommand(CommandId)
    CommandTargetMismatch(CommandId)
    CommandTransition(CommandError)
    } derive(Eq,
    Debug
    )

    Errors raised by the node enrollment and heartbeat flow.

    ControlError::equal

    ControlError::not_equal

    fn ControlError::not_equal(x : ControlError, y : ControlError) -> Bool

    DeployError

    pub(all) suberror DeployError {
    EmptyPath
    InvalidResourceLimit
    UnknownArgument(String)
    MissingArgument(String)
    InvalidProfile(String)
    } derive(Eq,
    Debug
    )

    Errors raised while resolving a local deployment profile.

    DeployError::equal

    fn DeployError::equal(DeployError, DeployError) -> Bool

    DeployError::not_equal

    fn DeployError::not_equal(x : DeployError, y : DeployError) -> Bool

    DiagnosticsError

    pub(all) suberror DiagnosticsError {
    InvalidLogLimit
    EmptyComponent
    EmptyMessage
    InvalidTimestamp
    } derive(Eq,
    Debug
    )

    Errors raised while recording local diagnostics.

    DiagnosticsError::equal

    DiagnosticsError::not_equal

    fn DiagnosticsError::not_equal(x : DiagnosticsError, y : DiagnosticsError) -> Bool

    EdgeError

    pub(all) suberror EdgeError {
    EmptyAllowlistedAction
    InvalidActionName
    InvalidExecutionCheckpoint
    PersistenceFailed
    OutputTooLarge
    InvalidTimestamp
    NodeNotReady(NodeLifecycle)
    RetiredNode(NodeId)
    CommandTargetMismatch(CommandId)
    CommandConflict(CommandId)
    ActionNotAllowed(CommandAction)
    MissingCapability(NodeCapability)
    ExpiredCommand(CommandId)
    CommandNotExecutable(CommandState)
    ExecutionInProgress(CommandId)
    EmptyResultMessage
    CommandTransition(CommandError)
    } derive(Eq,
    Debug
    )

    Errors raised while dispatching an edge command.

    EdgeError::equal

    fn EdgeError::equal(EdgeError, EdgeError) -> Bool

    EdgeError::not_equal

    fn EdgeError::not_equal(x : EdgeError, y : EdgeError) -> Bool

    NodeError

    pub(all) suberror NodeError {
    EmptyNodeId
    InvalidTimestamp
    InvalidTransition(String)
    InvalidHealthUpdate
    } derive(Eq,
    Debug
    )

    Errors raised while constructing or updating a node model.

    NodeError::equal

    fn NodeError::equal(NodeError, NodeError) -> Bool

    NodeError::not_equal

    fn NodeError::not_equal(x : NodeError, y : NodeError) -> Bool

    NodeError::to_repr

    Keep derived trait methods explicit for newer MoonBit toolchains.

    PolicyError

    pub(all) suberror PolicyError {
    EmptyRuleId
    EmptyAction
    InvalidWindow
    InvalidMaxTriggers
    InvalidOfflineDuration
    InvalidTimestamp
    InvalidCheckpoint
    UnsupportedPolicyVersion
    PersistenceFailed
    DuplicateRuleId(String)
    ActionNotAllowed(CommandAction)
    } derive(Eq,
    Debug
    )

    Errors raised while defining or evaluating bounded autonomy rules.

    PolicyError::equal

    fn PolicyError::equal(PolicyError, PolicyError) -> Bool

    PolicyError::not_equal

    fn PolicyError::not_equal(x : PolicyError, y : PolicyError) -> Bool

    ProtocolError

    pub(all) suberror ProtocolError {
    InvalidVersion
    UnsupportedVersion(ProtocolVersion)
    EmptyMessageId
    EmptyCorrelationId
    EmptyPayload
    } derive(Eq,
    Debug
    )

    Errors raised while validating a protocol message.

    ProtocolError::equal

    ProtocolError::not_equal

    fn ProtocolError::not_equal(x : ProtocolError, y : ProtocolError) -> Bool

    StoreError

    pub(all) suberror StoreError {
    InvalidCapacity
    QueueFull
    EventNotFound(Int)
    InvalidCheckpoint
    SequenceExhausted
    } derive(Eq,
    Debug
    )

    Errors raised while managing local durable state.

    StoreError::equal

    fn StoreError::equal(StoreError, StoreError) -> Bool

    StoreError::not_equal

    fn StoreError::not_equal(x : StoreError, y : StoreError) -> Bool

    SyncError

    pub(all) suberror SyncError {
    InvalidBatchSize
    InvalidMaxAttempts
    InvalidCursor
    } derive(Eq,
    Debug
    )

    Errors raised while configuring offline event replay.

    SyncError::equal

    fn SyncError::equal(SyncError, SyncError) -> Bool

    SyncError::not_equal

    fn SyncError::not_equal(x : SyncError, y : SyncError) -> Bool

    TransportError

    pub(all) suberror TransportError {
    InvalidBaseDelay
    InvalidMaxDelay
    InvalidAttemptLimit
    InvalidTimestamp
    TimestampOverflow
    InvalidState(ConnectionState)
    RetryNotReady(Timestamp)
    RetryExhausted
    UnsupportedProtocol(ProtocolVersion)
    NoSharedCapability
    SyncNotReady
    Store(StoreError)
    } derive(Eq,
    Debug
    )

    Errors raised while reconnecting and negotiating a transport link.

    TransportError::equal

    TransportError::not_equal

    fn TransportError::not_equal(x : TransportError, y : TransportError) -> Bool

    WireError

    pub(all) suberror WireError {
    TooLarge
    InvalidData
    UnsupportedVersion
    } derive(Eq,
    Debug
    )

    Errors returned before a wire message reaches domain logic.

    WireError::equal

    fn WireError::equal(WireError, WireError) -> Bool

    WireError::not_equal

    fn WireError::not_equal(x : WireError, y : WireError) -> Bool

    ActuatorAdapter

    pub(all) struct ActuatorAdapter {
    id : String
    allowed_actions : Array[String]
    state : String
    } derive(Eq,
    Debug
    )

    A simulated actuator adapter with an explicit action allowlist.

    ActuatorAdapter::equal

    ActuatorAdapter::execute

    fn ActuatorAdapter::execute(self : ActuatorAdapter, action~ : String, at~ : Timestamp) -> ActuatorResult raise AdapterError

    Applies an allowed action and returns the new actuator state.

    ActuatorAdapter::new

    fn ActuatorAdapter::new(id~ : String, allowed_actions~ : Array[String], initial_state~ : String) -> ActuatorAdapter raise AdapterError

    Creates an actuator adapter with a non-empty action allowlist.

    ActuatorAdapter::not_equal

    fn ActuatorAdapter::not_equal(x : ActuatorAdapter, y : ActuatorAdapter) -> Bool

    ActuatorResult

    pub(all) struct ActuatorResult {
    actuator_id : String
    action : String
    state : String
    executed_at : Timestamp
    } derive(Eq,
    Debug
    )

    The result of an actuator operation.

    ActuatorResult::equal

    ActuatorResult::not_equal

    fn ActuatorResult::not_equal(x : ActuatorResult, y : ActuatorResult) -> Bool

    AllowedAction

    pub(all) enum AllowedAction {
    ApplyConfig
    ReadTelemetry
    Execute(String)
    } derive(Eq,
    Debug
    )

    An operation explicitly permitted on an edge node.

    AllowedAction::equal

    AllowedAction::not_equal

    fn AllowedAction::not_equal(x : AllowedAction, y : AllowedAction) -> Bool

    AutonomyContext

    pub(all) struct AutonomyContext {
    lifecycle : NodeLifecycle
    health : NodeHealth
    offline_for : Int
    } derive(Eq,
    Debug
    )

    The observations available to the offline policy engine.

    AutonomyContext::equal

    AutonomyContext::new

    fn AutonomyContext::new(lifecycle~ : NodeLifecycle, health~ : NodeHealth, offline_for~ : Int) -> AutonomyContext raise PolicyError

    Creates a validated policy evaluation context.

    AutonomyContext::not_equal

    fn AutonomyContext::not_equal(x : AutonomyContext, y : AutonomyContext) -> Bool

    AutonomyEngine

    pub(all) struct AutonomyEngine {
    allowlist : CommandAllowlist
    rules : Array[AutonomyRule]
    } derive(Eq,
    Debug
    )

    Stateful evaluator for a node's offline autonomy rules.

    AutonomyEngine::checkpoint

    fn AutonomyEngine::checkpoint(self : AutonomyEngine) -> Array[AutonomyRule]

    Captures trigger budgets for persistence across process restarts.

    AutonomyEngine::equal

    AutonomyEngine::evaluate

    fn AutonomyEngine::evaluate(self : AutonomyEngine, context~ : AutonomyContext, at~ : Timestamp) -> PolicyDecision raise PolicyError

    Evaluates rules in declaration order and consumes one trigger budget.

    The engine only acts while the node is offline and health is known. Expired, exhausted, or non-matching rules fall through to the safe default.

    AutonomyEngine::evaluate_durable

    fn AutonomyEngine::evaluate_durable(self : AutonomyEngine, context~ : AutonomyContext, at~ : Timestamp, persist~ : (Array[AutonomyRule]) -> Bool) -> PolicyDecision raise PolicyError

    Persists a consumed trigger budget before returning an action decision.

    AutonomyEngine::new

    Creates an evaluator and verifies every rule is allowlisted.

    AutonomyEngine::not_equal

    fn AutonomyEngine::not_equal(x : AutonomyEngine, y : AutonomyEngine) -> Bool

    AutonomyEngine::restore

    fn AutonomyEngine::restore(allowlist~ : CommandAllowlist, rules~ : Array[AutonomyRule]) -> AutonomyEngine raise PolicyError

    Restores an evaluator from persisted rule counters.

    AutonomyRule

    pub(all) struct AutonomyRule {
    id : String
    condition : PolicyCondition
    action : CommandAction
    valid_from : Timestamp
    valid_until : Timestamp
    max_triggers : Int
    fired_count : Int
    policy_version : Int
    last_evaluated_at : Timestamp?
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    A bounded local action with a validity window and trigger budget.

    AutonomyRule::equal

    AutonomyRule::new

    fn AutonomyRule::new(id~ : String, condition~ : PolicyCondition, action~ : CommandAction, valid_from~ : Timestamp, valid_until~ : Timestamp, max_triggers~ : Int) -> AutonomyRule raise PolicyError

    Creates a validated offline autonomy rule.

    AutonomyRule::not_equal

    fn AutonomyRule::not_equal(x : AutonomyRule, y : AutonomyRule) -> Bool

    AutonomyRule::to_json

    BackoffPolicy

    pub(all) struct BackoffPolicy {
    base_delay : Int
    max_delay : Int
    max_attempts : Int
    } derive(Eq,
    Debug
    )

    Exponential reconnect limits measured in seconds.

    BackoffPolicy::delay_for

    fn BackoffPolicy::delay_for(self : BackoffPolicy, attempt~ : Int) -> Int raise TransportError

    Returns the delay for a one-based failed connection attempt.

    BackoffPolicy::equal

    BackoffPolicy::new

    fn BackoffPolicy::new(base_delay~ : Int, max_delay~ : Int, max_attempts~ : Int) -> BackoffPolicy raise TransportError

    Creates a bounded exponential backoff policy.

    BackoffPolicy::not_equal

    fn BackoffPolicy::not_equal(x : BackoffPolicy, y : BackoffPolicy) -> Bool

    CapabilityAdvertisement

    pub(all) struct CapabilityAdvertisement {
    protocol : ProtocolVersion
    capabilities : Array[TransportCapability]
    } derive(Eq,
    Debug
    )

    The peer capabilities presented during a transport handshake.

    CapabilityAdvertisement::equal

    CapabilityAdvertisement::new

    Creates a peer capability advertisement.

    CapabilityAdvertisement::not_equal

    Command

    pub(all) struct Command {
    id : CommandId
    node_id : NodeId
    action : CommandAction
    issued_at : Timestamp
    expires_at : Timestamp
    updated_at : Timestamp
    state : CommandState
    result : CommandResult?
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    A command with an explicit expiry and an auditable result.

    Command::accept

    fn Command::accept(self : Command, at~ : Timestamp) -> Command raise CommandError

    Moves a pending command into the accepted state.

    Command::equal

    fn Command::equal(Command, Command) -> Bool

    Command::expire

    fn Command::expire(self : Command, at~ : Timestamp) -> Command raise CommandError

    Expires a non-terminal command once its deadline has been reached.

    Command::fail

    fn Command::fail(self : Command, at~ : Timestamp, message~ : String) -> Command raise CommandError

    Completes a running command with a failure result.

    Command::new

    fn Command::new(id~ : CommandId, node_id~ : NodeId, action~ : CommandAction, issued_at~ : Timestamp, expires_at~ : Timestamp) -> Command raise CommandError

    Creates a pending command with a non-decreasing expiry deadline.

    Command::not_equal

    fn Command::not_equal(x : Command, y : Command) -> Bool

    Command::reject

    fn Command::reject(self : Command, at~ : Timestamp, reason~ : String) -> Command raise CommandError

    Rejects a pending command before execution begins.

    Command::same_identity

    fn Command::same_identity(self : Command, other~ : Command) -> Bool

    Reports whether two commands refer to the same idempotent request.

    Command::start

    fn Command::start(self : Command, at~ : Timestamp) -> Command raise CommandError

    Moves an accepted command into the running state.

    Command::succeed

    fn Command::succeed(self : Command, at~ : Timestamp, message~ : String) -> Command raise CommandError

    Completes a running command successfully.

    Command::to_json

    fn Command::to_json(Command) -> Json

    Command::to_repr

    CommandAction

    pub(all) enum CommandAction {
    ApplyConfig(ConfigVersion)
    ReadTelemetry
    Execute(String)
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    The operation requested by a command.

    CommandAction::equal

    CommandAction::not_equal

    fn CommandAction::not_equal(x : CommandAction, y : CommandAction) -> Bool

    CommandAction::to_json

    CommandAllowlist

    pub(all) struct CommandAllowlist {
    actions : Array[AllowedAction]
    } derive(Eq,
    Debug
    )

    The local command allowlist for one node.

    CommandAllowlist::allows

    fn CommandAllowlist::allows(self : CommandAllowlist, action~ : CommandAction) -> Bool

    Reports whether an action is explicitly allowed.

    CommandAllowlist::equal

    CommandAllowlist::new

    Creates an allowlist and rejects an empty executable name.

    CommandAllowlist::not_equal

    fn CommandAllowlist::not_equal(x : CommandAllowlist, y : CommandAllowlist) -> Bool

    CommandId

    pub(all) struct CommandId {
    value : String
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    A stable idempotency key for one command request.

    CommandId::equal

    fn CommandId::equal(CommandId, CommandId) -> Bool

    CommandId::new

    fn CommandId::new(value~ : String) -> CommandId raise CommandError

    Creates a non-empty command identifier.

    CommandId::not_equal

    fn CommandId::not_equal(x : CommandId, y : CommandId) -> Bool

    CommandId::to_json

    fn CommandId::to_json(CommandId) -> Json

    CommandResult

    pub(all) struct CommandResult {
    state : CommandState
    message : String
    completed_at : Timestamp
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    Terminal information attached to a completed command.

    CommandResult::equal

    CommandResult::new

    fn CommandResult::new(state~ : CommandState, message~ : String, completed_at~ : Timestamp) -> CommandResult raise CommandError

    Creates a result for a terminal command state.

    CommandResult::not_equal

    fn CommandResult::not_equal(x : CommandResult, y : CommandResult) -> Bool

    CommandResult::to_json

    CommandState

    pub(all) enum CommandState {
    Pending
    Accepted
    Running
    Succeeded
    Failed
    Expired
    Rejected
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    Lifecycle states for one command request.

    CommandState::equal

    CommandState::not_equal

    fn CommandState::not_equal(x : CommandState, y : CommandState) -> Bool

    CommandState::to_json

    CommandUpdate

    pub(all) enum CommandUpdate {
    Accept
    Start
    Succeed(String)
    Fail(String)
    Reject(String)
    Expire
    } derive(Eq,
    Debug
    )

    A lifecycle update requested for a tracked command.

    CommandUpdate::equal

    CommandUpdate::not_equal

    fn CommandUpdate::not_equal(x : CommandUpdate, y : CommandUpdate) -> Bool

    ConfigDelivery

    pub(all) struct ConfigDelivery {
    node_id : NodeId
    snapshot : ConfigSnapshot
    delivered_at : Timestamp
    } derive(Eq,
    Debug
    )

    A versioned configuration accepted for one node.

    ConfigDelivery::equal

    ConfigDelivery::not_equal

    fn ConfigDelivery::not_equal(x : ConfigDelivery, y : ConfigDelivery) -> Bool

    ConfigSnapshot

    pub(all) struct ConfigSnapshot {
    version : ConfigVersion
    content : String
    created_at : Timestamp
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    An immutable configuration snapshot that can be referenced by a command.

    ConfigSnapshot::equal

    ConfigSnapshot::new

    fn ConfigSnapshot::new(version~ : ConfigVersion, content~ : String, created_at~ : Timestamp) -> ConfigSnapshot raise ConfigError

    Creates a configuration snapshot with non-empty content.

    ConfigSnapshot::not_equal

    fn ConfigSnapshot::not_equal(x : ConfigSnapshot, y : ConfigSnapshot) -> Bool

    ConfigSnapshot::supersedes

    fn ConfigSnapshot::supersedes(self : ConfigSnapshot, previous~ : ConfigSnapshot) -> Bool

    Reports whether this snapshot is newer than the supplied snapshot.

    ConfigSnapshot::to_json

    ConfigVersion

    pub(all) struct ConfigVersion {
    value : Int
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    A positive, monotonically comparable configuration version.

    ConfigVersion::equal

    ConfigVersion::new

    fn ConfigVersion::new(value~ : Int) -> ConfigVersion raise ConfigError

    Creates a positive configuration version.

    ConfigVersion::not_equal

    fn ConfigVersion::not_equal(x : ConfigVersion, y : ConfigVersion) -> Bool

    ConfigVersion::to_json

    ConnectionState

    pub(all) enum ConnectionState {
    Disconnected
    Connecting
    Connected
    Backoff
    } derive(Eq,
    Debug
    )

    States of the local transport lifecycle.

    ConnectionState::equal

    ConnectionState::not_equal

    fn ConnectionState::not_equal(x : ConnectionState, y : ConnectionState) -> Bool

    ControlPlane

    pub(all) struct ControlPlane {
    nodes : Array[Node]
    configs : Array[ConfigDelivery]
    commands : Array[Command]
    } derive(Eq,
    Debug
    )

    In-memory control-plane registry for enrolled nodes.

    ControlPlane::command

    fn ControlPlane::command(self : ControlPlane, command_id~ : CommandId) -> Command?

    Returns a command tracked by its idempotency key.

    ControlPlane::config

    fn ControlPlane::config(self : ControlPlane, node_id~ : NodeId) -> ConfigDelivery?

    Returns the latest configuration accepted for a node.

    ControlPlane::deliver_command

    fn ControlPlane::deliver_command(self : ControlPlane, node_id~ : NodeId, command~ : Command) -> Command raise ControlError

    Delivers a command to its declared node target.

    ControlPlane::deliver_config

    fn ControlPlane::deliver_config(self : ControlPlane, node_id~ : NodeId, snapshot~ : ConfigSnapshot, at~ : Timestamp) -> ConfigDelivery raise ControlError

    Accepts a newer configuration version for a registered node.

    ControlPlane::enroll

    fn ControlPlane::enroll(self : ControlPlane, request~ : EnrollmentRequest) -> Node raise ControlError

    Registers a node and places it in the Enrolled lifecycle state.

    ControlPlane::equal

    ControlPlane::lookup

    fn ControlPlane::lookup(self : ControlPlane, node_id~ : NodeId) -> Node?

    Looks up an enrolled node by its stable identity.

    ControlPlane::mark_offline

    fn ControlPlane::mark_offline(self : ControlPlane, node_id~ : NodeId, at~ : Timestamp) -> Node raise ControlError

    Marks an enrolled node offline after a missed heartbeat window.

    ControlPlane::new

    Creates an empty control-plane registry.

    ControlPlane::not_equal

    fn ControlPlane::not_equal(x : ControlPlane, y : ControlPlane) -> Bool

    ControlPlane::receive_heartbeat

    fn ControlPlane::receive_heartbeat(self : ControlPlane, heartbeat~ : Heartbeat) -> Node raise ControlError

    Applies a heartbeat and moves an enrolled or offline node online.

    ControlPlane::update_command

    fn ControlPlane::update_command(self : ControlPlane, command_id~ : CommandId, update~ : CommandUpdate, at~ : Timestamp) -> Command raise ControlError

    Applies one lifecycle update and retains the resulting command state.

    DeploymentTarget

    pub(all) enum DeploymentTarget {
    LinuxNative
    } derive(Eq,
    Debug
    )

    The supported deployment target for this release.

    DeploymentTarget::equal

    DeploymentTarget::not_equal

    fn DeploymentTarget::not_equal(x : DeploymentTarget, y : DeploymentTarget) -> Bool

    DeviceObservation

    pub(all) struct DeviceObservation {
    node_id : NodeId
    device_id : String
    health : NodeHealth
    metric : String
    value : Int
    unit : String
    captured_at : Timestamp
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    A backend-independent result of collecting one device metric.

    DeviceObservation::equal

    DeviceObservation::new

    fn DeviceObservation::new(node_id~ : NodeId, device_id~ : String, health~ : NodeHealth, metric~ : String, value~ : Int, unit~ : String, captured_at~ : Timestamp) -> DeviceObservation raise AdapterError

    Validates identity, metric, unit and collection time for any adapter.

    DeviceObservation::not_equal

    fn DeviceObservation::not_equal(x : DeviceObservation, y : DeviceObservation) -> Bool

    DeviceObservation::to_envelope

    fn DeviceObservation::to_envelope(self : DeviceObservation, message_id~ : String) -> MessageEnvelope raise ProtocolError

    Encodes the structured observation as a versioned telemetry event.

    DeviceObservation::to_json

    DeviceSimulator

    pub(all) struct DeviceSimulator {
    node_id : NodeId
    sensors : Array[SensorAdapter]
    actuators : Array[ActuatorAdapter]
    } derive(Eq,
    Debug
    )

    A node-local simulator that exposes sensor and actuator adapter APIs.

    DeviceSimulator::collect_sensor

    fn DeviceSimulator::collect_sensor(self : DeviceSimulator, sensor_id~ : String, at~ : Timestamp) -> DeviceObservation raise AdapterError

    Collects one simulated sensor through the shared device observation contract.

    DeviceSimulator::equal

    DeviceSimulator::execute_actuator

    fn DeviceSimulator::execute_actuator(self : DeviceSimulator, actuator_id~ : String, action~ : String, at~ : Timestamp) -> ActuatorResult raise AdapterError

    Executes one action on a registered actuator.

    DeviceSimulator::new

    fn DeviceSimulator::new(node_id~ : NodeId, sensors~ : Array[SensorAdapter], actuators~ : Array[ActuatorAdapter]) -> DeviceSimulator raise AdapterError

    Creates a simulator and rejects duplicate adapter identities.

    DeviceSimulator::not_equal

    fn DeviceSimulator::not_equal(x : DeviceSimulator, y : DeviceSimulator) -> Bool

    DeviceSimulator::read_all

    Reads all registered sensors in registration order.

    DeviceSimulator::read_sensor

    fn DeviceSimulator::read_sensor(self : DeviceSimulator, sensor_id~ : String, at~ : Timestamp) -> SensorReading raise AdapterError

    Reads one registered sensor.

    DeviceSimulator::restore

    fn DeviceSimulator::restore(snapshot~ : DeviceSnapshot) -> DeviceSimulator

    Restores a simulator from a previously captured snapshot.

    DeviceSimulator::snapshot

    Captures simulator state for deterministic restart tests.

    DeviceSnapshot

    pub(all) struct DeviceSnapshot {
    node_id : NodeId
    sensors : Array[SensorAdapter]
    actuators : Array[ActuatorAdapter]
    } derive(Eq,
    Debug
    )

    A simulator snapshot containing all adapter state.

    DeviceSnapshot::equal

    DeviceSnapshot::not_equal

    fn DeviceSnapshot::not_equal(x : DeviceSnapshot, y : DeviceSnapshot) -> Bool

    DiagnosticEvent

    pub(all) struct DiagnosticEvent {
    at : Timestamp
    level : LogLevel
    component : String
    message : String
    } derive(Eq,
    Debug
    )

    One structured event retained by the local diagnostics collector.

    DiagnosticEvent::equal

    DiagnosticEvent::not_equal

    fn DiagnosticEvent::not_equal(x : DiagnosticEvent, y : DiagnosticEvent) -> Bool

    DiagnosticsCollector

    pub(all) struct DiagnosticsCollector {
    max_logs : Int
    logs : Array[DiagnosticEvent]
    sync_failures : Int
    last_sync_error : String?
    last_policy_decision : PolicyDecision
    } derive(Eq,
    Debug
    )

    A bounded collector for local events and sync/policy status.

    DiagnosticsCollector::equal

    DiagnosticsCollector::events

    Returns a copy of the retained structured events.

    DiagnosticsCollector::new

    Creates an empty diagnostics collector with a bounded log buffer.

    DiagnosticsCollector::not_equal

    DiagnosticsCollector::record_event

    fn DiagnosticsCollector::record_event(self : DiagnosticsCollector, at~ : Timestamp, level~ : LogLevel, component~ : String, message~ : String) -> Unit raise DiagnosticsError

    Records one structured event, dropping the oldest event at capacity.

    DiagnosticsCollector::record_policy_decision

    fn DiagnosticsCollector::record_policy_decision(self : DiagnosticsCollector, at~ : Timestamp, decision~ : PolicyDecision) -> Unit raise DiagnosticsError

    Records the latest policy decision for diagnostics.

    DiagnosticsCollector::record_sync_failure

    fn DiagnosticsCollector::record_sync_failure(self : DiagnosticsCollector, at~ : Timestamp, message~ : String) -> Unit raise DiagnosticsError

    Records a sync failure and retains its latest message.

    DiagnosticsCollector::snapshot

    fn DiagnosticsCollector::snapshot(self : DiagnosticsCollector, node~ : Node, store~ : LocalStore, transport~ : TransportManager, executor~ : EdgeExecutor, at~ : Timestamp) -> LocalDiagnostics raise DiagnosticsError

    Captures a cross-component local health snapshot.

    DiagnosticsJson

    type DiagnosticsJson derive(ToJson)

    A deliberately small diagnostic projection. Raw events, command payloads, runner output and error messages never enter this type.

    DiagnosticsJson::to_json

    EdgeExecutor

    pub(all) struct EdgeExecutor {
    node : Node
    allowlist : CommandAllowlist
    records : Array[ExecutionRecord]
    } derive(Eq,
    Debug
    )

    Local command dispatcher for one enrolled node.

    EdgeExecutor::checkpoint

    Captures execution records for durable persistence.

    EdgeExecutor::equal

    EdgeExecutor::execute

    fn EdgeExecutor::execute(self : EdgeExecutor, command~ : Command, at~ : Timestamp, runner~ : (CommandAction) -> ExecutionResult) -> ExecutionRecord raise EdgeError

    Executes an allowlisted command once and persists its result.

    A prior record is returned without invoking the adapter again. An in-progress record is also returned unchanged so a retry cannot repeat a non-idempotent side effect after a restart.

    EdgeExecutor::execute_durable

    fn EdgeExecutor::execute_durable(self : EdgeExecutor, command~ : Command, at~ : Timestamp, persist~ : (ExecutionCheckpoint) -> Bool, runner~ : (CommandAction) -> ExecutionResult) -> ExecutionRecord raise EdgeError

    Writes InProgress before a side effect and saves the terminal result after. If either save fails, the command is never presented as successful and a restored InProgress record prevents an automatic retry.

    EdgeExecutor::new

    fn EdgeExecutor::new(node~ : Node, allowlist~ : CommandAllowlist) -> EdgeExecutor

    Creates an empty executor for a node and its explicit allowlist.

    EdgeExecutor::not_equal

    fn EdgeExecutor::not_equal(x : EdgeExecutor, y : EdgeExecutor) -> Bool

    EdgeExecutor::record

    fn EdgeExecutor::record(self : EdgeExecutor, command_id~ : CommandId) -> ExecutionRecord?

    Returns the persisted record for one command, if present.

    EdgeExecutor::records

    Returns all persisted execution records.

    EdgeExecutor::restore

    fn EdgeExecutor::restore(node~ : Node, allowlist~ : CommandAllowlist, checkpoint~ : ExecutionCheckpoint) -> EdgeExecutor

    Restores an executor with previously persisted execution records.

    EdgeExecutor::restore_checked

    fn EdgeExecutor::restore_checked(node~ : Node, allowlist~ : CommandAllowlist, checkpoint~ : ExecutionCheckpoint) -> EdgeExecutor raise EdgeError

    Validates a durable execution checkpoint before exposing any result.

    EnrollmentRequest

    pub(all) struct EnrollmentRequest {
    version : ProtocolVersion
    node_id : String
    capabilities : Array[NodeCapability]
    at : Timestamp
    } derive(Eq,
    Debug
    )

    A request to register one node with the control plane.

    EnrollmentRequest::equal

    EnrollmentRequest::new

    fn EnrollmentRequest::new(version~ : ProtocolVersion, node_id~ : String, capabilities~ : Array[NodeCapability], at~ : Timestamp) -> EnrollmentRequest raise ControlError

    Creates an enrollment request with a non-empty identity.

    EnrollmentRequest::not_equal

    fn EnrollmentRequest::not_equal(x : EnrollmentRequest, y : EnrollmentRequest) -> Bool

    ExecutionCheckpoint

    A checkpoint that can be persisted and restored across process restarts.

    ExecutionCheckpoint::equal

    ExecutionCheckpoint::not_equal

    ExecutionCheckpoint::to_json

    ExecutionRecord

    pub(all) struct ExecutionRecord {
    command : Command
    status : ExecutionStatus
    message : String
    started_at : Timestamp
    completed_at : Timestamp?
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    A persisted execution record used to make retries idempotent.

    ExecutionRecord::equal

    ExecutionRecord::not_equal

    fn ExecutionRecord::not_equal(x : ExecutionRecord, y : ExecutionRecord) -> Bool

    ExecutionRecord::to_json

    ExecutionResult

    pub(all) enum ExecutionResult {
    Succeeded(String)
    Failed(String)
    } derive(Eq,
    Debug
    )

    Result produced by the local action adapter.

    ExecutionResult::equal

    ExecutionResult::not_equal

    fn ExecutionResult::not_equal(x : ExecutionResult, y : ExecutionResult) -> Bool

    ExecutionStatus

    pub(all) enum ExecutionStatus {
    InProgress
    Succeeded
    Failed
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    Durable status for one command execution attempt.

    ExecutionStatus::equal

    ExecutionStatus::not_equal

    fn ExecutionStatus::not_equal(x : ExecutionStatus, y : ExecutionStatus) -> Bool

    ExecutionStatus::to_json

    Heartbeat

    pub(all) struct Heartbeat {
    version : ProtocolVersion
    node_id : String
    health : NodeHealth
    at : Timestamp
    } derive(Eq,
    Debug
    )

    A liveness and health observation sent by an enrolled node.

    Heartbeat::equal

    fn Heartbeat::equal(Heartbeat, Heartbeat) -> Bool

    Heartbeat::new

    fn Heartbeat::new(version~ : ProtocolVersion, node_id~ : String, health~ : NodeHealth, at~ : Timestamp) -> Heartbeat raise ControlError

    Creates a heartbeat with a non-empty node identity.

    Heartbeat::not_equal

    fn Heartbeat::not_equal(x : Heartbeat, y : Heartbeat) -> Bool

    JournalConfig

    pub(all) struct JournalConfig {
    capacity : Int
    full_policy : QueueFullPolicy
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    Capacity and overload behavior for a local event journal.

    JournalConfig::equal

    JournalConfig::new

    fn JournalConfig::new(capacity~ : Int, full_policy~ : QueueFullPolicy) -> JournalConfig raise StoreError

    Creates a journal configuration with a positive pending capacity.

    JournalConfig::not_equal

    fn JournalConfig::not_equal(x : JournalConfig, y : JournalConfig) -> Bool

    JournalConfig::to_json

    JournalEntry

    pub(all) struct JournalEntry {
    sequence : Int
    envelope : MessageEnvelope
    status : JournalStatus
    attempts : Int
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    One ordered event retained for local replay or audit.

    JournalEntry::equal

    JournalEntry::is_pending

    fn JournalEntry::is_pending(self : JournalEntry) -> Bool

    Reports whether an entry still awaits acknowledgement.

    JournalEntry::not_equal

    fn JournalEntry::not_equal(x : JournalEntry, y : JournalEntry) -> Bool

    JournalEntry::to_json

    JournalStatus

    pub(all) enum JournalStatus {
    Pending
    Acknowledged
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    Retention state for one journal entry.

    JournalStatus::equal

    JournalStatus::not_equal

    fn JournalStatus::not_equal(x : JournalStatus, y : JournalStatus) -> Bool

    JournalStatus::to_json

    LaunchOptions

    pub(all) struct LaunchOptions {
    kind : RunProfileKind
    data_dir : String?
    config_path : String?
    } derive(Eq,
    Debug
    )

    Startup overrides accepted by the command-line launcher.

    LaunchOptions::equal

    LaunchOptions::new

    Creates launcher options for a profile role.

    LaunchOptions::not_equal

    fn LaunchOptions::not_equal(x : LaunchOptions, y : LaunchOptions) -> Bool

    LaunchOptions::parse

    fn LaunchOptions::parse(args~ : Array[String]) -> LaunchOptions raise DeployError

    Parses profile, data directory, and config path startup arguments.

    LaunchOptions::resolve

    fn LaunchOptions::resolve(self : LaunchOptions) -> RunProfile raise DeployError

    Resolves startup overrides into a validated run profile.

    LocalDiagnostics

    pub(all) struct LocalDiagnostics {
    node_id : NodeId
    lifecycle : NodeLifecycle
    health : NodeHealth
    captured_at : Timestamp
    pending_events : Int
    dropped_events : Int
    sync_failures : Int
    last_sync_error : String?
    sync_cursor : SyncCursor
    connection_state : ConnectionState
    last_connected_at : Timestamp?
    last_error_category : String?
    negotiated_capabilities : Array[TransportCapability]
    next_retry_at : Timestamp?
    policy_decision : PolicyDecision
    execution_records : Int
    uncertain_executions : Int
    failed_executions : Int
    succeeded_executions : Int
    events : Array[DiagnosticEvent]
    } derive(Eq,
    Debug
    )

    Cross-component status exposed to local operators.

    LocalDiagnostics::equal

    LocalDiagnostics::not_equal

    fn LocalDiagnostics::not_equal(x : LocalDiagnostics, y : LocalDiagnostics) -> Bool

    LocalDiagnostics::to_json

    fn LocalDiagnostics::to_json(self : LocalDiagnostics, role~ : RunProfileKind) -> String

    Emits one stable, redacted JSON snapshot for local diagnostics.

    LocalStateSnapshot

    pub(all) struct LocalStateSnapshot {
    node : Node
    config : ConfigSnapshot?
    saved_at : Timestamp
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    A recoverable snapshot of the node's local operational state.

    LocalStateSnapshot::equal

    LocalStateSnapshot::not_equal

    LocalStateSnapshot::to_json

    LocalStore

    pub(all) struct LocalStore {
    config : JournalConfig
    state : LocalStateSnapshot?
    journal : Array[JournalEntry]
    next_sequence : Int
    dropped_count : Int
    }

    Mutable local state and event journal for one edge node process.

    LocalStore::acknowledge

    fn LocalStore::acknowledge(self : LocalStore, sequence~ : Int) -> Unit raise StoreError

    Marks an event acknowledged; repeating the acknowledgement is harmless.

    LocalStore::append_event

    fn LocalStore::append_event(self : LocalStore, envelope~ : MessageEnvelope) -> Int raise StoreError

    Appends an event and returns its local journal sequence.

    LocalStore::checkpoint

    fn LocalStore::checkpoint(self : LocalStore) -> StoreCheckpoint

    Captures a checkpoint suitable for durable encoding by a platform adapter.

    LocalStore::dropped_count

    fn LocalStore::dropped_count(self : LocalStore) -> Int

    Returns how many pending events have been dropped by overload policy.

    LocalStore::journal_entries

    fn LocalStore::journal_entries(self : LocalStore) -> Array[JournalEntry]

    Returns the complete retained journal in sequence order.

    LocalStore::new

    fn LocalStore::new(config~ : JournalConfig) -> LocalStore

    Creates an empty local store.

    LocalStore::pending_count

    fn LocalStore::pending_count(self : LocalStore) -> Int

    Returns the number of events awaiting acknowledgement.

    LocalStore::pending_events

    fn LocalStore::pending_events(self : LocalStore) -> Array[JournalEntry]

    Returns all entries that still await acknowledgement.

    LocalStore::record_attempt

    fn LocalStore::record_attempt(self : LocalStore, sequence~ : Int) -> Unit raise StoreError

    Records one replay attempt for a pending event.

    LocalStore::restore

    fn LocalStore::restore(checkpoint~ : StoreCheckpoint) -> LocalStore raise StoreError

    Restores a local store from a previously captured checkpoint.

    LocalStore::save_state

    fn LocalStore::save_state(self : LocalStore, snapshot~ : LocalStateSnapshot) -> Unit

    Replaces the recoverable node and configuration snapshot.

    LocalStore::state

    Returns the latest local state snapshot, if one has been saved.

    LogLevel

    pub(all) enum LogLevel {
    Debug
    Info
    Warn
    Error
    } derive(Eq,
    Debug
    )

    Severity for one structured local diagnostic event.

    LogLevel::equal

    fn LogLevel::equal(LogLevel, LogLevel) -> Bool

    LogLevel::not_equal

    fn LogLevel::not_equal(x : LogLevel, y : LogLevel) -> Bool

    LogLevel::to_repr

    MessageEnvelope

    pub(all) struct MessageEnvelope {
    version : ProtocolVersion
    message_id : String
    node_id : NodeId
    created_at : Timestamp
    correlation_id : String?
    payload : MessagePayload
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    A versioned message shared by telemetry and control-plane flows.

    MessageEnvelope::equal

    MessageEnvelope::new

    fn MessageEnvelope::new(version~ : ProtocolVersion, message_id~ : String, node_id~ : NodeId, created_at~ : Timestamp, correlation_id~ : String?, payload~ : MessagePayload) -> MessageEnvelope raise ProtocolError

    Creates a validated versioned message envelope.

    MessageEnvelope::not_equal

    fn MessageEnvelope::not_equal(x : MessageEnvelope, y : MessageEnvelope) -> Bool

    MessageEnvelope::to_json

    MessagePayload

    pub(all) enum MessagePayload {
    Telemetry(String)
    Command(String)
    CommandResult(String)
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    The payload categories carried by the common message envelope.

    MessagePayload::equal

    MessagePayload::not_equal

    fn MessagePayload::not_equal(x : MessagePayload, y : MessagePayload) -> Bool

    MessagePayload::to_json

    pub(all) struct NegotiatedLink {
    protocol : ProtocolVersion
    capabilities : Array[TransportCapability]
    } derive(Eq,
    Debug
    )

    The negotiated protocol and channel set for an active link.

    NegotiatedLink::equal

    NegotiatedLink::not_equal

    fn NegotiatedLink::not_equal(x : NegotiatedLink, y : NegotiatedLink) -> Bool

    NetworkMode

    pub(all) enum NetworkMode {
    Reconnectable
    OfflineOnly
    } derive(Eq,
    Debug
    )

    Network behavior selected by a run profile.

    NetworkMode::equal

    fn NetworkMode::equal(NetworkMode, NetworkMode) -> Bool

    NetworkMode::not_equal

    fn NetworkMode::not_equal(x : NetworkMode, y : NetworkMode) -> Bool

    Node

    pub(all) struct Node {
    id : NodeId
    capabilities : Array[NodeCapability]
    lifecycle : NodeLifecycle
    health : NodeHealth
    created_at : Timestamp
    updated_at : Timestamp
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    Identity, capabilities, lifecycle, health, and observation time for a node.

    Node::equal

    fn Node::equal(Node, Node) -> Bool

    Node::new

    fn Node::new(id~ : String, capabilities~ : Array[NodeCapability], created_at~ : Timestamp) -> Node raise NodeError

    Creates a node in the New lifecycle with unknown health.

    Node::not_equal

    fn Node::not_equal(x : Node, y : Node) -> Bool

    Node::record_health

    fn Node::record_health(self : Node, health~ : NodeHealth, at~ : Timestamp) -> Node raise NodeError

    Records a health observation at a monotonic timestamp.

    Node::supports

    fn Node::supports(self : Node, capability~ : NodeCapability) -> Bool

    Reports whether the node advertises a capability.

    Node::to_json

    fn Node::to_json(Node) -> Json

    Node::to_repr

    Node::transition

    fn Node::transition(self : Node, target~ : NodeLifecycle, at~ : Timestamp) -> Node raise NodeError

    Applies a legal lifecycle transition at a monotonic timestamp.

    NodeCapability

    pub(all) enum NodeCapability {
    Telemetry
    CommandExecution
    PersistentStorage
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    Capabilities that a node can advertise to the control plane.

    NodeCapability::equal

    NodeCapability::not_equal

    fn NodeCapability::not_equal(x : NodeCapability, y : NodeCapability) -> Bool

    NodeCapability::to_json

    NodeHealth

    pub(all) enum NodeHealth {
    Unknown
    Healthy
    Degraded
    Unhealthy
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    Health states reported by a node or an operator.

    NodeHealth::equal

    fn NodeHealth::equal(NodeHealth, NodeHealth) -> Bool

    NodeHealth::not_equal

    fn NodeHealth::not_equal(x : NodeHealth, y : NodeHealth) -> Bool

    NodeHealth::to_json

    fn NodeHealth::to_json(NodeHealth) -> Json

    NodeId

    pub(all) struct NodeId {
    value : String
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    A stable identifier for one edge node.

    NodeId::equal

    fn NodeId::equal(NodeId, NodeId) -> Bool

    NodeId::new

    fn NodeId::new(value~ : String) -> NodeId raise NodeError

    Creates a non-empty node identifier.

    NodeId::not_equal

    fn NodeId::not_equal(x : NodeId, y : NodeId) -> Bool

    NodeId::to_json

    fn NodeId::to_json(NodeId) -> Json

    NodeId::to_repr

    NodeLifecycle

    pub(all) enum NodeLifecycle {
    New
    Enrolled
    Online
    Offline
    Retired
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    Lifecycle states for an EdgeWeaver node.

    NodeLifecycle::equal

    NodeLifecycle::not_equal

    fn NodeLifecycle::not_equal(x : NodeLifecycle, y : NodeLifecycle) -> Bool

    NodeLifecycle::to_json

    PolicyCondition

    pub(all) enum PolicyCondition {
    OfflineFor(Int)
    HealthIs(NodeHealth)
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    Conditions that can trigger a local offline rule.

    PolicyCondition::equal

    PolicyCondition::not_equal

    fn PolicyCondition::not_equal(x : PolicyCondition, y : PolicyCondition) -> Bool

    PolicyCondition::to_json

    PolicyDecision

    pub(all) enum PolicyDecision {
    SafeDefault
    Execute(String, CommandAction)
    } derive(Eq,
    Debug
    )

    The safe result when no bounded rule may run.

    PolicyDecision::equal

    PolicyDecision::not_equal

    fn PolicyDecision::not_equal(x : PolicyDecision, y : PolicyDecision) -> Bool

    ProtocolVersion

    pub(all) struct ProtocolVersion {
    major : Int
    minor : Int
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    A protocol version carried by every EdgeWeaver message.

    ProtocolVersion::current

    Returns the only protocol version currently accepted by this release.

    ProtocolVersion::ensure_supported

    fn ProtocolVersion::ensure_supported(self : ProtocolVersion) -> Unit raise ProtocolError

    Rejects versions that this release cannot interpret.

    ProtocolVersion::equal

    ProtocolVersion::new

    fn ProtocolVersion::new(major~ : Int, minor~ : Int) -> ProtocolVersion raise ProtocolError

    Creates a non-negative protocol version.

    ProtocolVersion::not_equal

    fn ProtocolVersion::not_equal(x : ProtocolVersion, y : ProtocolVersion) -> Bool

    ProtocolVersion::to_json

    QueueFullPolicy

    pub(all) enum QueueFullPolicy {
    RejectNew
    DropOldest
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    The policy applied when the pending journal reaches its capacity.

    QueueFullPolicy::equal

    QueueFullPolicy::not_equal

    fn QueueFullPolicy::not_equal(x : QueueFullPolicy, y : QueueFullPolicy) -> Bool

    QueueFullPolicy::to_json

    ReplayItem

    pub(all) struct ReplayItem {
    sequence : Int
    message_id : String
    outcome : ReplayOutcome
    attempts : Int
    } derive(Eq,
    Debug
    )

    Per-entry result from one replay pass.

    ReplayItem::equal

    fn ReplayItem::equal(ReplayItem, ReplayItem) -> Bool

    ReplayItem::not_equal

    fn ReplayItem::not_equal(x : ReplayItem, y : ReplayItem) -> Bool

    ReplayOutcome

    pub(all) enum ReplayOutcome {
    Acknowledged
    Deduplicated
    RetryScheduled
    Rejected
    Exhausted
    } derive(Eq,
    Debug
    )

    Outcome recorded for one inspected journal entry.

    ReplayOutcome::equal

    ReplayOutcome::not_equal

    fn ReplayOutcome::not_equal(x : ReplayOutcome, y : ReplayOutcome) -> Bool

    ReplayReport

    pub(all) struct ReplayReport {
    cursor : SyncCursor
    inspected : Int
    acknowledged : Int
    deduplicated : Int
    retryable_failures : Int
    permanent_failures : Int
    exhausted : Int
    items : Array[ReplayItem]
    } derive(Eq,
    Debug
    )

    Summary of one bounded, ordered replay pass.

    ReplayReport::equal

    ReplayReport::not_equal

    fn ReplayReport::not_equal(x : ReplayReport, y : ReplayReport) -> Bool

    ResourceLimits

    pub(all) struct ResourceLimits {
    max_pending_events : Int
    max_log_entries : Int
    max_reconnect_attempts : Int
    } derive(Eq,
    Debug
    )

    Bounded local resource settings for a process role.

    ResourceLimits::equal

    ResourceLimits::new

    fn ResourceLimits::new(max_pending_events~ : Int, max_log_entries~ : Int, max_reconnect_attempts~ : Int) -> ResourceLimits raise DeployError

    Creates positive resource limits.

    ResourceLimits::not_equal

    fn ResourceLimits::not_equal(x : ResourceLimits, y : ResourceLimits) -> Bool

    RunProfile

    pub(all) struct RunProfile {
    name : String
    kind : RunProfileKind
    target : DeploymentTarget
    network : NetworkMode
    data_dir : String
    config_path : String
    journal_dir : String
    diagnostics_dir : String
    resources : ResourceLimits
    } derive(Eq,
    Debug
    )

    A complete node or control-plane run profile.

    RunProfile::control_plane_default

    fn RunProfile::control_plane_default() -> RunProfile

    Returns the default control-plane profile for a standard Linux user process.

    RunProfile::equal

    fn RunProfile::equal(RunProfile, RunProfile) -> Bool

    RunProfile::for_kind

    fn RunProfile::for_kind(kind~ : RunProfileKind) -> RunProfile

    Selects a default profile by process role.

    RunProfile::node_default

    fn RunProfile::node_default() -> RunProfile

    Returns the default node profile for a standard Linux user process.

    RunProfile::not_equal

    fn RunProfile::not_equal(x : RunProfile, y : RunProfile) -> Bool

    RunProfile::validate

    fn RunProfile::validate(self : RunProfile) -> Unit raise DeployError

    Validates paths and resource limits before process startup.

    RunProfileKind

    pub(all) enum RunProfileKind {
    Node
    ControlPlane
    } derive(Eq,
    Debug
    )

    The two supported process roles.

    RunProfileKind::equal

    RunProfileKind::not_equal

    fn RunProfileKind::not_equal(x : RunProfileKind, y : RunProfileKind) -> Bool

    SensorAdapter

    pub(all) struct SensorAdapter {
    id : String
    unit : String
    value : Int
    step : Int
    } derive(Eq,
    Debug
    )

    A simulated sensor adapter with a fixed increment per read.

    SensorAdapter::equal

    SensorAdapter::new

    fn SensorAdapter::new(id~ : String, unit~ : String, initial_value~ : Int, step~ : Int) -> SensorAdapter raise AdapterError

    Creates a deterministic sensor adapter.

    SensorAdapter::not_equal

    fn SensorAdapter::not_equal(x : SensorAdapter, y : SensorAdapter) -> Bool

    SensorAdapter::read

    Reads the current value and advances the deterministic simulator state.

    SensorReading

    pub(all) struct SensorReading {
    sensor_id : String
    value : Int
    unit : String
    captured_at : Timestamp
    } derive(Eq,
    Debug
    )

    A deterministic reading produced by a sensor adapter.

    SensorReading::equal

    SensorReading::not_equal

    fn SensorReading::not_equal(x : SensorReading, y : SensorReading) -> Bool

    StoreCheckpoint

    pub(all) struct StoreCheckpoint {
    config : JournalConfig
    state : LocalStateSnapshot?
    journal : Array[JournalEntry]
    next_sequence : Int
    dropped_count : Int
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    The persistence boundary used to recover a local store after restart.

    StoreCheckpoint::equal

    StoreCheckpoint::not_equal

    fn StoreCheckpoint::not_equal(x : StoreCheckpoint, y : StoreCheckpoint) -> Bool

    StoreCheckpoint::to_json

    SyncConfig

    pub(all) struct SyncConfig {
    batch_size : Int
    max_attempts : Int
    } derive(Eq,
    Debug
    )

    Limits applied to one offline replay pass.

    SyncConfig::equal

    fn SyncConfig::equal(SyncConfig, SyncConfig) -> Bool

    SyncConfig::new

    fn SyncConfig::new(batch_size~ : Int, max_attempts~ : Int) -> SyncConfig raise SyncError

    Creates a replay configuration with positive limits.

    SyncConfig::not_equal

    fn SyncConfig::not_equal(x : SyncConfig, y : SyncConfig) -> Bool

    SyncCursor

    pub(all) struct SyncCursor {
    last_acked_sequence : Int
    } derive(Eq,
    Debug
    )

    The last event sequence acknowledged during ordered replay.

    SyncCursor::advance

    fn SyncCursor::advance(self : SyncCursor, sequence~ : Int) -> SyncCursor

    Advances the cursor without moving it backwards.

    SyncCursor::equal

    fn SyncCursor::equal(SyncCursor, SyncCursor) -> Bool

    SyncCursor::new

    fn SyncCursor::new(last_acked_sequence~ : Int) -> SyncCursor raise SyncError

    Creates a cursor at a validated journal sequence.

    SyncCursor::not_equal

    fn SyncCursor::not_equal(x : SyncCursor, y : SyncCursor) -> Bool

    SyncCursor::start

    fn SyncCursor::start() -> SyncCursor

    Starts replay before the first local journal sequence.

    SyncSendResult

    pub(all) enum SyncSendResult {
    Accepted
    Duplicate
    RetryableFailure(String)
    PermanentFailure(String)
    } derive(Eq,
    Debug
    )

    Result returned by a transport adapter for one message.

    SyncSendResult::equal

    SyncSendResult::not_equal

    fn SyncSendResult::not_equal(x : SyncSendResult, y : SyncSendResult) -> Bool

    Timestamp

    pub(all) struct Timestamp {
    unix_seconds : Int
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    A non-negative Unix timestamp measured in seconds.

    Timestamp::equal

    fn Timestamp::equal(Timestamp, Timestamp) -> Bool

    Timestamp::new

    fn Timestamp::new(unix_seconds~ : Int) -> Timestamp raise NodeError

    Creates a validated timestamp.

    Timestamp::not_equal

    fn Timestamp::not_equal(x : Timestamp, y : Timestamp) -> Bool

    Timestamp::to_json

    fn Timestamp::to_json(Timestamp) -> Json

    TransportAdapter

    pub(all) struct TransportAdapter {
    connect : () -> TransportIoResult
    close : () -> Unit
    exchange : (CapabilityAdvertisement) -> TransportHandshakeResult
    send_batch : (Array[MessageEnvelope]) -> TransportBatchResult
    }

    Injected I/O boundary. Implementations must return only after the receiver durably accepts a message; a timeout or unknown result must retain it.

    TransportBatchResult

    pub(all) enum TransportBatchResult {
    Receipts(Array[TransportReceipt])
    Timeout
    Disconnected
    Failed(String)
    }

    Result of one bounded event batch request.

    TransportCapability

    pub(all) enum TransportCapability {
    EventReplay
    Heartbeat
    Telemetry
    Command
    Config
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    Channels that can be negotiated after the protocol handshake.

    TransportCapability::equal

    TransportCapability::not_equal

    TransportCapability::to_json

    TransportHandshakeResult

    pub(all) enum TransportHandshakeResult {
    Peer(CapabilityAdvertisement)
    Timeout
    Disconnected
    Failed(String)
    }

    Result of exchanging a version and channel advertisement.

    TransportIoResult

    pub(all) enum TransportIoResult {
    Ready
    Timeout
    Disconnected
    Failed(String)
    }

    Outcome of a physical connection attempt.

    TransportManager

    pub(all) struct TransportManager {
    protocol : ProtocolVersion
    capabilities : Array[TransportCapability]
    backoff : BackoffPolicy
    state : ConnectionState
    attempts : Int
    next_retry_at : Timestamp?
    last_connect_attempt_at : Timestamp?
    last_connected_at : Timestamp?
    negotiated : NegotiatedLink?
    cursor : SyncCursor
    } derive(Eq,
    Debug
    )

    Local transport state, reconnect budget, and sync cursor.

    TransportManager::begin_connect

    fn TransportManager::begin_connect(self : TransportManager, at~ : Timestamp) -> Unit raise TransportError

    Starts a connection attempt when the retry window permits it.

    TransportManager::close_with

    fn TransportManager::close_with(self : TransportManager, adapter~ : TransportAdapter, at~ : Timestamp) -> Unit raise TransportError

    Closes an established or connecting link and schedules a bounded retry.

    TransportManager::connect_with

    fn TransportManager::connect_with(self : TransportManager, adapter~ : TransportAdapter, at~ : Timestamp) -> NegotiatedLink raise TransportError

    Opens a link through an injected adapter and enforces the handshake gate.

    TransportManager::disconnect

    fn TransportManager::disconnect(self : TransportManager, at~ : Timestamp) -> Unit raise TransportError

    Records a link loss and schedules the next bounded retry.

    TransportManager::equal

    TransportManager::handshake

    Completes the handshake and records the common capabilities.

    TransportManager::has_capability

    fn TransportManager::has_capability(self : TransportManager, capability~ : TransportCapability) -> Bool

    Reports whether a negotiated channel is available.

    TransportManager::last_connected_at

    fn TransportManager::last_connected_at(self : TransportManager) -> Timestamp?

    Returns the timestamp of the last successful handshake, if any.

    TransportManager::negotiated

    Returns the most recent negotiated link, if connected.

    TransportManager::new

    fn TransportManager::new(protocol~ : ProtocolVersion, capabilities~ : Array[TransportCapability], backoff~ : BackoffPolicy) -> TransportManager raise TransportError

    Creates a disconnected transport manager.

    TransportManager::next_retry_at

    fn TransportManager::next_retry_at(self : TransportManager) -> Timestamp?

    Returns the next retry time, if the link is backing off.

    TransportManager::not_equal

    fn TransportManager::not_equal(x : TransportManager, y : TransportManager) -> Bool

    TransportManager::replay_pending

    fn TransportManager::replay_pending(self : TransportManager, store : LocalStore, config~ : SyncConfig, sender~ : (MessageEnvelope) -> SyncSendResult) -> ReplayReport raise TransportError

    Replays offline events only after a successful capability handshake.

    TransportManager::replay_with

    fn TransportManager::replay_with(self : TransportManager, store : LocalStore, config~ : SyncConfig, adapter~ : TransportAdapter) -> ReplayReport raise TransportError

    Sends each pending event as a one-element batch and checks the matching receipt before marking it acknowledged. Missing/extra/alien receipts fail closed; the event remains pending for another attempt.

    TransportManager::state

    Returns the current connection state.

    TransportManager::sync_cursor

    fn TransportManager::sync_cursor(self : TransportManager) -> SyncCursor

    Returns the cursor advanced by successful event replay.

    TransportReceipt

    pub(all) struct TransportReceipt {
    message_id : String
    result : SyncSendResult
    }

    One receiver response bound to the original message ID.

    WireAckStatus

    pub(all) enum WireAckStatus {
    Accepted
    Duplicate
    Rejected(String)
    } derive(Eq, ToJson,
    FromJson
    )

    Receiver acknowledgement status; only Accepted or Duplicate permits a sender to remove a pending event.

    WireAckStatus::equal

    WireAckStatus::not_equal

    fn WireAckStatus::not_equal(x : WireAckStatus, y : WireAckStatus) -> Bool

    WireAckStatus::to_json

    WireFrame

    pub(all) struct WireFrame {
    version : ProtocolVersion
    message : WireMessage
    } derive(ToJson,
    FromJson
    )

    One versioned JSON frame. The transport supplies an external length prefix.

    WireFrame::to_json

    fn WireFrame::to_json(WireFrame) -> Json

    WireMessage

    pub(all) enum WireMessage {
    Handshake(Array[TransportCapability])
    Enroll(String, Array[NodeCapability], Timestamp)
    Heartbeat(String, NodeHealth, Timestamp)
    ConfigUpdate(String, ConfigSnapshot)
    Command(String, String, String, Timestamp)
    EventReplay(MessageEnvelope)
    Receipt(String, WireAckStatus)
    ErrorResponse(String, String)
    } derive(ToJson,
    FromJson
    )

    Version 1 request/response kinds. Strings are values, never shell text. Semantic validation follows JSON decoding before dispatch.

    WireMessage::to_json

    fn WireMessage::to_json(WireMessage) -> Json

    decode_wire

    fn decode_wire(content : String) -> WireFrame raise WireError

    Decodes one complete UTF-8 JSON frame and rejects invalid semantics.

    encode_wire

    fn encode_wire(frame : WireFrame) -> String raise WireError

    Encodes a validated version 1 frame for length-delimited transport.

    replay_pending

    fn replay_pending(store : LocalStore, config~ : SyncConfig, cursor~ : SyncCursor, sender~ : (MessageEnvelope) -> SyncSendResult) -> ReplayReport raise StoreError

    Replays pending events in order and records idempotent outcomes.

    An acknowledged message ID is never sent again. A retryable or permanent result stops the pass so the cursor remains contiguous with the journal.

    wire_max_bytes

    fn wire_max_bytes() -> Int

    The maximum UTF-8 JSON payload accepted by the native transport.