Skip to main content

supercode_interchange/world/
mod.rs

1//! The world 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, PendingPairing};
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::{ExpiryPolicy, ExpiryScope, PersonaRef, Profile, ProfileResidue, World};
27pub use route::{resolve_route, route_specificity, Route, RouteMatch};
28pub use subscription::WebhookSubscription;
29pub use worker::{EnvValue, PermissionDefault, PermissionPolicy, WorkerSpec};
30
31/// The JSON Schema of the whole world 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!(World)
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        "World" => schemars::schema_for!(World),
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        "ExpiryPolicy" => schemars::schema_for!(ExpiryPolicy),
54        "PersonaRef" => schemars::schema_for!(PersonaRef),
55        "SecretRef" => schemars::schema_for!(crate::ontology::SecretRef),
56        "Fidelity" => schemars::schema_for!(crate::ontology::Fidelity),
57        "ArtifactFidelity" => schemars::schema_for!(crate::ontology::ArtifactFidelity),
58        _ => return None,
59    })
60}
61
62/// Every name [`schema_for`] answers.
63pub const RECORDS: &[&str] = &[
64    "World",
65    "Profile",
66    "Binding",
67    "SurfaceKey",
68    "Job",
69    "Fire",
70    "Obligation",
71    "ChannelConfig",
72    "Route",
73    "Access",
74    "WebhookSubscription",
75    "WorkerSpec",
76    "ExpiryPolicy",
77    "PersonaRef",
78    "SecretRef",
79    "Fidelity",
80    "ArtifactFidelity",
81];