Add Epiphany distill promote update surfaces
This commit is contained in:
parent
80c29e0934
commit
9834c5d468
47 changed files with 3091 additions and 323 deletions
|
|
@ -341,6 +341,21 @@ client_request_definitions! {
|
|||
params: v2::ThreadEpiphanyIndexParams,
|
||||
response: v2::ThreadEpiphanyIndexResponse,
|
||||
},
|
||||
#[experimental("thread/epiphany/distill")]
|
||||
ThreadEpiphanyDistill => "thread/epiphany/distill" {
|
||||
params: v2::ThreadEpiphanyDistillParams,
|
||||
response: v2::ThreadEpiphanyDistillResponse,
|
||||
},
|
||||
#[experimental("thread/epiphany/promote")]
|
||||
ThreadEpiphanyPromote => "thread/epiphany/promote" {
|
||||
params: v2::ThreadEpiphanyPromoteParams,
|
||||
response: v2::ThreadEpiphanyPromoteResponse,
|
||||
},
|
||||
#[experimental("thread/epiphany/update")]
|
||||
ThreadEpiphanyUpdate => "thread/epiphany/update" {
|
||||
params: v2::ThreadEpiphanyUpdateParams,
|
||||
response: v2::ThreadEpiphanyUpdateResponse,
|
||||
},
|
||||
#[experimental("thread/epiphany/retrieve")]
|
||||
ThreadEpiphanyRetrieve => "thread/epiphany/retrieve" {
|
||||
params: v2::ThreadEpiphanyRetrieveParams,
|
||||
|
|
@ -1701,6 +1716,126 @@ mod tests {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn serialize_thread_epiphany_distill_response() -> Result<()> {
|
||||
let response = ClientResponse::ThreadEpiphanyDistill {
|
||||
request_id: RequestId::Integer(10),
|
||||
response: v2::ThreadEpiphanyDistillResponse {
|
||||
expected_revision: 7,
|
||||
patch: v2::ThreadEpiphanyUpdatePatch {
|
||||
observations: vec![codex_protocol::protocol::EpiphanyObservation {
|
||||
id: "obs-123".to_string(),
|
||||
summary: "Smoke passed".to_string(),
|
||||
source_kind: "smoke".to_string(),
|
||||
status: "ok".to_string(),
|
||||
code_refs: Vec::new(),
|
||||
evidence_ids: vec!["ev-123".to_string()],
|
||||
}],
|
||||
evidence: vec![codex_protocol::protocol::EpiphanyEvidenceRecord {
|
||||
id: "ev-123".to_string(),
|
||||
kind: "verification".to_string(),
|
||||
status: "ok".to_string(),
|
||||
summary: "Smoke passed".to_string(),
|
||||
code_refs: Vec::new(),
|
||||
}],
|
||||
..Default::default()
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
assert_eq!(response.id(), &RequestId::Integer(10));
|
||||
assert_eq!(response.method(), "thread/epiphany/distill");
|
||||
assert_eq!(
|
||||
json!({
|
||||
"method": "thread/epiphany/distill",
|
||||
"id": 10,
|
||||
"response": {
|
||||
"expectedRevision": 7,
|
||||
"patch": {
|
||||
"observations": [
|
||||
{
|
||||
"id": "obs-123",
|
||||
"summary": "Smoke passed",
|
||||
"source_kind": "smoke",
|
||||
"status": "ok",
|
||||
"evidence_ids": ["ev-123"]
|
||||
}
|
||||
],
|
||||
"evidence": [
|
||||
{
|
||||
"id": "ev-123",
|
||||
"kind": "verification",
|
||||
"status": "ok",
|
||||
"summary": "Smoke passed"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}),
|
||||
serde_json::to_value(&response)?,
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn serialize_thread_epiphany_promote_response() -> Result<()> {
|
||||
let response = ClientResponse::ThreadEpiphanyPromote {
|
||||
request_id: RequestId::Integer(11),
|
||||
response: v2::ThreadEpiphanyPromoteResponse {
|
||||
accepted: false,
|
||||
reasons: vec!["verifierEvidence.status must be accepting".to_string()],
|
||||
epiphany_state: None,
|
||||
},
|
||||
};
|
||||
|
||||
assert_eq!(response.id(), &RequestId::Integer(11));
|
||||
assert_eq!(response.method(), "thread/epiphany/promote");
|
||||
assert_eq!(
|
||||
json!({
|
||||
"method": "thread/epiphany/promote",
|
||||
"id": 11,
|
||||
"response": {
|
||||
"accepted": false,
|
||||
"reasons": ["verifierEvidence.status must be accepting"],
|
||||
"epiphanyState": null
|
||||
}
|
||||
}),
|
||||
serde_json::to_value(&response)?,
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn serialize_thread_epiphany_update_response() -> Result<()> {
|
||||
let response = ClientResponse::ThreadEpiphanyUpdate {
|
||||
request_id: RequestId::Integer(12),
|
||||
response: v2::ThreadEpiphanyUpdateResponse {
|
||||
epiphany_state: codex_protocol::protocol::EpiphanyThreadState {
|
||||
revision: 2,
|
||||
objective: Some("Keep the map honest".to_string()),
|
||||
..Default::default()
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
assert_eq!(response.id(), &RequestId::Integer(12));
|
||||
assert_eq!(response.method(), "thread/epiphany/update");
|
||||
assert_eq!(
|
||||
json!({
|
||||
"method": "thread/epiphany/update",
|
||||
"id": 12,
|
||||
"response": {
|
||||
"epiphanyState": {
|
||||
"revision": 2,
|
||||
"objective": "Keep the map honest"
|
||||
}
|
||||
}
|
||||
}),
|
||||
serde_json::to_value(&response)?,
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn serialize_config_requirements_read() -> Result<()> {
|
||||
let request = ClientRequest::ConfigRequirementsRead {
|
||||
|
|
@ -2225,6 +2360,65 @@ mod tests {
|
|||
assert_eq!(reason, Some("thread/epiphany/index"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn thread_epiphany_distill_is_marked_experimental() {
|
||||
let request = ClientRequest::ThreadEpiphanyDistill {
|
||||
request_id: RequestId::Integer(1),
|
||||
params: v2::ThreadEpiphanyDistillParams {
|
||||
thread_id: "thr_123".to_string(),
|
||||
source_kind: "smoke".to_string(),
|
||||
status: "ok".to_string(),
|
||||
text: "smoke passed".to_string(),
|
||||
subject: Some("thread/epiphany/distill".to_string()),
|
||||
evidence_kind: None,
|
||||
code_refs: Vec::new(),
|
||||
},
|
||||
};
|
||||
let reason = crate::experimental_api::ExperimentalApi::experimental_reason(&request);
|
||||
assert_eq!(reason, Some("thread/epiphany/distill"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn thread_epiphany_promote_is_marked_experimental() {
|
||||
let request = ClientRequest::ThreadEpiphanyPromote {
|
||||
request_id: RequestId::Integer(1),
|
||||
params: v2::ThreadEpiphanyPromoteParams {
|
||||
thread_id: "thr_123".to_string(),
|
||||
expected_revision: Some(1),
|
||||
patch: v2::ThreadEpiphanyUpdatePatch {
|
||||
objective: Some("Keep the map honest".to_string()),
|
||||
..Default::default()
|
||||
},
|
||||
verifier_evidence: codex_protocol::protocol::EpiphanyEvidenceRecord {
|
||||
id: "ev-verifier".to_string(),
|
||||
kind: "verification".to_string(),
|
||||
status: "ok".to_string(),
|
||||
summary: "Verifier accepted promotion".to_string(),
|
||||
code_refs: Vec::new(),
|
||||
},
|
||||
},
|
||||
};
|
||||
let reason = crate::experimental_api::ExperimentalApi::experimental_reason(&request);
|
||||
assert_eq!(reason, Some("thread/epiphany/promote"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn thread_epiphany_update_is_marked_experimental() {
|
||||
let request = ClientRequest::ThreadEpiphanyUpdate {
|
||||
request_id: RequestId::Integer(1),
|
||||
params: v2::ThreadEpiphanyUpdateParams {
|
||||
thread_id: "thr_123".to_string(),
|
||||
expected_revision: Some(1),
|
||||
patch: v2::ThreadEpiphanyUpdatePatch {
|
||||
objective: Some("Keep the map honest".to_string()),
|
||||
..Default::default()
|
||||
},
|
||||
},
|
||||
};
|
||||
let reason = crate::experimental_api::ExperimentalApi::experimental_reason(&request);
|
||||
assert_eq!(reason, Some("thread/epiphany/update"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn thread_realtime_start_is_marked_experimental() {
|
||||
let request = ClientRequest::ThreadRealtimeStart {
|
||||
|
|
|
|||
|
|
@ -57,7 +57,18 @@ use codex_protocol::protocol::AgentStatus as CoreAgentStatus;
|
|||
use codex_protocol::protocol::AskForApproval as CoreAskForApproval;
|
||||
use codex_protocol::protocol::CodexErrorInfo as CoreCodexErrorInfo;
|
||||
use codex_protocol::protocol::CreditsSnapshot as CoreCreditsSnapshot;
|
||||
use codex_protocol::protocol::EpiphanyChurnState as CoreEpiphanyChurnState;
|
||||
use codex_protocol::protocol::EpiphanyCodeRef as CoreEpiphanyCodeRef;
|
||||
use codex_protocol::protocol::EpiphanyEvidenceRecord as CoreEpiphanyEvidenceRecord;
|
||||
use codex_protocol::protocol::EpiphanyGraphCheckpoint as CoreEpiphanyGraphCheckpoint;
|
||||
use codex_protocol::protocol::EpiphanyGraphFrontier as CoreEpiphanyGraphFrontier;
|
||||
use codex_protocol::protocol::EpiphanyGraphs as CoreEpiphanyGraphs;
|
||||
use codex_protocol::protocol::EpiphanyInvariant as CoreEpiphanyInvariant;
|
||||
use codex_protocol::protocol::EpiphanyModeState as CoreEpiphanyModeState;
|
||||
use codex_protocol::protocol::EpiphanyObservation as CoreEpiphanyObservation;
|
||||
use codex_protocol::protocol::EpiphanyRetrievalStatus as CoreEpiphanyRetrievalStatus;
|
||||
use codex_protocol::protocol::EpiphanyScratchPad as CoreEpiphanyScratchPad;
|
||||
use codex_protocol::protocol::EpiphanySubgoal as CoreEpiphanySubgoal;
|
||||
use codex_protocol::protocol::EpiphanyThreadState as CoreEpiphanyThreadState;
|
||||
use codex_protocol::protocol::ExecCommandSource as CoreExecCommandSource;
|
||||
use codex_protocol::protocol::ExecCommandStatus as CoreExecCommandStatus;
|
||||
|
|
@ -3920,6 +3931,111 @@ pub struct ThreadEpiphanyIndexResponse {
|
|||
pub index_summary: ThreadEpiphanyRetrieveIndexSummary,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export_to = "v2/")]
|
||||
pub struct ThreadEpiphanyDistillParams {
|
||||
pub thread_id: String,
|
||||
pub source_kind: String,
|
||||
pub status: String,
|
||||
pub text: String,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional = nullable)]
|
||||
pub subject: Option<String>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional = nullable)]
|
||||
pub evidence_kind: Option<String>,
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub code_refs: Vec<CoreEpiphanyCodeRef>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export_to = "v2/")]
|
||||
pub struct ThreadEpiphanyDistillResponse {
|
||||
pub expected_revision: u64,
|
||||
pub patch: ThreadEpiphanyUpdatePatch,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export_to = "v2/")]
|
||||
pub struct ThreadEpiphanyPromoteParams {
|
||||
pub thread_id: String,
|
||||
#[serde(default)]
|
||||
#[ts(optional = nullable)]
|
||||
pub expected_revision: Option<u64>,
|
||||
pub patch: ThreadEpiphanyUpdatePatch,
|
||||
pub verifier_evidence: CoreEpiphanyEvidenceRecord,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export_to = "v2/")]
|
||||
pub struct ThreadEpiphanyPromoteResponse {
|
||||
pub accepted: bool,
|
||||
pub reasons: Vec<String>,
|
||||
pub epiphany_state: Option<CoreEpiphanyThreadState>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export_to = "v2/")]
|
||||
pub struct ThreadEpiphanyUpdateParams {
|
||||
pub thread_id: String,
|
||||
#[serde(default)]
|
||||
#[ts(optional = nullable)]
|
||||
pub expected_revision: Option<u64>,
|
||||
pub patch: ThreadEpiphanyUpdatePatch,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS, Default)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export_to = "v2/")]
|
||||
pub struct ThreadEpiphanyUpdatePatch {
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional = nullable)]
|
||||
pub objective: Option<String>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional = nullable)]
|
||||
pub active_subgoal_id: Option<String>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional = nullable)]
|
||||
pub subgoals: Option<Vec<CoreEpiphanySubgoal>>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional = nullable)]
|
||||
pub invariants: Option<Vec<CoreEpiphanyInvariant>>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional = nullable)]
|
||||
pub graphs: Option<CoreEpiphanyGraphs>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional = nullable)]
|
||||
pub graph_frontier: Option<CoreEpiphanyGraphFrontier>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional = nullable)]
|
||||
pub graph_checkpoint: Option<CoreEpiphanyGraphCheckpoint>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional = nullable)]
|
||||
pub scratch: Option<CoreEpiphanyScratchPad>,
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub observations: Vec<CoreEpiphanyObservation>,
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub evidence: Vec<CoreEpiphanyEvidenceRecord>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional = nullable)]
|
||||
pub churn: Option<CoreEpiphanyChurnState>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional = nullable)]
|
||||
pub mode: Option<CoreEpiphanyModeState>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export_to = "v2/")]
|
||||
pub struct ThreadEpiphanyUpdateResponse {
|
||||
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