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;
18pub mod workflow;
19
20pub use access::{Access, AccessPolicy};
21pub use channel::ChannelConfig;
22pub use fire::{Fire, FireStatus};
23pub use job::{Job, JobOrigin, Repeat, Schedule, Target};
24pub use obligation::{
25    Attachment, Obligation, ObligationSource, ObligationState, OutboundContent, Posted,
26};
27pub use profile::{Orchestration, PersonaRef, Profile, ProfileResidue};
28pub use route::{resolve_route, route_specificity, Route, RouteMatch};
29pub use subscription::WebhookSubscription;
30pub use worker::{
31    EnvValue, PermissionDefault, PermissionPolicy, PermissionUnattended, WorkerHome, WorkerSpec,
32    WorkerSurface,
33};
34pub use workflow::{hermes_instance, Workflow};
35
36/// The JSON Schema of the whole orchestration value, with every record it contains
37/// as a definition — what `supercode ontology schema` prints and what the
38/// TypeScript types are generated from (ONT-6).
39pub fn schema() -> schemars::Schema {
40    schemars::schema_for!(Orchestration)
41}
42
43/// The schema of one record by name, for readers who want a single type.
44pub fn schema_for(record: &str) -> Option<schemars::Schema> {
45    Some(match record {
46        "Orchestration" => schemars::schema_for!(Orchestration),
47        "Profile" => schemars::schema_for!(Profile),
48        "Binding" => schemars::schema_for!(crate::ontology::Binding),
49        "SurfaceKey" => schemars::schema_for!(crate::ontology::SurfaceKey),
50        "Job" => schemars::schema_for!(Job),
51        "Fire" => schemars::schema_for!(Fire),
52        "Obligation" => schemars::schema_for!(Obligation),
53        "ChannelConfig" => schemars::schema_for!(ChannelConfig),
54        "Route" => schemars::schema_for!(Route),
55        "Access" => schemars::schema_for!(Access),
56        "WebhookSubscription" => schemars::schema_for!(WebhookSubscription),
57        "WorkerSpec" => schemars::schema_for!(WorkerSpec),
58        "PersonaRef" => schemars::schema_for!(PersonaRef),
59        "SecretRef" => schemars::schema_for!(crate::ontology::SecretRef),
60        "Fidelity" => schemars::schema_for!(crate::ontology::Fidelity),
61        "ArtifactFidelity" => schemars::schema_for!(crate::ontology::ArtifactFidelity),
62        _ => return None,
63    })
64}
65
66/// Every name [`schema_for`] answers.
67pub const RECORDS: &[&str] = &[
68    "Orchestration",
69    "Profile",
70    "Binding",
71    "SurfaceKey",
72    "Job",
73    "Fire",
74    "Obligation",
75    "ChannelConfig",
76    "Route",
77    "Access",
78    "WebhookSubscription",
79    "WorkerSpec",
80    "PersonaRef",
81    "SecretRef",
82    "Fidelity",
83    "ArtifactFidelity",
84];