use acativa::PlanIdentity;
pub use acativa::{
CompiledWorkflow, CompilerSemantics, DefinitionRevision, EngineSemantics, HandoffReason,
InterpreterProfile, LoweringCapabilities, LoweringRefusal, PlanInputError, PlanKey,
PlanMismatch, RecordedPlanKey, RetainedPlan, RunAdmission,
};
pub const LICOUP_PLAN_IDENTITY: PlanIdentity = PlanIdentity::new(
"licoup.workflow.compiler",
"licoup.workflow.engine",
"licoup.workflow.plan-key.v1",
);
pub fn compiler_semantics_version(
version: u16,
) -> std::result::Result<CompilerSemantics, PlanInputError> {
CompilerSemantics::version(&LICOUP_PLAN_IDENTITY, version)
}
pub fn compiler_semantics_wire(semantics: CompilerSemantics) -> String {
semantics.wire(&LICOUP_PLAN_IDENTITY)
}
pub fn compiler_semantics_from_wire(
value: &str,
) -> std::result::Result<CompilerSemantics, PlanInputError> {
CompilerSemantics::from_wire(&LICOUP_PLAN_IDENTITY, value)
}
pub fn engine_semantics_version(
version: u16,
) -> std::result::Result<EngineSemantics, PlanInputError> {
EngineSemantics::version(&LICOUP_PLAN_IDENTITY, version)
}
pub fn engine_semantics_wire(semantics: EngineSemantics) -> String {
semantics.wire(&LICOUP_PLAN_IDENTITY)
}
pub fn engine_semantics_from_wire(
value: &str,
) -> std::result::Result<EngineSemantics, PlanInputError> {
EngineSemantics::from_wire(&LICOUP_PLAN_IDENTITY, value)
}
pub fn plan_binding_digest(key: &PlanKey) -> String {
key.binding_digest(&LICOUP_PLAN_IDENTITY)
}
pub fn record_plan_key(key: &PlanKey) -> RecordedPlanKey {
RecordedPlanKey::record(key, &LICOUP_PLAN_IDENTITY)
}
pub fn typed_plan_key(recorded: &RecordedPlanKey) -> std::result::Result<PlanKey, PlanInputError> {
recorded.typed(&LICOUP_PLAN_IDENTITY)
}
pub fn admit_recorded_plan(
profile: &InterpreterProfile,
recorded: &RecordedPlanKey,
) -> RunAdmission {
profile.admit_recorded(recorded, &LICOUP_PLAN_IDENTITY)
}
pub fn retained_binding_digest(plan: &RetainedPlan) -> String {
plan.binding_digest(&LICOUP_PLAN_IDENTITY)
}
pub fn rebuild_retained_plan(
plan: &RetainedPlan,
) -> std::result::Result<CompiledWorkflow, crate::WorkflowValidationFailure> {
plan.rebuild(&crate::workflow_schema())
.map_err(crate::WorkflowValidationFailure::from)
}