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

Function write_frame

atomic-cli/src/commands/agent/owner.rs:1347–1360  ·  view source on GitHub ↗
(stream: &mut S, value: &T)

Source from the content-addressed store, hash-verified

1345}
1346
1347async fn write_frame<T, S>(stream: &mut S, value: &T) -> anyhow::Result<()>
1348where
1349 T: Serialize,
1350 S: AsyncWrite + Unpin,
1351{
1352 let payload = serde_json::to_vec(value)?;
1353 if payload.len() > MAX_FRAME_BYTES {
1354 return Err(anyhow!("database-owner frame exceeds size limit"));
1355 }
1356 stream.write_u32(payload.len() as u32).await?;
1357 stream.write_all(&payload).await?;
1358 stream.flush().await?;
1359 Ok(())
1360}
1361
1362/// A turn's envelope batch can exceed `MAX_FRAME_BYTES` on its own (a heavy
1363/// agent turn recovers full tool output), so split it before framing. The

Callers 3

handle_connectionFunction · 0.85
exchangeFunction · 0.85

Calls 2

lenMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected