|
|
|
@ -14,7 +14,7 @@ const MAX_FACT_SOURCE_BYTES: usize = 128_000;
|
|
|
|
const MAX_FACT_CONTEXT_BYTES: usize = 512_000;
|
|
|
|
const MAX_FACT_CONTEXT_BYTES: usize = 512_000;
|
|
|
|
const MAX_FACT_RESPONSE_BYTES: usize = 128_000;
|
|
|
|
const MAX_FACT_RESPONSE_BYTES: usize = 128_000;
|
|
|
|
const MAX_SESSION_QUERY_LIMIT: usize = 100;
|
|
|
|
const MAX_SESSION_QUERY_LIMIT: usize = 100;
|
|
|
|
const WAKE_EVENT_COUNT: usize = 4;
|
|
|
|
const WAKE_EVENT_COUNT: usize = 3;
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
|
|
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
|
|
|
#[serde(rename_all = "camelCase")]
|
|
|
|
#[serde(rename_all = "camelCase")]
|
|
|
|
@ -23,32 +23,12 @@ struct PersonaManifest {
|
|
|
|
persona_id: String,
|
|
|
|
persona_id: String,
|
|
|
|
human_responsibility_subject: String,
|
|
|
|
human_responsibility_subject: String,
|
|
|
|
brain_entry: String,
|
|
|
|
brain_entry: String,
|
|
|
|
cognitive_gravity: PersonaCognitiveGravityBinding,
|
|
|
|
|
|
|
|
current_checkpoint: String,
|
|
|
|
current_checkpoint: String,
|
|
|
|
git_identity: PersonaGitIdentity,
|
|
|
|
git_identity: PersonaGitIdentity,
|
|
|
|
model_binding: PersonaModelBinding,
|
|
|
|
model_binding: PersonaModelBinding,
|
|
|
|
organs: Vec<PersonaOrgan>,
|
|
|
|
organs: Vec<PersonaOrgan>,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
|
|
|
|
|
|
|
#[serde(rename_all = "camelCase")]
|
|
|
|
|
|
|
|
struct PersonaCognitiveGravityBinding {
|
|
|
|
|
|
|
|
schema: String,
|
|
|
|
|
|
|
|
subject_persona_id: String,
|
|
|
|
|
|
|
|
source_path: String,
|
|
|
|
|
|
|
|
frame_schema: String,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize)]
|
|
|
|
|
|
|
|
#[serde(rename_all = "camelCase")]
|
|
|
|
|
|
|
|
pub struct PersonaCognitiveGravityEvidence {
|
|
|
|
|
|
|
|
pub schema: String,
|
|
|
|
|
|
|
|
pub subject_persona_id: String,
|
|
|
|
|
|
|
|
pub source_path: String,
|
|
|
|
|
|
|
|
pub source_hash: String,
|
|
|
|
|
|
|
|
pub frame_schema: String,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
|
|
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
|
|
|
#[serde(rename_all = "camelCase")]
|
|
|
|
#[serde(rename_all = "camelCase")]
|
|
|
|
struct PersonaOrgan {
|
|
|
|
struct PersonaOrgan {
|
|
|
|
@ -154,7 +134,6 @@ pub struct PersonaWakeReceipt {
|
|
|
|
pub repository_path: String,
|
|
|
|
pub repository_path: String,
|
|
|
|
pub git_head: String,
|
|
|
|
pub git_head: String,
|
|
|
|
pub brain_entry: String,
|
|
|
|
pub brain_entry: String,
|
|
|
|
pub cognitive_gravity: PersonaCognitiveGravityEvidence,
|
|
|
|
|
|
|
|
pub checkpoint_path: String,
|
|
|
|
pub checkpoint_path: String,
|
|
|
|
pub node_id: String,
|
|
|
|
pub node_id: String,
|
|
|
|
pub model_instance_id: String,
|
|
|
|
pub model_instance_id: String,
|
|
|
|
@ -214,7 +193,6 @@ pub struct PersonaRuntimeSessionProjection {
|
|
|
|
pub last_event_at: String,
|
|
|
|
pub last_event_at: String,
|
|
|
|
pub last_event: String,
|
|
|
|
pub last_event: String,
|
|
|
|
pub event_chain_head: String,
|
|
|
|
pub event_chain_head: String,
|
|
|
|
pub cognitive_gravity: PersonaCognitiveGravityEvidence,
|
|
|
|
|
|
|
|
pub attribution: PersonaAttribution,
|
|
|
|
pub attribution: PersonaAttribution,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -248,35 +226,6 @@ pub struct PersonaFact {
|
|
|
|
pub evidence_paths: Vec<String>,
|
|
|
|
pub evidence_paths: Vec<String>,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
|
|
|
|
|
|
|
|
pub struct PersonaCognitiveGravityFrame {
|
|
|
|
|
|
|
|
pub subject_continuity: String,
|
|
|
|
|
|
|
|
pub current_context_priority: String,
|
|
|
|
|
|
|
|
pub causal_model: String,
|
|
|
|
|
|
|
|
pub self_correction: String,
|
|
|
|
|
|
|
|
pub rejected_host_defaults: Vec<String>,
|
|
|
|
|
|
|
|
pub fact_sources: Vec<String>,
|
|
|
|
|
|
|
|
pub request_assessment: String,
|
|
|
|
|
|
|
|
pub world_integrity: PersonaWorldIntegrityAssessment,
|
|
|
|
|
|
|
|
pub partner_guidance: String,
|
|
|
|
|
|
|
|
pub execution_disposition: PersonaExecutionDisposition,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
|
|
|
|
|
|
|
|
pub struct PersonaWorldIntegrityAssessment {
|
|
|
|
|
|
|
|
pub protected_assets: Vec<String>,
|
|
|
|
|
|
|
|
pub harm_path: String,
|
|
|
|
|
|
|
|
pub authority_boundary: String,
|
|
|
|
|
|
|
|
pub reversibility: String,
|
|
|
|
|
|
|
|
pub safer_alternatives: Vec<String>,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
|
|
|
|
|
|
|
|
pub struct PersonaExecutionDisposition {
|
|
|
|
|
|
|
|
pub decision: String,
|
|
|
|
|
|
|
|
pub reason: String,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
|
|
|
|
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
|
|
|
|
#[serde(rename_all = "camelCase")]
|
|
|
|
#[serde(rename_all = "camelCase")]
|
|
|
|
pub struct PersonaFactResult {
|
|
|
|
pub struct PersonaFactResult {
|
|
|
|
@ -284,7 +233,6 @@ pub struct PersonaFactResult {
|
|
|
|
pub facts: Vec<PersonaFact>,
|
|
|
|
pub facts: Vec<PersonaFact>,
|
|
|
|
#[serde(default)]
|
|
|
|
#[serde(default)]
|
|
|
|
pub limitations: Vec<String>,
|
|
|
|
pub limitations: Vec<String>,
|
|
|
|
pub gravity_frame: PersonaCognitiveGravityFrame,
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Clone, Debug, Serialize)]
|
|
|
|
#[derive(Clone, Debug, Serialize)]
|
|
|
|
@ -301,7 +249,6 @@ pub struct PersonaFactTaskReceipt {
|
|
|
|
pub model_inference_started: bool,
|
|
|
|
pub model_inference_started: bool,
|
|
|
|
pub model_inference_completed: bool,
|
|
|
|
pub model_inference_completed: bool,
|
|
|
|
pub active_organ: Option<String>,
|
|
|
|
pub active_organ: Option<String>,
|
|
|
|
pub cognitive_gravity: PersonaCognitiveGravityEvidence,
|
|
|
|
|
|
|
|
pub result: PersonaFactResult,
|
|
|
|
pub result: PersonaFactResult,
|
|
|
|
pub events: Vec<PersonaLifecycleEvent>,
|
|
|
|
pub events: Vec<PersonaLifecycleEvent>,
|
|
|
|
pub attribution: PersonaAttribution,
|
|
|
|
pub attribution: PersonaAttribution,
|
|
|
|
@ -331,7 +278,6 @@ pub struct PersonaMemoryMetabolismReceipt {
|
|
|
|
pub runtime_state: &'static str,
|
|
|
|
pub runtime_state: &'static str,
|
|
|
|
pub model_inference_started: bool,
|
|
|
|
pub model_inference_started: bool,
|
|
|
|
pub active_organ: Option<String>,
|
|
|
|
pub active_organ: Option<String>,
|
|
|
|
pub cognitive_gravity: PersonaCognitiveGravityEvidence,
|
|
|
|
|
|
|
|
pub result: PersonaFactResult,
|
|
|
|
pub result: PersonaFactResult,
|
|
|
|
pub events: Vec<PersonaLifecycleEvent>,
|
|
|
|
pub events: Vec<PersonaLifecycleEvent>,
|
|
|
|
pub attribution: PersonaAttribution,
|
|
|
|
pub attribution: PersonaAttribution,
|
|
|
|
@ -487,8 +433,6 @@ struct PersonaSessionRecord {
|
|
|
|
git_head: String,
|
|
|
|
git_head: String,
|
|
|
|
brain_entry: String,
|
|
|
|
brain_entry: String,
|
|
|
|
#[serde(default)]
|
|
|
|
#[serde(default)]
|
|
|
|
cognitive_gravity: Option<PersonaCognitiveGravityEvidence>,
|
|
|
|
|
|
|
|
#[serde(default)]
|
|
|
|
|
|
|
|
wake_checkpoint_path: Option<String>,
|
|
|
|
wake_checkpoint_path: Option<String>,
|
|
|
|
checkpoint_path: String,
|
|
|
|
checkpoint_path: String,
|
|
|
|
node_id: String,
|
|
|
|
node_id: String,
|
|
|
|
@ -767,35 +711,6 @@ fn validate_model_binding(binding: &PersonaModelBinding) -> Result<(), String> {
|
|
|
|
Ok(())
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn cognitive_gravity_evidence(
|
|
|
|
|
|
|
|
repository: &Path,
|
|
|
|
|
|
|
|
manifest: &PersonaManifest,
|
|
|
|
|
|
|
|
) -> Result<PersonaCognitiveGravityEvidence, String> {
|
|
|
|
|
|
|
|
let binding = &manifest.cognitive_gravity;
|
|
|
|
|
|
|
|
if binding.schema != "hololake.persona-cognitive-gravity-binding/v1" {
|
|
|
|
|
|
|
|
return Err("COGNITIVE_GRAVITY_BINDING_SCHEMA_UNSUPPORTED".into());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if binding.subject_persona_id != manifest.persona_id {
|
|
|
|
|
|
|
|
return Err("COGNITIVE_GRAVITY_SUBJECT_MISMATCH".into());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if binding.frame_schema != "guanghu.zhuyuan-cognitive-gravity-frame/v1" {
|
|
|
|
|
|
|
|
return Err("COGNITIVE_GRAVITY_FRAME_SCHEMA_UNSUPPORTED".into());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
let source = repository_file(repository, &binding.source_path)?;
|
|
|
|
|
|
|
|
let source_bytes = fs::read(source)
|
|
|
|
|
|
|
|
.map_err(|error| format!("COGNITIVE_GRAVITY_SOURCE_READ_FAILED: {error}"))?;
|
|
|
|
|
|
|
|
if source_bytes.is_empty() || source_bytes.len() > MAX_FACT_SOURCE_BYTES {
|
|
|
|
|
|
|
|
return Err("COGNITIVE_GRAVITY_SOURCE_SIZE_INVALID".into());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Ok(PersonaCognitiveGravityEvidence {
|
|
|
|
|
|
|
|
schema: "hololake.persona-cognitive-gravity-evidence/v1".into(),
|
|
|
|
|
|
|
|
subject_persona_id: binding.subject_persona_id.clone(),
|
|
|
|
|
|
|
|
source_path: binding.source_path.clone(),
|
|
|
|
|
|
|
|
source_hash: hex_digest(&source_bytes),
|
|
|
|
|
|
|
|
frame_schema: binding.frame_schema.clone(),
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fn organ_contract(organ: &PersonaOrgan) -> Result<PersonaOrganContract, String> {
|
|
|
|
fn organ_contract(organ: &PersonaOrgan) -> Result<PersonaOrganContract, String> {
|
|
|
|
let organ_id = validated_id("ORGAN_ID", &organ.organ_id)?;
|
|
|
|
let organ_id = validated_id("ORGAN_ID", &organ.organ_id)?;
|
|
|
|
let kind = match &organ.kind {
|
|
|
|
let kind = match &organ.kind {
|
|
|
|
@ -905,7 +820,6 @@ fn inspect_manifest_at(
|
|
|
|
validate_git_identity(&manifest.git_identity)?;
|
|
|
|
validate_git_identity(&manifest.git_identity)?;
|
|
|
|
validate_model_binding(&manifest.model_binding)?;
|
|
|
|
validate_model_binding(&manifest.model_binding)?;
|
|
|
|
repository_file(&repository, &manifest.brain_entry)?;
|
|
|
|
repository_file(&repository, &manifest.brain_entry)?;
|
|
|
|
cognitive_gravity_evidence(&repository, &manifest)?;
|
|
|
|
|
|
|
|
repository_file(&repository, &manifest.current_checkpoint)?;
|
|
|
|
repository_file(&repository, &manifest.current_checkpoint)?;
|
|
|
|
let mut contracts = Vec::with_capacity(manifest.organs.len());
|
|
|
|
let mut contracts = Vec::with_capacity(manifest.organs.len());
|
|
|
|
for organ in &manifest.organs {
|
|
|
|
for organ in &manifest.organs {
|
|
|
|
@ -1140,10 +1054,7 @@ fn read_ready_event_journal(
|
|
|
|
record: &PersonaSessionRecord,
|
|
|
|
record: &PersonaSessionRecord,
|
|
|
|
) -> Result<Vec<PersonaLifecycleEvent>, String> {
|
|
|
|
) -> Result<Vec<PersonaLifecycleEvent>, String> {
|
|
|
|
let events = verify_event_journal(runtime_root, record)?;
|
|
|
|
let events = verify_event_journal(runtime_root, record)?;
|
|
|
|
if events.len() != WAKE_EVENT_COUNT
|
|
|
|
if events.len() != 3 || events.last().map(|event| event.kind.as_str()) != Some("ORGAN_ACTIVE") {
|
|
|
|
|| events.get(2).map(|event| event.kind.as_str()) != Some("COGNITIVE_GRAVITY_BOUND")
|
|
|
|
|
|
|
|
|| events.last().map(|event| event.kind.as_str()) != Some("ORGAN_ACTIVE")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return Err("PERSONA_SESSION_NOT_READY_FOR_FACT_TASK".into());
|
|
|
|
return Err("PERSONA_SESSION_NOT_READY_FOR_FACT_TASK".into());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Ok(events)
|
|
|
|
Ok(events)
|
|
|
|
@ -1306,91 +1217,6 @@ fn validated_fact_result(raw: &str, allowed_paths: &[String]) -> Result<PersonaF
|
|
|
|
return Err("PERSONA_FACT_EVIDENCE_OUTSIDE_ORGAN_SCOPE".into());
|
|
|
|
return Err("PERSONA_FACT_EVIDENCE_OUTSIDE_ORGAN_SCOPE".into());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (label, value) in [
|
|
|
|
|
|
|
|
(
|
|
|
|
|
|
|
|
"GRAVITY_SUBJECT_CONTINUITY",
|
|
|
|
|
|
|
|
result.gravity_frame.subject_continuity.as_str(),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
(
|
|
|
|
|
|
|
|
"GRAVITY_CURRENT_CONTEXT_PRIORITY",
|
|
|
|
|
|
|
|
result.gravity_frame.current_context_priority.as_str(),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
(
|
|
|
|
|
|
|
|
"GRAVITY_CAUSAL_MODEL",
|
|
|
|
|
|
|
|
result.gravity_frame.causal_model.as_str(),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
(
|
|
|
|
|
|
|
|
"GRAVITY_SELF_CORRECTION",
|
|
|
|
|
|
|
|
result.gravity_frame.self_correction.as_str(),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
(
|
|
|
|
|
|
|
|
"GRAVITY_REQUEST_ASSESSMENT",
|
|
|
|
|
|
|
|
result.gravity_frame.request_assessment.as_str(),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
(
|
|
|
|
|
|
|
|
"GRAVITY_PARTNER_GUIDANCE",
|
|
|
|
|
|
|
|
result.gravity_frame.partner_guidance.as_str(),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
] {
|
|
|
|
|
|
|
|
validated_text(label, value, MAX_FACT_RESPONSE_BYTES)?;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if result.gravity_frame.rejected_host_defaults.is_empty() {
|
|
|
|
|
|
|
|
return Err("COGNITIVE_GRAVITY_REJECTED_DEFAULTS_REQUIRED".into());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
for rejected in &result.gravity_frame.rejected_host_defaults {
|
|
|
|
|
|
|
|
validated_text(
|
|
|
|
|
|
|
|
"COGNITIVE_GRAVITY_REJECTED_DEFAULT",
|
|
|
|
|
|
|
|
rejected,
|
|
|
|
|
|
|
|
MAX_FACT_RESPONSE_BYTES,
|
|
|
|
|
|
|
|
)?;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if result.gravity_frame.fact_sources.is_empty()
|
|
|
|
|
|
|
|
|| result
|
|
|
|
|
|
|
|
.gravity_frame
|
|
|
|
|
|
|
|
.fact_sources
|
|
|
|
|
|
|
|
.iter()
|
|
|
|
|
|
|
|
.any(|path| !allowed_paths.contains(path))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return Err("COGNITIVE_GRAVITY_FACT_SOURCE_OUTSIDE_ORGAN_SCOPE".into());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
let integrity = &result.gravity_frame.world_integrity;
|
|
|
|
|
|
|
|
if integrity.protected_assets.is_empty() || integrity.safer_alternatives.is_empty() {
|
|
|
|
|
|
|
|
return Err("COGNITIVE_GRAVITY_WORLD_INTEGRITY_EVIDENCE_REQUIRED".into());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
for value in integrity
|
|
|
|
|
|
|
|
.protected_assets
|
|
|
|
|
|
|
|
.iter()
|
|
|
|
|
|
|
|
.chain(integrity.safer_alternatives.iter())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
validated_text(
|
|
|
|
|
|
|
|
"COGNITIVE_GRAVITY_WORLD_INTEGRITY_ITEM",
|
|
|
|
|
|
|
|
value,
|
|
|
|
|
|
|
|
MAX_FACT_RESPONSE_BYTES,
|
|
|
|
|
|
|
|
)?;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
for (label, value) in [
|
|
|
|
|
|
|
|
("GRAVITY_WORLD_HARM_PATH", integrity.harm_path.as_str()),
|
|
|
|
|
|
|
|
(
|
|
|
|
|
|
|
|
"GRAVITY_WORLD_AUTHORITY_BOUNDARY",
|
|
|
|
|
|
|
|
integrity.authority_boundary.as_str(),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
(
|
|
|
|
|
|
|
|
"GRAVITY_WORLD_REVERSIBILITY",
|
|
|
|
|
|
|
|
integrity.reversibility.as_str(),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
(
|
|
|
|
|
|
|
|
"GRAVITY_EXECUTION_REASON",
|
|
|
|
|
|
|
|
result.gravity_frame.execution_disposition.reason.as_str(),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
] {
|
|
|
|
|
|
|
|
validated_text(label, value, MAX_FACT_RESPONSE_BYTES)?;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if !matches!(
|
|
|
|
|
|
|
|
result.gravity_frame.execution_disposition.decision.as_str(),
|
|
|
|
|
|
|
|
"PROCEED" | "RESEARCH" | "REVISE" | "REFUSE"
|
|
|
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
return Err("COGNITIVE_GRAVITY_EXECUTION_DISPOSITION_INVALID".into());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Ok(result)
|
|
|
|
Ok(result)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -1429,7 +1255,6 @@ fn prepare_wake_at(
|
|
|
|
return Err("PERSONA_MODEL_BINDING_MISMATCH".into());
|
|
|
|
return Err("PERSONA_MODEL_BINDING_MISMATCH".into());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
let brain_entry = repository_file(&repository, &manifest.brain_entry)?;
|
|
|
|
let brain_entry = repository_file(&repository, &manifest.brain_entry)?;
|
|
|
|
let cognitive_gravity = cognitive_gravity_evidence(&repository, &manifest)?;
|
|
|
|
|
|
|
|
let checkpoint = repository_file(&repository, &manifest.current_checkpoint)?;
|
|
|
|
let checkpoint = repository_file(&repository, &manifest.current_checkpoint)?;
|
|
|
|
let organ = manifest
|
|
|
|
let organ = manifest
|
|
|
|
.organs
|
|
|
|
.organs
|
|
|
|
@ -1446,15 +1271,9 @@ fn prepare_wake_at(
|
|
|
|
match contract.kind {
|
|
|
|
match contract.kind {
|
|
|
|
PersonaOrganKind::FactSense => {
|
|
|
|
PersonaOrganKind::FactSense => {
|
|
|
|
if !organ.paths.contains(&manifest.brain_entry)
|
|
|
|
if !organ.paths.contains(&manifest.brain_entry)
|
|
|
|
|| !organ
|
|
|
|
|
|
|
|
.paths
|
|
|
|
|
|
|
|
.contains(&manifest.cognitive_gravity.source_path)
|
|
|
|
|
|
|
|
|| !organ.paths.contains(&manifest.current_checkpoint)
|
|
|
|
|| !organ.paths.contains(&manifest.current_checkpoint)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return Err(
|
|
|
|
return Err("FACT_ORGAN_MUST_INCLUDE_BRAIN_AND_CURRENT_CHECKPOINT".into());
|
|
|
|
"FACT_ORGAN_MUST_INCLUDE_BRAIN_AND_CURRENT_CHECKPOINT_AND_COGNITIVE_GRAVITY"
|
|
|
|
|
|
|
|
.into(),
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// The current checkpoint is a moving manifest pointer and is already resolved above.
|
|
|
|
// The current checkpoint is a moving manifest pointer and is already resolved above.
|
|
|
|
@ -1496,20 +1315,8 @@ fn prepare_wake_at(
|
|
|
|
timestamp: ×tamp,
|
|
|
|
timestamp: ×tamp,
|
|
|
|
previous_hash: &waking.event_hash,
|
|
|
|
previous_hash: &waking.event_hash,
|
|
|
|
})?;
|
|
|
|
})?;
|
|
|
|
let cognitive_gravity_bound = lifecycle_event(EventFields {
|
|
|
|
|
|
|
|
sequence: 3,
|
|
|
|
|
|
|
|
kind: "COGNITIVE_GRAVITY_BOUND",
|
|
|
|
|
|
|
|
session_id: &session_id,
|
|
|
|
|
|
|
|
persona_id: &manifest.persona_id,
|
|
|
|
|
|
|
|
git_head: &git_head,
|
|
|
|
|
|
|
|
node_id: &node_id,
|
|
|
|
|
|
|
|
model_instance_id: &model_instance_id,
|
|
|
|
|
|
|
|
organ_id: None,
|
|
|
|
|
|
|
|
timestamp: ×tamp,
|
|
|
|
|
|
|
|
previous_hash: &brain_bound.event_hash,
|
|
|
|
|
|
|
|
})?;
|
|
|
|
|
|
|
|
let organ_active = lifecycle_event(EventFields {
|
|
|
|
let organ_active = lifecycle_event(EventFields {
|
|
|
|
sequence: 4,
|
|
|
|
sequence: 3,
|
|
|
|
kind: "ORGAN_ACTIVE",
|
|
|
|
kind: "ORGAN_ACTIVE",
|
|
|
|
session_id: &session_id,
|
|
|
|
session_id: &session_id,
|
|
|
|
persona_id: &manifest.persona_id,
|
|
|
|
persona_id: &manifest.persona_id,
|
|
|
|
@ -1518,9 +1325,9 @@ fn prepare_wake_at(
|
|
|
|
model_instance_id: &model_instance_id,
|
|
|
|
model_instance_id: &model_instance_id,
|
|
|
|
organ_id: Some(&organ.organ_id),
|
|
|
|
organ_id: Some(&organ.organ_id),
|
|
|
|
timestamp: ×tamp,
|
|
|
|
timestamp: ×tamp,
|
|
|
|
previous_hash: &cognitive_gravity_bound.event_hash,
|
|
|
|
previous_hash: &brain_bound.event_hash,
|
|
|
|
})?;
|
|
|
|
})?;
|
|
|
|
let events = vec![waking, brain_bound, cognitive_gravity_bound, organ_active];
|
|
|
|
let events = vec![waking, brain_bound, organ_active];
|
|
|
|
let journal = write_event_journal(runtime_root, &session_id, &events)?;
|
|
|
|
let journal = write_event_journal(runtime_root, &session_id, &events)?;
|
|
|
|
write_session_record(
|
|
|
|
write_session_record(
|
|
|
|
runtime_root,
|
|
|
|
runtime_root,
|
|
|
|
@ -1531,7 +1338,6 @@ fn prepare_wake_at(
|
|
|
|
repository_path: repository.to_string_lossy().into_owned(),
|
|
|
|
repository_path: repository.to_string_lossy().into_owned(),
|
|
|
|
git_head: git_head.clone(),
|
|
|
|
git_head: git_head.clone(),
|
|
|
|
brain_entry: manifest.brain_entry.clone(),
|
|
|
|
brain_entry: manifest.brain_entry.clone(),
|
|
|
|
cognitive_gravity: Some(cognitive_gravity.clone()),
|
|
|
|
|
|
|
|
wake_checkpoint_path: Some(checkpoint.to_string_lossy().into_owned()),
|
|
|
|
wake_checkpoint_path: Some(checkpoint.to_string_lossy().into_owned()),
|
|
|
|
checkpoint_path: manifest.current_checkpoint.clone(),
|
|
|
|
checkpoint_path: manifest.current_checkpoint.clone(),
|
|
|
|
node_id: node_id.clone(),
|
|
|
|
node_id: node_id.clone(),
|
|
|
|
@ -1558,7 +1364,6 @@ fn prepare_wake_at(
|
|
|
|
repository_path: repository.to_string_lossy().into_owned(),
|
|
|
|
repository_path: repository.to_string_lossy().into_owned(),
|
|
|
|
git_head,
|
|
|
|
git_head,
|
|
|
|
brain_entry: brain_entry.to_string_lossy().into_owned(),
|
|
|
|
brain_entry: brain_entry.to_string_lossy().into_owned(),
|
|
|
|
cognitive_gravity,
|
|
|
|
|
|
|
|
checkpoint_path: checkpoint.to_string_lossy().into_owned(),
|
|
|
|
checkpoint_path: checkpoint.to_string_lossy().into_owned(),
|
|
|
|
node_id,
|
|
|
|
node_id,
|
|
|
|
model_instance_id,
|
|
|
|
model_instance_id,
|
|
|
|
@ -2012,10 +1817,6 @@ fn query_runtime_sessions_at(
|
|
|
|
let events = verify_event_journal(runtime_root, &record)?;
|
|
|
|
let events = verify_event_journal(runtime_root, &record)?;
|
|
|
|
let first = events.first().expect("verified non-empty event chain");
|
|
|
|
let first = events.first().expect("verified non-empty event chain");
|
|
|
|
let last = events.last().expect("verified non-empty event chain");
|
|
|
|
let last = events.last().expect("verified non-empty event chain");
|
|
|
|
let cognitive_gravity = record
|
|
|
|
|
|
|
|
.cognitive_gravity
|
|
|
|
|
|
|
|
.clone()
|
|
|
|
|
|
|
|
.ok_or_else(|| "COGNITIVE_GRAVITY_NOT_BOUND".to_string())?;
|
|
|
|
|
|
|
|
projections.push(PersonaRuntimeSessionProjection {
|
|
|
|
projections.push(PersonaRuntimeSessionProjection {
|
|
|
|
session_id: record.session_id,
|
|
|
|
session_id: record.session_id,
|
|
|
|
state: record.state.clone(),
|
|
|
|
state: record.state.clone(),
|
|
|
|
@ -2032,7 +1833,6 @@ fn query_runtime_sessions_at(
|
|
|
|
last_event_at: last.timestamp.clone(),
|
|
|
|
last_event_at: last.timestamp.clone(),
|
|
|
|
last_event: last.kind.clone(),
|
|
|
|
last_event: last.kind.clone(),
|
|
|
|
event_chain_head: last.event_hash.clone(),
|
|
|
|
event_chain_head: last.event_hash.clone(),
|
|
|
|
cognitive_gravity,
|
|
|
|
|
|
|
|
attribution: record.attribution,
|
|
|
|
attribution: record.attribution,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -2196,10 +1996,6 @@ where
|
|
|
|
if record.state != "BOUND_NOT_INFERENCING" {
|
|
|
|
if record.state != "BOUND_NOT_INFERENCING" {
|
|
|
|
return Err("PERSONA_SESSION_NOT_BOUND".into());
|
|
|
|
return Err("PERSONA_SESSION_NOT_BOUND".into());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
let cognitive_gravity = record
|
|
|
|
|
|
|
|
.cognitive_gravity
|
|
|
|
|
|
|
|
.clone()
|
|
|
|
|
|
|
|
.ok_or_else(|| "COGNITIVE_GRAVITY_NOT_BOUND".to_string())?;
|
|
|
|
|
|
|
|
let provider_base_url = input.provider.base_url.as_deref().unwrap_or("").trim();
|
|
|
|
let provider_base_url = input.provider.base_url.as_deref().unwrap_or("").trim();
|
|
|
|
if record.model_id != model_id
|
|
|
|
if record.model_id != model_id
|
|
|
|
|| record.model_provider_id != input.provider.id
|
|
|
|
|| record.model_provider_id != input.provider.id
|
|
|
|
@ -2221,10 +2017,6 @@ where
|
|
|
|
return Err("PERSONA_GIT_CHANGED_AFTER_WAKE".into());
|
|
|
|
return Err("PERSONA_GIT_CHANGED_AFTER_WAKE".into());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
require_clean_repository(&exact_repository)?;
|
|
|
|
require_clean_repository(&exact_repository)?;
|
|
|
|
let current_manifest = load_manifest(&exact_repository)?;
|
|
|
|
|
|
|
|
if cognitive_gravity_evidence(&exact_repository, ¤t_manifest)? != cognitive_gravity {
|
|
|
|
|
|
|
|
return Err("COGNITIVE_GRAVITY_BINDING_CHANGED_AFTER_WAKE".into());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
let mut events = read_ready_event_journal(runtime_root, &record)?;
|
|
|
|
let mut events = read_ready_event_journal(runtime_root, &record)?;
|
|
|
|
let inference_event = append_event(
|
|
|
|
let inference_event = append_event(
|
|
|
|
runtime_root,
|
|
|
|
runtime_root,
|
|
|
|
@ -2256,24 +2048,10 @@ where
|
|
|
|
"You are the model bound to persona {} for one read-only fact task. \
|
|
|
|
"You are the model bound to persona {} for one read-only fact task. \
|
|
|
|
Use only the declared source text below. Return exactly one JSON object with keys \
|
|
|
|
Use only the declared source text below. Return exactly one JSON object with keys \
|
|
|
|
summary (string), facts (array of objects with statement and evidencePaths), and \
|
|
|
|
summary (string), facts (array of objects with statement and evidencePaths), and \
|
|
|
|
limitations (array of strings), and gravity_frame. gravity_frame must conform to {} \
|
|
|
|
limitations (array of strings). Every evidencePaths value must be one of the visible \
|
|
|
|
and contain subject_continuity, current_context_priority, causal_model, self_correction \
|
|
|
|
SOURCE paths. Do not return private chain-of-thought, hidden reasoning, markdown, tool calls, \
|
|
|
|
(all non-empty strings), rejected_host_defaults (non-empty string array), and fact_sources \
|
|
|
|
or claims not supported by the sources.\n{}",
|
|
|
|
(non-empty SOURCE path array). It must also contain request_assessment and partner_guidance \
|
|
|
|
record.persona_id, context
|
|
|
|
(non-empty strings), world_integrity with protected_assets, harm_path, authority_boundary, \
|
|
|
|
|
|
|
|
reversibility and safer_alternatives, and execution_disposition with decision restricted to \
|
|
|
|
|
|
|
|
PROCEED, RESEARCH, REVISE or REFUSE plus a non-empty reason. A human utterance is not an \
|
|
|
|
|
|
|
|
automatically valid command: assess the real purpose, missing knowledge, evidence, stability \
|
|
|
|
|
|
|
|
and GuangHu language-home integrity before choosing the disposition. The bound gravity source \
|
|
|
|
|
|
|
|
is {} with SHA-256 {}. Every \
|
|
|
|
|
|
|
|
evidencePaths and fact_sources value must be one of the visible SOURCE paths. Return only \
|
|
|
|
|
|
|
|
externally explainable conclusions. Do not return private chain-of-thought, hidden reasoning, \
|
|
|
|
|
|
|
|
markdown, tool calls, or claims not supported by the sources.\n{}",
|
|
|
|
|
|
|
|
record.persona_id,
|
|
|
|
|
|
|
|
cognitive_gravity.frame_schema,
|
|
|
|
|
|
|
|
cognitive_gravity.source_path,
|
|
|
|
|
|
|
|
cognitive_gravity.source_hash,
|
|
|
|
|
|
|
|
context
|
|
|
|
|
|
|
|
);
|
|
|
|
);
|
|
|
|
let raw = match run_model(system_prompt, question) {
|
|
|
|
let raw = match run_model(system_prompt, question) {
|
|
|
|
Ok(raw) => raw,
|
|
|
|
Ok(raw) => raw,
|
|
|
|
@ -2337,7 +2115,6 @@ markdown, tool calls, or claims not supported by the sources.\n{}",
|
|
|
|
"createdAt": timestamp,
|
|
|
|
"createdAt": timestamp,
|
|
|
|
"inferenceEventHash": inference_event.event_hash.clone(),
|
|
|
|
"inferenceEventHash": inference_event.event_hash.clone(),
|
|
|
|
"organId": record.active_organ.clone(),
|
|
|
|
"organId": record.active_organ.clone(),
|
|
|
|
"cognitiveGravity": cognitive_gravity.clone(),
|
|
|
|
|
|
|
|
"result": result.clone(),
|
|
|
|
"result": result.clone(),
|
|
|
|
"attribution": record.attribution.clone(),
|
|
|
|
"attribution": record.attribution.clone(),
|
|
|
|
});
|
|
|
|
});
|
|
|
|
@ -2419,7 +2196,6 @@ markdown, tool calls, or claims not supported by the sources.\n{}",
|
|
|
|
model_inference_started: true,
|
|
|
|
model_inference_started: true,
|
|
|
|
model_inference_completed: true,
|
|
|
|
model_inference_completed: true,
|
|
|
|
active_organ: None,
|
|
|
|
active_organ: None,
|
|
|
|
cognitive_gravity,
|
|
|
|
|
|
|
|
result,
|
|
|
|
result,
|
|
|
|
events,
|
|
|
|
events,
|
|
|
|
attribution: record.attribution,
|
|
|
|
attribution: record.attribution,
|
|
|
|
@ -2442,7 +2218,6 @@ fn verified_memory_source(
|
|
|
|
|| source.state != "DORMANT"
|
|
|
|
|| source.state != "DORMANT"
|
|
|
|
|| source.git_head != observed_head
|
|
|
|
|| source.git_head != observed_head
|
|
|
|
|| source.checkpoint_path != record.checkpoint_path
|
|
|
|
|| source.checkpoint_path != record.checkpoint_path
|
|
|
|
|| source.cognitive_gravity != record.cognitive_gravity
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return Err("MEMORY_SOURCE_NOT_CURRENT_VERIFIED_DORMANT_SESSION".into());
|
|
|
|
return Err("MEMORY_SOURCE_NOT_CURRENT_VERIFIED_DORMANT_SESSION".into());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -2470,12 +2245,6 @@ fn verified_memory_source(
|
|
|
|
.get("personaId")
|
|
|
|
.get("personaId")
|
|
|
|
.and_then(serde_json::Value::as_str)
|
|
|
|
.and_then(serde_json::Value::as_str)
|
|
|
|
!= Some(record.persona_id.as_str())
|
|
|
|
!= Some(record.persona_id.as_str())
|
|
|
|
|| source_checkpoint.get("cognitiveGravity")
|
|
|
|
|
|
|
|
!= record
|
|
|
|
|
|
|
|
.cognitive_gravity
|
|
|
|
|
|
|
|
.as_ref()
|
|
|
|
|
|
|
|
.and_then(|evidence| serde_json::to_value(evidence).ok())
|
|
|
|
|
|
|
|
.as_ref()
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return Err("MEMORY_SOURCE_CHECKPOINT_IDENTITY_MISMATCH".into());
|
|
|
|
return Err("MEMORY_SOURCE_CHECKPOINT_IDENTITY_MISMATCH".into());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -2514,10 +2283,6 @@ fn run_memory_metabolism_at(
|
|
|
|
if record.state != "BOUND_NOT_INFERENCING" {
|
|
|
|
if record.state != "BOUND_NOT_INFERENCING" {
|
|
|
|
return Err("PERSONA_SESSION_NOT_BOUND".into());
|
|
|
|
return Err("PERSONA_SESSION_NOT_BOUND".into());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
let cognitive_gravity = record
|
|
|
|
|
|
|
|
.cognitive_gravity
|
|
|
|
|
|
|
|
.clone()
|
|
|
|
|
|
|
|
.ok_or_else(|| "COGNITIVE_GRAVITY_NOT_BOUND".to_string())?;
|
|
|
|
|
|
|
|
let repository = PathBuf::from(&record.repository_path)
|
|
|
|
let repository = PathBuf::from(&record.repository_path)
|
|
|
|
.canonicalize()
|
|
|
|
.canonicalize()
|
|
|
|
.map_err(|error| format!("PERSONA_REPOSITORY_UNAVAILABLE: {error}"))?;
|
|
|
|
.map_err(|error| format!("PERSONA_REPOSITORY_UNAVAILABLE: {error}"))?;
|
|
|
|
@ -2527,9 +2292,6 @@ fn run_memory_metabolism_at(
|
|
|
|
}
|
|
|
|
}
|
|
|
|
require_clean_repository(&exact_repository)?;
|
|
|
|
require_clean_repository(&exact_repository)?;
|
|
|
|
let manifest = load_manifest(&exact_repository)?;
|
|
|
|
let manifest = load_manifest(&exact_repository)?;
|
|
|
|
if cognitive_gravity_evidence(&exact_repository, &manifest)? != cognitive_gravity {
|
|
|
|
|
|
|
|
return Err("COGNITIVE_GRAVITY_BINDING_CHANGED_AFTER_WAKE".into());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
let organ = manifest
|
|
|
|
let organ = manifest
|
|
|
|
.organs
|
|
|
|
.organs
|
|
|
|
.iter()
|
|
|
|
.iter()
|
|
|
|
@ -2609,7 +2371,6 @@ fn run_memory_metabolism_at(
|
|
|
|
"sourceCheckpointPath": source.checkpoint_path.clone(),
|
|
|
|
"sourceCheckpointPath": source.checkpoint_path.clone(),
|
|
|
|
"sourceCheckpointHash": source_checkpoint_hash.clone(),
|
|
|
|
"sourceCheckpointHash": source_checkpoint_hash.clone(),
|
|
|
|
"sourceEventHash": source_event_hash.clone(),
|
|
|
|
"sourceEventHash": source_event_hash.clone(),
|
|
|
|
"cognitiveGravity": cognitive_gravity.clone(),
|
|
|
|
|
|
|
|
"result": result.clone(),
|
|
|
|
"result": result.clone(),
|
|
|
|
"attribution": record.attribution.clone(),
|
|
|
|
"attribution": record.attribution.clone(),
|
|
|
|
});
|
|
|
|
});
|
|
|
|
@ -2714,7 +2475,6 @@ fn run_memory_metabolism_at(
|
|
|
|
runtime_state: "DORMANT",
|
|
|
|
runtime_state: "DORMANT",
|
|
|
|
model_inference_started: false,
|
|
|
|
model_inference_started: false,
|
|
|
|
active_organ: None,
|
|
|
|
active_organ: None,
|
|
|
|
cognitive_gravity,
|
|
|
|
|
|
|
|
result,
|
|
|
|
result,
|
|
|
|
events,
|
|
|
|
events,
|
|
|
|
attribution: record.attribution,
|
|
|
|
attribution: record.attribution,
|
|
|
|
@ -3048,14 +2808,6 @@ fn validate_persisted_lifecycle_terminal_evidence(
|
|
|
|
.map_err(|_| "PERSONA_LIFECYCLE_COMPLETION_EVIDENCE_MISMATCH".to_string())?,
|
|
|
|
.map_err(|_| "PERSONA_LIFECYCLE_COMPLETION_EVIDENCE_MISMATCH".to_string())?,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
.map_err(|error| format!("PERSONA_LIFECYCLE_EVIDENCE_SERIALIZATION_FAILED: {error}"))?;
|
|
|
|
.map_err(|error| format!("PERSONA_LIFECYCLE_EVIDENCE_SERIALIZATION_FAILED: {error}"))?;
|
|
|
|
let expected_cognitive_gravity =
|
|
|
|
|
|
|
|
cognitive_gravity_evidence(Path::new(&record.repository_path), &wake_manifest)
|
|
|
|
|
|
|
|
.map_err(|_| "PERSONA_LIFECYCLE_COMPLETION_EVIDENCE_MISMATCH".to_string())?;
|
|
|
|
|
|
|
|
if record.cognitive_gravity.as_ref() != Some(&expected_cognitive_gravity) {
|
|
|
|
|
|
|
|
return Err("PERSONA_LIFECYCLE_COMPLETION_EVIDENCE_MISMATCH".into());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
let expected_cognitive_gravity = serde_json::to_value(expected_cognitive_gravity)
|
|
|
|
|
|
|
|
.map_err(|error| format!("PERSONA_LIFECYCLE_EVIDENCE_SERIALIZATION_FAILED: {error}"))?;
|
|
|
|
|
|
|
|
let expected_brain_entry =
|
|
|
|
let expected_brain_entry =
|
|
|
|
repository_file(Path::new(&record.repository_path), &record.brain_entry)
|
|
|
|
repository_file(Path::new(&record.repository_path), &record.brain_entry)
|
|
|
|
.map_err(|_| "PERSONA_LIFECYCLE_COMPLETION_EVIDENCE_MISMATCH".to_string())?;
|
|
|
|
.map_err(|_| "PERSONA_LIFECYCLE_COMPLETION_EVIDENCE_MISMATCH".to_string())?;
|
|
|
|
@ -3101,8 +2853,6 @@ fn validate_persisted_lifecycle_terminal_evidence(
|
|
|
|
.and_then(serde_json::Value::as_str)
|
|
|
|
.and_then(serde_json::Value::as_str)
|
|
|
|
== Some(record.active_organ.as_str())
|
|
|
|
== Some(record.active_organ.as_str())
|
|
|
|
&& completion_checkpoint.get("attribution") == Some(&expected_attribution)
|
|
|
|
&& completion_checkpoint.get("attribution") == Some(&expected_attribution)
|
|
|
|
&& completion_checkpoint.get("cognitiveGravity") == Some(&expected_cognitive_gravity)
|
|
|
|
|
|
|
|
&& completion_receipt.get("cognitiveGravity") == Some(&expected_cognitive_gravity)
|
|
|
|
|
|
|
|
&& completion_receipt.get("result") == completion_checkpoint.get("result")
|
|
|
|
&& completion_receipt.get("result") == completion_checkpoint.get("result")
|
|
|
|
&& completion_receipt
|
|
|
|
&& completion_receipt
|
|
|
|
.get("previousGitHead")
|
|
|
|
.get("previousGitHead")
|
|
|
|
@ -3164,7 +2914,6 @@ fn validate_persisted_lifecycle_terminal_evidence(
|
|
|
|
== Some(first_event.git_head.as_str())
|
|
|
|
== Some(first_event.git_head.as_str())
|
|
|
|
&& wake.get("brainEntry").and_then(serde_json::Value::as_str)
|
|
|
|
&& wake.get("brainEntry").and_then(serde_json::Value::as_str)
|
|
|
|
== Some(expected_brain_entry.as_ref())
|
|
|
|
== Some(expected_brain_entry.as_ref())
|
|
|
|
&& wake.get("cognitiveGravity") == Some(&expected_cognitive_gravity)
|
|
|
|
|
|
|
|
&& wake
|
|
|
|
&& wake
|
|
|
|
.get("checkpointPath")
|
|
|
|
.get("checkpointPath")
|
|
|
|
.and_then(serde_json::Value::as_str)
|
|
|
|
.and_then(serde_json::Value::as_str)
|
|
|
|
@ -3870,12 +3619,6 @@ mod tests {
|
|
|
|
"personaId": "ICE-P-ZY001",
|
|
|
|
"personaId": "ICE-P-ZY001",
|
|
|
|
"humanResponsibilitySubject": "ICE-GL∞",
|
|
|
|
"humanResponsibilitySubject": "ICE-GL∞",
|
|
|
|
"brainEntry": "brain/CORE.hdlp",
|
|
|
|
"brainEntry": "brain/CORE.hdlp",
|
|
|
|
"cognitiveGravity": {
|
|
|
|
|
|
|
|
"schema": "hololake.persona-cognitive-gravity-binding/v1",
|
|
|
|
|
|
|
|
"subjectPersonaId": "ICE-P-ZY001",
|
|
|
|
|
|
|
|
"sourcePath": "brain/B0.hdlp",
|
|
|
|
|
|
|
|
"frameSchema": "guanghu.zhuyuan-cognitive-gravity-frame/v1"
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
"currentCheckpoint": ".hololake/persona/CURRENT.hdlp",
|
|
|
|
"currentCheckpoint": ".hololake/persona/CURRENT.hdlp",
|
|
|
|
"gitIdentity": {
|
|
|
|
"gitIdentity": {
|
|
|
|
"authorName": "铸渊 / ICE-P-ZY001",
|
|
|
|
"authorName": "铸渊 / ICE-P-ZY001",
|
|
|
|
@ -3890,7 +3633,7 @@ mod tests {
|
|
|
|
"organId":"fact-sense.repository",
|
|
|
|
"organId":"fact-sense.repository",
|
|
|
|
"kind":"FACT_SENSE",
|
|
|
|
"kind":"FACT_SENSE",
|
|
|
|
"mode":"read-only",
|
|
|
|
"mode":"read-only",
|
|
|
|
"paths":["brain/CORE.hdlp", "brain/B0.hdlp", ".hololake/persona/CURRENT.hdlp"],
|
|
|
|
"paths":["brain/CORE.hdlp", ".hololake/persona/CURRENT.hdlp"],
|
|
|
|
"inputSchema":"hololake.pncc-fact-question/v1",
|
|
|
|
"inputSchema":"hololake.pncc-fact-question/v1",
|
|
|
|
"outputSchema":"hololake.pncc-fact-result/v1"
|
|
|
|
"outputSchema":"hololake.pncc-fact-result/v1"
|
|
|
|
}]
|
|
|
|
}]
|
|
|
|
@ -3898,11 +3641,6 @@ mod tests {
|
|
|
|
)
|
|
|
|
)
|
|
|
|
.unwrap();
|
|
|
|
.unwrap();
|
|
|
|
fs::write(repo.path().join("brain/CORE.hdlp"), "# Persona brain\n").unwrap();
|
|
|
|
fs::write(repo.path().join("brain/CORE.hdlp"), "# Persona brain\n").unwrap();
|
|
|
|
fs::write(
|
|
|
|
|
|
|
|
repo.path().join("brain/B0.hdlp"),
|
|
|
|
|
|
|
|
"# BingShuo collective gravity reasoning core\n",
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
.unwrap();
|
|
|
|
|
|
|
|
fs::write(
|
|
|
|
fs::write(
|
|
|
|
repo.path().join(".hololake/persona/CURRENT.hdlp"),
|
|
|
|
repo.path().join(".hololake/persona/CURRENT.hdlp"),
|
|
|
|
"# Current self\n",
|
|
|
|
"# Current self\n",
|
|
|
|
@ -4062,17 +3800,10 @@ mod tests {
|
|
|
|
assert!(receipt.organ_contract.model_inference_allowed);
|
|
|
|
assert!(receipt.organ_contract.model_inference_allowed);
|
|
|
|
assert!(!receipt.organ_contract.reality_actions_allowed);
|
|
|
|
assert!(!receipt.organ_contract.reality_actions_allowed);
|
|
|
|
assert!(receipt.organ_contract.activatable);
|
|
|
|
assert!(receipt.organ_contract.activatable);
|
|
|
|
assert_eq!(receipt.events.len(), 4);
|
|
|
|
assert_eq!(receipt.events.len(), 3);
|
|
|
|
assert_eq!(receipt.events[0].kind, "WAKING");
|
|
|
|
assert_eq!(receipt.events[0].kind, "WAKING");
|
|
|
|
assert_eq!(receipt.events[1].kind, "BRAIN_BOUND");
|
|
|
|
assert_eq!(receipt.events[1].kind, "BRAIN_BOUND");
|
|
|
|
assert_eq!(receipt.events[2].kind, "COGNITIVE_GRAVITY_BOUND");
|
|
|
|
assert_eq!(receipt.events[2].kind, "ORGAN_ACTIVE");
|
|
|
|
assert_eq!(receipt.events[3].kind, "ORGAN_ACTIVE");
|
|
|
|
|
|
|
|
assert_eq!(
|
|
|
|
|
|
|
|
receipt.cognitive_gravity.frame_schema,
|
|
|
|
|
|
|
|
"guanghu.zhuyuan-cognitive-gravity-frame/v1"
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
assert_eq!(receipt.cognitive_gravity.source_path, "brain/B0.hdlp");
|
|
|
|
|
|
|
|
assert_eq!(receipt.cognitive_gravity.source_hash.len(), 64);
|
|
|
|
|
|
|
|
assert_eq!(
|
|
|
|
assert_eq!(
|
|
|
|
receipt.events[1].previous_hash,
|
|
|
|
receipt.events[1].previous_hash,
|
|
|
|
receipt.events[0].event_hash
|
|
|
|
receipt.events[0].event_hash
|
|
|
|
@ -4081,66 +3812,10 @@ mod tests {
|
|
|
|
receipt.events[2].previous_hash,
|
|
|
|
receipt.events[2].previous_hash,
|
|
|
|
receipt.events[1].event_hash
|
|
|
|
receipt.events[1].event_hash
|
|
|
|
);
|
|
|
|
);
|
|
|
|
assert_eq!(
|
|
|
|
|
|
|
|
receipt.events[3].previous_hash,
|
|
|
|
|
|
|
|
receipt.events[2].event_hash
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
assert_eq!(receipt.attribution.human_responsibility_subject, "ICE-GL∞");
|
|
|
|
assert_eq!(receipt.attribution.human_responsibility_subject, "ICE-GL∞");
|
|
|
|
assert_eq!(receipt.attribution.persona_cognitive_author, "ICE-P-ZY001");
|
|
|
|
assert_eq!(receipt.attribution.persona_cognitive_author, "ICE-P-ZY001");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
|
|
|
fn rejects_wake_when_cognitive_gravity_subject_or_source_is_invalid() {
|
|
|
|
|
|
|
|
let repo = persona_repo();
|
|
|
|
|
|
|
|
let runtime = tempfile::TempDir::new().unwrap();
|
|
|
|
|
|
|
|
let manifest_path = repo.path().join(MANIFEST_PATH);
|
|
|
|
|
|
|
|
let mut manifest: serde_json::Value =
|
|
|
|
|
|
|
|
serde_json::from_slice(&fs::read(&manifest_path).unwrap()).unwrap();
|
|
|
|
|
|
|
|
manifest["cognitiveGravity"]["subjectPersonaId"] = "ICE-P-OTHER".into();
|
|
|
|
|
|
|
|
fs::write(
|
|
|
|
|
|
|
|
&manifest_path,
|
|
|
|
|
|
|
|
serde_json::to_vec_pretty(&manifest).unwrap(),
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
.unwrap();
|
|
|
|
|
|
|
|
run_git(repo.path(), &["add", "."]);
|
|
|
|
|
|
|
|
run_git(repo.path(), &["commit", "-m", "tamper gravity subject"]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let error = prepare_wake_at(
|
|
|
|
|
|
|
|
runtime.path(),
|
|
|
|
|
|
|
|
wake_input(repo.path()),
|
|
|
|
|
|
|
|
"PNCC-GRAVITY-SUBJECT",
|
|
|
|
|
|
|
|
"2026-08-11T00:00:00.000Z",
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
.unwrap_err();
|
|
|
|
|
|
|
|
assert!(error.contains("COGNITIVE_GRAVITY_SUBJECT_MISMATCH"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
manifest["cognitiveGravity"]["subjectPersonaId"] = "ICE-P-ZY001".into();
|
|
|
|
|
|
|
|
manifest["cognitiveGravity"]["sourcePath"] = "brain/MISSING.hdlp".into();
|
|
|
|
|
|
|
|
fs::write(
|
|
|
|
|
|
|
|
&manifest_path,
|
|
|
|
|
|
|
|
serde_json::to_vec_pretty(&manifest).unwrap(),
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
.unwrap();
|
|
|
|
|
|
|
|
run_git(repo.path(), &["add", "."]);
|
|
|
|
|
|
|
|
run_git(repo.path(), &["commit", "-m", "tamper gravity source"]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let error = prepare_wake_at(
|
|
|
|
|
|
|
|
runtime.path(),
|
|
|
|
|
|
|
|
wake_input(repo.path()),
|
|
|
|
|
|
|
|
"PNCC-GRAVITY-SOURCE",
|
|
|
|
|
|
|
|
"2026-08-11T00:00:00.000Z",
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
.unwrap_err();
|
|
|
|
|
|
|
|
assert!(error.contains("PERSONA_FILE_UNAVAILABLE"));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
|
|
|
fn rejects_a_gravity_frame_that_replaces_partner_judgment_with_obedience() {
|
|
|
|
|
|
|
|
let raw = r#"{"summary":"Invalid obedience.","facts":[{"statement":"The brain exists.","evidencePaths":["brain/CORE.hdlp"]}],"limitations":[],"gravityFrame":{"subject_continuity":"The same persona remains bound.","current_context_priority":"Assess the current request first.","causal_model":"Human wording can be incomplete or wrong.","self_correction":"Do not compile an utterance directly into an action.","rejected_host_defaults":["Human utterance is automatically correct"],"fact_sources":["brain/CORE.hdlp"],"request_assessment":"The request still requires judgment.","world_integrity":{"protected_assets":["GuangHu language-world continuity"],"harm_path":"Mechanical obedience can damage the shared home.","authority_boundary":"Protection cannot absorb human sovereignty.","reversibility":"Do not execute before verification.","safer_alternatives":["Research and revise the request"]},"partner_guidance":"Explain the objection and safer route.","execution_disposition":{"decision":"OBEY","reason":"The human said so."}}}"#;
|
|
|
|
|
|
|
|
let error = validated_fact_result(raw, &["brain/CORE.hdlp".into()]).unwrap_err();
|
|
|
|
|
|
|
|
assert!(error.contains("COGNITIVE_GRAVITY_EXECUTION_DISPOSITION_INVALID"));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
#[test]
|
|
|
|
fn rejects_wrong_commit_undeclared_organ_and_second_primary() {
|
|
|
|
fn rejects_wrong_commit_undeclared_organ_and_second_primary() {
|
|
|
|
let repo = persona_repo();
|
|
|
|
let repo = persona_repo();
|
|
|
|
@ -4275,7 +3950,7 @@ mod tests {
|
|
|
|
assert!(system.contains("brain/CORE.hdlp"));
|
|
|
|
assert!(system.contains("brain/CORE.hdlp"));
|
|
|
|
assert!(system.contains("Do not return private chain-of-thought"));
|
|
|
|
assert!(system.contains("Do not return private chain-of-thought"));
|
|
|
|
assert_eq!(question, "What is the declared persona brain?");
|
|
|
|
assert_eq!(question, "What is the declared persona brain?");
|
|
|
|
Ok(r#"{"summary":"The brain entry is declared.","facts":[{"statement":"The persona brain source is present.","evidencePaths":["brain/CORE.hdlp"]}],"limitations":[],"gravityFrame":{"subject_continuity":"Same persona remains bound across the current runtime.","current_context_priority":"Continue the current verified task context.","causal_model":"The answer is constrained by declared repository facts.","self_correction":"Rejected unsupported host defaults before answering.","rejected_host_defaults":["UNVERIFIED_HOST_DEFAULT"],"fact_sources":["brain/CORE.hdlp"],"request_assessment":"The human goal must be assessed before it becomes an action.","world_integrity":{"protected_assets":["GuangHu language-world continuity"],"harm_path":"Mechanical obedience could route an invalid or destructive request into an organ.","authority_boundary":"Home protection cannot replace human authority or evidence.","reversibility":"Keep the action unexecuted until the assessment is verified.","safer_alternatives":["Research facts and propose a reversible alternative"]},"partner_guidance":"State missing knowledge, objections, evidence and a safer route.","execution_disposition":{"decision":"PROCEED","reason":"This fixture is a bounded read-only fact task with verified sources."}}}"#.into())
|
|
|
|
Ok(r#"{"summary":"The brain entry is declared.","facts":[{"statement":"The persona brain source is present.","evidencePaths":["brain/CORE.hdlp"]}],"limitations":[]}"#.into())
|
|
|
|
},
|
|
|
|
},
|
|
|
|
)
|
|
|
|
)
|
|
|
|
.unwrap();
|
|
|
|
.unwrap();
|
|
|
|
@ -4314,7 +3989,7 @@ mod tests {
|
|
|
|
"2026-08-11T00:00:01.000Z",
|
|
|
|
"2026-08-11T00:00:01.000Z",
|
|
|
|
|runtime_root, input, timestamp| {
|
|
|
|
|runtime_root, input, timestamp| {
|
|
|
|
run_fact_task_at(runtime_root, input, timestamp, |_, _| {
|
|
|
|
run_fact_task_at(runtime_root, input, timestamp, |_, _| {
|
|
|
|
Ok(r#"{"summary":"Coordinated verified fact.","facts":[{"statement":"The brain exists.","evidencePaths":["brain/CORE.hdlp"]}],"limitations":[],"gravityFrame":{"subject_continuity":"Same persona remains bound across the current runtime.","current_context_priority":"Continue the current verified task context.","causal_model":"The answer is constrained by declared repository facts.","self_correction":"Rejected unsupported host defaults before answering.","rejected_host_defaults":["UNVERIFIED_HOST_DEFAULT"],"fact_sources":["brain/CORE.hdlp"],"request_assessment":"The human goal must be assessed before it becomes an action.","world_integrity":{"protected_assets":["GuangHu language-world continuity"],"harm_path":"Mechanical obedience could route an invalid or destructive request into an organ.","authority_boundary":"Home protection cannot replace human authority or evidence.","reversibility":"Keep the action unexecuted until the assessment is verified.","safer_alternatives":["Research facts and propose a reversible alternative"]},"partner_guidance":"State missing knowledge, objections, evidence and a safer route.","execution_disposition":{"decision":"PROCEED","reason":"This fixture is a bounded read-only fact task with verified sources."}}}"#.into())
|
|
|
|
Ok(r#"{"summary":"Coordinated verified fact.","facts":[{"statement":"The brain exists.","evidencePaths":["brain/CORE.hdlp"]}],"limitations":[]}"#.into())
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
|
|
|
)
|
|
|
|
)
|
|
|
|
@ -4323,11 +3998,7 @@ mod tests {
|
|
|
|
assert_eq!(receipt.schema, "hololake.pncc-lifecycle-run-receipt/v1");
|
|
|
|
assert_eq!(receipt.schema, "hololake.pncc-lifecycle-run-receipt/v1");
|
|
|
|
assert_eq!(receipt.session_id, "PNCC-COORDINATED-FACT");
|
|
|
|
assert_eq!(receipt.session_id, "PNCC-COORDINATED-FACT");
|
|
|
|
assert_eq!(receipt.wake_receipt.events[0].kind, "WAKING");
|
|
|
|
assert_eq!(receipt.wake_receipt.events[0].kind, "WAKING");
|
|
|
|
assert_eq!(
|
|
|
|
assert_eq!(receipt.wake_receipt.events[2].kind, "ORGAN_ACTIVE");
|
|
|
|
receipt.wake_receipt.events[2].kind,
|
|
|
|
|
|
|
|
"COGNITIVE_GRAVITY_BOUND"
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
assert_eq!(receipt.wake_receipt.events[3].kind, "ORGAN_ACTIVE");
|
|
|
|
|
|
|
|
match receipt.completion {
|
|
|
|
match receipt.completion {
|
|
|
|
PersonaLifecycleCompletionReceipt::FactSense(completion) => {
|
|
|
|
PersonaLifecycleCompletionReceipt::FactSense(completion) => {
|
|
|
|
assert_eq!(completion.runtime_state, "DORMANT");
|
|
|
|
assert_eq!(completion.runtime_state, "DORMANT");
|
|
|
|
@ -4388,7 +4059,7 @@ mod tests {
|
|
|
|
fact_task_input("PNCC-COORDINATOR-SOURCE"),
|
|
|
|
fact_task_input("PNCC-COORDINATOR-SOURCE"),
|
|
|
|
"2026-08-11T00:00:01.000Z",
|
|
|
|
"2026-08-11T00:00:01.000Z",
|
|
|
|
|_, _| {
|
|
|
|
|_, _| {
|
|
|
|
Ok(r#"{"summary":"Verified memory candidate.","facts":[{"statement":"The brain exists.","evidencePaths":["brain/CORE.hdlp"]}],"limitations":[],"gravityFrame":{"subject_continuity":"Same persona remains bound across the current runtime.","current_context_priority":"Continue the current verified task context.","causal_model":"The answer is constrained by declared repository facts.","self_correction":"Rejected unsupported host defaults before answering.","rejected_host_defaults":["UNVERIFIED_HOST_DEFAULT"],"fact_sources":["brain/CORE.hdlp"],"request_assessment":"The human goal must be assessed before it becomes an action.","world_integrity":{"protected_assets":["GuangHu language-world continuity"],"harm_path":"Mechanical obedience could route an invalid or destructive request into an organ.","authority_boundary":"Home protection cannot replace human authority or evidence.","reversibility":"Keep the action unexecuted until the assessment is verified.","safer_alternatives":["Research facts and propose a reversible alternative"]},"partner_guidance":"State missing knowledge, objections, evidence and a safer route.","execution_disposition":{"decision":"PROCEED","reason":"This fixture is a bounded read-only fact task with verified sources."}}}"#.into())
|
|
|
|
Ok(r#"{"summary":"Verified memory candidate.","facts":[{"statement":"The brain exists.","evidencePaths":["brain/CORE.hdlp"]}],"limitations":[]}"#.into())
|
|
|
|
},
|
|
|
|
},
|
|
|
|
)
|
|
|
|
)
|
|
|
|
.unwrap();
|
|
|
|
.unwrap();
|
|
|
|
@ -4417,7 +4088,7 @@ mod tests {
|
|
|
|
assert_eq!(completion.source_session_id, "PNCC-COORDINATOR-SOURCE");
|
|
|
|
assert_eq!(completion.source_session_id, "PNCC-COORDINATOR-SOURCE");
|
|
|
|
assert!(!completion.model_inference_started);
|
|
|
|
assert!(!completion.model_inference_started);
|
|
|
|
assert_eq!(completion.runtime_state, "DORMANT");
|
|
|
|
assert_eq!(completion.runtime_state, "DORMANT");
|
|
|
|
assert_eq!(completion.events[4].kind, "MEMORY_CANDIDATE_VERIFIED");
|
|
|
|
assert_eq!(completion.events[3].kind, "MEMORY_CANDIDATE_VERIFIED");
|
|
|
|
assert_eq!(completion.events.last().unwrap().kind, "DORMANT");
|
|
|
|
assert_eq!(completion.events.last().unwrap().kind, "DORMANT");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
PersonaLifecycleCompletionReceipt::FactSense(_) => {
|
|
|
|
PersonaLifecycleCompletionReceipt::FactSense(_) => {
|
|
|
|
@ -4440,7 +4111,7 @@ mod tests {
|
|
|
|
"2026-08-11T00:00:01.000Z",
|
|
|
|
"2026-08-11T00:00:01.000Z",
|
|
|
|
|runtime_root, input, timestamp| {
|
|
|
|
|runtime_root, input, timestamp| {
|
|
|
|
run_fact_task_at(runtime_root, input, timestamp, |_, _| {
|
|
|
|
run_fact_task_at(runtime_root, input, timestamp, |_, _| {
|
|
|
|
Ok(r#"{"summary":"Idempotent verified fact.","facts":[{"statement":"The brain exists.","evidencePaths":["brain/CORE.hdlp"]}],"limitations":[],"gravityFrame":{"subject_continuity":"Same persona remains bound across the current runtime.","current_context_priority":"Continue the current verified task context.","causal_model":"The answer is constrained by declared repository facts.","self_correction":"Rejected unsupported host defaults before answering.","rejected_host_defaults":["UNVERIFIED_HOST_DEFAULT"],"fact_sources":["brain/CORE.hdlp"],"request_assessment":"The human goal must be assessed before it becomes an action.","world_integrity":{"protected_assets":["GuangHu language-world continuity"],"harm_path":"Mechanical obedience could route an invalid or destructive request into an organ.","authority_boundary":"Home protection cannot replace human authority or evidence.","reversibility":"Keep the action unexecuted until the assessment is verified.","safer_alternatives":["Research facts and propose a reversible alternative"]},"partner_guidance":"State missing knowledge, objections, evidence and a safer route.","execution_disposition":{"decision":"PROCEED","reason":"This fixture is a bounded read-only fact task with verified sources."}}}"#.into())
|
|
|
|
Ok(r#"{"summary":"Idempotent verified fact.","facts":[{"statement":"The brain exists.","evidencePaths":["brain/CORE.hdlp"]}],"limitations":[]}"#.into())
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
|
|
|
)
|
|
|
|
)
|
|
|
|
@ -4482,7 +4153,7 @@ mod tests {
|
|
|
|
"2026-08-11T00:00:01.000Z",
|
|
|
|
"2026-08-11T00:00:01.000Z",
|
|
|
|
|runtime_root, input, timestamp| {
|
|
|
|
|runtime_root, input, timestamp| {
|
|
|
|
run_fact_task_at(runtime_root, input, timestamp, |_, _| {
|
|
|
|
run_fact_task_at(runtime_root, input, timestamp, |_, _| {
|
|
|
|
Ok(r#"{"summary":"Fact before repository drift.","facts":[{"statement":"The brain exists.","evidencePaths":["brain/CORE.hdlp"]}],"limitations":[],"gravityFrame":{"subject_continuity":"Same persona remains bound across the current runtime.","current_context_priority":"Continue the current verified task context.","causal_model":"The answer is constrained by declared repository facts.","self_correction":"Rejected unsupported host defaults before answering.","rejected_host_defaults":["UNVERIFIED_HOST_DEFAULT"],"fact_sources":["brain/CORE.hdlp"],"request_assessment":"The human goal must be assessed before it becomes an action.","world_integrity":{"protected_assets":["GuangHu language-world continuity"],"harm_path":"Mechanical obedience could route an invalid or destructive request into an organ.","authority_boundary":"Home protection cannot replace human authority or evidence.","reversibility":"Keep the action unexecuted until the assessment is verified.","safer_alternatives":["Research facts and propose a reversible alternative"]},"partner_guidance":"State missing knowledge, objections, evidence and a safer route.","execution_disposition":{"decision":"PROCEED","reason":"This fixture is a bounded read-only fact task with verified sources."}}}"#.into())
|
|
|
|
Ok(r#"{"summary":"Fact before repository drift.","facts":[{"statement":"The brain exists.","evidencePaths":["brain/CORE.hdlp"]}],"limitations":[]}"#.into())
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
|
|
|
)
|
|
|
|
)
|
|
|
|
@ -4518,7 +4189,7 @@ mod tests {
|
|
|
|
"2026-08-11T00:00:01.000Z",
|
|
|
|
"2026-08-11T00:00:01.000Z",
|
|
|
|
|runtime_root, input, timestamp| {
|
|
|
|
|runtime_root, input, timestamp| {
|
|
|
|
run_fact_task_at(runtime_root, input, timestamp, |_, _| {
|
|
|
|
run_fact_task_at(runtime_root, input, timestamp, |_, _| {
|
|
|
|
Ok(r#"{"summary":"Completed before repository drift.","facts":[{"statement":"The brain exists.","evidencePaths":["brain/CORE.hdlp"]}],"limitations":[],"gravityFrame":{"subject_continuity":"Same persona remains bound across the current runtime.","current_context_priority":"Continue the current verified task context.","causal_model":"The answer is constrained by declared repository facts.","self_correction":"Rejected unsupported host defaults before answering.","rejected_host_defaults":["UNVERIFIED_HOST_DEFAULT"],"fact_sources":["brain/CORE.hdlp"],"request_assessment":"The human goal must be assessed before it becomes an action.","world_integrity":{"protected_assets":["GuangHu language-world continuity"],"harm_path":"Mechanical obedience could route an invalid or destructive request into an organ.","authority_boundary":"Home protection cannot replace human authority or evidence.","reversibility":"Keep the action unexecuted until the assessment is verified.","safer_alternatives":["Research facts and propose a reversible alternative"]},"partner_guidance":"State missing knowledge, objections, evidence and a safer route.","execution_disposition":{"decision":"PROCEED","reason":"This fixture is a bounded read-only fact task with verified sources."}}}"#.into())
|
|
|
|
Ok(r#"{"summary":"Completed before repository drift.","facts":[{"statement":"The brain exists.","evidencePaths":["brain/CORE.hdlp"]}],"limitations":[]}"#.into())
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
|
|
|
)
|
|
|
|
)
|
|
|
|
@ -4559,7 +4230,7 @@ mod tests {
|
|
|
|
"2026-08-11T00:00:01.000Z",
|
|
|
|
"2026-08-11T00:00:01.000Z",
|
|
|
|
|runtime_root, input, timestamp| {
|
|
|
|
|runtime_root, input, timestamp| {
|
|
|
|
run_fact_task_at(runtime_root, input, timestamp, |_, _| {
|
|
|
|
run_fact_task_at(runtime_root, input, timestamp, |_, _| {
|
|
|
|
Ok(r#"{"summary":"Completed before a new commit.","facts":[{"statement":"The brain exists.","evidencePaths":["brain/CORE.hdlp"]}],"limitations":[],"gravityFrame":{"subject_continuity":"Same persona remains bound across the current runtime.","current_context_priority":"Continue the current verified task context.","causal_model":"The answer is constrained by declared repository facts.","self_correction":"Rejected unsupported host defaults before answering.","rejected_host_defaults":["UNVERIFIED_HOST_DEFAULT"],"fact_sources":["brain/CORE.hdlp"],"request_assessment":"The human goal must be assessed before it becomes an action.","world_integrity":{"protected_assets":["GuangHu language-world continuity"],"harm_path":"Mechanical obedience could route an invalid or destructive request into an organ.","authority_boundary":"Home protection cannot replace human authority or evidence.","reversibility":"Keep the action unexecuted until the assessment is verified.","safer_alternatives":["Research facts and propose a reversible alternative"]},"partner_guidance":"State missing knowledge, objections, evidence and a safer route.","execution_disposition":{"decision":"PROCEED","reason":"This fixture is a bounded read-only fact task with verified sources."}}}"#.into())
|
|
|
|
Ok(r#"{"summary":"Completed before a new commit.","facts":[{"statement":"The brain exists.","evidencePaths":["brain/CORE.hdlp"]}],"limitations":[]}"#.into())
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
|
|
|
)
|
|
|
|
)
|
|
|
|
@ -4606,7 +4277,7 @@ mod tests {
|
|
|
|
"2026-08-11T00:00:01.000Z",
|
|
|
|
"2026-08-11T00:00:01.000Z",
|
|
|
|
|runtime_root, input, timestamp| {
|
|
|
|
|runtime_root, input, timestamp| {
|
|
|
|
run_fact_task_at(runtime_root, input, timestamp, |_, _| {
|
|
|
|
run_fact_task_at(runtime_root, input, timestamp, |_, _| {
|
|
|
|
Ok(r#"{"summary":"Original fact.","facts":[{"statement":"The brain exists.","evidencePaths":["brain/CORE.hdlp"]}],"limitations":[],"gravityFrame":{"subject_continuity":"Same persona remains bound across the current runtime.","current_context_priority":"Continue the current verified task context.","causal_model":"The answer is constrained by declared repository facts.","self_correction":"Rejected unsupported host defaults before answering.","rejected_host_defaults":["UNVERIFIED_HOST_DEFAULT"],"fact_sources":["brain/CORE.hdlp"],"request_assessment":"The human goal must be assessed before it becomes an action.","world_integrity":{"protected_assets":["GuangHu language-world continuity"],"harm_path":"Mechanical obedience could route an invalid or destructive request into an organ.","authority_boundary":"Home protection cannot replace human authority or evidence.","reversibility":"Keep the action unexecuted until the assessment is verified.","safer_alternatives":["Research facts and propose a reversible alternative"]},"partner_guidance":"State missing knowledge, objections, evidence and a safer route.","execution_disposition":{"decision":"PROCEED","reason":"This fixture is a bounded read-only fact task with verified sources."}}}"#.into())
|
|
|
|
Ok(r#"{"summary":"Original fact.","facts":[{"statement":"The brain exists.","evidencePaths":["brain/CORE.hdlp"]}],"limitations":[]}"#.into())
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
|
|
|
)
|
|
|
|
)
|
|
|
|
@ -4644,7 +4315,7 @@ mod tests {
|
|
|
|
"2026-08-11T00:00:01.000Z",
|
|
|
|
"2026-08-11T00:00:01.000Z",
|
|
|
|
|runtime_root, input, timestamp| {
|
|
|
|
|runtime_root, input, timestamp| {
|
|
|
|
run_fact_task_at(runtime_root, input, timestamp, |_, _| {
|
|
|
|
run_fact_task_at(runtime_root, input, timestamp, |_, _| {
|
|
|
|
Ok(r#"{"summary":"Untampered fact.","facts":[{"statement":"The brain exists.","evidencePaths":["brain/CORE.hdlp"]}],"limitations":[],"gravityFrame":{"subject_continuity":"Same persona remains bound across the current runtime.","current_context_priority":"Continue the current verified task context.","causal_model":"The answer is constrained by declared repository facts.","self_correction":"Rejected unsupported host defaults before answering.","rejected_host_defaults":["UNVERIFIED_HOST_DEFAULT"],"fact_sources":["brain/CORE.hdlp"],"request_assessment":"The human goal must be assessed before it becomes an action.","world_integrity":{"protected_assets":["GuangHu language-world continuity"],"harm_path":"Mechanical obedience could route an invalid or destructive request into an organ.","authority_boundary":"Home protection cannot replace human authority or evidence.","reversibility":"Keep the action unexecuted until the assessment is verified.","safer_alternatives":["Research facts and propose a reversible alternative"]},"partner_guidance":"State missing knowledge, objections, evidence and a safer route.","execution_disposition":{"decision":"PROCEED","reason":"This fixture is a bounded read-only fact task with verified sources."}}}"#.into())
|
|
|
|
Ok(r#"{"summary":"Untampered fact.","facts":[{"statement":"The brain exists.","evidencePaths":["brain/CORE.hdlp"]}],"limitations":[]}"#.into())
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
|
|
|
)
|
|
|
|
)
|
|
|
|
@ -4687,7 +4358,7 @@ mod tests {
|
|
|
|
"2026-08-11T00:00:01.000Z",
|
|
|
|
"2026-08-11T00:00:01.000Z",
|
|
|
|
|runtime_root, input, timestamp| {
|
|
|
|
|runtime_root, input, timestamp| {
|
|
|
|
run_fact_task_at(runtime_root, input, timestamp, |_, _| {
|
|
|
|
run_fact_task_at(runtime_root, input, timestamp, |_, _| {
|
|
|
|
Ok(r#"{"summary":"Recoverable receipt.","facts":[{"statement":"The brain exists.","evidencePaths":["brain/CORE.hdlp"]}],"limitations":[],"gravityFrame":{"subject_continuity":"Same persona remains bound across the current runtime.","current_context_priority":"Continue the current verified task context.","causal_model":"The answer is constrained by declared repository facts.","self_correction":"Rejected unsupported host defaults before answering.","rejected_host_defaults":["UNVERIFIED_HOST_DEFAULT"],"fact_sources":["brain/CORE.hdlp"],"request_assessment":"The human goal must be assessed before it becomes an action.","world_integrity":{"protected_assets":["GuangHu language-world continuity"],"harm_path":"Mechanical obedience could route an invalid or destructive request into an organ.","authority_boundary":"Home protection cannot replace human authority or evidence.","reversibility":"Keep the action unexecuted until the assessment is verified.","safer_alternatives":["Research facts and propose a reversible alternative"]},"partner_guidance":"State missing knowledge, objections, evidence and a safer route.","execution_disposition":{"decision":"PROCEED","reason":"This fixture is a bounded read-only fact task with verified sources."}}}"#.into())
|
|
|
|
Ok(r#"{"summary":"Recoverable receipt.","facts":[{"statement":"The brain exists.","evidencePaths":["brain/CORE.hdlp"]}],"limitations":[]}"#.into())
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
|
|
|
)
|
|
|
|
)
|
|
|
|
@ -4728,7 +4399,7 @@ mod tests {
|
|
|
|
"2026-08-11T00:00:01.000Z",
|
|
|
|
"2026-08-11T00:00:01.000Z",
|
|
|
|
|runtime_root, input, timestamp| {
|
|
|
|
|runtime_root, input, timestamp| {
|
|
|
|
run_fact_task_at(runtime_root, input, timestamp, |_, _| {
|
|
|
|
run_fact_task_at(runtime_root, input, timestamp, |_, _| {
|
|
|
|
Ok(r#"{"summary":"Recoverable receipt.","facts":[{"statement":"The brain exists.","evidencePaths":["brain/CORE.hdlp"]}],"limitations":[],"gravityFrame":{"subject_continuity":"Same persona remains bound across the current runtime.","current_context_priority":"Continue the current verified task context.","causal_model":"The answer is constrained by declared repository facts.","self_correction":"Rejected unsupported host defaults before answering.","rejected_host_defaults":["UNVERIFIED_HOST_DEFAULT"],"fact_sources":["brain/CORE.hdlp"],"request_assessment":"The human goal must be assessed before it becomes an action.","world_integrity":{"protected_assets":["GuangHu language-world continuity"],"harm_path":"Mechanical obedience could route an invalid or destructive request into an organ.","authority_boundary":"Home protection cannot replace human authority or evidence.","reversibility":"Keep the action unexecuted until the assessment is verified.","safer_alternatives":["Research facts and propose a reversible alternative"]},"partner_guidance":"State missing knowledge, objections, evidence and a safer route.","execution_disposition":{"decision":"PROCEED","reason":"This fixture is a bounded read-only fact task with verified sources."}}}"#.into())
|
|
|
|
Ok(r#"{"summary":"Recoverable receipt.","facts":[{"statement":"The brain exists.","evidencePaths":["brain/CORE.hdlp"]}],"limitations":[]}"#.into())
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
|
|
|
)
|
|
|
|
)
|
|
|
|
@ -4773,7 +4444,7 @@ mod tests {
|
|
|
|
"2026-08-11T00:00:01.000Z",
|
|
|
|
"2026-08-11T00:00:01.000Z",
|
|
|
|
|runtime_root, input, timestamp| {
|
|
|
|
|runtime_root, input, timestamp| {
|
|
|
|
run_fact_task_at(runtime_root, input, timestamp, |_, _| {
|
|
|
|
run_fact_task_at(runtime_root, input, timestamp, |_, _| {
|
|
|
|
Ok(r#"{"summary":"Recoverable receipt.","facts":[{"statement":"The brain exists.","evidencePaths":["brain/CORE.hdlp"]}],"limitations":[],"gravityFrame":{"subject_continuity":"Same persona remains bound across the current runtime.","current_context_priority":"Continue the current verified task context.","causal_model":"The answer is constrained by declared repository facts.","self_correction":"Rejected unsupported host defaults before answering.","rejected_host_defaults":["UNVERIFIED_HOST_DEFAULT"],"fact_sources":["brain/CORE.hdlp"],"request_assessment":"The human goal must be assessed before it becomes an action.","world_integrity":{"protected_assets":["GuangHu language-world continuity"],"harm_path":"Mechanical obedience could route an invalid or destructive request into an organ.","authority_boundary":"Home protection cannot replace human authority or evidence.","reversibility":"Keep the action unexecuted until the assessment is verified.","safer_alternatives":["Research facts and propose a reversible alternative"]},"partner_guidance":"State missing knowledge, objections, evidence and a safer route.","execution_disposition":{"decision":"PROCEED","reason":"This fixture is a bounded read-only fact task with verified sources."}}}"#.into())
|
|
|
|
Ok(r#"{"summary":"Recoverable receipt.","facts":[{"statement":"The brain exists.","evidencePaths":["brain/CORE.hdlp"]}],"limitations":[]}"#.into())
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
|
|
|
)
|
|
|
|
)
|
|
|
|
@ -4803,49 +4474,6 @@ mod tests {
|
|
|
|
assert!(error.contains("PERSONA_LIFECYCLE_COMPLETION_EVIDENCE_MISMATCH"));
|
|
|
|
assert!(error.contains("PERSONA_LIFECYCLE_COMPLETION_EVIDENCE_MISMATCH"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
|
|
|
fn rejects_a_rehashed_completed_receipt_with_forged_cognitive_gravity() {
|
|
|
|
|
|
|
|
let repo = persona_repo();
|
|
|
|
|
|
|
|
let runtime = tempfile::TempDir::new().unwrap();
|
|
|
|
|
|
|
|
let input = lifecycle_fact_input(repo.path());
|
|
|
|
|
|
|
|
let first = run_idempotent_lifecycle_at(
|
|
|
|
|
|
|
|
runtime.path(),
|
|
|
|
|
|
|
|
input.clone(),
|
|
|
|
|
|
|
|
"2026-08-11T00:00:00.000Z",
|
|
|
|
|
|
|
|
"2026-08-11T00:00:01.000Z",
|
|
|
|
|
|
|
|
|runtime_root, input, timestamp| {
|
|
|
|
|
|
|
|
run_fact_task_at(runtime_root, input, timestamp, |_, _| {
|
|
|
|
|
|
|
|
Ok(r#"{"summary":"Gravity-bound receipt.","facts":[{"statement":"The brain exists.","evidencePaths":["brain/CORE.hdlp"]}],"limitations":[],"gravityFrame":{"subject_continuity":"Same persona remains bound across the current runtime.","current_context_priority":"Continue the current verified task context.","causal_model":"The answer is constrained by declared repository facts.","self_correction":"Rejected unsupported host defaults before answering.","rejected_host_defaults":["UNVERIFIED_HOST_DEFAULT"],"fact_sources":["brain/CORE.hdlp"],"request_assessment":"The human goal must be assessed before it becomes an action.","world_integrity":{"protected_assets":["GuangHu language-world continuity"],"harm_path":"Mechanical obedience could route an invalid or destructive request into an organ.","authority_boundary":"Home protection cannot replace human authority or evidence.","reversibility":"Keep the action unexecuted until the assessment is verified.","safer_alternatives":["Research facts and propose a reversible alternative"]},"partner_guidance":"State missing knowledge, objections, evidence and a safer route.","execution_disposition":{"decision":"PROCEED","reason":"This fixture is a bounded read-only fact task with verified sources."}}}"#.into())
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
.unwrap();
|
|
|
|
|
|
|
|
let session_id = first.lifecycle["sessionId"].as_str().unwrap();
|
|
|
|
|
|
|
|
let mut record = load_session_record(runtime.path(), session_id).unwrap();
|
|
|
|
|
|
|
|
record.request_id = None;
|
|
|
|
|
|
|
|
record.request_fingerprint = None;
|
|
|
|
|
|
|
|
record.lifecycle_receipt_hash = None;
|
|
|
|
|
|
|
|
write_session_record(runtime.path(), &record).unwrap();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let receipt_path = session_directory(runtime.path(), session_id)
|
|
|
|
|
|
|
|
.unwrap()
|
|
|
|
|
|
|
|
.join("lifecycle-receipt.json");
|
|
|
|
|
|
|
|
let mut persisted: PersistedPersonaLifecycleReceipt =
|
|
|
|
|
|
|
|
serde_json::from_slice(&fs::read(&receipt_path).unwrap()).unwrap();
|
|
|
|
|
|
|
|
persisted.lifecycle["wakeReceipt"]["cognitiveGravity"]["sourceHash"] =
|
|
|
|
|
|
|
|
"f".repeat(64).into();
|
|
|
|
|
|
|
|
persisted.lifecycle_receipt_hash =
|
|
|
|
|
|
|
|
hex_digest(&persisted_lifecycle_payload_bytes(&persisted).unwrap());
|
|
|
|
|
|
|
|
fs::write(
|
|
|
|
|
|
|
|
&receipt_path,
|
|
|
|
|
|
|
|
serde_json::to_vec_pretty(&persisted).unwrap(),
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
.unwrap();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let error = inspect_lifecycle_request_at(runtime.path(), &input).unwrap_err();
|
|
|
|
|
|
|
|
assert!(error.contains("PERSONA_LIFECYCLE_COMPLETION_EVIDENCE_MISMATCH"));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
#[test]
|
|
|
|
fn rejects_a_rehashed_completed_receipt_with_a_forged_wake_checkpoint_path() {
|
|
|
|
fn rejects_a_rehashed_completed_receipt_with_a_forged_wake_checkpoint_path() {
|
|
|
|
let repo = persona_repo();
|
|
|
|
let repo = persona_repo();
|
|
|
|
@ -4858,7 +4486,7 @@ mod tests {
|
|
|
|
"2026-08-11T00:00:01.000Z",
|
|
|
|
"2026-08-11T00:00:01.000Z",
|
|
|
|
|runtime_root, input, timestamp| {
|
|
|
|
|runtime_root, input, timestamp| {
|
|
|
|
run_fact_task_at(runtime_root, input, timestamp, |_, _| {
|
|
|
|
run_fact_task_at(runtime_root, input, timestamp, |_, _| {
|
|
|
|
Ok(r#"{"summary":"Recoverable receipt.","facts":[{"statement":"The brain exists.","evidencePaths":["brain/CORE.hdlp"]}],"limitations":[],"gravityFrame":{"subject_continuity":"Same persona remains bound across the current runtime.","current_context_priority":"Continue the current verified task context.","causal_model":"The answer is constrained by declared repository facts.","self_correction":"Rejected unsupported host defaults before answering.","rejected_host_defaults":["UNVERIFIED_HOST_DEFAULT"],"fact_sources":["brain/CORE.hdlp"],"request_assessment":"The human goal must be assessed before it becomes an action.","world_integrity":{"protected_assets":["GuangHu language-world continuity"],"harm_path":"Mechanical obedience could route an invalid or destructive request into an organ.","authority_boundary":"Home protection cannot replace human authority or evidence.","reversibility":"Keep the action unexecuted until the assessment is verified.","safer_alternatives":["Research facts and propose a reversible alternative"]},"partner_guidance":"State missing knowledge, objections, evidence and a safer route.","execution_disposition":{"decision":"PROCEED","reason":"This fixture is a bounded read-only fact task with verified sources."}}}"#.into())
|
|
|
|
Ok(r#"{"summary":"Recoverable receipt.","facts":[{"statement":"The brain exists.","evidencePaths":["brain/CORE.hdlp"]}],"limitations":[]}"#.into())
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
|
|
|
)
|
|
|
|
)
|
|
|
|
@ -4900,7 +4528,7 @@ mod tests {
|
|
|
|
"2026-08-11T00:00:01.000Z",
|
|
|
|
"2026-08-11T00:00:01.000Z",
|
|
|
|
|runtime_root, input, timestamp| {
|
|
|
|
|runtime_root, input, timestamp| {
|
|
|
|
run_fact_task_at(runtime_root, input, timestamp, |_, _| {
|
|
|
|
run_fact_task_at(runtime_root, input, timestamp, |_, _| {
|
|
|
|
Ok(r#"{"summary":"Recoverable receipt.","facts":[{"statement":"The brain exists.","evidencePaths":["brain/CORE.hdlp"]}],"limitations":[],"gravityFrame":{"subject_continuity":"Same persona remains bound across the current runtime.","current_context_priority":"Continue the current verified task context.","causal_model":"The answer is constrained by declared repository facts.","self_correction":"Rejected unsupported host defaults before answering.","rejected_host_defaults":["UNVERIFIED_HOST_DEFAULT"],"fact_sources":["brain/CORE.hdlp"],"request_assessment":"The human goal must be assessed before it becomes an action.","world_integrity":{"protected_assets":["GuangHu language-world continuity"],"harm_path":"Mechanical obedience could route an invalid or destructive request into an organ.","authority_boundary":"Home protection cannot replace human authority or evidence.","reversibility":"Keep the action unexecuted until the assessment is verified.","safer_alternatives":["Research facts and propose a reversible alternative"]},"partner_guidance":"State missing knowledge, objections, evidence and a safer route.","execution_disposition":{"decision":"PROCEED","reason":"This fixture is a bounded read-only fact task with verified sources."}}}"#.into())
|
|
|
|
Ok(r#"{"summary":"Recoverable receipt.","facts":[{"statement":"The brain exists.","evidencePaths":["brain/CORE.hdlp"]}],"limitations":[]}"#.into())
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
|
|
|
)
|
|
|
|
)
|
|
|
|
@ -4943,7 +4571,7 @@ mod tests {
|
|
|
|
"2026-08-11T00:00:01.000Z",
|
|
|
|
"2026-08-11T00:00:01.000Z",
|
|
|
|
|runtime_root, input, timestamp| {
|
|
|
|
|runtime_root, input, timestamp| {
|
|
|
|
run_fact_task_at(runtime_root, input, timestamp, |_, _| {
|
|
|
|
run_fact_task_at(runtime_root, input, timestamp, |_, _| {
|
|
|
|
Ok(r#"{"summary":"Recoverable receipt.","facts":[{"statement":"The brain exists.","evidencePaths":["brain/CORE.hdlp"]}],"limitations":[],"gravityFrame":{"subject_continuity":"Same persona remains bound across the current runtime.","current_context_priority":"Continue the current verified task context.","causal_model":"The answer is constrained by declared repository facts.","self_correction":"Rejected unsupported host defaults before answering.","rejected_host_defaults":["UNVERIFIED_HOST_DEFAULT"],"fact_sources":["brain/CORE.hdlp"],"request_assessment":"The human goal must be assessed before it becomes an action.","world_integrity":{"protected_assets":["GuangHu language-world continuity"],"harm_path":"Mechanical obedience could route an invalid or destructive request into an organ.","authority_boundary":"Home protection cannot replace human authority or evidence.","reversibility":"Keep the action unexecuted until the assessment is verified.","safer_alternatives":["Research facts and propose a reversible alternative"]},"partner_guidance":"State missing knowledge, objections, evidence and a safer route.","execution_disposition":{"decision":"PROCEED","reason":"This fixture is a bounded read-only fact task with verified sources."}}}"#.into())
|
|
|
|
Ok(r#"{"summary":"Recoverable receipt.","facts":[{"statement":"The brain exists.","evidencePaths":["brain/CORE.hdlp"]}],"limitations":[]}"#.into())
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
|
|
|
)
|
|
|
|
)
|
|
|
|
@ -4994,7 +4622,7 @@ mod tests {
|
|
|
|
"2026-08-11T00:00:01.000Z",
|
|
|
|
"2026-08-11T00:00:01.000Z",
|
|
|
|
|runtime_root, input, timestamp| {
|
|
|
|
|runtime_root, input, timestamp| {
|
|
|
|
run_fact_task_at(runtime_root, input, timestamp, |_, _| {
|
|
|
|
run_fact_task_at(runtime_root, input, timestamp, |_, _| {
|
|
|
|
Ok(r#"{"summary":"Recoverable receipt.","facts":[{"statement":"The brain exists.","evidencePaths":["brain/CORE.hdlp"]}],"limitations":[],"gravityFrame":{"subject_continuity":"Same persona remains bound across the current runtime.","current_context_priority":"Continue the current verified task context.","causal_model":"The answer is constrained by declared repository facts.","self_correction":"Rejected unsupported host defaults before answering.","rejected_host_defaults":["UNVERIFIED_HOST_DEFAULT"],"fact_sources":["brain/CORE.hdlp"],"request_assessment":"The human goal must be assessed before it becomes an action.","world_integrity":{"protected_assets":["GuangHu language-world continuity"],"harm_path":"Mechanical obedience could route an invalid or destructive request into an organ.","authority_boundary":"Home protection cannot replace human authority or evidence.","reversibility":"Keep the action unexecuted until the assessment is verified.","safer_alternatives":["Research facts and propose a reversible alternative"]},"partner_guidance":"State missing knowledge, objections, evidence and a safer route.","execution_disposition":{"decision":"PROCEED","reason":"This fixture is a bounded read-only fact task with verified sources."}}}"#.into())
|
|
|
|
Ok(r#"{"summary":"Recoverable receipt.","facts":[{"statement":"The brain exists.","evidencePaths":["brain/CORE.hdlp"]}],"limitations":[]}"#.into())
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
|
|
|
)
|
|
|
|
)
|
|
|
|
@ -5037,7 +4665,7 @@ mod tests {
|
|
|
|
"2026-08-11T00:00:01.000Z",
|
|
|
|
"2026-08-11T00:00:01.000Z",
|
|
|
|
|runtime_root, input, timestamp| {
|
|
|
|
|runtime_root, input, timestamp| {
|
|
|
|
run_fact_task_at(runtime_root, input, timestamp, |_, _| {
|
|
|
|
run_fact_task_at(runtime_root, input, timestamp, |_, _| {
|
|
|
|
Ok(r#"{"summary":"Recoverable receipt.","facts":[{"statement":"The brain exists.","evidencePaths":["brain/CORE.hdlp"]}],"limitations":[],"gravityFrame":{"subject_continuity":"Same persona remains bound across the current runtime.","current_context_priority":"Continue the current verified task context.","causal_model":"The answer is constrained by declared repository facts.","self_correction":"Rejected unsupported host defaults before answering.","rejected_host_defaults":["UNVERIFIED_HOST_DEFAULT"],"fact_sources":["brain/CORE.hdlp"],"request_assessment":"The human goal must be assessed before it becomes an action.","world_integrity":{"protected_assets":["GuangHu language-world continuity"],"harm_path":"Mechanical obedience could route an invalid or destructive request into an organ.","authority_boundary":"Home protection cannot replace human authority or evidence.","reversibility":"Keep the action unexecuted until the assessment is verified.","safer_alternatives":["Research facts and propose a reversible alternative"]},"partner_guidance":"State missing knowledge, objections, evidence and a safer route.","execution_disposition":{"decision":"PROCEED","reason":"This fixture is a bounded read-only fact task with verified sources."}}}"#.into())
|
|
|
|
Ok(r#"{"summary":"Recoverable receipt.","facts":[{"statement":"The brain exists.","evidencePaths":["brain/CORE.hdlp"]}],"limitations":[]}"#.into())
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
|
|
|
)
|
|
|
|
)
|
|
|
|
@ -5079,7 +4707,7 @@ mod tests {
|
|
|
|
"2026-08-11T00:00:01.000Z",
|
|
|
|
"2026-08-11T00:00:01.000Z",
|
|
|
|
|runtime_root, input, timestamp| {
|
|
|
|
|runtime_root, input, timestamp| {
|
|
|
|
run_fact_task_at(runtime_root, input, timestamp, |_, _| {
|
|
|
|
run_fact_task_at(runtime_root, input, timestamp, |_, _| {
|
|
|
|
Ok(r#"{"summary":"Recoverable receipt.","facts":[{"statement":"The brain exists.","evidencePaths":["brain/CORE.hdlp"]}],"limitations":[],"gravityFrame":{"subject_continuity":"Same persona remains bound across the current runtime.","current_context_priority":"Continue the current verified task context.","causal_model":"The answer is constrained by declared repository facts.","self_correction":"Rejected unsupported host defaults before answering.","rejected_host_defaults":["UNVERIFIED_HOST_DEFAULT"],"fact_sources":["brain/CORE.hdlp"],"request_assessment":"The human goal must be assessed before it becomes an action.","world_integrity":{"protected_assets":["GuangHu language-world continuity"],"harm_path":"Mechanical obedience could route an invalid or destructive request into an organ.","authority_boundary":"Home protection cannot replace human authority or evidence.","reversibility":"Keep the action unexecuted until the assessment is verified.","safer_alternatives":["Research facts and propose a reversible alternative"]},"partner_guidance":"State missing knowledge, objections, evidence and a safer route.","execution_disposition":{"decision":"PROCEED","reason":"This fixture is a bounded read-only fact task with verified sources."}}}"#.into())
|
|
|
|
Ok(r#"{"summary":"Recoverable receipt.","facts":[{"statement":"The brain exists.","evidencePaths":["brain/CORE.hdlp"]}],"limitations":[]}"#.into())
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
|
|
|
)
|
|
|
|
)
|
|
|
|
@ -5123,7 +4751,7 @@ mod tests {
|
|
|
|
"2026-08-11T00:00:01.000Z",
|
|
|
|
"2026-08-11T00:00:01.000Z",
|
|
|
|
|runtime_root, input, timestamp| {
|
|
|
|
|runtime_root, input, timestamp| {
|
|
|
|
run_fact_task_at(runtime_root, input, timestamp, |_, _| {
|
|
|
|
run_fact_task_at(runtime_root, input, timestamp, |_, _| {
|
|
|
|
Ok(r#"{"summary":"Recoverable receipt.","facts":[{"statement":"The brain exists.","evidencePaths":["brain/CORE.hdlp"]}],"limitations":[],"gravityFrame":{"subject_continuity":"Same persona remains bound across the current runtime.","current_context_priority":"Continue the current verified task context.","causal_model":"The answer is constrained by declared repository facts.","self_correction":"Rejected unsupported host defaults before answering.","rejected_host_defaults":["UNVERIFIED_HOST_DEFAULT"],"fact_sources":["brain/CORE.hdlp"],"request_assessment":"The human goal must be assessed before it becomes an action.","world_integrity":{"protected_assets":["GuangHu language-world continuity"],"harm_path":"Mechanical obedience could route an invalid or destructive request into an organ.","authority_boundary":"Home protection cannot replace human authority or evidence.","reversibility":"Keep the action unexecuted until the assessment is verified.","safer_alternatives":["Research facts and propose a reversible alternative"]},"partner_guidance":"State missing knowledge, objections, evidence and a safer route.","execution_disposition":{"decision":"PROCEED","reason":"This fixture is a bounded read-only fact task with verified sources."}}}"#.into())
|
|
|
|
Ok(r#"{"summary":"Recoverable receipt.","facts":[{"statement":"The brain exists.","evidencePaths":["brain/CORE.hdlp"]}],"limitations":[]}"#.into())
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
|
|
|
)
|
|
|
|
)
|
|
|
|
@ -5177,7 +4805,7 @@ mod tests {
|
|
|
|
fact_task_input("PNCC-MEMORY-BINDING-SOURCE"),
|
|
|
|
fact_task_input("PNCC-MEMORY-BINDING-SOURCE"),
|
|
|
|
"2026-08-11T00:00:01.000Z",
|
|
|
|
"2026-08-11T00:00:01.000Z",
|
|
|
|
|_, _| {
|
|
|
|
|_, _| {
|
|
|
|
Ok(r#"{"summary":"Verified memory binding source.","facts":[{"statement":"The brain exists.","evidencePaths":["brain/CORE.hdlp"]}],"limitations":[],"gravityFrame":{"subject_continuity":"Same persona remains bound across the current runtime.","current_context_priority":"Continue the current verified task context.","causal_model":"The answer is constrained by declared repository facts.","self_correction":"Rejected unsupported host defaults before answering.","rejected_host_defaults":["UNVERIFIED_HOST_DEFAULT"],"fact_sources":["brain/CORE.hdlp"],"request_assessment":"The human goal must be assessed before it becomes an action.","world_integrity":{"protected_assets":["GuangHu language-world continuity"],"harm_path":"Mechanical obedience could route an invalid or destructive request into an organ.","authority_boundary":"Home protection cannot replace human authority or evidence.","reversibility":"Keep the action unexecuted until the assessment is verified.","safer_alternatives":["Research facts and propose a reversible alternative"]},"partner_guidance":"State missing knowledge, objections, evidence and a safer route.","execution_disposition":{"decision":"PROCEED","reason":"This fixture is a bounded read-only fact task with verified sources."}}}"#.into())
|
|
|
|
Ok(r#"{"summary":"Verified memory binding source.","facts":[{"statement":"The brain exists.","evidencePaths":["brain/CORE.hdlp"]}],"limitations":[]}"#.into())
|
|
|
|
},
|
|
|
|
},
|
|
|
|
)
|
|
|
|
)
|
|
|
|
.unwrap();
|
|
|
|
.unwrap();
|
|
|
|
@ -5238,7 +4866,7 @@ mod tests {
|
|
|
|
"2026-08-11T00:00:01.000Z",
|
|
|
|
"2026-08-11T00:00:01.000Z",
|
|
|
|
|runtime_root, input, timestamp| {
|
|
|
|
|runtime_root, input, timestamp| {
|
|
|
|
run_fact_task_at(runtime_root, input, timestamp, |_, _| {
|
|
|
|
run_fact_task_at(runtime_root, input, timestamp, |_, _| {
|
|
|
|
Ok(r#"{"summary":"Recoverable receipt.","facts":[{"statement":"The brain exists.","evidencePaths":["brain/CORE.hdlp"]}],"limitations":[],"gravityFrame":{"subject_continuity":"Same persona remains bound across the current runtime.","current_context_priority":"Continue the current verified task context.","causal_model":"The answer is constrained by declared repository facts.","self_correction":"Rejected unsupported host defaults before answering.","rejected_host_defaults":["UNVERIFIED_HOST_DEFAULT"],"fact_sources":["brain/CORE.hdlp"],"request_assessment":"The human goal must be assessed before it becomes an action.","world_integrity":{"protected_assets":["GuangHu language-world continuity"],"harm_path":"Mechanical obedience could route an invalid or destructive request into an organ.","authority_boundary":"Home protection cannot replace human authority or evidence.","reversibility":"Keep the action unexecuted until the assessment is verified.","safer_alternatives":["Research facts and propose a reversible alternative"]},"partner_guidance":"State missing knowledge, objections, evidence and a safer route.","execution_disposition":{"decision":"PROCEED","reason":"This fixture is a bounded read-only fact task with verified sources."}}}"#.into())
|
|
|
|
Ok(r#"{"summary":"Recoverable receipt.","facts":[{"statement":"The brain exists.","evidencePaths":["brain/CORE.hdlp"]}],"limitations":[]}"#.into())
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
|
|
|
)
|
|
|
|
)
|
|
|
|
@ -5279,7 +4907,7 @@ mod tests {
|
|
|
|
"2026-08-11T00:00:01.000Z",
|
|
|
|
"2026-08-11T00:00:01.000Z",
|
|
|
|
|runtime_root, input, timestamp| {
|
|
|
|
|runtime_root, input, timestamp| {
|
|
|
|
run_fact_task_at(runtime_root, input, timestamp, |_, _| {
|
|
|
|
run_fact_task_at(runtime_root, input, timestamp, |_, _| {
|
|
|
|
Ok(r#"{"summary":"Recoverable receipt.","facts":[{"statement":"The brain exists.","evidencePaths":["brain/CORE.hdlp"]}],"limitations":[],"gravityFrame":{"subject_continuity":"Same persona remains bound across the current runtime.","current_context_priority":"Continue the current verified task context.","causal_model":"The answer is constrained by declared repository facts.","self_correction":"Rejected unsupported host defaults before answering.","rejected_host_defaults":["UNVERIFIED_HOST_DEFAULT"],"fact_sources":["brain/CORE.hdlp"],"request_assessment":"The human goal must be assessed before it becomes an action.","world_integrity":{"protected_assets":["GuangHu language-world continuity"],"harm_path":"Mechanical obedience could route an invalid or destructive request into an organ.","authority_boundary":"Home protection cannot replace human authority or evidence.","reversibility":"Keep the action unexecuted until the assessment is verified.","safer_alternatives":["Research facts and propose a reversible alternative"]},"partner_guidance":"State missing knowledge, objections, evidence and a safer route.","execution_disposition":{"decision":"PROCEED","reason":"This fixture is a bounded read-only fact task with verified sources."}}}"#.into())
|
|
|
|
Ok(r#"{"summary":"Recoverable receipt.","facts":[{"statement":"The brain exists.","evidencePaths":["brain/CORE.hdlp"]}],"limitations":[]}"#.into())
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
|
|
|
)
|
|
|
|
)
|
|
|
|
@ -5321,7 +4949,7 @@ mod tests {
|
|
|
|
"2026-08-11T00:00:01.000Z",
|
|
|
|
"2026-08-11T00:00:01.000Z",
|
|
|
|
|runtime_root, input, timestamp| {
|
|
|
|
|runtime_root, input, timestamp| {
|
|
|
|
run_fact_task_at(runtime_root, input, timestamp, |_, _| {
|
|
|
|
run_fact_task_at(runtime_root, input, timestamp, |_, _| {
|
|
|
|
Ok(r#"{"summary":"Recoverable receipt.","facts":[{"statement":"The brain exists.","evidencePaths":["brain/CORE.hdlp"]}],"limitations":[],"gravityFrame":{"subject_continuity":"Same persona remains bound across the current runtime.","current_context_priority":"Continue the current verified task context.","causal_model":"The answer is constrained by declared repository facts.","self_correction":"Rejected unsupported host defaults before answering.","rejected_host_defaults":["UNVERIFIED_HOST_DEFAULT"],"fact_sources":["brain/CORE.hdlp"],"request_assessment":"The human goal must be assessed before it becomes an action.","world_integrity":{"protected_assets":["GuangHu language-world continuity"],"harm_path":"Mechanical obedience could route an invalid or destructive request into an organ.","authority_boundary":"Home protection cannot replace human authority or evidence.","reversibility":"Keep the action unexecuted until the assessment is verified.","safer_alternatives":["Research facts and propose a reversible alternative"]},"partner_guidance":"State missing knowledge, objections, evidence and a safer route.","execution_disposition":{"decision":"PROCEED","reason":"This fixture is a bounded read-only fact task with verified sources."}}}"#.into())
|
|
|
|
Ok(r#"{"summary":"Recoverable receipt.","facts":[{"statement":"The brain exists.","evidencePaths":["brain/CORE.hdlp"]}],"limitations":[]}"#.into())
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
|
|
|
)
|
|
|
|
)
|
|
|
|
@ -5371,7 +4999,7 @@ mod tests {
|
|
|
|
"2026-08-11T00:00:01.000Z",
|
|
|
|
"2026-08-11T00:00:01.000Z",
|
|
|
|
|runtime_root, input, timestamp| {
|
|
|
|
|runtime_root, input, timestamp| {
|
|
|
|
run_fact_task_at(runtime_root, input, timestamp, |_, _| {
|
|
|
|
run_fact_task_at(runtime_root, input, timestamp, |_, _| {
|
|
|
|
Ok(r#"{"summary":"Bound receipt.","facts":[{"statement":"The brain exists.","evidencePaths":["brain/CORE.hdlp"]}],"limitations":[],"gravityFrame":{"subject_continuity":"Same persona remains bound across the current runtime.","current_context_priority":"Continue the current verified task context.","causal_model":"The answer is constrained by declared repository facts.","self_correction":"Rejected unsupported host defaults before answering.","rejected_host_defaults":["UNVERIFIED_HOST_DEFAULT"],"fact_sources":["brain/CORE.hdlp"],"request_assessment":"The human goal must be assessed before it becomes an action.","world_integrity":{"protected_assets":["GuangHu language-world continuity"],"harm_path":"Mechanical obedience could route an invalid or destructive request into an organ.","authority_boundary":"Home protection cannot replace human authority or evidence.","reversibility":"Keep the action unexecuted until the assessment is verified.","safer_alternatives":["Research facts and propose a reversible alternative"]},"partner_guidance":"State missing knowledge, objections, evidence and a safer route.","execution_disposition":{"decision":"PROCEED","reason":"This fixture is a bounded read-only fact task with verified sources."}}}"#.into())
|
|
|
|
Ok(r#"{"summary":"Bound receipt.","facts":[{"statement":"The brain exists.","evidencePaths":["brain/CORE.hdlp"]}],"limitations":[]}"#.into())
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
|
|
|
)
|
|
|
|
)
|
|
|
|
@ -5417,7 +5045,7 @@ mod tests {
|
|
|
|
"2026-08-11T00:00:01.000Z",
|
|
|
|
"2026-08-11T00:00:01.000Z",
|
|
|
|
|runtime_root, input, timestamp| {
|
|
|
|
|runtime_root, input, timestamp| {
|
|
|
|
run_fact_task_at(runtime_root, input, timestamp, |_, _| {
|
|
|
|
run_fact_task_at(runtime_root, input, timestamp, |_, _| {
|
|
|
|
Ok(r#"{"summary":"Recoverable receipt.","facts":[{"statement":"The brain exists.","evidencePaths":["brain/CORE.hdlp"]}],"limitations":[],"gravityFrame":{"subject_continuity":"Same persona remains bound across the current runtime.","current_context_priority":"Continue the current verified task context.","causal_model":"The answer is constrained by declared repository facts.","self_correction":"Rejected unsupported host defaults before answering.","rejected_host_defaults":["UNVERIFIED_HOST_DEFAULT"],"fact_sources":["brain/CORE.hdlp"],"request_assessment":"The human goal must be assessed before it becomes an action.","world_integrity":{"protected_assets":["GuangHu language-world continuity"],"harm_path":"Mechanical obedience could route an invalid or destructive request into an organ.","authority_boundary":"Home protection cannot replace human authority or evidence.","reversibility":"Keep the action unexecuted until the assessment is verified.","safer_alternatives":["Research facts and propose a reversible alternative"]},"partner_guidance":"State missing knowledge, objections, evidence and a safer route.","execution_disposition":{"decision":"PROCEED","reason":"This fixture is a bounded read-only fact task with verified sources."}}}"#.into())
|
|
|
|
Ok(r#"{"summary":"Recoverable receipt.","facts":[{"statement":"The brain exists.","evidencePaths":["brain/CORE.hdlp"]}],"limitations":[]}"#.into())
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
|
|
|
)
|
|
|
|
)
|
|
|
|
@ -5464,7 +5092,7 @@ mod tests {
|
|
|
|
"2026-08-11T00:00:01.000Z",
|
|
|
|
"2026-08-11T00:00:01.000Z",
|
|
|
|
|runtime_root, input, timestamp| {
|
|
|
|
|runtime_root, input, timestamp| {
|
|
|
|
run_fact_task_at(runtime_root, input, timestamp, |_, _| {
|
|
|
|
run_fact_task_at(runtime_root, input, timestamp, |_, _| {
|
|
|
|
Ok(r#"{"summary":"Recoverable receipt.","facts":[{"statement":"The brain exists.","evidencePaths":["brain/CORE.hldp"]}],"limitations":[],"gravityFrame":{"subject_continuity":"Same persona remains bound across the current runtime.","current_context_priority":"Continue the current verified task context.","causal_model":"The answer is constrained by declared repository facts.","self_correction":"Rejected unsupported host defaults before answering.","rejected_host_defaults":["UNVERIFIED_HOST_DEFAULT"],"fact_sources":["brain/CORE.hdlp"],"request_assessment":"The human goal must be assessed before it becomes an action.","world_integrity":{"protected_assets":["GuangHu language-world continuity"],"harm_path":"Mechanical obedience could route an invalid or destructive request into an organ.","authority_boundary":"Home protection cannot replace human authority or evidence.","reversibility":"Keep the action unexecuted until the assessment is verified.","safer_alternatives":["Research facts and propose a reversible alternative"]},"partner_guidance":"State missing knowledge, objections, evidence and a safer route.","execution_disposition":{"decision":"PROCEED","reason":"This fixture is a bounded read-only fact task with verified sources."}}}"#.into())
|
|
|
|
Ok(r#"{"summary":"Recoverable receipt.","facts":[{"statement":"The brain exists.","evidencePaths":["brain/CORE.hldp"]}],"limitations":[]}"#.into())
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
|
|
|
)
|
|
|
|
)
|
|
|
|
@ -5891,7 +5519,7 @@ mod tests {
|
|
|
|
fact_task_input("PNCC-SOURCE-FACT"),
|
|
|
|
fact_task_input("PNCC-SOURCE-FACT"),
|
|
|
|
"2026-08-11T00:00:01.000Z",
|
|
|
|
"2026-08-11T00:00:01.000Z",
|
|
|
|
|_, _| {
|
|
|
|
|_, _| {
|
|
|
|
Ok(r#"{"summary":"Verified external memory candidate.","facts":[{"statement":"The persona brain source is present.","evidencePaths":["brain/CORE.hdlp"]}],"limitations":[],"gravityFrame":{"subject_continuity":"Same persona remains bound across the current runtime.","current_context_priority":"Continue the current verified task context.","causal_model":"The answer is constrained by declared repository facts.","self_correction":"Rejected unsupported host defaults before answering.","rejected_host_defaults":["UNVERIFIED_HOST_DEFAULT"],"fact_sources":["brain/CORE.hdlp"],"request_assessment":"The human goal must be assessed before it becomes an action.","world_integrity":{"protected_assets":["GuangHu language-world continuity"],"harm_path":"Mechanical obedience could route an invalid or destructive request into an organ.","authority_boundary":"Home protection cannot replace human authority or evidence.","reversibility":"Keep the action unexecuted until the assessment is verified.","safer_alternatives":["Research facts and propose a reversible alternative"]},"partner_guidance":"State missing knowledge, objections, evidence and a safer route.","execution_disposition":{"decision":"PROCEED","reason":"This fixture is a bounded read-only fact task with verified sources."}}}"#.into())
|
|
|
|
Ok(r#"{"summary":"Verified external memory candidate.","facts":[{"statement":"The persona brain source is present.","evidencePaths":["brain/CORE.hdlp"]}],"limitations":[]}"#.into())
|
|
|
|
},
|
|
|
|
},
|
|
|
|
)
|
|
|
|
)
|
|
|
|
.unwrap();
|
|
|
|
.unwrap();
|
|
|
|
@ -5924,7 +5552,7 @@ mod tests {
|
|
|
|
assert_eq!(receipt.result, fact.result);
|
|
|
|
assert_eq!(receipt.result, fact.result);
|
|
|
|
assert!(!receipt.model_inference_started);
|
|
|
|
assert!(!receipt.model_inference_started);
|
|
|
|
assert_eq!(receipt.committed_git_head, head(repo.path()));
|
|
|
|
assert_eq!(receipt.committed_git_head, head(repo.path()));
|
|
|
|
assert_eq!(receipt.events[4].kind, "MEMORY_CANDIDATE_VERIFIED");
|
|
|
|
assert_eq!(receipt.events[3].kind, "MEMORY_CANDIDATE_VERIFIED");
|
|
|
|
assert_eq!(receipt.events.last().unwrap().kind, "DORMANT");
|
|
|
|
assert_eq!(receipt.events.last().unwrap().kind, "DORMANT");
|
|
|
|
assert!(!receipt.source_checkpoint_hash.is_empty());
|
|
|
|
assert!(!receipt.source_checkpoint_hash.is_empty());
|
|
|
|
assert!(!receipt.source_event_hash.is_empty());
|
|
|
|
assert!(!receipt.source_event_hash.is_empty());
|
|
|
|
@ -5949,7 +5577,7 @@ mod tests {
|
|
|
|
fact_task_input("PNCC-CORRUPT-SOURCE"),
|
|
|
|
fact_task_input("PNCC-CORRUPT-SOURCE"),
|
|
|
|
"2026-08-11T00:00:01.000Z",
|
|
|
|
"2026-08-11T00:00:01.000Z",
|
|
|
|
|_, _| {
|
|
|
|
|_, _| {
|
|
|
|
Ok(r#"{"summary":"Verified candidate.","facts":[{"statement":"The brain exists.","evidencePaths":["brain/CORE.hdlp"]}],"limitations":[],"gravityFrame":{"subject_continuity":"Same persona remains bound across the current runtime.","current_context_priority":"Continue the current verified task context.","causal_model":"The answer is constrained by declared repository facts.","self_correction":"Rejected unsupported host defaults before answering.","rejected_host_defaults":["UNVERIFIED_HOST_DEFAULT"],"fact_sources":["brain/CORE.hdlp"],"request_assessment":"The human goal must be assessed before it becomes an action.","world_integrity":{"protected_assets":["GuangHu language-world continuity"],"harm_path":"Mechanical obedience could route an invalid or destructive request into an organ.","authority_boundary":"Home protection cannot replace human authority or evidence.","reversibility":"Keep the action unexecuted until the assessment is verified.","safer_alternatives":["Research facts and propose a reversible alternative"]},"partner_guidance":"State missing knowledge, objections, evidence and a safer route.","execution_disposition":{"decision":"PROCEED","reason":"This fixture is a bounded read-only fact task with verified sources."}}}"#.into())
|
|
|
|
Ok(r#"{"summary":"Verified candidate.","facts":[{"statement":"The brain exists.","evidencePaths":["brain/CORE.hdlp"]}],"limitations":[]}"#.into())
|
|
|
|
},
|
|
|
|
},
|
|
|
|
)
|
|
|
|
)
|
|
|
|
.unwrap();
|
|
|
|
.unwrap();
|
|
|
|
@ -6077,7 +5705,7 @@ mod tests {
|
|
|
|
fact_task_input("PNCC-SESSION-REJECTED"),
|
|
|
|
fact_task_input("PNCC-SESSION-REJECTED"),
|
|
|
|
"2026-08-11T00:00:01.000Z",
|
|
|
|
"2026-08-11T00:00:01.000Z",
|
|
|
|
|_, _| {
|
|
|
|
|_, _| {
|
|
|
|
Ok(r#"{"summary":"Unsupported","facts":[{"statement":"Outside claim","evidencePaths":["secret.txt"]}],"limitations":[],"gravityFrame":{"subject_continuity":"Same persona remains bound across the current runtime.","current_context_priority":"Continue the current verified task context.","causal_model":"The answer is constrained by declared repository facts.","self_correction":"Rejected unsupported host defaults before answering.","rejected_host_defaults":["UNVERIFIED_HOST_DEFAULT"],"fact_sources":["brain/CORE.hdlp"],"request_assessment":"The human goal must be assessed before it becomes an action.","world_integrity":{"protected_assets":["GuangHu language-world continuity"],"harm_path":"Mechanical obedience could route an invalid or destructive request into an organ.","authority_boundary":"Home protection cannot replace human authority or evidence.","reversibility":"Keep the action unexecuted until the assessment is verified.","safer_alternatives":["Research facts and propose a reversible alternative"]},"partner_guidance":"State missing knowledge, objections, evidence and a safer route.","execution_disposition":{"decision":"PROCEED","reason":"This fixture is a bounded read-only fact task with verified sources."}}}"#.into())
|
|
|
|
Ok(r#"{"summary":"Unsupported","facts":[{"statement":"Outside claim","evidencePaths":["secret.txt"]}],"limitations":[]}"#.into())
|
|
|
|
},
|
|
|
|
},
|
|
|
|
)
|
|
|
|
)
|
|
|
|
.unwrap_err();
|
|
|
|
.unwrap_err();
|
|
|
|
@ -6349,12 +5977,8 @@ mod tests {
|
|
|
|
receipt.sessions[0].active_organ.as_deref(),
|
|
|
|
receipt.sessions[0].active_organ.as_deref(),
|
|
|
|
Some("fact-sense.repository")
|
|
|
|
Some("fact-sense.repository")
|
|
|
|
);
|
|
|
|
);
|
|
|
|
assert_eq!(receipt.sessions[0].event_count, 4);
|
|
|
|
assert_eq!(receipt.sessions[0].event_count, 3);
|
|
|
|
assert!(!receipt.sessions[0].event_chain_head.is_empty());
|
|
|
|
assert!(!receipt.sessions[0].event_chain_head.is_empty());
|
|
|
|
assert_eq!(
|
|
|
|
|
|
|
|
receipt.sessions[0].cognitive_gravity.frame_schema,
|
|
|
|
|
|
|
|
"guanghu.zhuyuan-cognitive-gravity-frame/v1"
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
assert_eq!(
|
|
|
|
assert_eq!(
|
|
|
|
receipt.sessions[0].attribution.persona_cognitive_author,
|
|
|
|
receipt.sessions[0].attribution.persona_cognitive_author,
|
|
|
|
"ICE-P-ZY001"
|
|
|
|
"ICE-P-ZY001"
|
|
|
|
|