Skip to main content

objectiveai_sdk/functions/executions/response/streaming/
function_execution_chunk_log.rs

1//! On-disk shape of a `FunctionExecutionChunk` log file.
2//!
3//! Mirrors [`super::FunctionExecutionChunk`]'s field-by-field shape
4//! with three type swaps and one order tweak:
5//!
6//! - `tasks: Vec<TaskChunk>` → `Vec<task_log_reference::LogReference>`
7//!   (untagged enum dispatching to function-execution or vector-completion
8//!   task references; each task in its own file)
9//! - `retry_token: Option<String>` →
10//!   `Option<LogReference>` (plain — token extracted to its own file)
11//! - `reasoning: Option<ReasoningSummaryChunk>` →
12//!   `Option<reasoning_summary_log_reference::LogReference>` (reasoning
13//!   extracted to its own file)
14//!
15//! Field order matches what the legacy `to_value(&shell) +
16//! Map::insert` chain produced on disk — specifically, `reasoning`
17//! lands at the END of the object (appended via Map::insert),
18//! NOT in the middle where the wire chunk's struct declaration puts
19//! it. Mirroring that order keeps the snapshot tests byte-identical.
20
21use schemars::JsonSchema;
22use serde::{Deserialize, Serialize};
23
24use crate::agent;
25use crate::error;
26use crate::logs::LogReference;
27use crate::functions::executions::response;
28
29use super::{reasoning_summary_log_reference, task_log_reference};
30
31#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
32#[schemars(
33    rename = "functions.executions.response.streaming.FunctionExecutionChunkLog"
34)]
35pub struct FunctionExecutionChunkLog {
36    pub id: String,
37    pub tasks: Vec<task_log_reference::LogReference>,
38    #[serde(skip_serializing_if = "Option::is_none")]
39    #[schemars(extend("omitempty" = true))]
40    pub tasks_errors: Option<bool>,
41    #[serde(skip_serializing_if = "Option::is_none")]
42    #[schemars(extend("omitempty" = true))]
43    pub output: Option<response::Output>,
44    #[serde(skip_serializing_if = "Option::is_none")]
45    #[schemars(extend("omitempty" = true))]
46    pub error: Option<error::ResponseError>,
47    #[serde(skip_serializing_if = "Option::is_none")]
48    #[schemars(extend("omitempty" = true))]
49    pub retry_token: Option<LogReference>,
50    pub created: u64,
51    pub function: Option<crate::RemotePath>,
52    pub profile: Option<crate::RemotePath>,
53    pub object: response::streaming::Object,
54    #[serde(skip_serializing_if = "Option::is_none")]
55    #[schemars(extend("omitempty" = true))]
56    pub usage: Option<agent::completions::response::Usage>,
57    /// Appended at the end to match the legacy on-disk order: the
58    /// old code inserted `reasoning` via `Map::insert` AFTER all
59    /// the shell fields, putting it at the tail of the object.
60    #[serde(skip_serializing_if = "Option::is_none")]
61    #[schemars(extend("omitempty" = true))]
62    pub reasoning: Option<reasoning_summary_log_reference::LogReference>,
63}