Add Epiphany MVP coordinator

This commit is contained in:
Meta Vens 2026-04-28 18:43:46 +01:00
commit b7f4a03ff8
16 changed files with 1773 additions and 31 deletions

View file

@ -15105,6 +15105,57 @@
],
"type": "string"
},
"ThreadEpiphanyCoordinatorAction": {
"enum": [
"prepareCheckpoint",
"compactRehydrateReorient",
"launchReorientWorker",
"waitForReorientWorker",
"reviewReorientResult",
"regatherManually",
"launchModeling",
"reviewModelingResult",
"launchVerification",
"reviewVerificationResult",
"continueImplementation"
],
"type": "string"
},
"ThreadEpiphanyCoordinatorSignals": {
"properties": {
"crrcAction": {
"$ref": "#/definitions/v2/ThreadEpiphanyCrrcAction"
},
"modelingResultStatus": {
"$ref": "#/definitions/v2/ThreadEpiphanyRoleResultStatus"
},
"pressureLevel": {
"$ref": "#/definitions/v2/ThreadEpiphanyPressureLevel"
},
"reorientAction": {
"$ref": "#/definitions/v2/ThreadEpiphanyReorientAction"
},
"reorientResultStatus": {
"$ref": "#/definitions/v2/ThreadEpiphanyReorientResultStatus"
},
"shouldPrepareCompaction": {
"type": "boolean"
},
"verificationResultStatus": {
"$ref": "#/definitions/v2/ThreadEpiphanyRoleResultStatus"
}
},
"required": [
"crrcAction",
"modelingResultStatus",
"pressureLevel",
"reorientAction",
"reorientResultStatus",
"shouldPrepareCompaction",
"verificationResultStatus"
],
"type": "object"
},
"ThreadEpiphanyCrrcAction": {
"enum": [
"continue",
@ -16260,6 +16311,7 @@
"context",
"jobs",
"roles",
"coordinator",
"roleLaunch",
"roleResult",
"jobLaunch",

View file

@ -12992,6 +12992,57 @@
],
"type": "string"
},
"ThreadEpiphanyCoordinatorAction": {
"enum": [
"prepareCheckpoint",
"compactRehydrateReorient",
"launchReorientWorker",
"waitForReorientWorker",
"reviewReorientResult",
"regatherManually",
"launchModeling",
"reviewModelingResult",
"launchVerification",
"reviewVerificationResult",
"continueImplementation"
],
"type": "string"
},
"ThreadEpiphanyCoordinatorSignals": {
"properties": {
"crrcAction": {
"$ref": "#/definitions/ThreadEpiphanyCrrcAction"
},
"modelingResultStatus": {
"$ref": "#/definitions/ThreadEpiphanyRoleResultStatus"
},
"pressureLevel": {
"$ref": "#/definitions/ThreadEpiphanyPressureLevel"
},
"reorientAction": {
"$ref": "#/definitions/ThreadEpiphanyReorientAction"
},
"reorientResultStatus": {
"$ref": "#/definitions/ThreadEpiphanyReorientResultStatus"
},
"shouldPrepareCompaction": {
"type": "boolean"
},
"verificationResultStatus": {
"$ref": "#/definitions/ThreadEpiphanyRoleResultStatus"
}
},
"required": [
"crrcAction",
"modelingResultStatus",
"pressureLevel",
"reorientAction",
"reorientResultStatus",
"shouldPrepareCompaction",
"verificationResultStatus"
],
"type": "object"
},
"ThreadEpiphanyCrrcAction": {
"enum": [
"continue",
@ -14147,6 +14198,7 @@
"context",
"jobs",
"roles",
"coordinator",
"roleLaunch",
"roleResult",
"jobLaunch",

View file

@ -0,0 +1,5 @@
// GENERATED CODE! DO NOT MODIFY BY HAND!
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type ThreadEpiphanyCoordinatorAction = "prepareCheckpoint" | "compactRehydrateReorient" | "launchReorientWorker" | "waitForReorientWorker" | "reviewReorientResult" | "regatherManually" | "launchModeling" | "reviewModelingResult" | "launchVerification" | "reviewVerificationResult" | "continueImplementation";

View file

@ -0,0 +1,10 @@
// GENERATED CODE! DO NOT MODIFY BY HAND!
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { ThreadEpiphanyCrrcAction } from "./ThreadEpiphanyCrrcAction";
import type { ThreadEpiphanyPressureLevel } from "./ThreadEpiphanyPressureLevel";
import type { ThreadEpiphanyReorientAction } from "./ThreadEpiphanyReorientAction";
import type { ThreadEpiphanyReorientResultStatus } from "./ThreadEpiphanyReorientResultStatus";
import type { ThreadEpiphanyRoleResultStatus } from "./ThreadEpiphanyRoleResultStatus";
export type ThreadEpiphanyCoordinatorSignals = { pressureLevel: ThreadEpiphanyPressureLevel, shouldPrepareCompaction: boolean, reorientAction: ThreadEpiphanyReorientAction, crrcAction: ThreadEpiphanyCrrcAction, modelingResultStatus: ThreadEpiphanyRoleResultStatus, verificationResultStatus: ThreadEpiphanyRoleResultStatus, reorientResultStatus: ThreadEpiphanyReorientResultStatus, };

View file

@ -2,4 +2,4 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type ThreadEpiphanySceneAction = "index" | "retrieve" | "distill" | "context" | "jobs" | "roles" | "roleLaunch" | "roleResult" | "jobLaunch" | "jobInterrupt" | "freshness" | "pressure" | "reorient" | "crrc" | "reorientLaunch" | "reorientResult" | "reorientAccept" | "propose" | "promote" | "update";
export type ThreadEpiphanySceneAction = "index" | "retrieve" | "distill" | "context" | "jobs" | "roles" | "coordinator" | "roleLaunch" | "roleResult" | "jobLaunch" | "jobInterrupt" | "freshness" | "pressure" | "reorient" | "crrc" | "reorientLaunch" | "reorientResult" | "reorientAccept" | "propose" | "promote" | "update";

View file

@ -321,6 +321,8 @@ export type { ThreadEpiphanyContext } from "./ThreadEpiphanyContext";
export type { ThreadEpiphanyContextMissing } from "./ThreadEpiphanyContextMissing";
export type { ThreadEpiphanyContextSource } from "./ThreadEpiphanyContextSource";
export type { ThreadEpiphanyContextStateStatus } from "./ThreadEpiphanyContextStateStatus";
export type { ThreadEpiphanyCoordinatorAction } from "./ThreadEpiphanyCoordinatorAction";
export type { ThreadEpiphanyCoordinatorSignals } from "./ThreadEpiphanyCoordinatorSignals";
export type { ThreadEpiphanyCrrcAction } from "./ThreadEpiphanyCrrcAction";
export type { ThreadEpiphanyCrrcRecommendation } from "./ThreadEpiphanyCrrcRecommendation";
export type { ThreadEpiphanyFreshnessSource } from "./ThreadEpiphanyFreshnessSource";

View file

@ -351,6 +351,11 @@ client_request_definitions! {
params: v2::ThreadEpiphanyRolesParams,
response: v2::ThreadEpiphanyRolesResponse,
},
#[experimental("thread/epiphany/coordinator")]
ThreadEpiphanyCoordinator => "thread/epiphany/coordinator" {
params: v2::ThreadEpiphanyCoordinatorParams,
response: v2::ThreadEpiphanyCoordinatorResponse,
},
#[experimental("thread/epiphany/roleLaunch")]
ThreadEpiphanyRoleLaunch => "thread/epiphany/roleLaunch" {
params: v2::ThreadEpiphanyRoleLaunchParams,
@ -1742,6 +1747,7 @@ mod tests {
v2::ThreadEpiphanySceneAction::Context,
v2::ThreadEpiphanySceneAction::Jobs,
v2::ThreadEpiphanySceneAction::Roles,
v2::ThreadEpiphanySceneAction::Coordinator,
v2::ThreadEpiphanySceneAction::RoleLaunch,
v2::ThreadEpiphanySceneAction::RoleResult,
v2::ThreadEpiphanySceneAction::JobLaunch,
@ -1846,6 +1852,7 @@ mod tests {
"context",
"jobs",
"roles",
"coordinator",
"roleLaunch",
"roleResult",
"jobLaunch",
@ -2012,6 +2019,89 @@ mod tests {
Ok(())
}
#[test]
fn serialize_thread_epiphany_coordinator_response() -> Result<()> {
let response = ClientResponse::ThreadEpiphanyCoordinator {
request_id: RequestId::Integer(8),
response: v2::ThreadEpiphanyCoordinatorResponse {
thread_id: "thr_123".to_string(),
source: v2::ThreadEpiphanyRolesSource::Live,
state_status: v2::ThreadEpiphanyReorientStateStatus::Ready,
state_revision: Some(4),
action: v2::ThreadEpiphanyCoordinatorAction::LaunchModeling,
target_role: Some(v2::ThreadEpiphanyRoleId::Modeling),
recommended_scene_action: Some(v2::ThreadEpiphanySceneAction::RoleLaunch),
requires_review: false,
can_auto_run: true,
reason: "The modeling/checkpoint lane is ready.".to_string(),
source_signals: v2::ThreadEpiphanyCoordinatorSignals {
pressure_level: v2::ThreadEpiphanyPressureLevel::Low,
should_prepare_compaction: false,
reorient_action: v2::ThreadEpiphanyReorientAction::Resume,
crrc_action: v2::ThreadEpiphanyCrrcAction::Continue,
modeling_result_status: v2::ThreadEpiphanyRoleResultStatus::MissingBinding,
verification_result_status: v2::ThreadEpiphanyRoleResultStatus::MissingBinding,
reorient_result_status: v2::ThreadEpiphanyReorientResultStatus::MissingBinding,
},
roles: vec![v2::ThreadEpiphanyRoleLane {
id: v2::ThreadEpiphanyRoleId::Modeling,
title: "Modeling / Checkpoint".to_string(),
owner_role: "epiphany-modeler".to_string(),
status: v2::ThreadEpiphanyRoleStatus::Ready,
note: "Checkpoint ready.".to_string(),
jobs: Vec::new(),
authority_scopes: vec!["thread/epiphany/roleLaunch".to_string()],
recommended_action: Some(v2::ThreadEpiphanySceneAction::RoleLaunch),
}],
note: "Coordinator is read-only.".to_string(),
},
};
assert_eq!(response.id(), &RequestId::Integer(8));
assert_eq!(response.method(), "thread/epiphany/coordinator");
assert_eq!(
json!({
"method": "thread/epiphany/coordinator",
"id": 8,
"response": {
"threadId": "thr_123",
"source": "live",
"stateStatus": "ready",
"stateRevision": 4,
"action": "launchModeling",
"targetRole": "modeling",
"recommendedSceneAction": "roleLaunch",
"requiresReview": false,
"canAutoRun": true,
"reason": "The modeling/checkpoint lane is ready.",
"sourceSignals": {
"pressureLevel": "low",
"shouldPrepareCompaction": false,
"reorientAction": "resume",
"crrcAction": "continue",
"modelingResultStatus": "missingBinding",
"verificationResultStatus": "missingBinding",
"reorientResultStatus": "missingBinding"
},
"roles": [
{
"id": "modeling",
"title": "Modeling / Checkpoint",
"ownerRole": "epiphany-modeler",
"status": "ready",
"note": "Checkpoint ready.",
"authorityScopes": ["thread/epiphany/roleLaunch"],
"recommendedAction": "roleLaunch"
}
],
"note": "Coordinator is read-only."
}
}),
serde_json::to_value(&response)?,
);
Ok(())
}
#[test]
fn serialize_thread_epiphany_role_launch_response() -> Result<()> {
let response = ClientResponse::ThreadEpiphanyRoleLaunch {
@ -4211,6 +4301,18 @@ mod tests {
assert_eq!(reason, Some("thread/epiphany/roles"));
}
#[test]
fn thread_epiphany_coordinator_is_marked_experimental() {
let request = ClientRequest::ThreadEpiphanyCoordinator {
request_id: RequestId::Integer(1),
params: v2::ThreadEpiphanyCoordinatorParams {
thread_id: "thr_123".to_string(),
},
};
let reason = crate::experimental_api::ExperimentalApi::experimental_reason(&request);
assert_eq!(reason, Some("thread/epiphany/coordinator"));
}
#[test]
fn thread_epiphany_role_launch_is_marked_experimental() {
let request = ClientRequest::ThreadEpiphanyRoleLaunch {

View file

@ -3998,6 +3998,7 @@ pub enum ThreadEpiphanySceneAction {
Context,
Jobs,
Roles,
Coordinator,
RoleLaunch,
RoleResult,
JobLaunch,
@ -4303,6 +4304,68 @@ pub enum ThreadEpiphanyRoleResultStatus {
Cancelled,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct ThreadEpiphanyCoordinatorParams {
pub thread_id: String,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct ThreadEpiphanyCoordinatorResponse {
pub thread_id: String,
pub source: ThreadEpiphanyRolesSource,
pub state_status: ThreadEpiphanyReorientStateStatus,
#[serde(default, skip_serializing_if = "Option::is_none")]
#[ts(optional = nullable)]
pub state_revision: Option<u64>,
pub action: ThreadEpiphanyCoordinatorAction,
#[serde(default, skip_serializing_if = "Option::is_none")]
#[ts(optional = nullable)]
pub target_role: Option<ThreadEpiphanyRoleId>,
#[serde(default, skip_serializing_if = "Option::is_none")]
#[ts(optional = nullable)]
pub recommended_scene_action: Option<ThreadEpiphanySceneAction>,
pub requires_review: bool,
pub can_auto_run: bool,
pub reason: String,
pub source_signals: ThreadEpiphanyCoordinatorSignals,
pub roles: Vec<ThreadEpiphanyRoleLane>,
pub note: String,
}
#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub enum ThreadEpiphanyCoordinatorAction {
PrepareCheckpoint,
CompactRehydrateReorient,
LaunchReorientWorker,
WaitForReorientWorker,
ReviewReorientResult,
RegatherManually,
LaunchModeling,
ReviewModelingResult,
LaunchVerification,
ReviewVerificationResult,
ContinueImplementation,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct ThreadEpiphanyCoordinatorSignals {
pub pressure_level: ThreadEpiphanyPressureLevel,
pub should_prepare_compaction: bool,
pub reorient_action: ThreadEpiphanyReorientAction,
pub crrc_action: ThreadEpiphanyCrrcAction,
pub modeling_result_status: ThreadEpiphanyRoleResultStatus,
pub verification_result_status: ThreadEpiphanyRoleResultStatus,
pub reorient_result_status: ThreadEpiphanyReorientResultStatus,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]