Skip to content

Commit a324eb4

Browse files
committed
Merge remote-tracking branch 'origin/main'
# Conflicts: # mobile/garyx-mobile/App/GaryxMobile/GaryxMobileModel+ThreadStream.swift
2 parents a035f12 + 7c68380 commit a324eb4

55 files changed

Lines changed: 5061 additions & 1720 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

TODO.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# TODO
2+
3+
> 临时兼容债清单:这里记录的是为了当前版本兼容而保留、但不应该长期存在的设计债。清掉对应债务后,需要同步删除相关兼容代码。
4+
5+
1. 删除旧 subprocess plugin 的 `dispatch_outbound` 兼容 adapter。
6+
当前内置 channel 和新 subprocess plugin 已统一到 `StreamDispatchEnvelope` /
7+
`dispatch_stream_event` outbound 契约;旧 subprocess plugin 仍可能只声明
8+
`dispatch_outbound` 能力,所以 `garyx-channels` 暂时保留
9+
`StreamEvent` -> `ChannelOutboundContent` -> `dispatch_outbound` 的 adapter。
10+
这个 adapter 只是兼容旧插件的边界妥协,不是长期主路径。等所有受支持插件都声明
11+
`capabilities.dispatch_stream_event = true` 后,应删除该 fallback adapter 和对应测试。

codex-sdk/src/client.rs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ use crate::error::CodexError;
99
use crate::transport::CodexTransport;
1010
use crate::types::{
1111
Capabilities, ClientInfo, InitializeParams, InputItem, JsonRpcNotification, ThreadForkParams,
12-
ThreadResumeParams, ThreadStartParams, TurnInterruptParams, TurnStartParams, TurnSteerParams,
13-
extract_thread_id, extract_turn_id,
12+
ThreadResumeParams, ThreadStartParams, TurnInterruptParams, TurnStartOptions, TurnStartParams,
13+
TurnSteerParams, extract_thread_id, extract_turn_id,
1414
};
1515

1616
// ---------------------------------------------------------------------------
@@ -173,12 +173,26 @@ impl CodexClient {
173173
&self,
174174
thread_id: &str,
175175
input: Vec<InputItem>,
176+
) -> Result<String, CodexError> {
177+
self.start_turn_with_options(thread_id, input, TurnStartOptions::default())
178+
.await
179+
}
180+
181+
/// Start a turn with optional sticky execution settings.
182+
pub async fn start_turn_with_options(
183+
&self,
184+
thread_id: &str,
185+
input: Vec<InputItem>,
186+
options: TurnStartOptions,
176187
) -> Result<String, CodexError> {
177188
self.require_initialized()?;
178189

179190
let params = TurnStartParams {
180191
thread_id: thread_id.to_owned(),
181192
input,
193+
model: options.model,
194+
effort: options.effort,
195+
service_tier: options.service_tier,
182196
};
183197
let value = serde_json::to_value(&params)
184198
.map_err(|e| CodexError::Fatal(format!("serialize error: {e}")))?;

codex-sdk/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ pub use types::{
1919
AgentMessageDelta, Capabilities, ClientInfo, CommandApprovalRequest, FileChangeApprovalRequest,
2020
InitializeParams, InputItem, ItemEventParams, JsonRpcNotification, ThreadForkParams,
2121
ThreadResumeParams, ThreadStartParams, TurnCompletedParams, TurnInfo, TurnInterruptParams,
22-
TurnStartParams, TurnSteerParams, UsageInfo,
22+
TurnStartOptions, TurnStartParams, TurnSteerParams, UsageInfo,
2323
};

codex-sdk/src/types.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,24 @@ pub enum InputItem {
170170
pub struct TurnStartParams {
171171
pub thread_id: String,
172172
pub input: Vec<InputItem>,
173+
#[serde(skip_serializing_if = "Option::is_none")]
174+
pub model: Option<String>,
175+
#[serde(skip_serializing_if = "Option::is_none")]
176+
pub effort: Option<String>,
177+
#[serde(skip_serializing_if = "Option::is_none")]
178+
pub service_tier: Option<String>,
179+
}
180+
181+
/// Optional sticky execution settings for `turn/start`.
182+
///
183+
/// The current app-server schema applies these to the current turn and
184+
/// subsequent turns. Omit fields to let the thread or local Codex defaults
185+
/// decide.
186+
#[derive(Debug, Clone, Default)]
187+
pub struct TurnStartOptions {
188+
pub model: Option<String>,
189+
pub effort: Option<String>,
190+
pub service_tier: Option<String>,
173191
}
174192

175193
/// Parameters for `turn/steer`.

codex-sdk/src/types/tests.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,18 @@ fn test_turn_start_params_serialization() {
193193
input: vec![InputItem::Text {
194194
text: "hi".to_owned(),
195195
}],
196+
model: Some("gpt-5.4".to_owned()),
197+
effort: Some("medium".to_owned()),
198+
service_tier: Some("priority".to_owned()),
196199
};
197200
let val = serde_json::to_value(&params).unwrap();
198201
assert_eq!(val["threadId"], "th_1");
199202
assert_eq!(val["input"][0]["type"], "text");
200203
assert_eq!(val["input"][0]["text"], "hi");
204+
assert_eq!(val["model"], "gpt-5.4");
205+
assert_eq!(val["effort"], "medium");
206+
assert_eq!(val["serviceTier"], "priority");
207+
assert!(val.get("modelReasoningEffort").is_none());
201208
}
202209

203210
#[test]

0 commit comments

Comments
 (0)