Add Epiphany state update notification
This commit is contained in:
parent
b36cee6eb5
commit
cabad31b5e
17 changed files with 1039 additions and 40 deletions
|
|
@ -1094,6 +1094,8 @@ server_notification_definitions! {
|
|||
GuardianWarning => "guardianWarning" (v2::GuardianWarningNotification),
|
||||
DeprecationNotice => "deprecationNotice" (v2::DeprecationNoticeNotification),
|
||||
ConfigWarning => "configWarning" (v2::ConfigWarningNotification),
|
||||
#[experimental("thread/epiphany/stateUpdated")]
|
||||
ThreadEpiphanyStateUpdated => "thread/epiphany/stateUpdated" (v2::ThreadEpiphanyStateUpdatedNotification),
|
||||
FuzzyFileSearchSessionUpdated => "fuzzyFileSearch/sessionUpdated" (FuzzyFileSearchSessionUpdatedNotification),
|
||||
FuzzyFileSearchSessionCompleted => "fuzzyFileSearch/sessionCompleted" (FuzzyFileSearchSessionCompletedNotification),
|
||||
#[experimental("thread/realtime/started")]
|
||||
|
|
@ -1881,6 +1883,34 @@ mod tests {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn serialize_thread_epiphany_state_updated_notification() -> Result<()> {
|
||||
let notification = ServerNotification::ThreadEpiphanyStateUpdated(
|
||||
v2::ThreadEpiphanyStateUpdatedNotification {
|
||||
thread_id: "thr_123".to_string(),
|
||||
epiphany_state: codex_protocol::protocol::EpiphanyThreadState {
|
||||
revision: 7,
|
||||
objective: Some("Keep the map live".to_string()),
|
||||
..Default::default()
|
||||
},
|
||||
},
|
||||
);
|
||||
assert_eq!(
|
||||
json!({
|
||||
"method": "thread/epiphany/stateUpdated",
|
||||
"params": {
|
||||
"threadId": "thr_123",
|
||||
"epiphanyState": {
|
||||
"revision": 7,
|
||||
"objective": "Keep the map live"
|
||||
}
|
||||
}
|
||||
}),
|
||||
serde_json::to_value(¬ification)?,
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn serialize_config_requirements_read() -> Result<()> {
|
||||
let request = ClientRequest::ConfigRequirementsRead {
|
||||
|
|
@ -2477,6 +2507,18 @@ mod tests {
|
|||
assert_eq!(reason, Some("thread/epiphany/update"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn thread_epiphany_state_updated_notification_is_marked_experimental() {
|
||||
let notification = ServerNotification::ThreadEpiphanyStateUpdated(
|
||||
v2::ThreadEpiphanyStateUpdatedNotification {
|
||||
thread_id: "thr_123".to_string(),
|
||||
epiphany_state: codex_protocol::protocol::EpiphanyThreadState::default(),
|
||||
},
|
||||
);
|
||||
let reason = crate::experimental_api::ExperimentalApi::experimental_reason(¬ification);
|
||||
assert_eq!(reason, Some("thread/epiphany/stateUpdated"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn thread_realtime_start_is_marked_experimental() {
|
||||
let request = ClientRequest::ThreadRealtimeStart {
|
||||
|
|
|
|||
|
|
@ -4053,6 +4053,14 @@ pub struct ThreadEpiphanyUpdateResponse {
|
|||
pub epiphany_state: CoreEpiphanyThreadState,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export_to = "v2/")]
|
||||
pub struct ThreadEpiphanyStateUpdatedNotification {
|
||||
pub thread_id: String,
|
||||
pub epiphany_state: CoreEpiphanyThreadState,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export_to = "v2/")]
|
||||
|
|
|
|||
Reference in a new issue