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::{
30    EnvValue, PermissionDefault, PermissionPolicy, PermissionUnattended, WorkerHome, WorkerSpec,
31    WorkerSurface,
32};
33
34/// The JSON Schema of the whole orchestration value, with every record it contains
35/// as a definition — what `supercode ontology schema` prints and what the
36/// TypeScript types are generated from (ONT-6).
37pub fn schema() -> schemars::Schema {
38    schemars::schema_for!(Orchestration)
39}
40
41/// The schema of one record by name, for readers who want a single type.
42pub fn schema_for(record: &str) -> Option<schemars::Schema> {
43    Some(match record {
44        "Orchestration" => schemars::schema_for!(Orchestration),
45        "Profile" => schemars::schema_for!(Profile),
46        "Binding" => schemars::schema_for!(crate::ontology::Binding),
47        "SurfaceKey" => schemars::schema_for!(crate::ontology::SurfaceKey),
48        "Job" => schemars::schema_for!(Job),
49        "Fire" => schemars::schema_for!(Fire),
50        "Obligation" => schemars::schema_for!(Obligation),
51        "ChannelConfig" => schemars::schema_for!(ChannelConfig),
52        "Route" => schemars::schema_for!(Route),
53        "Access" => schemars::schema_for!(Access),
54        "WebhookSubscription" => schemars::schema_for!(WebhookSubscription),
55        "WorkerSpec" => schemars::schema_for!(WorkerSpec),
56        "PersonaRef" => schemars::schema_for!(PersonaRef),
57        "SecretRef" => schemars::schema_for!(crate::ontology::SecretRef),
58        "Fidelity" => schemars::schema_for!(crate::ontology::Fidelity),
59        "ArtifactFidelity" => schemars::schema_for!(crate::ontology::ArtifactFidelity),
60        _ => return None,
61    })
62}
63
64/// Every name [`schema_for`] answers.
65pub const RECORDS: &[&str] = &[
66    "Orchestration",
67    "Profile",
68    "Binding",
69    "SurfaceKey",
70    "Job",
71    "Fire",
72    "Obligation",
73    "ChannelConfig",
74    "Route",
75    "Access",
76    "WebhookSubscription",
77    "WorkerSpec",
78    "PersonaRef",
79    "SecretRef",
80    "Fidelity",
81    "ArtifactFidelity",
82];