Type heartbeat timing state
This commit is contained in:
parent
05e0554ae4
commit
f19e99c7fe
12 changed files with 302 additions and 244 deletions
|
|
@ -7,6 +7,7 @@ use cultcache_rs::DatabaseEntry;
|
|||
use cultcache_rs::SingleFileMessagePackBackingStore;
|
||||
use epiphany_core::AgentCanonicalTraitSeed;
|
||||
use epiphany_core::AgentSelfPatch;
|
||||
use epiphany_core::HeartbeatBirthPersonalitySeed;
|
||||
use epiphany_core::apply_agent_canonical_trait_seeds;
|
||||
use epiphany_core::apply_agent_self_patch_document;
|
||||
use epiphany_core::default_heartbeat_state;
|
||||
|
|
@ -1540,11 +1541,11 @@ fn process_heartbeat_seed_patches(
|
|||
};
|
||||
let previous_initiative_speed = participant.initiative_speed;
|
||||
let previous_reaction_bias = participant.reaction_bias;
|
||||
let previous_cooldown = participant
|
||||
.extra
|
||||
.get("personalityCooldownMultiplier")
|
||||
.and_then(Value::as_f64)
|
||||
.unwrap_or(1.0);
|
||||
let previous_cooldown = if participant.personality_cooldown_multiplier > 0.0 {
|
||||
participant.personality_cooldown_multiplier
|
||||
} else {
|
||||
1.0
|
||||
};
|
||||
let initiative_delta = number_from_map(&seed.heartbeat_deltas, "initiativeSpeedDelta");
|
||||
let cooldown_delta = number_from_map(&seed.heartbeat_deltas, "cooldownMultiplierDelta");
|
||||
let urgency = number_from_map(&seed.default_mood_pressure, "urgency");
|
||||
|
|
@ -1554,21 +1555,16 @@ fn process_heartbeat_seed_patches(
|
|||
participant.reaction_bias =
|
||||
round3((participant.reaction_bias + urgency * 0.08 + anxiety * 0.04).clamp(0.05, 2.0));
|
||||
let cooldown = round3((previous_cooldown + cooldown_delta).clamp(0.55, 1.55));
|
||||
participant
|
||||
.extra
|
||||
.insert("personalityCooldownMultiplier".to_string(), json!(cooldown));
|
||||
participant.extra.insert(
|
||||
"birthPersonalitySeed".to_string(),
|
||||
json!({
|
||||
"schemaVersion": "epiphany.birth_heartbeat_seed.v0",
|
||||
"source": "repo-personality accept-init",
|
||||
"projectionId": seed.projection_id,
|
||||
"repoId": seed.repo_id,
|
||||
"heartbeatDeltas": seed.heartbeat_deltas,
|
||||
"defaultMoodPressure": seed.default_mood_pressure,
|
||||
"contract": "Birth personality may seed heartbeat timing once after Self review; later drift belongs to mood, rumination, sleep, and reviewed selfPatch."
|
||||
}),
|
||||
);
|
||||
participant.personality_cooldown_multiplier = cooldown;
|
||||
participant.birth_personality_seed = Some(HeartbeatBirthPersonalitySeed {
|
||||
schema_version: "epiphany.birth_heartbeat_seed.v0".to_string(),
|
||||
source: "repo-personality accept-init".to_string(),
|
||||
projection_id: seed.projection_id.clone(),
|
||||
repo_id: seed.repo_id.clone(),
|
||||
heartbeat_deltas: seed.heartbeat_deltas.clone(),
|
||||
default_mood_pressure: seed.default_mood_pressure.clone(),
|
||||
contract: "Birth personality may seed heartbeat timing once after Self review; later drift belongs to mood, rumination, sleep, and reviewed selfPatch.".to_string(),
|
||||
});
|
||||
applied.push(json!({
|
||||
"roleId": seed.role_id,
|
||||
"status": "applied",
|
||||
|
|
|
|||
|
|
@ -155,7 +155,6 @@ pub fn run_void_routine_store(
|
|||
candidate_interventions: Some(candidate_interventions),
|
||||
appraisals: Some(appraisals),
|
||||
reactions: Some(reactions),
|
||||
extra: BTreeMap::new(),
|
||||
},
|
||||
)?;
|
||||
write_heartbeat_state_entry(store_path, &state)?;
|
||||
|
|
@ -241,19 +240,16 @@ pub fn pump_heartbeat_store(
|
|||
|
||||
let pacing = adaptive_swarm_pacing(&state, &options);
|
||||
state.target_heartbeat_rate = pacing.effective_heartbeat_rate;
|
||||
state.extra.insert(
|
||||
"adaptivePacing".to_string(),
|
||||
serde_json::json!({
|
||||
"schema_version": "epiphany.adaptive_heartbeat_pacing.v0",
|
||||
"contract": "Swarm pressure controls both heartbeat tempo and concurrency. Relaxed systems sleep slow; urgent systems fill more lanes without re-waking unfinished turns.",
|
||||
"pressure": pacing.pressure,
|
||||
"effectiveHeartbeatRate": pacing.effective_heartbeat_rate,
|
||||
"targetConcurrency": pacing.target_concurrency,
|
||||
"runningTurns": pacing.running_turns,
|
||||
"activeParticipants": pacing.active_participants,
|
||||
"signals": pacing.signals,
|
||||
}),
|
||||
);
|
||||
state.adaptive_pacing = Some(HeartbeatAdaptivePacing {
|
||||
schema_version: "epiphany.adaptive_heartbeat_pacing.v0".to_string(),
|
||||
contract: "Swarm pressure controls both heartbeat tempo and concurrency. Relaxed systems sleep slow; urgent systems fill more lanes without re-waking unfinished turns.".to_string(),
|
||||
pressure: pacing.pressure,
|
||||
effective_heartbeat_rate: pacing.effective_heartbeat_rate,
|
||||
target_concurrency: pacing.target_concurrency,
|
||||
running_turns: pacing.running_turns,
|
||||
active_participants: pacing.active_participants,
|
||||
signals: pacing.signals.clone(),
|
||||
});
|
||||
|
||||
let artifact_dir = artifact_dir.as_ref();
|
||||
fs::create_dir_all(artifact_dir)
|
||||
|
|
@ -393,7 +389,6 @@ pub fn update_heartbeat_heat_store(
|
|||
expires_at_scene_clock: options
|
||||
.expires_after_scene_clock
|
||||
.map(|delta| round6(state.scene_clock + delta.max(0.0))),
|
||||
extra: BTreeMap::new(),
|
||||
};
|
||||
state
|
||||
.initiative_heat
|
||||
|
|
@ -484,7 +479,6 @@ pub fn complete_heartbeat_store(
|
|||
next_ready_at: Some(participant.next_ready_at),
|
||||
turn_status: Some("completed".to_string()),
|
||||
cooldown_started_after_completion: Some(true),
|
||||
extra: BTreeMap::new(),
|
||||
};
|
||||
state.history.push(event.clone());
|
||||
trim_history(&mut state);
|
||||
|
|
@ -547,34 +541,16 @@ fn tick_once(
|
|||
completed_at: None,
|
||||
completed_scene_clock: None,
|
||||
next_ready_at: None,
|
||||
extra: BTreeMap::new(),
|
||||
};
|
||||
let mut pending = pending;
|
||||
pending.extra.insert(
|
||||
"personalityCooldownMultiplier".to_string(),
|
||||
serde_json::json!(personality_cooldown_multiplier(&selected)),
|
||||
);
|
||||
pending.extra.insert(
|
||||
"moodCooldownMultiplier".to_string(),
|
||||
serde_json::json!(mood_cooldown_multiplier(&selected)),
|
||||
);
|
||||
pending.extra.insert(
|
||||
"effectiveCooldownMultiplier".to_string(),
|
||||
serde_json::json!(effective_cooldown_multiplier(&selected)),
|
||||
);
|
||||
pending.extra.insert(
|
||||
"initiativeHeatMultiplier".to_string(),
|
||||
serde_json::json!(initiative_heat_multiplier(&selected)),
|
||||
);
|
||||
pending
|
||||
.extra
|
||||
.insert("initiativeFrozen".to_string(), serde_json::json!(true));
|
||||
pending.extra.insert(
|
||||
"initiativeFreezeReason".to_string(),
|
||||
serde_json::json!(
|
||||
personality_cooldown_multiplier: personality_cooldown_multiplier(&selected),
|
||||
mood_cooldown_multiplier: mood_cooldown_multiplier(&selected),
|
||||
initiative_heat_multiplier: initiative_heat_multiplier(&selected),
|
||||
effective_cooldown_multiplier: effective_cooldown_multiplier(&selected),
|
||||
initiative_frozen: true,
|
||||
initiative_freeze_reason: Some(
|
||||
"Participant has an active heartbeat turn; initiative cannot queue it again until the turn completes."
|
||||
.to_string(),
|
||||
),
|
||||
);
|
||||
};
|
||||
state.participants[selected_index].pending_turn = Some(pending.clone());
|
||||
state.participants[selected_index].last_action_id = Some(action.action_id.clone());
|
||||
state.participants[selected_index].last_woke_at = Some(now_iso());
|
||||
|
|
@ -607,7 +583,6 @@ fn tick_once(
|
|||
"completed".to_string()
|
||||
}),
|
||||
cooldown_started_after_completion: Some(true),
|
||||
extra: BTreeMap::new(),
|
||||
};
|
||||
state.history.push(event.clone());
|
||||
trim_history(state);
|
||||
|
|
@ -915,12 +890,9 @@ fn patch_missing_participants(state: &mut EpiphanyHeartbeatStateEntry) {
|
|||
|
||||
fn is_ghostlight_scene_state(state: &EpiphanyHeartbeatStateEntry) -> bool {
|
||||
state
|
||||
.extra
|
||||
.get("protocol")
|
||||
.and_then(Value::as_object)
|
||||
.and_then(|protocol| protocol.get("domain"))
|
||||
.and_then(Value::as_str)
|
||||
== Some("ghostlight")
|
||||
.protocol
|
||||
.as_ref()
|
||||
.is_some_and(|protocol| protocol.domain == "ghostlight")
|
||||
}
|
||||
|
||||
fn participant_index_by_role(state: &EpiphanyHeartbeatStateEntry, role_id: &str) -> Result<usize> {
|
||||
|
|
@ -1255,24 +1227,18 @@ fn apply_personality_timing_profiles(
|
|||
continue;
|
||||
};
|
||||
let timing = personality_timing_for_profile(profile);
|
||||
participant.extra.insert(
|
||||
"personalityCooldownMultiplier".to_string(),
|
||||
serde_json::json!(timing.cooldown_multiplier),
|
||||
);
|
||||
participant.extra.insert(
|
||||
"personalityTiming".to_string(),
|
||||
serde_json::json!({
|
||||
"schema_version": "epiphany.personality_timing.v0",
|
||||
"source": "state/agents.msgpack",
|
||||
"cooldownMultiplier": timing.cooldown_multiplier,
|
||||
"workDrive": timing.work_drive,
|
||||
"handsiness": timing.handsiness,
|
||||
"caution": timing.caution,
|
||||
"ruminationBias": timing.rumination_bias,
|
||||
"basis": timing.basis,
|
||||
"contract": "Cooldown is personality-shaped. Lower multipliers recover faster; higher multipliers yield the floor to other lanes."
|
||||
}),
|
||||
);
|
||||
participant.personality_cooldown_multiplier = timing.cooldown_multiplier;
|
||||
participant.personality_timing = Some(HeartbeatPersonalityTiming {
|
||||
schema_version: "epiphany.personality_timing.v0".to_string(),
|
||||
source: "state/agents.msgpack".to_string(),
|
||||
cooldown_multiplier: timing.cooldown_multiplier,
|
||||
work_drive: timing.work_drive,
|
||||
handsiness: timing.handsiness,
|
||||
caution: timing.caution,
|
||||
rumination_bias: timing.rumination_bias,
|
||||
basis: timing.basis,
|
||||
contract: "Cooldown is personality-shaped. Lower multipliers recover faster; higher multipliers yield the floor to other lanes.".to_string(),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1439,25 +1405,22 @@ fn apply_mood_timing_from_appraisals(state: &mut EpiphanyHeartbeatStateEntry, ap
|
|||
.clamp(0.0, 1.0);
|
||||
let multiplier =
|
||||
(1.10 - urgency * 0.24 - anxiety * 0.38 - reaction_intensity * 0.12).clamp(0.55, 1.25);
|
||||
participant.extra.insert(
|
||||
"moodCooldownMultiplier".to_string(),
|
||||
serde_json::json!(round3(multiplier)),
|
||||
);
|
||||
participant.extra.insert(
|
||||
"moodTiming".to_string(),
|
||||
serde_json::json!({
|
||||
"schema_version": "epiphany.mood_timing.v0",
|
||||
"source": appraisal.get("appraisalId"),
|
||||
"cooldownMultiplier": round3(multiplier),
|
||||
"anxiety": round3(anxiety),
|
||||
"urgency": round3(urgency),
|
||||
"arousal": round3(arousal),
|
||||
"thoughtPressure": round3(thought_pressure),
|
||||
"guardedness": round3(guardedness),
|
||||
"reactionIntensity": round3(reaction_intensity),
|
||||
"contract": "Mood bends personality timing. Anxiety and urgency lower cooldown so the lane that needs the floor most gets it sooner."
|
||||
}),
|
||||
);
|
||||
participant.mood_cooldown_multiplier = round3(multiplier);
|
||||
participant.mood_timing = Some(HeartbeatMoodTiming {
|
||||
schema_version: "epiphany.mood_timing.v0".to_string(),
|
||||
source: appraisal
|
||||
.get("appraisalId")
|
||||
.and_then(Value::as_str)
|
||||
.map(str::to_string),
|
||||
cooldown_multiplier: round3(multiplier),
|
||||
anxiety: round3(anxiety),
|
||||
urgency: round3(urgency),
|
||||
arousal: round3(arousal),
|
||||
thought_pressure: round3(thought_pressure),
|
||||
guardedness: round3(guardedness),
|
||||
reaction_intensity: round3(reaction_intensity),
|
||||
contract: "Mood bends personality timing. Anxiety and urgency lower cooldown so the lane that needs the floor most gets it sooner.".to_string(),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,8 +36,10 @@ pub struct EpiphanyHeartbeatStateEntry {
|
|||
pub history: Vec<HeartbeatHistoryEvent>,
|
||||
#[cultcache(key = 16, default)]
|
||||
pub initiative_heat: HeartbeatInitiativeHeatPolicy,
|
||||
#[cultcache(key = 15, default)]
|
||||
pub extra: BTreeMap<String, Value>,
|
||||
#[cultcache(key = 17, default)]
|
||||
pub protocol: Option<HeartbeatProtocol>,
|
||||
#[cultcache(key = 18, default)]
|
||||
pub adaptive_pacing: Option<HeartbeatAdaptivePacing>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DatabaseEntry)]
|
||||
|
|
@ -72,8 +74,6 @@ pub struct EpiphanyHeartbeatCognitionEntry {
|
|||
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)]
|
||||
|
|
@ -122,8 +122,6 @@ pub struct HeartbeatSelectionPolicy {
|
|||
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)]
|
||||
|
|
@ -133,8 +131,40 @@ pub struct HeartbeatPacingPolicy {
|
|||
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 HeartbeatProtocol {
|
||||
pub domain: String,
|
||||
#[serde(default)]
|
||||
pub scene_id: Option<String>,
|
||||
pub arena: String,
|
||||
pub contract: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
|
||||
pub struct HeartbeatAdaptivePacing {
|
||||
pub schema_version: String,
|
||||
pub contract: String,
|
||||
pub pressure: f64,
|
||||
pub effective_heartbeat_rate: f64,
|
||||
pub target_concurrency: usize,
|
||||
pub running_turns: usize,
|
||||
pub active_participants: usize,
|
||||
pub signals: HeartbeatAdaptivePacingSignals,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
|
||||
pub struct HeartbeatAdaptivePacingSignals {
|
||||
pub external_urgency: f64,
|
||||
pub max_anxiety: f64,
|
||||
pub average_anxiety: f64,
|
||||
pub max_urgency: f64,
|
||||
pub max_arousal: f64,
|
||||
pub max_thought_pressure: f64,
|
||||
pub max_reaction_intensity: f64,
|
||||
pub pending_pressure: f64,
|
||||
pub contract: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
|
|
@ -145,8 +175,6 @@ pub struct HeartbeatInitiativeHeatPolicy {
|
|||
pub global_multiplier: f64,
|
||||
#[serde(default)]
|
||||
pub multipliers: Vec<HeartbeatInitiativeMultiplier>,
|
||||
#[serde(flatten)]
|
||||
pub extra: BTreeMap<String, Value>,
|
||||
}
|
||||
|
||||
impl Default for HeartbeatInitiativeHeatPolicy {
|
||||
|
|
@ -155,7 +183,6 @@ impl Default for HeartbeatInitiativeHeatPolicy {
|
|||
schema_version: default_heat_schema_version(),
|
||||
global_multiplier: default_heat_global_multiplier(),
|
||||
multipliers: Vec::new(),
|
||||
extra: BTreeMap::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -177,8 +204,6 @@ pub struct HeartbeatInitiativeMultiplier {
|
|||
pub updated_at: Option<String>,
|
||||
#[serde(default)]
|
||||
pub expires_at_scene_clock: Option<f64>,
|
||||
#[serde(flatten)]
|
||||
pub extra: BTreeMap<String, Value>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
|
||||
|
|
@ -201,8 +226,80 @@ pub struct HeartbeatParticipant {
|
|||
pub last_woke_at: Option<String>,
|
||||
pub last_finished_at: Option<String>,
|
||||
pub pending_turn: Option<HeartbeatPendingTurn>,
|
||||
#[serde(flatten)]
|
||||
pub extra: BTreeMap<String, Value>,
|
||||
#[serde(default)]
|
||||
pub scene_id: Option<String>,
|
||||
#[serde(default)]
|
||||
pub groups: Vec<String>,
|
||||
#[serde(default = "default_heat_global_multiplier")]
|
||||
pub personality_cooldown_multiplier: f64,
|
||||
#[serde(default = "default_heat_global_multiplier")]
|
||||
pub mood_cooldown_multiplier: f64,
|
||||
#[serde(default = "default_heat_global_multiplier")]
|
||||
pub initiative_heat_multiplier: f64,
|
||||
#[serde(default)]
|
||||
pub initiative_heat: Option<HeartbeatInitiativeHeatProjection>,
|
||||
#[serde(default)]
|
||||
pub personality_timing: Option<HeartbeatPersonalityTiming>,
|
||||
#[serde(default)]
|
||||
pub mood_timing: Option<HeartbeatMoodTiming>,
|
||||
#[serde(default)]
|
||||
pub birth_personality_seed: Option<HeartbeatBirthPersonalitySeed>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
|
||||
pub struct HeartbeatInitiativeHeatProjection {
|
||||
pub schema_version: String,
|
||||
pub global_multiplier: f64,
|
||||
pub effective_multiplier: f64,
|
||||
pub basis: Vec<HeartbeatInitiativeHeatBasis>,
|
||||
pub contract: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
|
||||
pub struct HeartbeatInitiativeHeatBasis {
|
||||
pub id: String,
|
||||
pub scope: String,
|
||||
pub selector: String,
|
||||
pub multiplier: f64,
|
||||
pub reason: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
|
||||
pub struct HeartbeatPersonalityTiming {
|
||||
pub schema_version: String,
|
||||
pub source: String,
|
||||
pub cooldown_multiplier: f64,
|
||||
pub work_drive: f64,
|
||||
pub handsiness: f64,
|
||||
pub caution: f64,
|
||||
pub rumination_bias: f64,
|
||||
pub basis: Vec<String>,
|
||||
pub contract: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
|
||||
pub struct HeartbeatMoodTiming {
|
||||
pub schema_version: String,
|
||||
pub source: Option<String>,
|
||||
pub cooldown_multiplier: f64,
|
||||
pub anxiety: f64,
|
||||
pub urgency: f64,
|
||||
pub arousal: f64,
|
||||
pub thought_pressure: f64,
|
||||
pub guardedness: f64,
|
||||
pub reaction_intensity: f64,
|
||||
pub contract: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
|
||||
pub struct HeartbeatBirthPersonalitySeed {
|
||||
pub schema_version: String,
|
||||
pub source: String,
|
||||
pub projection_id: String,
|
||||
pub repo_id: String,
|
||||
pub heartbeat_deltas: BTreeMap<String, f64>,
|
||||
pub default_mood_pressure: BTreeMap<String, f64>,
|
||||
pub contract: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
|
||||
|
|
@ -233,8 +330,30 @@ pub struct HeartbeatPendingTurn {
|
|||
pub completed_scene_clock: Option<f64>,
|
||||
#[serde(rename = "nextReadyAt", default)]
|
||||
pub next_ready_at: Option<f64>,
|
||||
#[serde(flatten)]
|
||||
pub extra: BTreeMap<String, Value>,
|
||||
#[serde(
|
||||
rename = "personalityCooldownMultiplier",
|
||||
default = "default_heat_global_multiplier"
|
||||
)]
|
||||
pub personality_cooldown_multiplier: f64,
|
||||
#[serde(
|
||||
rename = "moodCooldownMultiplier",
|
||||
default = "default_heat_global_multiplier"
|
||||
)]
|
||||
pub mood_cooldown_multiplier: f64,
|
||||
#[serde(
|
||||
rename = "initiativeHeatMultiplier",
|
||||
default = "default_heat_global_multiplier"
|
||||
)]
|
||||
pub initiative_heat_multiplier: f64,
|
||||
#[serde(
|
||||
rename = "effectiveCooldownMultiplier",
|
||||
default = "default_heat_global_multiplier"
|
||||
)]
|
||||
pub effective_cooldown_multiplier: f64,
|
||||
#[serde(rename = "initiativeFrozen", default)]
|
||||
pub initiative_frozen: bool,
|
||||
#[serde(rename = "initiativeFreezeReason", default)]
|
||||
pub initiative_freeze_reason: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
|
||||
|
|
@ -270,8 +389,6 @@ pub struct HeartbeatHistoryEvent {
|
|||
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)]
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
use super::EpiphanyHeartbeatStateEntry;
|
||||
use super::HeartbeatAdaptivePacingSignals;
|
||||
use super::HeartbeatInitiativeHeatBasis;
|
||||
use super::HeartbeatInitiativeHeatProjection;
|
||||
use super::HeartbeatInitiativeMultiplier;
|
||||
use super::HeartbeatParticipant;
|
||||
use super::HeartbeatPumpOptions;
|
||||
use super::round3;
|
||||
use super::round6;
|
||||
use serde_json::Value;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub(super) struct AdaptiveSwarmPacing {
|
||||
|
|
@ -13,7 +15,7 @@ pub(super) struct AdaptiveSwarmPacing {
|
|||
pub(super) target_concurrency: usize,
|
||||
pub(super) running_turns: usize,
|
||||
pub(super) active_participants: usize,
|
||||
pub(super) signals: Value,
|
||||
pub(super) signals: HeartbeatAdaptivePacingSignals,
|
||||
}
|
||||
|
||||
pub(super) fn adaptive_swarm_pacing(
|
||||
|
|
@ -75,17 +77,17 @@ pub(super) fn adaptive_swarm_pacing(
|
|||
target_concurrency,
|
||||
running_turns,
|
||||
active_participants,
|
||||
signals: serde_json::json!({
|
||||
"externalUrgency": round3(external_urgency),
|
||||
"maxAnxiety": round3(mood_signals.max_anxiety),
|
||||
"averageAnxiety": round3(mood_signals.average_anxiety),
|
||||
"maxUrgency": round3(mood_signals.max_urgency),
|
||||
"maxArousal": round3(mood_signals.max_arousal),
|
||||
"maxThoughtPressure": round3(mood_signals.max_thought_pressure),
|
||||
"maxReactionIntensity": round3(mood_signals.max_reaction_intensity),
|
||||
"pendingPressure": round3(pending_pressure),
|
||||
"contract": "Anxiety-like state raises tempo and concurrency; calm state lets the swarm sleep slow.",
|
||||
}),
|
||||
signals: HeartbeatAdaptivePacingSignals {
|
||||
external_urgency: round3(external_urgency),
|
||||
max_anxiety: round3(mood_signals.max_anxiety),
|
||||
average_anxiety: round3(mood_signals.average_anxiety),
|
||||
max_urgency: round3(mood_signals.max_urgency),
|
||||
max_arousal: round3(mood_signals.max_arousal),
|
||||
max_thought_pressure: round3(mood_signals.max_thought_pressure),
|
||||
max_reaction_intensity: round3(mood_signals.max_reaction_intensity),
|
||||
pending_pressure: round3(pending_pressure),
|
||||
contract: "Anxiety-like state raises tempo and concurrency; calm state lets the swarm sleep slow.".to_string(),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -104,14 +106,14 @@ fn swarm_mood_signals(state: &EpiphanyHeartbeatStateEntry) -> SwarmMoodSignals {
|
|||
let mut anxiety_total = 0.0;
|
||||
let mut anxiety_count = 0_usize;
|
||||
for participant in &state.participants {
|
||||
let Some(mood) = participant.extra.get("moodTiming") else {
|
||||
let Some(mood) = participant.mood_timing.as_ref() else {
|
||||
continue;
|
||||
};
|
||||
let anxiety = number_at(mood, "/anxiety");
|
||||
let urgency = number_at(mood, "/urgency");
|
||||
let arousal = number_at(mood, "/arousal");
|
||||
let thought_pressure = number_at(mood, "/thoughtPressure");
|
||||
let reaction_intensity = number_at(mood, "/reactionIntensity");
|
||||
let anxiety = mood.anxiety;
|
||||
let urgency = mood.urgency;
|
||||
let arousal = mood.arousal;
|
||||
let thought_pressure = mood.thought_pressure;
|
||||
let reaction_intensity = mood.reaction_intensity;
|
||||
signals.max_anxiety = signals.max_anxiety.max(anxiety);
|
||||
signals.max_urgency = signals.max_urgency.max(urgency);
|
||||
signals.max_arousal = signals.max_arousal.max(arousal);
|
||||
|
|
@ -139,29 +141,12 @@ pub(super) fn running_turn_count(state: &EpiphanyHeartbeatStateEntry) -> usize {
|
|||
.count()
|
||||
}
|
||||
|
||||
fn number_at(value: &Value, pointer: &str) -> f64 {
|
||||
value
|
||||
.pointer(pointer)
|
||||
.and_then(Value::as_f64)
|
||||
.unwrap_or(0.0)
|
||||
}
|
||||
|
||||
pub(super) fn personality_cooldown_multiplier(participant: &HeartbeatParticipant) -> f64 {
|
||||
participant
|
||||
.extra
|
||||
.get("personalityCooldownMultiplier")
|
||||
.and_then(Value::as_f64)
|
||||
.unwrap_or(1.0)
|
||||
.clamp(0.25, 3.0)
|
||||
nonzero_multiplier(participant.personality_cooldown_multiplier).clamp(0.25, 3.0)
|
||||
}
|
||||
|
||||
pub(super) fn mood_cooldown_multiplier(participant: &HeartbeatParticipant) -> f64 {
|
||||
participant
|
||||
.extra
|
||||
.get("moodCooldownMultiplier")
|
||||
.and_then(Value::as_f64)
|
||||
.unwrap_or(1.0)
|
||||
.clamp(0.25, 3.0)
|
||||
nonzero_multiplier(participant.mood_cooldown_multiplier).clamp(0.25, 3.0)
|
||||
}
|
||||
|
||||
pub(super) fn effective_cooldown_multiplier(participant: &HeartbeatParticipant) -> f64 {
|
||||
|
|
@ -173,12 +158,15 @@ pub(super) fn effective_cooldown_multiplier(participant: &HeartbeatParticipant)
|
|||
}
|
||||
|
||||
pub(super) fn initiative_heat_multiplier(participant: &HeartbeatParticipant) -> f64 {
|
||||
participant
|
||||
.extra
|
||||
.get("initiativeHeatMultiplier")
|
||||
.and_then(Value::as_f64)
|
||||
.unwrap_or(1.0)
|
||||
.clamp(0.05, 25.0)
|
||||
nonzero_multiplier(participant.initiative_heat_multiplier).clamp(0.05, 25.0)
|
||||
}
|
||||
|
||||
fn nonzero_multiplier(value: f64) -> f64 {
|
||||
if value.is_finite() && value > 0.0 {
|
||||
value
|
||||
} else {
|
||||
1.0
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn apply_initiative_heat_policy(state: &mut EpiphanyHeartbeatStateEntry) {
|
||||
|
|
@ -196,35 +184,29 @@ pub(super) fn apply_initiative_heat_policy(state: &mut EpiphanyHeartbeatStateEnt
|
|||
.collect::<Vec<_>>();
|
||||
for participant in &mut state.participants {
|
||||
let mut heat = global;
|
||||
let mut basis = Vec::<Value>::new();
|
||||
let mut basis = Vec::<HeartbeatInitiativeHeatBasis>::new();
|
||||
for multiplier in &active_multipliers {
|
||||
if multiplier_matches_participant(multiplier, participant) {
|
||||
let value = multiplier.multiplier.clamp(0.05, 25.0);
|
||||
heat *= value;
|
||||
basis.push(serde_json::json!({
|
||||
"id": multiplier.id,
|
||||
"scope": multiplier.scope,
|
||||
"selector": multiplier.selector,
|
||||
"multiplier": value,
|
||||
"reason": multiplier.reason,
|
||||
}));
|
||||
basis.push(HeartbeatInitiativeHeatBasis {
|
||||
id: multiplier.id.clone(),
|
||||
scope: multiplier.scope.clone(),
|
||||
selector: multiplier.selector.clone(),
|
||||
multiplier: value,
|
||||
reason: multiplier.reason.clone(),
|
||||
});
|
||||
}
|
||||
}
|
||||
let heat = round3(heat.clamp(0.05, 25.0));
|
||||
participant.extra.insert(
|
||||
"initiativeHeatMultiplier".to_string(),
|
||||
serde_json::json!(heat),
|
||||
);
|
||||
participant.extra.insert(
|
||||
"initiativeHeat".to_string(),
|
||||
serde_json::json!({
|
||||
"schema_version": "epiphany.heartbeat_initiative_heat_projection.v0",
|
||||
"globalMultiplier": global,
|
||||
"effectiveMultiplier": heat,
|
||||
"basis": basis,
|
||||
"contract": "Initiative heat accelerates turn recovery. Proximity or agency pressure may raise heat, but the typed heat policy remains the authority."
|
||||
}),
|
||||
);
|
||||
participant.initiative_heat_multiplier = heat;
|
||||
participant.initiative_heat = Some(HeartbeatInitiativeHeatProjection {
|
||||
schema_version: "epiphany.heartbeat_initiative_heat_projection.v0".to_string(),
|
||||
global_multiplier: global,
|
||||
effective_multiplier: heat,
|
||||
basis,
|
||||
contract: "Initiative heat accelerates turn recovery. Proximity or agency pressure may raise heat, but the typed heat policy remains the authority.".to_string(),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -245,15 +227,9 @@ fn multiplier_matches_participant(
|
|||
.iter()
|
||||
.any(|constraint| eq_key(constraint, selector))
|
||||
|| participant
|
||||
.extra
|
||||
.get("groups")
|
||||
.and_then(Value::as_array)
|
||||
.is_some_and(|groups| {
|
||||
groups
|
||||
.iter()
|
||||
.filter_map(Value::as_str)
|
||||
.any(|group| eq_key(group, selector))
|
||||
})
|
||||
.groups
|
||||
.iter()
|
||||
.any(|group| eq_key(group, selector))
|
||||
}
|
||||
_ => false,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ pub fn heartbeat_status_projection(
|
|||
"candidateInterventions": cognition.as_ref().and_then(|entry| entry.candidate_interventions.clone()),
|
||||
"appraisals": cognition.as_ref().and_then(|entry| entry.appraisals.clone()),
|
||||
"reactions": cognition.as_ref().and_then(|entry| entry.reactions.clone()),
|
||||
"adaptivePacing": state.extra.get("adaptivePacing"),
|
||||
"adaptivePacing": state.adaptive_pacing.as_ref(),
|
||||
"availableActions": ["init", "tick", "pump", "heat", "complete", "status", "routine"],
|
||||
}))
|
||||
}
|
||||
|
|
@ -225,7 +225,7 @@ fn participant_status_json(participant: &HeartbeatParticipant) -> Value {
|
|||
"personalityCooldownMultiplier": personality_cooldown_multiplier(participant),
|
||||
"moodCooldownMultiplier": mood_cooldown_multiplier(participant),
|
||||
"initiativeHeatMultiplier": initiative_heat_multiplier(participant),
|
||||
"initiativeHeat": participant.extra.get("initiativeHeat"),
|
||||
"initiativeHeat": participant.initiative_heat.as_ref(),
|
||||
"effectiveCooldownMultiplier": effective_cooldown_multiplier(participant),
|
||||
"initiativeFrozen": participant
|
||||
.pending_turn
|
||||
|
|
@ -234,9 +234,9 @@ fn participant_status_json(participant: &HeartbeatParticipant) -> Value {
|
|||
"initiativeFreezeReason": participant
|
||||
.pending_turn
|
||||
.as_ref()
|
||||
.and_then(|turn| turn.extra.get("initiativeFreezeReason")),
|
||||
"personalityTiming": participant.extra.get("personalityTiming"),
|
||||
"moodTiming": participant.extra.get("moodTiming"),
|
||||
.and_then(|turn| turn.initiative_freeze_reason.as_ref()),
|
||||
"personalityTiming": participant.personality_timing.as_ref(),
|
||||
"moodTiming": participant.mood_timing.as_ref(),
|
||||
"nextReadyAt": participant.next_ready_at,
|
||||
"reactionBias": participant.reaction_bias,
|
||||
"interruptThreshold": participant.interrupt_threshold,
|
||||
|
|
@ -268,7 +268,7 @@ pub(super) fn schedule_participant_json(participant: &HeartbeatParticipant) -> V
|
|||
"initiative_freeze_reason": participant
|
||||
.pending_turn
|
||||
.as_ref()
|
||||
.and_then(|turn| turn.extra.get("initiativeFreezeReason")),
|
||||
.and_then(|turn| turn.initiative_freeze_reason.as_ref()),
|
||||
"next_ready_at": participant.next_ready_at,
|
||||
"reaction_bias": participant.reaction_bias,
|
||||
"interrupt_threshold": participant.interrupt_threshold,
|
||||
|
|
@ -299,12 +299,12 @@ pub(super) fn pending_turn_json(turn: &HeartbeatPendingTurn) -> Value {
|
|||
"startedAt": turn.started_at,
|
||||
"startedSceneClock": turn.started_scene_clock,
|
||||
"baseRecovery": turn.base_recovery,
|
||||
"personalityCooldownMultiplier": turn.extra.get("personalityCooldownMultiplier"),
|
||||
"moodCooldownMultiplier": turn.extra.get("moodCooldownMultiplier"),
|
||||
"initiativeHeatMultiplier": turn.extra.get("initiativeHeatMultiplier"),
|
||||
"effectiveCooldownMultiplier": turn.extra.get("effectiveCooldownMultiplier"),
|
||||
"initiativeFrozen": turn.extra.get("initiativeFrozen"),
|
||||
"initiativeFreezeReason": turn.extra.get("initiativeFreezeReason"),
|
||||
"personalityCooldownMultiplier": turn.personality_cooldown_multiplier,
|
||||
"moodCooldownMultiplier": turn.mood_cooldown_multiplier,
|
||||
"initiativeHeatMultiplier": turn.initiative_heat_multiplier,
|
||||
"effectiveCooldownMultiplier": turn.effective_cooldown_multiplier,
|
||||
"initiativeFrozen": turn.initiative_frozen,
|
||||
"initiativeFreezeReason": turn.initiative_freeze_reason.as_ref(),
|
||||
"recovery": turn.recovery,
|
||||
"cooldownPolicy": turn.cooldown_policy,
|
||||
"completedAt": turn.completed_at,
|
||||
|
|
|
|||
|
|
@ -5,13 +5,13 @@ use super::HEARTBEAT_ARENA_SCENE;
|
|||
use super::HEARTBEAT_STATE_SCHEMA_VERSION;
|
||||
use super::HeartbeatPacingPolicy;
|
||||
use super::HeartbeatParticipant;
|
||||
use super::HeartbeatProtocol;
|
||||
use super::HeartbeatSelectionPolicy;
|
||||
use super::PARTICIPANT_KIND_AGENT;
|
||||
use super::PARTICIPANT_KIND_CHARACTER;
|
||||
use super::write_heartbeat_state_entry;
|
||||
use anyhow::Result;
|
||||
use anyhow::anyhow;
|
||||
use std::collections::BTreeMap;
|
||||
use std::path::Path;
|
||||
|
||||
pub(super) const ROLE_ORDER: &[&str] = &[
|
||||
|
|
@ -40,7 +40,6 @@ pub fn default_heartbeat_state(target_heartbeat_rate: f64) -> EpiphanyHeartbeatS
|
|||
"initiative_speed_desc".to_string(),
|
||||
"stable_actor_id_asc".to_string(),
|
||||
],
|
||||
extra: BTreeMap::new(),
|
||||
},
|
||||
pacing_policy: HeartbeatPacingPolicy {
|
||||
cooldown_starts_after_turn_completion: true,
|
||||
|
|
@ -48,7 +47,6 @@ pub fn default_heartbeat_state(target_heartbeat_rate: f64) -> EpiphanyHeartbeatS
|
|||
idle_base_recovery: 2.0,
|
||||
sleep_heartbeat_rate_multiplier: 0.05,
|
||||
minimum_effective_rate: 0.001,
|
||||
extra: BTreeMap::new(),
|
||||
},
|
||||
participants: ROLE_ORDER
|
||||
.iter()
|
||||
|
|
@ -56,7 +54,8 @@ pub fn default_heartbeat_state(target_heartbeat_rate: f64) -> EpiphanyHeartbeatS
|
|||
.collect(),
|
||||
history: Vec::new(),
|
||||
initiative_heat: Default::default(),
|
||||
extra: BTreeMap::new(),
|
||||
protocol: None,
|
||||
adaptive_pacing: None,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -83,15 +82,12 @@ pub fn ghostlight_scene_heartbeat_state(
|
|||
.into_iter()
|
||||
.map(|seed| ghostlight_scene_participant(&scene_id, seed))
|
||||
.collect();
|
||||
state.extra.insert(
|
||||
"protocol".to_string(),
|
||||
serde_json::json!({
|
||||
"domain": "ghostlight",
|
||||
"sceneId": scene_id,
|
||||
"arena": HEARTBEAT_ARENA_SCENE,
|
||||
"contract": "Characters and maintenance organs use one initiative timing law; scene participants receive only projected local context.",
|
||||
}),
|
||||
);
|
||||
state.protocol = Some(HeartbeatProtocol {
|
||||
domain: "ghostlight".to_string(),
|
||||
scene_id: Some(scene_id),
|
||||
arena: HEARTBEAT_ARENA_SCENE.to_string(),
|
||||
contract: "Characters and maintenance organs use one initiative timing law; scene participants receive only projected local context.".to_string(),
|
||||
});
|
||||
super::validate_heartbeat_state(&state)?;
|
||||
Ok(state)
|
||||
}
|
||||
|
|
@ -127,7 +123,15 @@ pub(super) fn default_participant(role_id: &str) -> HeartbeatParticipant {
|
|||
last_woke_at: None,
|
||||
last_finished_at: None,
|
||||
pending_turn: None,
|
||||
extra: BTreeMap::new(),
|
||||
scene_id: None,
|
||||
groups: Vec::new(),
|
||||
personality_cooldown_multiplier: 1.0,
|
||||
mood_cooldown_multiplier: 1.0,
|
||||
initiative_heat_multiplier: 1.0,
|
||||
initiative_heat: None,
|
||||
personality_timing: None,
|
||||
mood_timing: None,
|
||||
birth_personality_seed: None,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -136,8 +140,6 @@ fn ghostlight_scene_participant(
|
|||
seed: GhostlightSceneParticipantSeed,
|
||||
) -> HeartbeatParticipant {
|
||||
let role_id = ghostlight_role_id(seed.agent_id.as_str());
|
||||
let mut extra = BTreeMap::new();
|
||||
extra.insert("sceneId".to_string(), serde_json::json!(scene_id));
|
||||
HeartbeatParticipant {
|
||||
agent_id: seed.agent_id,
|
||||
role_id,
|
||||
|
|
@ -155,7 +157,15 @@ fn ghostlight_scene_participant(
|
|||
last_woke_at: None,
|
||||
last_finished_at: None,
|
||||
pending_turn: None,
|
||||
extra,
|
||||
scene_id: Some(scene_id.to_string()),
|
||||
groups: Vec::new(),
|
||||
personality_cooldown_multiplier: 1.0,
|
||||
mood_cooldown_multiplier: 1.0,
|
||||
initiative_heat_multiplier: 1.0,
|
||||
initiative_heat: None,
|
||||
personality_timing: None,
|
||||
mood_timing: None,
|
||||
birth_personality_seed: None,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -323,12 +333,12 @@ mod tests {
|
|||
assert_eq!(participant.role_id, "ghostlight.character.ariadne-prime");
|
||||
assert_eq!(participant.arena, HEARTBEAT_ARENA_SCENE);
|
||||
assert_eq!(participant.participant_kind, PARTICIPANT_KIND_CHARACTER);
|
||||
assert_eq!(participant.scene_id.as_deref(), Some("room"));
|
||||
assert_eq!(
|
||||
state
|
||||
.extra
|
||||
.get("protocol")
|
||||
.and_then(|value| value.get("domain"))
|
||||
.and_then(|value| value.as_str()),
|
||||
.protocol
|
||||
.as_ref()
|
||||
.map(|protocol| protocol.domain.as_str()),
|
||||
Some("ghostlight")
|
||||
);
|
||||
Ok(())
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ use anyhow::anyhow;
|
|||
use cultcache_rs::CultCache;
|
||||
use cultcache_rs::SingleFileMessagePackBackingStore;
|
||||
use serde_json::Value;
|
||||
use std::collections::BTreeMap;
|
||||
use std::path::Path;
|
||||
|
||||
pub fn heartbeat_state_cache(store_path: impl AsRef<Path>) -> Result<CultCache> {
|
||||
|
|
@ -65,10 +64,9 @@ pub fn load_heartbeat_cognition_entry(
|
|||
return Ok(Some(cognition));
|
||||
}
|
||||
let legacy_cache = legacy_heartbeat_state_cache(store_path)?;
|
||||
let Some(legacy) =
|
||||
legacy_cache.get::<LegacyHeartbeatStateWithCognition>(HEARTBEAT_STATE_KEY)?
|
||||
else {
|
||||
return Ok(None);
|
||||
let legacy = match legacy_cache.get::<LegacyHeartbeatStateWithCognition>(HEARTBEAT_STATE_KEY) {
|
||||
Ok(Some(legacy)) => legacy,
|
||||
Ok(None) | Err(_) => return Ok(None),
|
||||
};
|
||||
legacy_heartbeat_cognition_entry(legacy)
|
||||
}
|
||||
|
|
@ -135,7 +133,6 @@ fn legacy_heartbeat_cognition_entry(
|
|||
candidate_interventions: legacy.candidate_interventions,
|
||||
appraisals: legacy.appraisals,
|
||||
reactions: legacy.reactions,
|
||||
extra: BTreeMap::new(),
|
||||
}))
|
||||
}
|
||||
|
||||
|
|
@ -250,7 +247,6 @@ mod tests {
|
|||
candidate_interventions: None,
|
||||
appraisals: None,
|
||||
reactions: None,
|
||||
extra: BTreeMap::new(),
|
||||
};
|
||||
|
||||
write_heartbeat_cognition_entry(&store_path, &cognition)?;
|
||||
|
|
|
|||
|
|
@ -66,6 +66,7 @@ pub use heartbeat_state::HEARTBEAT_COGNITION_TYPE;
|
|||
pub use heartbeat_state::HEARTBEAT_STATE_KEY;
|
||||
pub use heartbeat_state::HEARTBEAT_STATE_SCHEMA_VERSION;
|
||||
pub use heartbeat_state::HEARTBEAT_STATE_TYPE;
|
||||
pub use heartbeat_state::HeartbeatBirthPersonalitySeed;
|
||||
pub use heartbeat_state::HeartbeatCompleteOptions;
|
||||
pub use heartbeat_state::HeartbeatHeatUpdateOptions;
|
||||
pub use heartbeat_state::HeartbeatHistoryEvent;
|
||||
|
|
|
|||
|
|
@ -426,7 +426,6 @@ mod tests {
|
|||
})),
|
||||
appraisals: None,
|
||||
reactions: None,
|
||||
extra: Default::default(),
|
||||
};
|
||||
|
||||
let snapshot = memory_graph_from_heartbeat_cognition("heartbeat-profile", &cognition);
|
||||
|
|
|
|||
|
|
@ -60,7 +60,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`, role/default construction lives in `epiphany-core/src/heartbeat_state/heartbeat_roles.rs`, persistence/validation lives in `epiphany-core/src/heartbeat_state/heartbeat_store.rs`, and status/artifact JSON projection lives in `epiphany-core/src/heartbeat_state/heartbeat_projection.rs`. The root `heartbeat_state.rs` keeps scheduling and Void cognition orchestration for the next cuts. Focused heartbeat tests and `epiphany-core` check pass after the splits.
|
||||
- Heartbeat durable document/schema types now live in `epiphany-core/src/heartbeat_state/heartbeat_documents.rs`, role/default construction lives in `epiphany-core/src/heartbeat_state/heartbeat_roles.rs`, persistence/validation lives in `epiphany-core/src/heartbeat_state/heartbeat_store.rs`, and status/artifact JSON projection lives in `epiphany-core/src/heartbeat_state/heartbeat_projection.rs`. Adaptive pacing, scene protocol, participant personality/mood timing, initiative heat projection, birth personality seed receipts, and pending-turn freeze/multiplier facts are typed fields rather than `extra` maps; only the sealed legacy combined-state reader still carries `extra` for old `voidRoutine` migration. The root `heartbeat_state.rs` keeps scheduling and Void cognition orchestration for the next cuts.
|
||||
- Heartbeat role/default and store seams now have module-local unit tests: fixed lane catalog, Ghostlight scene role projection, and typed state/cognition CultCache round-trip. Keep future heartbeat cuts aligned to those seam tests instead of growing root integration-only coverage.
|
||||
- Heartbeat adaptive pacing now lives in `epiphany-core/src/heartbeat_state/heartbeat_pacing.rs`, including running-turn count and effective cooldown multipliers. It has a module-local unit test for pending-turn counting; root scheduling calls the pacing seam instead of owning pressure/concurrency math directly.
|
||||
- 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.
|
||||
|
|
@ -94,7 +94,7 @@ remembers doctrine; the branch remembers the blade.
|
|||
- The machine-priest voice now says the quiet part plainly: crusade/heresy/purity language is aimed at technical rot, hidden state, duplicate truth, drift, and lying structures, not at humans. Future Epiphany swarms should inherit severity toward systems and curiosity toward people.
|
||||
- The Ghostlight memory pass is landed. `epiphany_specialists.toml` now has a shared persistent-memory projection prepended by the harness to fixed role specialists, reorientation workers, coordinator notes, and CRRC checkpoint interventions. The rendered base doctrine also states the Perfect Machine rule directly: prompt is projection, durable typed state is the mind, every lane must improve its own memory/model/prompt/evidence habit or name the repair, and each lane phrases that duty in its own organ language so the salience sticks.
|
||||
- The role self-memory persistence pass is native now. Each lane has a Ghostlight-shaped typed dossier in `state/agents.msgpack`, and specialists may return optional `selfPatch` requests beside their normal role result. Relationship, event, scene, and perceived-overlay arrays are typed dossier documents, not JSON cargo, and the durable structs do not keep unknown `extra` maps. `roleResult`/`roleAccept` project coordinator review as `selfPersistence`: accepted requests are role-matched, bounded lane memory/goal/value/private-note mutations; refused requests explain wrong role, project-truth smuggling, authority grabs, bloat, missing reason, or malformed records. GUI/coordinator accept paths apply accepted `selfPatch` requests through the native `epiphany-agent-memory-store` binary; project truth still belongs only in `EpiphanyThreadState`.
|
||||
- The heartbeat initiative pass is landed as a bounded tool seam. `state/agent-heartbeats.msgpack` tracks Self, Face, Imagination, Eyes, Body, Hands, Soul, and Life as Ghostlight-style initiative participants with arena, participant kind, speed, next-ready time, reaction bias, interrupt threshold, load, status, constraints, personality cooldown, mood cooldown, effective cooldown, adaptive pacing, history, and pending turns through `epiphany-core::EpiphanyHeartbeatStateEntry` and the native `epiphany-heartbeat-store` binary. Role dossiers set baseline timing; appraisal mood/anxiety bends it through urgency, arousal, thought pressure, guardedness, and reaction intensity, so Hands-like work pressure and high-need anxious lanes recover sooner without being heartbeaten while a prior turn is running. `epiphany-heartbeat-store pump` computes pressure from external urgency, mood/anxiety, reaction intensity, thought pressure, and current pending load, then chooses tempo plus target concurrency: calm can launch zero and sleep slow; alarm can fill most active lanes. Idle turns are for rumination: light thought shuffling, role-quality attention, and candidate selfPatch pressure. Sleep/dream cycle passes are the intended distillation window for durable self-memory and doctrine. JSON heartbeat state and Python wrapper state are gone; general CultCache schema sync, polyglot domain loading, and debug display tools belong in CultLib. This is a callable scheduler seam, not yet an always-on daemon; a heart valve, not a whole circulatory god.
|
||||
- The heartbeat initiative pass is landed as a bounded tool seam. `state/agent-heartbeats.msgpack` tracks Self, Face, Imagination, Eyes, Body, Hands, Soul, and Life as Ghostlight-style initiative participants with arena, participant kind, speed, next-ready time, reaction bias, interrupt threshold, load, status, constraints, personality cooldown, mood cooldown, effective cooldown, adaptive pacing, history, and pending turns through `epiphany-core::EpiphanyHeartbeatStateEntry` and the native `epiphany-heartbeat-store` binary. Role dossiers set baseline timing; appraisal mood/anxiety bends it through urgency, arousal, thought pressure, guardedness, and reaction intensity, so Hands-like work pressure and high-need anxious lanes recover sooner without being heartbeaten while a prior turn is running. `epiphany-heartbeat-store pump` computes pressure from external urgency, mood/anxiety, reaction intensity, thought pressure, and current pending load, then chooses tempo plus target concurrency: calm can launch zero and sleep slow; alarm can fill most active lanes. Idle turns are for rumination: light thought shuffling, role-quality attention, and candidate selfPatch pressure. Sleep/dream cycle passes are the intended distillation window for durable self-memory and doctrine. JSON heartbeat state, Python wrapper state, and live heartbeat timing `extra` maps are gone; general CultCache schema sync, polyglot domain loading, and debug display tools belong in CultLib. This is a callable scheduler seam, not yet an always-on daemon; a heart valve, not a whole circulatory god.
|
||||
|
||||
- Heartbeat initiative heat is now part of that seam. `EpiphanyHeartbeatStateEntry` owns `initiative_heat`, pacing applies active global/all/agent/role/arena/participant-kind/group/constraint multipliers into per-participant `initiativeHeatMultiplier`, and recovery divides by that multiplier. The CLI exposes `epiphany-heartbeat-store heat`, status/schedule projections show heat, and the CultNet catalog advertises both `epiphany.heartbeat_initiative_heat.v0` and coordinator intent `epiphany.heartbeat_heat_intent.v0`; runtime-spine hello lists the heat intent on the heartbeat mutation contract. Smoke proves a heated implementation lane reaches the live action catalog with `initiative_heat_multiplier: 4.0`.
|
||||
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -100,7 +100,7 @@ accepted_design:
|
|||
- `epiphany-openai-runtime` worker result ingress now parses assistant output directly into launch-kind-specific typed documents and stores typed nested `statePatch` / `selfPatch` payloads as MessagePack inside `EpiphanyRuntimeRoleWorkerResult`; generic `serde_json::Value` no longer mediates role/reorient worker results in that crate. JSON still exists at the OpenAI text edge because the model's output is text, but the runtime boundary after parsing is typed.
|
||||
- Agent self-memory review/application now has typed `AgentSelfPatch` core APIs. The old JSON-value selfPatch functions remain only as edge compatibility wrappers for CLI/artifact ingress; `epiphany-agent-memory-store`, heartbeat rumination application, and repo initialization selfPatch processing parse once at the edge and then operate on typed documents. Role-result self-persistence no longer exports a JSON-value reviewer; native review uses `review_role_self_patch_document`.
|
||||
- Durable Ghostlight role dossiers are typed through their relationship/event/scene/perceived-overlay surfaces now. `EpiphanyAgentMemoryEntry` no longer stores those arrays as `serde_json::Value`, and durable Ghostlight structs no longer carry flattened unknown `extra` bags. `AgentSelfPatch.extra` remains only as an ingress guard so unknown patch keys can be rejected with reasons.
|
||||
- Heartbeat durable document/schema types live in `epiphany-core/src/heartbeat_state/heartbeat_documents.rs`; role/default construction lives in `epiphany-core/src/heartbeat_state/heartbeat_roles.rs`; heartbeat persistence/validation lives in `epiphany-core/src/heartbeat_state/heartbeat_store.rs`; heartbeat status/artifact JSON projection lives in `epiphany-core/src/heartbeat_state/heartbeat_projection.rs`; the root heartbeat module remains the scheduling/cognition orchestration surface until those responsibilities are split into their own tested seams.
|
||||
- Heartbeat durable document/schema types live in `epiphany-core/src/heartbeat_state/heartbeat_documents.rs`; role/default construction lives in `epiphany-core/src/heartbeat_state/heartbeat_roles.rs`; heartbeat persistence/validation lives in `epiphany-core/src/heartbeat_state/heartbeat_store.rs`; heartbeat status/artifact JSON projection lives in `epiphany-core/src/heartbeat_state/heartbeat_projection.rs`; the root heartbeat module remains the scheduling/cognition orchestration surface until those responsibilities are split into their own tested seams. Heartbeat timing authority is now typed state: adaptive pacing, scene protocol, participant personality/mood timing, initiative heat projection, birth personality seed receipts, and pending-turn freeze/multiplier facts are named fields rather than `extra` maps. The only remaining heartbeat `extra` bag is the sealed legacy combined-state reader for old `voidRoutine` migration.
|
||||
- Heartbeat role/default and store seams are pinned by module-local unit tests for fixed lane catalog, Ghostlight scene role projection, and typed state/cognition CultCache round-trip.
|
||||
- Heartbeat adaptive pacing lives in `epiphany-core/src/heartbeat_state/heartbeat_pacing.rs`; it owns pressure/concurrency derivation, running-turn count, initiative heat projection, and effective cooldown multipliers for scheduler/projection callers.
|
||||
- `epiphany-openai-auth-spine` is now a thin Epiphany-named boundary over retained vendored `codex-login`, not a clean-room credential store or token-refresh clone. Keep this impurity sealed as the Codex-compatible subscription auth organ while Epiphany owns typed request/status/event/runtime documents around it.
|
||||
|
|
|
|||
Reference in a new issue