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

Method to_json

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

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

(&self)

Source from the content-addressed store, hash-verified

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

Calls 2

pushMethod · 0.45
cloneMethod · 0.45