Skip to main content

supercode_interchange/orchestration/
mod.rs

1//! The orchestration piece of the ontology (`docs/ONTOLOGY.md` §2.7, `docs/ORCHESTRATOR-IR.md` §2):
2//! a harness's operational home as ONE typed value. These are the records the
3//! orchestrator loads, steps and saves; a Hermes or OpenClaw home compiles
4//! into them and decompiles back (the codecs are ONT-3's). The wire form is
5//! the orchestrator IR's canonical JSON: the runtime half is never persisted
6//! and is not here.
7
8pub mod access;
9pub mod channel;
10pub mod codec;
11pub mod fire;
12pub mod job;
13pub mod obligation;
14pub mod profile;
15pub mod route;
16pub mod subscription;
17pub mod worker;
18
19pub use access::{Access, AccessPolicy};
20pub use channel::ChannelConfig;
21pub use fire::{Fire, FireStatus};
22pub use job::{Job, JobOrigin, Repeat, Schedule, Target};
23pub use obligation::{
24    Attachment, Obligation, ObligationSource, ObligationState, OutboundContent, Posted,
25};
26pub use profile::{Orchestration, PersonaRef, Profile, ProfileResidue};
27pub use route::{resolve_route, route_specificity, Route, RouteMatch};
28pub use subscription::WebhookSubscription;
29pub use worker::{EnvValue, PermissionDefault, PermissionPolicy, PermissionUnattended, WorkerSpec};
30
31/// The JSON Schema of the whole orchestration value, with every record it contains
32/// as a definition — what `supercode ontology schema` prints and what the
33/// TypeScript types are generated from (ONT-6).
34pub fn schema() -> schemars::Schema {
35    schemars::schema_for!(Orchestration)
36}
37
38/// The schema of one record by name, for readers who want a single type.
39pub fn schema_for(record: &str) -> Option<schemars::Schema> {
40    Some(match record {
41        "Orchestration" => schemars::schema_for!(Orchestration),
42        "Profile" => schemars::schema_for!(Profile),
43        "Binding" => schemars::schema_for!(crate::ontology::Binding),
44        "SurfaceKey" => schemars::schema_for!(crate::ontology::SurfaceKey),
45        "Job" => schemars::schema_for!(Job),
46        "Fire" => schemars::schema_for!(Fire),
47        "Obligation" => schemars::schema_for!(Obligation),
48        "ChannelConfig" => schemars::schema_for!(ChannelConfig),
49        "Route" => schemars::schema_for!(Route),
50        "Access" => schemars::schema_for!(Access),
51        "WebhookSubscription" => schemars::schema_for!(WebhookSubscription),
52        "WorkerSpec" => schemars::schema_for!(WorkerSpec),
53        "PersonaRef" => schemars::schema_for!(PersonaRef),
54        "SecretRef" => schemars::schema_for!(crate::ontology::SecretRef),
55        "Fidelity" => schemars::schema_for!(crate::ontology::Fidelity),
56        "ArtifactFidelity" => schemars::schema_for!(crate::ontology::ArtifactFidelity),
57        _ => return None,
58    })
59}
60
61/// Every name [`schema_for`] answers.
62pub const RECORDS: &[&str] = &[
63    "Orchestration",
64    "Profile",
65    "Binding",
66    "SurfaceKey",
67    "Job",
68    "Fire",
69    "Obligation",
70    "ChannelConfig",
71    "Route",
72    "Access",
73    "WebhookSubscription",
74    "WorkerSpec",
75    "PersonaRef",
76    "SecretRef",
77    "Fidelity",
78    "ArtifactFidelity",
79];