Add turn item injection API (#17703)

## Summary
- Add `turn/inject_items` app-server v2 request support for appending
raw Responses API items to a loaded thread history without starting a
turn.
- Generate JSON schema and TypeScript protocol artifacts for the new
params and empty response.
- Document the new endpoint and include a request/response example.
- Preserve compatibility with the typo alias `turn/injet_items` while
returning the canonical method name.

## Testing
- Not run (not requested)
This commit is contained in:
pakrym-oai
2026-04-13 16:11:05 -07:00
committed by GitHub
Unverified
parent 937dd3812d
commit d4be06adea
17 changed files with 598 additions and 1 deletions
+23
View File
@@ -199,6 +199,29 @@ impl CodexThread {
Ok(submission_id)
}
/// Append raw Responses API items to the thread's model-visible history.
pub async fn inject_response_items(&self, items: Vec<ResponseItem>) -> CodexResult<()> {
if items.is_empty() {
return Err(CodexErr::InvalidRequest(
"items must not be empty".to_string(),
));
}
let turn_context = self.codex.session.new_default_turn().await;
if self.codex.session.reference_context_item().await.is_none() {
self.codex
.session
.record_context_updates_and_set_reference_context_item(turn_context.as_ref())
.await;
}
self.codex
.session
.record_conversation_items(turn_context.as_ref(), &items)
.await;
self.codex.session.flush_rollout().await?;
Ok(())
}
pub fn rollout_path(&self) -> Option<PathBuf> {
self.rollout_path.clone()
}