mirror of
https://github.com/openai/codex.git
synced 2026-06-01 19:02:59 +00:00
Summary - Add TurnErrorInput and TurnLifecycleContributor::on_turn_error to the extension API. - Emit the turn-error lifecycle from core turn error paths, including usage limit failures. - Add direct lifecycle coverage for the emitted error facts and stores. Tests - just fmt - git diff --check - Not run: full tests or clippy (per instructions)
59 lines
2.1 KiB
Rust
59 lines
2.1 KiB
Rust
use codex_protocol::config_types::CollaborationMode;
|
|
use codex_protocol::protocol::CodexErrorInfo;
|
|
use codex_protocol::protocol::TokenUsage;
|
|
use codex_protocol::protocol::TurnAbortReason;
|
|
|
|
use crate::ExtensionData;
|
|
|
|
/// Input supplied when the host starts a turn.
|
|
pub struct TurnStartInput<'a> {
|
|
/// Stable host-owned turn identifier.
|
|
pub turn_id: &'a str,
|
|
/// Effective collaboration mode for this turn.
|
|
pub collaboration_mode: &'a CollaborationMode,
|
|
/// Total token usage snapshot captured when the turn started.
|
|
pub token_usage_at_turn_start: &'a TokenUsage,
|
|
/// Store scoped to the host session runtime.
|
|
pub session_store: &'a ExtensionData,
|
|
/// Store scoped to this thread runtime.
|
|
pub thread_store: &'a ExtensionData,
|
|
/// Store scoped to this turn runtime.
|
|
pub turn_store: &'a ExtensionData,
|
|
}
|
|
|
|
/// Input supplied when the host completes a turn.
|
|
pub struct TurnStopInput<'a> {
|
|
/// Store scoped to the host session runtime.
|
|
pub session_store: &'a ExtensionData,
|
|
/// Store scoped to this thread runtime.
|
|
pub thread_store: &'a ExtensionData,
|
|
/// Store scoped to this turn runtime.
|
|
pub turn_store: &'a ExtensionData,
|
|
}
|
|
|
|
/// Input supplied when the host aborts a turn.
|
|
pub struct TurnAbortInput<'a> {
|
|
/// Reason the host aborted the turn.
|
|
pub reason: TurnAbortReason,
|
|
/// Store scoped to the host session runtime.
|
|
pub session_store: &'a ExtensionData,
|
|
/// Store scoped to this thread runtime.
|
|
pub thread_store: &'a ExtensionData,
|
|
/// Store scoped to this turn runtime.
|
|
pub turn_store: &'a ExtensionData,
|
|
}
|
|
|
|
/// Input supplied when the host observes an error for a turn.
|
|
pub struct TurnErrorInput<'a> {
|
|
/// Stable host-owned turn identifier.
|
|
pub turn_id: &'a str,
|
|
/// Error surfaced by the host for this turn.
|
|
pub error: CodexErrorInfo,
|
|
/// Store scoped to the host session runtime.
|
|
pub session_store: &'a ExtensionData,
|
|
/// Store scoped to this thread runtime.
|
|
pub thread_store: &'a ExtensionData,
|
|
/// Store scoped to this turn runtime.
|
|
pub turn_store: &'a ExtensionData,
|
|
}
|