Type self patch application
This commit is contained in:
parent
3a6b243837
commit
ed215d515b
10 changed files with 134 additions and 56 deletions
|
|
@ -108,6 +108,7 @@ pub use role_result::interpret_runtime_reorient_worker_result;
|
|||
pub use role_result::interpret_runtime_role_worker_result;
|
||||
pub use role_result::modeling_role_state_patch_policy_errors;
|
||||
pub use role_result::review_role_self_patch;
|
||||
pub use role_result::review_role_self_patch_document;
|
||||
pub use role_result::role_self_memory_target;
|
||||
pub use scene::EpiphanyScene;
|
||||
pub use scene::EpiphanySceneAction;
|
||||
|
|
|
|||
|
|
@ -451,12 +451,27 @@ pub fn role_label(role_id: EpiphanyRoleResultRoleId) -> Result<&'static str, Str
|
|||
pub fn review_role_self_patch(
|
||||
role_id: EpiphanyRoleResultRoleId,
|
||||
patch: &serde_json::Value,
|
||||
) -> EpiphanyRoleSelfPersistenceReview {
|
||||
match decode_agent_self_patch(patch) {
|
||||
Ok(patch) => review_role_self_patch_document(role_id, &patch),
|
||||
Err(reason) => {
|
||||
let (expected_agent_id, target_path) = role_self_memory_target(role_id);
|
||||
EpiphanyRoleSelfPersistenceReview {
|
||||
status: EpiphanyRoleSelfPersistenceStatus::Rejected,
|
||||
target_agent_id: Some(expected_agent_id.to_string()),
|
||||
target_path: Some(target_path.to_string()),
|
||||
reasons: vec![reason],
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn review_role_self_patch_document(
|
||||
role_id: EpiphanyRoleResultRoleId,
|
||||
patch: &AgentSelfPatch,
|
||||
) -> EpiphanyRoleSelfPersistenceReview {
|
||||
let (expected_agent_id, target_path) = role_self_memory_target(role_id);
|
||||
let reasons = match decode_agent_self_patch(patch) {
|
||||
Ok(patch) => review_agent_self_patch_contract(expected_agent_id, &patch),
|
||||
Err(reason) => vec![reason],
|
||||
};
|
||||
let reasons = review_agent_self_patch_contract(expected_agent_id, patch);
|
||||
|
||||
EpiphanyRoleSelfPersistenceReview {
|
||||
status: if reasons.is_empty() {
|
||||
|
|
|
|||
Reference in a new issue