Add Phase 6 jobs reflection

This commit is contained in:
Meta Vens 2026-04-26 02:24:56 +01:00
commit 78965396de
20 changed files with 1196 additions and 47 deletions

View file

@ -341,6 +341,11 @@ client_request_definitions! {
params: v2::ThreadEpiphanySceneParams,
response: v2::ThreadEpiphanySceneResponse,
},
#[experimental("thread/epiphany/jobs")]
ThreadEpiphanyJobs => "thread/epiphany/jobs" {
params: v2::ThreadEpiphanyJobsParams,
response: v2::ThreadEpiphanyJobsResponse,
},
#[experimental("thread/epiphany/index")]
ThreadEpiphanyIndex => "thread/epiphany/index" {
params: v2::ThreadEpiphanyIndexParams,
@ -1745,6 +1750,64 @@ mod tests {
Ok(())
}
#[test]
fn serialize_thread_epiphany_jobs_response() -> Result<()> {
let response = ClientResponse::ThreadEpiphanyJobs {
request_id: RequestId::Integer(8),
response: v2::ThreadEpiphanyJobsResponse {
thread_id: "thr_123".to_string(),
source: v2::ThreadEpiphanyJobsSource::Live,
state_revision: Some(3),
jobs: vec![v2::ThreadEpiphanyJob {
id: "retrieval-index".to_string(),
kind: v2::ThreadEpiphanyJobKind::Indexing,
scope: "/workspace".to_string(),
owner_role: "epiphany-core".to_string(),
status: v2::ThreadEpiphanyJobStatus::Needed,
items_processed: Some(12),
items_total: None,
progress_note: Some(
"Retrieval catalog is stale; refresh is available.".to_string(),
),
last_checkpoint_at_unix_seconds: Some(1_744_500_000),
blocking_reason: None,
linked_subgoal_ids: vec!["phase-6".to_string()],
linked_graph_node_ids: vec!["retrieval".to_string()],
}],
},
};
assert_eq!(response.id(), &RequestId::Integer(8));
assert_eq!(response.method(), "thread/epiphany/jobs");
assert_eq!(
json!({
"method": "thread/epiphany/jobs",
"id": 8,
"response": {
"threadId": "thr_123",
"source": "live",
"stateRevision": 3,
"jobs": [
{
"id": "retrieval-index",
"kind": "indexing",
"scope": "/workspace",
"ownerRole": "epiphany-core",
"status": "needed",
"itemsProcessed": 12,
"progressNote": "Retrieval catalog is stale; refresh is available.",
"lastCheckpointAtUnixSeconds": 1744500000,
"linkedSubgoalIds": ["phase-6"],
"linkedGraphNodeIds": ["retrieval"]
}
]
}
}),
serde_json::to_value(&response)?,
);
Ok(())
}
#[test]
fn serialize_thread_epiphany_retrieve_response() -> Result<()> {
let response = ClientResponse::ThreadEpiphanyRetrieve {
@ -2615,6 +2678,18 @@ mod tests {
assert_eq!(reason, Some("thread/epiphany/scene"));
}
#[test]
fn thread_epiphany_jobs_is_marked_experimental() {
let request = ClientRequest::ThreadEpiphanyJobs {
request_id: RequestId::Integer(1),
params: v2::ThreadEpiphanyJobsParams {
thread_id: "thr_123".to_string(),
},
};
let reason = crate::experimental_api::ExperimentalApi::experimental_reason(&request);
assert_eq!(reason, Some("thread/epiphany/jobs"));
}
#[test]
fn thread_epiphany_index_is_marked_experimental() {
let request = ClientRequest::ThreadEpiphanyIndex {

View file

@ -3985,6 +3985,7 @@ pub enum ThreadEpiphanySceneAction {
Index,
Retrieve,
Distill,
Jobs,
Propose,
Promote,
Update,
@ -4093,6 +4094,84 @@ pub struct ThreadEpiphanySceneChurn {
pub unexplained_writes: Option<u32>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct ThreadEpiphanyJobsParams {
pub thread_id: String,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct ThreadEpiphanyJobsResponse {
pub thread_id: String,
pub source: ThreadEpiphanyJobsSource,
#[serde(default, skip_serializing_if = "Option::is_none")]
#[ts(optional = nullable)]
pub state_revision: Option<u64>,
pub jobs: Vec<ThreadEpiphanyJob>,
}
#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub enum ThreadEpiphanyJobsSource {
Stored,
Live,
}
#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub enum ThreadEpiphanyJobKind {
Indexing,
Remap,
Verification,
Specialist,
}
#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub enum ThreadEpiphanyJobStatus {
Idle,
Needed,
Running,
Blocked,
Unavailable,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct ThreadEpiphanyJob {
pub id: String,
pub kind: ThreadEpiphanyJobKind,
pub scope: String,
pub owner_role: String,
pub status: ThreadEpiphanyJobStatus,
#[serde(default, skip_serializing_if = "Option::is_none")]
#[ts(optional = nullable)]
pub items_processed: Option<u32>,
#[serde(default, skip_serializing_if = "Option::is_none")]
#[ts(optional = nullable)]
pub items_total: Option<u32>,
#[serde(default, skip_serializing_if = "Option::is_none")]
#[ts(optional = nullable)]
pub progress_note: Option<String>,
#[serde(default, skip_serializing_if = "Option::is_none")]
#[ts(optional = nullable)]
pub last_checkpoint_at_unix_seconds: Option<i64>,
#[serde(default, skip_serializing_if = "Option::is_none")]
#[ts(optional = nullable)]
pub blocking_reason: Option<String>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub linked_subgoal_ids: Vec<String>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub linked_graph_node_ids: Vec<String>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]