jif-oai
2026-01-23 13:57:59 +01:00
committed by GitHub
parent afa08570f2
commit f30f39b28b
6 changed files with 642 additions and 146 deletions

View File

@@ -105,3 +105,18 @@ pub(crate) fn spawn_agent_from_existing(
codex_op_tx
}
/// Spawn an op-forwarding loop for an existing thread without subscribing to events.
pub(crate) fn spawn_op_forwarder(thread: std::sync::Arc<CodexThread>) -> UnboundedSender<Op> {
let (codex_op_tx, mut codex_op_rx) = unbounded_channel::<Op>();
tokio::spawn(async move {
while let Some(op) = codex_op_rx.recv().await {
if let Err(e) = thread.submit(op).await {
tracing::error!("failed to submit op: {e}");
}
}
});
codex_op_tx
}