pub struct RunRecord {Show 22 fields
pub session_id: SessionId,
pub run_id: RunId,
pub revision: u64,
pub conversation_id: ConversationId,
pub input: Vec<InputPart>,
pub status: RunStatus,
pub output_preview: Option<String>,
pub terminal_error: Option<RunTerminalError>,
pub structured_output: Value,
pub latest_checkpoint: Option<CheckpointRef>,
pub environment_state: Option<EnvironmentStateRef>,
pub stream_cursors: Vec<StreamCursorRef>,
pub trace_context: TraceContext,
pub sequence_no: usize,
pub restore_from_run_id: Option<RunId>,
pub parent_run_id: Option<RunId>,
pub parent_task_id: Option<TaskId>,
pub trigger_type: Option<String>,
pub profile: Option<String>,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
pub metadata: Metadata,
}Expand description
Durable run record.
Fields§
§session_id: SessionIdSession id.
run_id: RunIdRun id.
revision: u64Monotonic optimistic-concurrency revision.
conversation_id: ConversationIdConversation id.
input: Vec<InputPart>User, API, or service input parts.
status: RunStatusDurable run status.
output_preview: Option<String>Final output preview.
terminal_error: Option<RunTerminalError>Safe diagnostic for a failed or cancelled terminal run.
structured_output: ValueFinal structured output preview or summary.
latest_checkpoint: Option<CheckpointRef>Latest checkpoint reference.
environment_state: Option<EnvironmentStateRef>Latest environment state reference for this run.
stream_cursors: Vec<StreamCursorRef>Latest stream cursor refs by family.
trace_context: TraceContextTrace context.
sequence_no: usizeMonotonic order inside the session.
restore_from_run_id: Option<RunId>Run snapshot used as continuation source.
parent_run_id: Option<RunId>Parent run identifier when this run is delegated from another run.
parent_task_id: Option<TaskId>Parent-scoped delegated task identifier when this run executes a lightweight task.
trigger_type: Option<String>Trigger source such as cli, service, schedule, or delegated.
profile: Option<String>Profile resolved for this run.
created_at: DateTime<Utc>Creation time.
updated_at: DateTime<Utc>Last update time.
metadata: MetadataMetadata.
Implementations§
Source§impl RunRecord
impl RunRecord
Sourcepub fn terminal_projection(&self) -> Option<RunTerminalProjection>
pub fn terminal_projection(&self) -> Option<RunTerminalProjection>
Return the complete terminal projection when this record is terminal.
Historical failed records may legitimately return a projection with no diagnostic.
Sourcepub fn validate_new_write(&self) -> Result<(), RunTerminalProjectionError>
pub fn validate_new_write(&self) -> Result<(), RunTerminalProjectionError>
Validate a newly persisted run state.
Historical records are accepted when read, but every new write must carry a complete terminal projection and every non-terminal write must omit stale terminal diagnostics.
§Errors
Returns an error when status, output, and terminal diagnostic are inconsistent.
Sourcepub fn normalize_for_admission(&mut self)
pub fn normalize_for_admission(&mut self)
Normalize caller-provided state before a new admission is persisted.
Admission always creates a queued execution. Any stale terminal projection from a reused record is discarded rather than becoming active-run state or client-visible output.
Sourcepub fn apply_legacy_status_update(
&mut self,
status: RunStatus,
output_preview: Option<String>,
)
pub fn apply_legacy_status_update( &mut self, status: RunStatus, output_preview: Option<String>, )
Apply the legacy low-level status update contract.
The legacy API cannot distinguish safe diagnostics from arbitrary caller text, so failed and cancelled updates discard their preview and persist a fixed generic diagnostic.
Sourcepub fn new(
session_id: SessionId,
run_id: RunId,
conversation_id: ConversationId,
) -> Self
pub fn new( session_id: SessionId, run_id: RunId, conversation_id: ConversationId, ) -> Self
Build a run record for a session.