MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / to_json

Method to_json

atomic-agent/src/turn/capture.rs:183–194  ·  view source on GitHub ↗

Encode for durable storage (one JSON document per file).

(&self)

Source from the content-addressed store, hash-verified

181
182 /// Encode for durable storage (one JSON document per file).
183 pub fn to_json(&self) -> AgentResult<Vec<u8>> {
184 serde_json::to_vec_pretty(self)
185 .map(|mut bytes| {
186 bytes.push(b'\n');
187 bytes
188 })
189 .map_err(|e| crate::error::AgentError::RecordFailed {
190 session_id: self.session_id.clone(),
191 turn_number: self.turn,
192 reason: format!("Failed to encode commit capture: {}", e),
193 })
194 }
195
196 /// Decode a stored capture.
197 pub fn from_json(bytes: &[u8]) -> AgentResult<Self> {

Calls 2

pushMethod · 0.45
cloneMethod · 0.45