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

Function attach_unhashed

atomic-agent/src/transcript/storage.rs:154–167  ·  view source on GitHub ↗

Attach unhashed turn data to a change. Serializes `UnhashedTurnData` as JSON and stores it under the `"agent_turn"` key in `change.unhashed`. Creates the unhashed JSON object if it doesn't exist.

(
    change: &mut atomic_core::change::Change,
    data: &UnhashedTurnData,
)

Source from the content-addressed store, hash-verified

152/// `"agent_turn"` key in `change.unhashed`. Creates the unhashed
153/// JSON object if it doesn't exist.
154pub fn attach_unhashed(
155 change: &mut atomic_core::change::Change,
156 data: &UnhashedTurnData,
157) -> Result<(), serde_json::Error> {
158 let value = serde_json::to_value(data)?;
159
160 let unhashed = change.unhashed.get_or_insert_with(|| serde_json::json!({}));
161
162 if let Some(obj) = unhashed.as_object_mut() {
163 obj.insert(UNHASHED_KEY.to_string(), value);
164 }
165
166 Ok(())
167}
168
169/// Extract unhashed turn data from a change.
170///

Callers 5

save_reasoning_to_changeFunction · 0.85
test_attach_and_extractFunction · 0.85
test_strip_unhashedFunction · 0.85
explain_turns_implFunction · 0.85

Calls 1

insertMethod · 0.45

Tested by 3

test_attach_and_extractFunction · 0.68
test_strip_unhashedFunction · 0.68