Split heartbeat document surface
This commit is contained in:
parent
5acf9de263
commit
b599286949
5 changed files with 288 additions and 282 deletions
|
|
@ -3,10 +3,7 @@ use anyhow::Result;
|
|||
use anyhow::anyhow;
|
||||
use chrono::Duration;
|
||||
use cultcache_rs::CultCache;
|
||||
use cultcache_rs::DatabaseEntry;
|
||||
use cultcache_rs::SingleFileMessagePackBackingStore;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use serde_json::Value;
|
||||
use std::cmp::Reverse;
|
||||
use std::collections::BTreeMap;
|
||||
|
|
@ -14,15 +11,8 @@ use std::collections::BTreeSet;
|
|||
use std::fs;
|
||||
use std::path::Path;
|
||||
|
||||
pub const HEARTBEAT_STATE_TYPE: &str = "epiphany.agent_heartbeat";
|
||||
pub const HEARTBEAT_STATE_KEY: &str = "default";
|
||||
pub const HEARTBEAT_STATE_SCHEMA_VERSION: &str = "epiphany.agent_heartbeat.v0";
|
||||
pub const HEARTBEAT_COGNITION_TYPE: &str = "epiphany.agent_heartbeat_cognition";
|
||||
pub const HEARTBEAT_COGNITION_KEY: &str = "default";
|
||||
pub const HEARTBEAT_COGNITION_SCHEMA_VERSION: &str = "epiphany.agent_heartbeat_cognition.v0";
|
||||
pub const HEARTBEAT_STATUS_SCHEMA_VERSION: &str = "epiphany.agent_heartbeat_status.v0";
|
||||
pub const INITIATIVE_SCHEMA_VERSION: &str = "ghostlight.initiative_schedule.v0";
|
||||
pub const VOID_ROUTINE_SCHEMA_VERSION: &str = "epiphany.void_routine.v0";
|
||||
mod heartbeat_documents;
|
||||
pub use heartbeat_documents::*;
|
||||
|
||||
const HEARTBEAT_ARENA_MAINTENANCE: &str = "maintenance";
|
||||
const HEARTBEAT_ARENA_SCENE: &str = "scene";
|
||||
|
|
@ -40,271 +30,6 @@ const ROLE_ORDER: &[&str] = &[
|
|||
"reorientation",
|
||||
];
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DatabaseEntry)]
|
||||
#[cultcache(
|
||||
type = "epiphany.agent_heartbeat",
|
||||
schema = "EpiphanyHeartbeatStateEntry"
|
||||
)]
|
||||
pub struct EpiphanyHeartbeatStateEntry {
|
||||
#[cultcache(key = 0)]
|
||||
pub schema_version: String,
|
||||
#[cultcache(key = 1)]
|
||||
pub target_heartbeat_rate: f64,
|
||||
#[cultcache(key = 2)]
|
||||
pub scene_clock: f64,
|
||||
#[cultcache(key = 3)]
|
||||
pub selection_policy: HeartbeatSelectionPolicy,
|
||||
#[cultcache(key = 4)]
|
||||
pub pacing_policy: HeartbeatPacingPolicy,
|
||||
#[cultcache(key = 5)]
|
||||
pub participants: Vec<HeartbeatParticipant>,
|
||||
#[cultcache(key = 6)]
|
||||
pub history: Vec<HeartbeatHistoryEvent>,
|
||||
#[cultcache(key = 15, default)]
|
||||
pub extra: BTreeMap<String, Value>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DatabaseEntry)]
|
||||
#[cultcache(
|
||||
type = "epiphany.agent_heartbeat_cognition",
|
||||
schema = "EpiphanyHeartbeatCognitionEntry"
|
||||
)]
|
||||
pub struct EpiphanyHeartbeatCognitionEntry {
|
||||
#[cultcache(key = 0)]
|
||||
pub schema_version: String,
|
||||
#[cultcache(key = 1)]
|
||||
pub updated_at: String,
|
||||
#[cultcache(key = 2, default)]
|
||||
pub latest_run_id: Option<String>,
|
||||
#[cultcache(key = 3, default)]
|
||||
pub latest_artifact_ref: Option<String>,
|
||||
#[cultcache(key = 4, default)]
|
||||
pub source: Option<String>,
|
||||
#[cultcache(key = 5, default)]
|
||||
pub sleep_cycle: Option<Value>,
|
||||
#[cultcache(key = 6, default)]
|
||||
pub memory_resonance: Option<Value>,
|
||||
#[cultcache(key = 7, default)]
|
||||
pub incubation: Option<Value>,
|
||||
#[cultcache(key = 8, default)]
|
||||
pub thought_lanes: Option<Value>,
|
||||
#[cultcache(key = 9, default)]
|
||||
pub bridge: Option<Value>,
|
||||
#[cultcache(key = 10, default)]
|
||||
pub candidate_interventions: Option<Value>,
|
||||
#[cultcache(key = 11, default)]
|
||||
pub appraisals: Option<Value>,
|
||||
#[cultcache(key = 12, default)]
|
||||
pub reactions: Option<Value>,
|
||||
#[cultcache(key = 13, default)]
|
||||
pub extra: BTreeMap<String, Value>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DatabaseEntry)]
|
||||
#[cultcache(
|
||||
type = "epiphany.agent_heartbeat",
|
||||
schema = "EpiphanyHeartbeatStateEntry"
|
||||
)]
|
||||
struct LegacyHeartbeatStateWithCognition {
|
||||
#[cultcache(key = 0)]
|
||||
schema_version: String,
|
||||
#[cultcache(key = 1)]
|
||||
target_heartbeat_rate: f64,
|
||||
#[cultcache(key = 2)]
|
||||
scene_clock: f64,
|
||||
#[cultcache(key = 3)]
|
||||
selection_policy: HeartbeatSelectionPolicy,
|
||||
#[cultcache(key = 4)]
|
||||
pacing_policy: HeartbeatPacingPolicy,
|
||||
#[cultcache(key = 5)]
|
||||
participants: Vec<HeartbeatParticipant>,
|
||||
#[cultcache(key = 6)]
|
||||
history: Vec<HeartbeatHistoryEvent>,
|
||||
#[cultcache(key = 7, default)]
|
||||
sleep_cycle: Option<Value>,
|
||||
#[cultcache(key = 8, default)]
|
||||
memory_resonance: Option<Value>,
|
||||
#[cultcache(key = 9, default)]
|
||||
incubation: Option<Value>,
|
||||
#[cultcache(key = 10, default)]
|
||||
thought_lanes: Option<Value>,
|
||||
#[cultcache(key = 11, default)]
|
||||
bridge: Option<Value>,
|
||||
#[cultcache(key = 12, default)]
|
||||
candidate_interventions: Option<Value>,
|
||||
#[cultcache(key = 13, default)]
|
||||
appraisals: Option<Value>,
|
||||
#[cultcache(key = 14, default)]
|
||||
reactions: Option<Value>,
|
||||
#[cultcache(key = 15, default)]
|
||||
extra: BTreeMap<String, Value>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
|
||||
pub struct HeartbeatSelectionPolicy {
|
||||
pub mode: String,
|
||||
pub reaction_precedence: bool,
|
||||
pub minimum_speed: f64,
|
||||
pub tie_breakers: Vec<String>,
|
||||
#[serde(flatten)]
|
||||
pub extra: BTreeMap<String, Value>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
|
||||
pub struct HeartbeatPacingPolicy {
|
||||
pub cooldown_starts_after_turn_completion: bool,
|
||||
pub work_base_recovery: f64,
|
||||
pub idle_base_recovery: f64,
|
||||
pub sleep_heartbeat_rate_multiplier: f64,
|
||||
pub minimum_effective_rate: f64,
|
||||
#[serde(flatten)]
|
||||
pub extra: BTreeMap<String, Value>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
|
||||
pub struct HeartbeatParticipant {
|
||||
pub agent_id: String,
|
||||
pub role_id: String,
|
||||
pub display_name: String,
|
||||
#[serde(default)]
|
||||
pub arena: String,
|
||||
#[serde(default)]
|
||||
pub participant_kind: String,
|
||||
pub initiative_speed: f64,
|
||||
pub next_ready_at: f64,
|
||||
pub reaction_bias: f64,
|
||||
pub interrupt_threshold: f64,
|
||||
pub current_load: f64,
|
||||
pub status: String,
|
||||
pub constraints: Vec<String>,
|
||||
pub last_action_id: Option<String>,
|
||||
pub last_woke_at: Option<String>,
|
||||
pub last_finished_at: Option<String>,
|
||||
pub pending_turn: Option<HeartbeatPendingTurn>,
|
||||
#[serde(flatten)]
|
||||
pub extra: BTreeMap<String, Value>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
|
||||
pub struct HeartbeatPendingTurn {
|
||||
pub status: String,
|
||||
#[serde(rename = "scheduleId")]
|
||||
pub schedule_id: String,
|
||||
#[serde(rename = "actionId")]
|
||||
pub action_id: String,
|
||||
#[serde(rename = "actionType")]
|
||||
pub action_type: String,
|
||||
#[serde(rename = "actionScale", default)]
|
||||
pub action_scale: String,
|
||||
#[serde(rename = "localAffordanceBasis", default)]
|
||||
pub local_affordance_basis: Vec<String>,
|
||||
#[serde(rename = "startedAt")]
|
||||
pub started_at: String,
|
||||
#[serde(rename = "startedSceneClock")]
|
||||
pub started_scene_clock: f64,
|
||||
#[serde(rename = "baseRecovery")]
|
||||
pub base_recovery: f64,
|
||||
pub recovery: f64,
|
||||
#[serde(rename = "cooldownPolicy")]
|
||||
pub cooldown_policy: String,
|
||||
#[serde(rename = "completedAt", default)]
|
||||
pub completed_at: Option<String>,
|
||||
#[serde(rename = "completedSceneClock", default)]
|
||||
pub completed_scene_clock: Option<f64>,
|
||||
#[serde(rename = "nextReadyAt", default)]
|
||||
pub next_ready_at: Option<f64>,
|
||||
#[serde(flatten)]
|
||||
pub extra: BTreeMap<String, Value>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
|
||||
pub struct HeartbeatHistoryEvent {
|
||||
pub ts: String,
|
||||
#[serde(rename = "scheduleId")]
|
||||
pub schedule_id: String,
|
||||
#[serde(rename = "selectedRole")]
|
||||
pub selected_role: String,
|
||||
#[serde(rename = "selectedAgentId")]
|
||||
pub selected_agent_id: String,
|
||||
#[serde(rename = "actionId")]
|
||||
pub action_id: String,
|
||||
#[serde(rename = "actionType")]
|
||||
pub action_type: String,
|
||||
#[serde(default)]
|
||||
pub arena: String,
|
||||
#[serde(rename = "participantKind", default)]
|
||||
pub participant_kind: String,
|
||||
#[serde(rename = "actionScale", default)]
|
||||
pub action_scale: String,
|
||||
#[serde(rename = "coordinatorAction", default)]
|
||||
pub coordinator_action: Option<String>,
|
||||
#[serde(rename = "targetRole", default)]
|
||||
pub target_role: Option<String>,
|
||||
#[serde(rename = "workRole", default)]
|
||||
pub work_role: Option<String>,
|
||||
#[serde(rename = "sceneClock", default)]
|
||||
pub scene_clock: Option<f64>,
|
||||
#[serde(rename = "nextReadyAt", default)]
|
||||
pub next_ready_at: Option<f64>,
|
||||
#[serde(rename = "turnStatus", default)]
|
||||
pub turn_status: Option<String>,
|
||||
#[serde(rename = "cooldownStartedAfterCompletion", default)]
|
||||
pub cooldown_started_after_completion: Option<bool>,
|
||||
#[serde(flatten)]
|
||||
pub extra: BTreeMap<String, Value>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct HeartbeatTickOptions {
|
||||
pub target_heartbeat_rate: f64,
|
||||
pub coordinator_action: Option<String>,
|
||||
pub target_role: Option<String>,
|
||||
pub urgency: f64,
|
||||
pub schedule_id: String,
|
||||
pub source_scene_ref: String,
|
||||
pub defer_completion: bool,
|
||||
pub agent_store: Option<std::path::PathBuf>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct HeartbeatPumpOptions {
|
||||
pub base_heartbeat_rate: f64,
|
||||
pub min_heartbeat_rate: f64,
|
||||
pub max_heartbeat_rate: f64,
|
||||
pub min_concurrency: usize,
|
||||
pub max_concurrency: usize,
|
||||
pub max_ticks: usize,
|
||||
pub external_urgency: f64,
|
||||
pub coordinator_action: Option<String>,
|
||||
pub target_role: Option<String>,
|
||||
pub schedule_id: String,
|
||||
pub source_scene_ref: String,
|
||||
pub agent_store: Option<std::path::PathBuf>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct HeartbeatCompleteOptions {
|
||||
pub role: String,
|
||||
pub action_id: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct VoidRoutineOptions {
|
||||
pub agent_store: Option<std::path::PathBuf>,
|
||||
pub source: String,
|
||||
pub allow_dream: bool,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct GhostlightSceneParticipantSeed {
|
||||
pub agent_id: String,
|
||||
pub display_name: String,
|
||||
pub initiative_speed: f64,
|
||||
pub reaction_bias: f64,
|
||||
pub interrupt_threshold: f64,
|
||||
pub constraints: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
struct HeartbeatAction {
|
||||
action_id: String,
|
||||
|
|
|
|||
280
epiphany-core/src/heartbeat_state/heartbeat_documents.rs
Normal file
280
epiphany-core/src/heartbeat_state/heartbeat_documents.rs
Normal file
|
|
@ -0,0 +1,280 @@
|
|||
use cultcache_rs::DatabaseEntry;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use serde_json::Value;
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
pub const HEARTBEAT_STATE_TYPE: &str = "epiphany.agent_heartbeat";
|
||||
pub const HEARTBEAT_STATE_KEY: &str = "default";
|
||||
pub const HEARTBEAT_STATE_SCHEMA_VERSION: &str = "epiphany.agent_heartbeat.v0";
|
||||
pub const HEARTBEAT_COGNITION_TYPE: &str = "epiphany.agent_heartbeat_cognition";
|
||||
pub const HEARTBEAT_COGNITION_KEY: &str = "default";
|
||||
pub const HEARTBEAT_COGNITION_SCHEMA_VERSION: &str = "epiphany.agent_heartbeat_cognition.v0";
|
||||
pub const HEARTBEAT_STATUS_SCHEMA_VERSION: &str = "epiphany.agent_heartbeat_status.v0";
|
||||
pub const INITIATIVE_SCHEMA_VERSION: &str = "ghostlight.initiative_schedule.v0";
|
||||
pub const VOID_ROUTINE_SCHEMA_VERSION: &str = "epiphany.void_routine.v0";
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DatabaseEntry)]
|
||||
#[cultcache(
|
||||
type = "epiphany.agent_heartbeat",
|
||||
schema = "EpiphanyHeartbeatStateEntry"
|
||||
)]
|
||||
pub struct EpiphanyHeartbeatStateEntry {
|
||||
#[cultcache(key = 0)]
|
||||
pub schema_version: String,
|
||||
#[cultcache(key = 1)]
|
||||
pub target_heartbeat_rate: f64,
|
||||
#[cultcache(key = 2)]
|
||||
pub scene_clock: f64,
|
||||
#[cultcache(key = 3)]
|
||||
pub selection_policy: HeartbeatSelectionPolicy,
|
||||
#[cultcache(key = 4)]
|
||||
pub pacing_policy: HeartbeatPacingPolicy,
|
||||
#[cultcache(key = 5)]
|
||||
pub participants: Vec<HeartbeatParticipant>,
|
||||
#[cultcache(key = 6)]
|
||||
pub history: Vec<HeartbeatHistoryEvent>,
|
||||
#[cultcache(key = 15, default)]
|
||||
pub extra: BTreeMap<String, Value>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DatabaseEntry)]
|
||||
#[cultcache(
|
||||
type = "epiphany.agent_heartbeat_cognition",
|
||||
schema = "EpiphanyHeartbeatCognitionEntry"
|
||||
)]
|
||||
pub struct EpiphanyHeartbeatCognitionEntry {
|
||||
#[cultcache(key = 0)]
|
||||
pub schema_version: String,
|
||||
#[cultcache(key = 1)]
|
||||
pub updated_at: String,
|
||||
#[cultcache(key = 2, default)]
|
||||
pub latest_run_id: Option<String>,
|
||||
#[cultcache(key = 3, default)]
|
||||
pub latest_artifact_ref: Option<String>,
|
||||
#[cultcache(key = 4, default)]
|
||||
pub source: Option<String>,
|
||||
#[cultcache(key = 5, default)]
|
||||
pub sleep_cycle: Option<Value>,
|
||||
#[cultcache(key = 6, default)]
|
||||
pub memory_resonance: Option<Value>,
|
||||
#[cultcache(key = 7, default)]
|
||||
pub incubation: Option<Value>,
|
||||
#[cultcache(key = 8, default)]
|
||||
pub thought_lanes: Option<Value>,
|
||||
#[cultcache(key = 9, default)]
|
||||
pub bridge: Option<Value>,
|
||||
#[cultcache(key = 10, default)]
|
||||
pub candidate_interventions: Option<Value>,
|
||||
#[cultcache(key = 11, default)]
|
||||
pub appraisals: Option<Value>,
|
||||
#[cultcache(key = 12, default)]
|
||||
pub reactions: Option<Value>,
|
||||
#[cultcache(key = 13, default)]
|
||||
pub extra: BTreeMap<String, Value>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DatabaseEntry)]
|
||||
#[cultcache(
|
||||
type = "epiphany.agent_heartbeat",
|
||||
schema = "EpiphanyHeartbeatStateEntry"
|
||||
)]
|
||||
pub(super) struct LegacyHeartbeatStateWithCognition {
|
||||
#[cultcache(key = 0)]
|
||||
pub(super) schema_version: String,
|
||||
#[cultcache(key = 1)]
|
||||
pub(super) target_heartbeat_rate: f64,
|
||||
#[cultcache(key = 2)]
|
||||
pub(super) scene_clock: f64,
|
||||
#[cultcache(key = 3)]
|
||||
pub(super) selection_policy: HeartbeatSelectionPolicy,
|
||||
#[cultcache(key = 4)]
|
||||
pub(super) pacing_policy: HeartbeatPacingPolicy,
|
||||
#[cultcache(key = 5)]
|
||||
pub(super) participants: Vec<HeartbeatParticipant>,
|
||||
#[cultcache(key = 6)]
|
||||
pub(super) history: Vec<HeartbeatHistoryEvent>,
|
||||
#[cultcache(key = 7, default)]
|
||||
pub(super) sleep_cycle: Option<Value>,
|
||||
#[cultcache(key = 8, default)]
|
||||
pub(super) memory_resonance: Option<Value>,
|
||||
#[cultcache(key = 9, default)]
|
||||
pub(super) incubation: Option<Value>,
|
||||
#[cultcache(key = 10, default)]
|
||||
pub(super) thought_lanes: Option<Value>,
|
||||
#[cultcache(key = 11, default)]
|
||||
pub(super) bridge: Option<Value>,
|
||||
#[cultcache(key = 12, default)]
|
||||
pub(super) candidate_interventions: Option<Value>,
|
||||
#[cultcache(key = 13, default)]
|
||||
pub(super) appraisals: Option<Value>,
|
||||
#[cultcache(key = 14, default)]
|
||||
pub(super) reactions: Option<Value>,
|
||||
#[cultcache(key = 15, default)]
|
||||
pub(super) extra: BTreeMap<String, Value>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
|
||||
pub struct HeartbeatSelectionPolicy {
|
||||
pub mode: String,
|
||||
pub reaction_precedence: bool,
|
||||
pub minimum_speed: f64,
|
||||
pub tie_breakers: Vec<String>,
|
||||
#[serde(flatten)]
|
||||
pub extra: BTreeMap<String, Value>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
|
||||
pub struct HeartbeatPacingPolicy {
|
||||
pub cooldown_starts_after_turn_completion: bool,
|
||||
pub work_base_recovery: f64,
|
||||
pub idle_base_recovery: f64,
|
||||
pub sleep_heartbeat_rate_multiplier: f64,
|
||||
pub minimum_effective_rate: f64,
|
||||
#[serde(flatten)]
|
||||
pub extra: BTreeMap<String, Value>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
|
||||
pub struct HeartbeatParticipant {
|
||||
pub agent_id: String,
|
||||
pub role_id: String,
|
||||
pub display_name: String,
|
||||
#[serde(default)]
|
||||
pub arena: String,
|
||||
#[serde(default)]
|
||||
pub participant_kind: String,
|
||||
pub initiative_speed: f64,
|
||||
pub next_ready_at: f64,
|
||||
pub reaction_bias: f64,
|
||||
pub interrupt_threshold: f64,
|
||||
pub current_load: f64,
|
||||
pub status: String,
|
||||
pub constraints: Vec<String>,
|
||||
pub last_action_id: Option<String>,
|
||||
pub last_woke_at: Option<String>,
|
||||
pub last_finished_at: Option<String>,
|
||||
pub pending_turn: Option<HeartbeatPendingTurn>,
|
||||
#[serde(flatten)]
|
||||
pub extra: BTreeMap<String, Value>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
|
||||
pub struct HeartbeatPendingTurn {
|
||||
pub status: String,
|
||||
#[serde(rename = "scheduleId")]
|
||||
pub schedule_id: String,
|
||||
#[serde(rename = "actionId")]
|
||||
pub action_id: String,
|
||||
#[serde(rename = "actionType")]
|
||||
pub action_type: String,
|
||||
#[serde(rename = "actionScale", default)]
|
||||
pub action_scale: String,
|
||||
#[serde(rename = "localAffordanceBasis", default)]
|
||||
pub local_affordance_basis: Vec<String>,
|
||||
#[serde(rename = "startedAt")]
|
||||
pub started_at: String,
|
||||
#[serde(rename = "startedSceneClock")]
|
||||
pub started_scene_clock: f64,
|
||||
#[serde(rename = "baseRecovery")]
|
||||
pub base_recovery: f64,
|
||||
pub recovery: f64,
|
||||
#[serde(rename = "cooldownPolicy")]
|
||||
pub cooldown_policy: String,
|
||||
#[serde(rename = "completedAt", default)]
|
||||
pub completed_at: Option<String>,
|
||||
#[serde(rename = "completedSceneClock", default)]
|
||||
pub completed_scene_clock: Option<f64>,
|
||||
#[serde(rename = "nextReadyAt", default)]
|
||||
pub next_ready_at: Option<f64>,
|
||||
#[serde(flatten)]
|
||||
pub extra: BTreeMap<String, Value>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
|
||||
pub struct HeartbeatHistoryEvent {
|
||||
pub ts: String,
|
||||
#[serde(rename = "scheduleId")]
|
||||
pub schedule_id: String,
|
||||
#[serde(rename = "selectedRole")]
|
||||
pub selected_role: String,
|
||||
#[serde(rename = "selectedAgentId")]
|
||||
pub selected_agent_id: String,
|
||||
#[serde(rename = "actionId")]
|
||||
pub action_id: String,
|
||||
#[serde(rename = "actionType")]
|
||||
pub action_type: String,
|
||||
#[serde(default)]
|
||||
pub arena: String,
|
||||
#[serde(rename = "participantKind", default)]
|
||||
pub participant_kind: String,
|
||||
#[serde(rename = "actionScale", default)]
|
||||
pub action_scale: String,
|
||||
#[serde(rename = "coordinatorAction", default)]
|
||||
pub coordinator_action: Option<String>,
|
||||
#[serde(rename = "targetRole", default)]
|
||||
pub target_role: Option<String>,
|
||||
#[serde(rename = "workRole", default)]
|
||||
pub work_role: Option<String>,
|
||||
#[serde(rename = "sceneClock", default)]
|
||||
pub scene_clock: Option<f64>,
|
||||
#[serde(rename = "nextReadyAt", default)]
|
||||
pub next_ready_at: Option<f64>,
|
||||
#[serde(rename = "turnStatus", default)]
|
||||
pub turn_status: Option<String>,
|
||||
#[serde(rename = "cooldownStartedAfterCompletion", default)]
|
||||
pub cooldown_started_after_completion: Option<bool>,
|
||||
#[serde(flatten)]
|
||||
pub extra: BTreeMap<String, Value>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct HeartbeatTickOptions {
|
||||
pub target_heartbeat_rate: f64,
|
||||
pub coordinator_action: Option<String>,
|
||||
pub target_role: Option<String>,
|
||||
pub urgency: f64,
|
||||
pub schedule_id: String,
|
||||
pub source_scene_ref: String,
|
||||
pub defer_completion: bool,
|
||||
pub agent_store: Option<std::path::PathBuf>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct HeartbeatPumpOptions {
|
||||
pub base_heartbeat_rate: f64,
|
||||
pub min_heartbeat_rate: f64,
|
||||
pub max_heartbeat_rate: f64,
|
||||
pub min_concurrency: usize,
|
||||
pub max_concurrency: usize,
|
||||
pub max_ticks: usize,
|
||||
pub external_urgency: f64,
|
||||
pub coordinator_action: Option<String>,
|
||||
pub target_role: Option<String>,
|
||||
pub schedule_id: String,
|
||||
pub source_scene_ref: String,
|
||||
pub agent_store: Option<std::path::PathBuf>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct HeartbeatCompleteOptions {
|
||||
pub role: String,
|
||||
pub action_id: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct VoidRoutineOptions {
|
||||
pub agent_store: Option<std::path::PathBuf>,
|
||||
pub source: String,
|
||||
pub allow_dream: bool,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct GhostlightSceneParticipantSeed {
|
||||
pub agent_id: String,
|
||||
pub display_name: String,
|
||||
pub initiative_speed: f64,
|
||||
pub reaction_bias: f64,
|
||||
pub interrupt_threshold: f64,
|
||||
pub constraints: Vec<String>,
|
||||
}
|
||||
|
|
@ -58,6 +58,7 @@ remembers doctrine; the branch remembers the blade.
|
|||
- Thread start route handling and its async lifecycle task now live in `codex_message_processor/thread_start_routes.rs`; root no longer owns `thread_start_task`.
|
||||
- Thread config helpers now live in `codex_message_processor/thread_config.rs`: instruction-source loading, thread config override construction, config-load error shaping, and dynamic-tool validation. The pure dynamic-tool validation contract has module-local unit tests.
|
||||
- Turn control routes now live in `codex_message_processor/turn_routes.rs`: turn start, thread item injection, app-server client info setting, turn steer, turn interrupt, mode normalization, and input-limit validation with module-local unit tests.
|
||||
- Heartbeat durable document/schema types now live in `epiphany-core/src/heartbeat_state/heartbeat_documents.rs`; the root `heartbeat_state.rs` keeps store access, scheduling, status rendering, and Void cognition orchestration for the next cuts. Focused heartbeat tests and `epiphany-core` check pass after the split.
|
||||
- Thread projection now lives in `codex_message_processor/thread_projection.rs`: state-db/thread-store/rollout summary projection, `ConversationSummary` to API `Thread` mapping, thread-title attachment helpers, turn pagination, and rollout turn reconstruction. `codex_message_processor.rs` is about 1,009 lines after this extraction and mostly owns JSON-RPC dispatch, processor construction, shared thread lookup/submit/error helpers, and lifecycle shutdown.
|
||||
- Turn paging/reconstruction now lives in `codex_message_processor/thread_turn_projection.rs`; `thread_projection.rs` keeps state-db/thread-store/rollout summary projection and `ConversationSummary` to API `Thread` mapping. Focused `thread_turns_list` cursor tests and stale in-progress turn interruption coverage pass.
|
||||
- The `thread/turns/list` route handler now lives in `codex_message_processor/thread_turn_routes.rs`, beside the turn projection helpers it consumes. `thread_read_routes.rs` is back to persisted/live thread listing, `thread/read`, loaded-thread listing, and summary reads.
|
||||
|
|
|
|||
Binary file not shown.
File diff suppressed because one or more lines are too long
Reference in a new issue