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