Move sleep items to the extension-owned lifecycle path (#33159)

## What changed

- Define `SleepItem` in `codex-extension-items` and carry `clock.sleep` events through `TurnItem::Extension`.
- Preserve sleep persistence, thread-history reconstruction, and the app-server's `type: "sleep"` schema while reusing the extension-owned type.

## Testing

- Add serialization coverage for the `clock.sleep` extension wire shape and its protocol wrapper.
- Update sleep lifecycle and thread-history tests to exercise the extension-owned item.

GitOrigin-RevId: 34bb33ed9b90a09bf4744aafdb56e019c717a168
This commit is contained in:
pakrym-oai authored and copyberry committed 2026-07-14 21:01:54 +00:00
1 parent 83a4187837
commit 5d325ba223
41 files changed
+141 -55

No files matched your search

+4 -3
View File
@@ -6,7 +6,8 @@ use crate::tools::context::boxed_tool_output;
use crate::tools::handlers::parse_arguments;
use crate::tools::registry::CoreToolRuntime;
use crate::tools::registry::ToolExecutor;
use codex_protocol::items::SleepItem;
use codex_extension_items::ExtensionItem;
use codex_extension_items::sleep::SleepItem;
use codex_protocol::items::TurnItem;
use codex_tools::JsonSchema;
use codex_tools::ResponsesApiNamespace;
@@ -89,10 +90,10 @@ impl ToolExecutor<ToolInvocation> for SleepHandler {
}
let started = Instant::now();
let item = TurnItem::Sleep(SleepItem {
let item = TurnItem::Extension(ExtensionItem::Sleep(SleepItem {
id: call_id,
duration_ms: args.duration_ms,
});
}));
session.emit_turn_item_started(turn.as_ref(), &item).await;
let turn_state = session
.input_queue