The wire's ProvActivityInput bundle (schema "atomic.prov.input.v1") → the plain projector input — the same field-for-field shape the handler serialized.
(payload: &[u8])
| 5024 | /// the plain projector input — the same field-for-field shape the handler |
| 5025 | /// serialized. |
| 5026 | fn prov_input_domain(payload: &[u8]) -> CliResult<atomic_canonical::prov::ProvActivityInput> { |
| 5027 | let value: serde_json::Value = serde_json::from_slice(payload) |
| 5028 | .map_err(|error| CliError::Internal(anyhow::anyhow!("prov input bundle: {error}")))?; |
| 5029 | let field = |name: &str| -> CliResult<Option<String>> { |
| 5030 | match &value[name] { |
| 5031 | serde_json::Value::Null => Ok(None), |
| 5032 | serde_json::Value::String(text) => Ok(Some(text.clone())), |
| 5033 | other => Err(CliError::Internal(anyhow::anyhow!( |
| 5034 | "prov input field {name}: unexpected {other}" |
| 5035 | ))), |
| 5036 | } |
| 5037 | }; |
| 5038 | Ok(atomic_canonical::prov::ProvActivityInput { |
| 5039 | change_id_base32: field("change_id_base32")?.unwrap_or_default(), |
| 5040 | activity_id: field("activity_id")?.unwrap_or_default(), |
| 5041 | started_at: field("started_at")?, |
| 5042 | ended_at: field("ended_at")?, |
| 5043 | agent_slug: field("agent_slug")?.unwrap_or_default(), |
| 5044 | agent_display_name: field("agent_display_name")?.unwrap_or_default(), |
| 5045 | agent_vendor: field("agent_vendor")?, |
| 5046 | person_did: field("person_did")?.unwrap_or_default(), |
| 5047 | generated: value["generated"] |
| 5048 | .as_array() |
| 5049 | .map(|items| { |
| 5050 | items |
| 5051 | .iter() |
| 5052 | .map(|item| item.as_str().unwrap_or_default().to_string()) |
| 5053 | .collect() |
| 5054 | }) |
| 5055 | .unwrap_or_default(), |
| 5056 | used: value["used"] |
| 5057 | .as_array() |
| 5058 | .map(|items| { |
| 5059 | items |
| 5060 | .iter() |
| 5061 | .map(|item| item.as_str().unwrap_or_default().to_string()) |
| 5062 | .collect() |
| 5063 | }) |
| 5064 | .unwrap_or_default(), |
| 5065 | turn_parent: field("turn_parent")?, |
| 5066 | }) |
| 5067 | } |
| 5068 | |
| 5069 | /// `atomic provenance trace/show <target>` over ExportProvenance — the |
| 5070 | /// handler resolves the target (URN/prefix/hash), loads the explaining |