supercode-interchange 0.4.18

Canonical, provider-neutral session interchange primitives for Supercode
Documentation
//! The orchestration piece of the ontology (`docs/ONTOLOGY.md` §2.7, `docs/ORCHESTRATOR-IR.md` §2):
//! a harness's operational home as ONE typed value. These are the records the
//! orchestrator loads, steps and saves; a Hermes or OpenClaw home compiles
//! into them and decompiles back (the codecs are ONT-3's). The wire form is
//! the orchestrator IR's canonical JSON: the runtime half is never persisted
//! and is not here.

pub mod access;
pub mod channel;
pub mod codec;
pub mod fire;
pub mod job;
pub mod obligation;
pub mod profile;
pub mod route;
pub mod subscription;
pub mod worker;

pub use access::{Access, AccessPolicy, PendingPairing};
pub use channel::ChannelConfig;
pub use fire::{Fire, FireStatus};
pub use job::{Job, JobOrigin, Repeat, Schedule, Target};
pub use obligation::{
    Attachment, Obligation, ObligationSource, ObligationState, OutboundContent, Posted,
};
pub use profile::{ExpiryPolicy, ExpiryScope, Orchestration, PersonaRef, Profile, ProfileResidue};
pub use route::{resolve_route, route_specificity, Route, RouteMatch};
pub use subscription::WebhookSubscription;
pub use worker::{EnvValue, PermissionDefault, PermissionPolicy, WorkerSpec};

/// The JSON Schema of the whole orchestration value, with every record it contains
/// as a definition — what `supercode ontology schema` prints and what the
/// TypeScript types are generated from (ONT-6).
pub fn schema() -> schemars::Schema {
    schemars::schema_for!(Orchestration)
}

/// The schema of one record by name, for readers who want a single type.
pub fn schema_for(record: &str) -> Option<schemars::Schema> {
    Some(match record {
        "Orchestration" => schemars::schema_for!(Orchestration),
        "Profile" => schemars::schema_for!(Profile),
        "Binding" => schemars::schema_for!(crate::ontology::Binding),
        "SurfaceKey" => schemars::schema_for!(crate::ontology::SurfaceKey),
        "Job" => schemars::schema_for!(Job),
        "Fire" => schemars::schema_for!(Fire),
        "Obligation" => schemars::schema_for!(Obligation),
        "ChannelConfig" => schemars::schema_for!(ChannelConfig),
        "Route" => schemars::schema_for!(Route),
        "Access" => schemars::schema_for!(Access),
        "WebhookSubscription" => schemars::schema_for!(WebhookSubscription),
        "WorkerSpec" => schemars::schema_for!(WorkerSpec),
        "ExpiryPolicy" => schemars::schema_for!(ExpiryPolicy),
        "PersonaRef" => schemars::schema_for!(PersonaRef),
        "SecretRef" => schemars::schema_for!(crate::ontology::SecretRef),
        "Fidelity" => schemars::schema_for!(crate::ontology::Fidelity),
        "ArtifactFidelity" => schemars::schema_for!(crate::ontology::ArtifactFidelity),
        _ => return None,
    })
}

/// Every name [`schema_for`] answers.
pub const RECORDS: &[&str] = &[
    "Orchestration",
    "Profile",
    "Binding",
    "SurfaceKey",
    "Job",
    "Fire",
    "Obligation",
    "ChannelConfig",
    "Route",
    "Access",
    "WebhookSubscription",
    "WorkerSpec",
    "ExpiryPolicy",
    "PersonaRef",
    "SecretRef",
    "Fidelity",
    "ArtifactFidelity",
];