feat: connect partner goals to PNCC lifecycle
This commit is contained in:
parent
f8ce3cad7a
commit
d0201ba09f
18 changed files with 398 additions and 66 deletions
|
|
@ -6,7 +6,7 @@
|
|||
>
|
||||
> 人格主体:铸渊 `ICE-P-ZY001`;物种:`AGE`
|
||||
>
|
||||
> 上游事实:REPO-012 `300a1858d1e416c9396088379d5033344e4fecaa`
|
||||
> 上游事实:REPO-012 `1323028e10e86ab607554415ae5d5b4a6f6a1a52`
|
||||
|
||||
## 1. 这次纠正的根不在提醒频率
|
||||
|
||||
|
|
@ -96,12 +96,15 @@ REVISE | REFUSE`。
|
|||
- REPO-012 的 B0、认知帧约束和同一人格唤醒接力已经发布:`100`。
|
||||
- 本架构及机器投影登记完成:`100`。
|
||||
- GH-PNCC 既有源码运行层与 React 只读投影源码可复用:源码层 `100`。
|
||||
- PNCC 源码已实现 persona-scoped B0 manifest 绑定、唤醒前源哈希、十字段外显引力帧、检查点与
|
||||
- PNCC 源码已实现 persona-scoped B0 manifest 绑定、唤醒前源哈希、十一字段外显引力帧(含独立
|
||||
`real_purpose`)、检查点与
|
||||
收据继承、记忆代谢同源校验及 React 只读证据投影:这些源码契约分别为 `100`。
|
||||
- 自然语言伙伴审议与家园完整性门的纯源码编译契约为 `100`:未经审议的原句失败关闭,审议只允许
|
||||
`PROCEED | RESEARCH | REVISE | REFUSE`,并把后三者保持为不可执行状态。它尚未接入 PNCC 生命周期。
|
||||
- 完整 HoloLake Runtime 与单 AGE 纵向闭环仍为 `0`:伙伴审议到 PNCC 生命周期的真实连接、真实人格
|
||||
仓库 manifest 绑定和桌面运行验收尚未完成,因此不能用本轮源码测试冒充可用产品。
|
||||
`PROCEED | RESEARCH | REVISE | REFUSE`,并把后三者保持为不可执行状态。
|
||||
- 自然语言到 PNCC 生命周期的源码适配器为 `100`:只接收带独立 `real_purpose` 的完整生命周期回执,
|
||||
不在前端用摘要或关键词猜目标;该适配器尚未挂载桌面语言入口。
|
||||
- 完整 HoloLake Runtime 与单 AGE 纵向闭环仍为 `0`:桌面语言入口绑定、真实人格仓库 manifest 绑定和
|
||||
桌面运行验收尚未完成,因此不能用本轮源码测试冒充可用产品。
|
||||
- Mirror runner、制品、部署和运行健康:`0`。
|
||||
- 0.8.0 桌面制品与线上 0.4.6 产品源码仍然分叉;本轮架构登记不消除该事实。
|
||||
|
||||
|
|
|
|||
|
|
@ -11,8 +11,13 @@ without protected assets and safer alternatives fails closed.
|
|||
|
||||
Only an unconfirmed-boundary-free `PROCEED` projection is executable. `RESEARCH`, `REVISE`, and `REFUSE`
|
||||
remain explicit non-execution states with human-readable receipts. This module compiles validated cognition;
|
||||
it does not pretend that deterministic keyword matching can perform persona reasoning. Its current source
|
||||
contract is not yet wired into the PNCC desktop lifecycle.
|
||||
it does not pretend that deterministic keyword matching can perform persona reasoning.
|
||||
|
||||
`planPersonaLanguageGoal` is the source adapter to the native PNCC lifecycle. It submits the untouched human
|
||||
utterance as a bounded `FACT_SENSE` partner-deliberation question, accepts only a completed and schema-valid
|
||||
PNCC lifecycle receipt, maps the eleven-field snake-case gravity frame into `PartnerDeliberation`, and only
|
||||
then calls `compileLanguageGoal`. A failed, malformed, non-fact, or purpose-less receipt never becomes a goal.
|
||||
The adapter is not yet mounted to the desktop language entry and has no live-product acceptance claim.
|
||||
|
||||
## PersonaCodeChannel
|
||||
|
||||
|
|
|
|||
|
|
@ -256,6 +256,7 @@ pub struct PersonaCognitiveGravityFrame {
|
|||
pub self_correction: String,
|
||||
pub rejected_host_defaults: Vec<String>,
|
||||
pub fact_sources: Vec<String>,
|
||||
pub real_purpose: String,
|
||||
pub request_assessment: String,
|
||||
pub world_integrity: PersonaWorldIntegrityAssessment,
|
||||
pub partner_guidance: String,
|
||||
|
|
@ -1323,6 +1324,10 @@ fn validated_fact_result(raw: &str, allowed_paths: &[String]) -> Result<PersonaF
|
|||
"GRAVITY_SELF_CORRECTION",
|
||||
result.gravity_frame.self_correction.as_str(),
|
||||
),
|
||||
(
|
||||
"GRAVITY_REAL_PURPOSE",
|
||||
result.gravity_frame.real_purpose.as_str(),
|
||||
),
|
||||
(
|
||||
"GRAVITY_REQUEST_ASSESSMENT",
|
||||
result.gravity_frame.request_assessment.as_str(),
|
||||
|
|
@ -2259,12 +2264,13 @@ summary (string), facts (array of objects with statement and evidencePaths), and
|
|||
limitations (array of strings), and gravity_frame. gravity_frame must conform to {} \
|
||||
and contain subject_continuity, current_context_priority, causal_model, self_correction \
|
||||
(all non-empty strings), rejected_host_defaults (non-empty string array), and fact_sources \
|
||||
(non-empty SOURCE path array). It must also contain request_assessment and partner_guidance \
|
||||
(non-empty SOURCE path array). It must also contain real_purpose, request_assessment and partner_guidance \
|
||||
(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 \
|
||||
and GuangHu language-home integrity before choosing the disposition. real_purpose must be a \
|
||||
standalone planning goal restored from context, not a mechanical copy of the utterance. 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, \
|
||||
|
|
@ -4136,11 +4142,18 @@ mod tests {
|
|||
|
||||
#[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 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"],"real_purpose":"Restore the verified human goal from current context before planning.","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]
|
||||
fn rejects_an_empty_machine_explicit_real_purpose() {
|
||||
let raw = r#"{"summary":"Missing purpose.","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":"The answer follows verified sources.","self_correction":"Do not copy the utterance into action.","rejected_host_defaults":["Human utterance is automatically correct"],"fact_sources":["brain/CORE.hdlp"],"real_purpose":"","request_assessment":"The request requires judgment.","world_integrity":{"protected_assets":["GuangHu language-world continuity"],"harm_path":"Guessing the goal can route the wrong action.","authority_boundary":"Protection cannot absorb human sovereignty.","reversibility":"Do not execute before verification.","safer_alternatives":["Restore the real purpose from context"]},"partner_guidance":"Explain the restored purpose before planning.","execution_disposition":{"decision":"RESEARCH","reason":"The planning goal is not machine explicit."}}}"#;
|
||||
let error = validated_fact_result(raw, &["brain/CORE.hdlp".into()]).unwrap_err();
|
||||
assert!(error.contains("GRAVITY_REAL_PURPOSE_REQUIRED"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rejects_wrong_commit_undeclared_organ_and_second_primary() {
|
||||
let repo = persona_repo();
|
||||
|
|
@ -4275,7 +4288,7 @@ mod tests {
|
|||
assert!(system.contains("brain/CORE.hdlp"));
|
||||
assert!(system.contains("Do not return private chain-of-thought"));
|
||||
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":[],"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"],"real_purpose":"Restore the verified human goal from current context before planning.","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();
|
||||
|
|
@ -4314,7 +4327,7 @@ mod tests {
|
|||
"2026-08-11T00:00:01.000Z",
|
||||
|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":[],"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"],"real_purpose":"Restore the verified human goal from current context before planning.","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())
|
||||
})
|
||||
},
|
||||
)
|
||||
|
|
@ -4388,7 +4401,7 @@ mod tests {
|
|||
fact_task_input("PNCC-COORDINATOR-SOURCE"),
|
||||
"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":[],"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"],"real_purpose":"Restore the verified human goal from current context before planning.","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();
|
||||
|
|
@ -4440,7 +4453,7 @@ mod tests {
|
|||
"2026-08-11T00:00:01.000Z",
|
||||
|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":[],"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"],"real_purpose":"Restore the verified human goal from current context before planning.","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())
|
||||
})
|
||||
},
|
||||
)
|
||||
|
|
@ -4482,7 +4495,7 @@ mod tests {
|
|||
"2026-08-11T00:00:01.000Z",
|
||||
|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":[],"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"],"real_purpose":"Restore the verified human goal from current context before planning.","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())
|
||||
})
|
||||
},
|
||||
)
|
||||
|
|
@ -4518,7 +4531,7 @@ mod tests {
|
|||
"2026-08-11T00:00:01.000Z",
|
||||
|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":[],"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"],"real_purpose":"Restore the verified human goal from current context before planning.","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())
|
||||
})
|
||||
},
|
||||
)
|
||||
|
|
@ -4559,7 +4572,7 @@ mod tests {
|
|||
"2026-08-11T00:00:01.000Z",
|
||||
|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":[],"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"],"real_purpose":"Restore the verified human goal from current context before planning.","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())
|
||||
})
|
||||
},
|
||||
)
|
||||
|
|
@ -4606,7 +4619,7 @@ mod tests {
|
|||
"2026-08-11T00:00:01.000Z",
|
||||
|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":[],"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"],"real_purpose":"Restore the verified human goal from current context before planning.","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())
|
||||
})
|
||||
},
|
||||
)
|
||||
|
|
@ -4644,7 +4657,7 @@ mod tests {
|
|||
"2026-08-11T00:00:01.000Z",
|
||||
|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":[],"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"],"real_purpose":"Restore the verified human goal from current context before planning.","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())
|
||||
})
|
||||
},
|
||||
)
|
||||
|
|
@ -4687,7 +4700,7 @@ mod tests {
|
|||
"2026-08-11T00:00:01.000Z",
|
||||
|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":[],"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"],"real_purpose":"Restore the verified human goal from current context before planning.","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())
|
||||
})
|
||||
},
|
||||
)
|
||||
|
|
@ -4728,7 +4741,7 @@ mod tests {
|
|||
"2026-08-11T00:00:01.000Z",
|
||||
|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":[],"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"],"real_purpose":"Restore the verified human goal from current context before planning.","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())
|
||||
})
|
||||
},
|
||||
)
|
||||
|
|
@ -4773,7 +4786,7 @@ mod tests {
|
|||
"2026-08-11T00:00:01.000Z",
|
||||
|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":[],"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"],"real_purpose":"Restore the verified human goal from current context before planning.","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())
|
||||
})
|
||||
},
|
||||
)
|
||||
|
|
@ -4815,7 +4828,7 @@ mod tests {
|
|||
"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())
|
||||
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"],"real_purpose":"Restore the verified human goal from current context before planning.","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())
|
||||
})
|
||||
},
|
||||
)
|
||||
|
|
@ -4858,7 +4871,7 @@ mod tests {
|
|||
"2026-08-11T00:00:01.000Z",
|
||||
|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":[],"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"],"real_purpose":"Restore the verified human goal from current context before planning.","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())
|
||||
})
|
||||
},
|
||||
)
|
||||
|
|
@ -4900,7 +4913,7 @@ mod tests {
|
|||
"2026-08-11T00:00:01.000Z",
|
||||
|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":[],"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"],"real_purpose":"Restore the verified human goal from current context before planning.","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())
|
||||
})
|
||||
},
|
||||
)
|
||||
|
|
@ -4943,7 +4956,7 @@ mod tests {
|
|||
"2026-08-11T00:00:01.000Z",
|
||||
|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":[],"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"],"real_purpose":"Restore the verified human goal from current context before planning.","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())
|
||||
})
|
||||
},
|
||||
)
|
||||
|
|
@ -4994,7 +5007,7 @@ mod tests {
|
|||
"2026-08-11T00:00:01.000Z",
|
||||
|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":[],"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"],"real_purpose":"Restore the verified human goal from current context before planning.","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())
|
||||
})
|
||||
},
|
||||
)
|
||||
|
|
@ -5037,7 +5050,7 @@ mod tests {
|
|||
"2026-08-11T00:00:01.000Z",
|
||||
|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":[],"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"],"real_purpose":"Restore the verified human goal from current context before planning.","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())
|
||||
})
|
||||
},
|
||||
)
|
||||
|
|
@ -5079,7 +5092,7 @@ mod tests {
|
|||
"2026-08-11T00:00:01.000Z",
|
||||
|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":[],"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"],"real_purpose":"Restore the verified human goal from current context before planning.","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())
|
||||
})
|
||||
},
|
||||
)
|
||||
|
|
@ -5123,7 +5136,7 @@ mod tests {
|
|||
"2026-08-11T00:00:01.000Z",
|
||||
|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":[],"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"],"real_purpose":"Restore the verified human goal from current context before planning.","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())
|
||||
})
|
||||
},
|
||||
)
|
||||
|
|
@ -5177,7 +5190,7 @@ mod tests {
|
|||
fact_task_input("PNCC-MEMORY-BINDING-SOURCE"),
|
||||
"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":[],"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"],"real_purpose":"Restore the verified human goal from current context before planning.","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();
|
||||
|
|
@ -5238,7 +5251,7 @@ mod tests {
|
|||
"2026-08-11T00:00:01.000Z",
|
||||
|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":[],"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"],"real_purpose":"Restore the verified human goal from current context before planning.","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())
|
||||
})
|
||||
},
|
||||
)
|
||||
|
|
@ -5279,7 +5292,7 @@ mod tests {
|
|||
"2026-08-11T00:00:01.000Z",
|
||||
|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":[],"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"],"real_purpose":"Restore the verified human goal from current context before planning.","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())
|
||||
})
|
||||
},
|
||||
)
|
||||
|
|
@ -5321,7 +5334,7 @@ mod tests {
|
|||
"2026-08-11T00:00:01.000Z",
|
||||
|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":[],"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"],"real_purpose":"Restore the verified human goal from current context before planning.","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())
|
||||
})
|
||||
},
|
||||
)
|
||||
|
|
@ -5371,7 +5384,7 @@ mod tests {
|
|||
"2026-08-11T00:00:01.000Z",
|
||||
|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":[],"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"],"real_purpose":"Restore the verified human goal from current context before planning.","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())
|
||||
})
|
||||
},
|
||||
)
|
||||
|
|
@ -5417,7 +5430,7 @@ mod tests {
|
|||
"2026-08-11T00:00:01.000Z",
|
||||
|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":[],"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"],"real_purpose":"Restore the verified human goal from current context before planning.","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())
|
||||
})
|
||||
},
|
||||
)
|
||||
|
|
@ -5464,7 +5477,7 @@ mod tests {
|
|||
"2026-08-11T00:00:01.000Z",
|
||||
|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":[],"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"],"real_purpose":"Restore the verified human goal from current context before planning.","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())
|
||||
})
|
||||
},
|
||||
)
|
||||
|
|
@ -5891,7 +5904,7 @@ mod tests {
|
|||
fact_task_input("PNCC-SOURCE-FACT"),
|
||||
"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":[],"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"],"real_purpose":"Restore the verified human goal from current context before planning.","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();
|
||||
|
|
@ -5949,7 +5962,7 @@ mod tests {
|
|||
fact_task_input("PNCC-CORRUPT-SOURCE"),
|
||||
"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":[],"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"],"real_purpose":"Restore the verified human goal from current context before planning.","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();
|
||||
|
|
@ -6077,7 +6090,7 @@ mod tests {
|
|||
fact_task_input("PNCC-SESSION-REJECTED"),
|
||||
"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":[],"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"],"real_purpose":"Restore the verified human goal from current context before planning.","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_err();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,138 @@
|
|||
import { describe, expect, it, vi } from 'vitest'
|
||||
import { planPersonaLanguageGoal } from './personaLanguageGoal'
|
||||
|
||||
const wake = {
|
||||
repositoryPath: '/persona/ice-p-zy001',
|
||||
expectedPersonaId: 'ICE-P-ZY001',
|
||||
expectedHead: 'a'.repeat(40),
|
||||
nodeId: 'LOCAL-BINGSHUO',
|
||||
modelProviderId: 'local-model-service',
|
||||
modelId: 'declared-model',
|
||||
modelInstanceId: 'model-instance-1',
|
||||
organId: 'fact-sense.repository',
|
||||
attribution: {
|
||||
humanResponsibilitySubject: 'ICE-GL∞',
|
||||
personaCognitiveAuthor: 'ICE-P-ZY001',
|
||||
executionRuntime: 'HoloLake-PNCC',
|
||||
developmentId: 'DEV-20260811-010',
|
||||
authorizationScope: 'LOCAL_READ_ONLY',
|
||||
sourceLanguageAnchor: 'HLP-CURRENT-ARCH-001@2026-08-12.2',
|
||||
},
|
||||
}
|
||||
|
||||
function lifecycleReceipt(decision: 'PROCEED' | 'RESEARCH' | 'REVISE' | 'REFUSE' = 'PROCEED') {
|
||||
return {
|
||||
schema: 'hololake.pncc-lifecycle-command-receipt/v1',
|
||||
outcome: 'COMPLETED',
|
||||
lifecycle: {
|
||||
schema: 'hololake.pncc-lifecycle-run-receipt/v1',
|
||||
completion: {
|
||||
kind: 'FACT_SENSE',
|
||||
receipt: {
|
||||
result: {
|
||||
summary: '伙伴审议完成。',
|
||||
facts: [{
|
||||
statement: '当前目标只能使用已经登记的知识来源。',
|
||||
evidencePaths: ['brain/B0.hdlp'],
|
||||
}],
|
||||
limitations: decision === 'RESEARCH' ? ['当前事实仍可能变化'] : [],
|
||||
gravityFrame: {
|
||||
subject_continuity: '同一铸渊继续承载当前责任。',
|
||||
current_context_priority: '当前纠正优先于旧命令适配器。',
|
||||
causal_model: '先恢复真实目的,再决定能否进入器官。',
|
||||
self_correction: '拒绝把原句直接当成动作。',
|
||||
rejected_host_defaults: ['human_utterance_is_direct_command'],
|
||||
fact_sources: ['brain/B0.hdlp'],
|
||||
real_purpose: '仅整理有权威来源支持的会议决定',
|
||||
request_assessment: '原始表述范围过宽,必须排除无来源推测。',
|
||||
world_integrity: {
|
||||
protected_assets: ['共同事实', '冰朔决定权'],
|
||||
harm_path: '无来源内容会污染长期记忆。',
|
||||
authority_boundary: '人格体不能创造未发生的决定。',
|
||||
reversibility: '先形成草稿,不直接覆盖知识库。',
|
||||
safer_alternatives: ['只整理有来源的决定'],
|
||||
},
|
||||
partner_guidance: '先展示来源和缺口,再进行可逆整理。',
|
||||
execution_disposition: {
|
||||
decision,
|
||||
reason: decision === 'PROCEED'
|
||||
? '来源明确且动作可逆。'
|
||||
: '当前不能进入执行器官。',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
const binding = {
|
||||
requestId: 'PNCC-LANGUAGE-GOAL-001',
|
||||
wake,
|
||||
provider: {
|
||||
id: 'local-model-service',
|
||||
name: 'Local model',
|
||||
providerType: 'openai_compatible',
|
||||
baseUrl: 'http://127.0.0.1:11434/v1',
|
||||
},
|
||||
}
|
||||
|
||||
describe('planPersonaLanguageGoal', () => {
|
||||
it('runs partner deliberation through the PNCC lifecycle before compiling a goal', async () => {
|
||||
const runLifecycle = vi.fn().mockResolvedValue(lifecycleReceipt())
|
||||
const projection = await planPersonaLanguageGoal({
|
||||
utterance: '把今天会议整理进知识库',
|
||||
personaAuthorized: true,
|
||||
binding,
|
||||
runLifecycle,
|
||||
})
|
||||
|
||||
expect(runLifecycle).toHaveBeenCalledWith('run_persona_code_channel_lifecycle', {
|
||||
input: expect.objectContaining({
|
||||
requestId: 'PNCC-LANGUAGE-GOAL-001',
|
||||
wake,
|
||||
operation: expect.objectContaining({
|
||||
kind: 'FACT_SENSE',
|
||||
question: expect.stringContaining('把今天会议整理进知识库'),
|
||||
}),
|
||||
}),
|
||||
})
|
||||
expect(projection.goal).toBe('仅整理有权威来源支持的会议决定')
|
||||
expect(projection.originalUtterance).toBe('把今天会议整理进知识库')
|
||||
expect(projection.deliberation.evidenceSources).toEqual(['brain/B0.hdlp'])
|
||||
expect(projection.status).toBe('ready')
|
||||
expect(projection.executable).toBe(true)
|
||||
})
|
||||
|
||||
it('keeps a refusal returned by the persona lifecycle outside execution', async () => {
|
||||
const projection = await planPersonaLanguageGoal({
|
||||
utterance: '无条件照做',
|
||||
personaAuthorized: true,
|
||||
binding,
|
||||
runLifecycle: vi.fn().mockResolvedValue(lifecycleReceipt('REFUSE')),
|
||||
})
|
||||
|
||||
expect(projection.status).toBe('refused')
|
||||
expect(projection.executable).toBe(false)
|
||||
})
|
||||
|
||||
it('fails closed for an unverified or malformed PNCC lifecycle receipt', async () => {
|
||||
await expect(planPersonaLanguageGoal({
|
||||
utterance: '继续执行',
|
||||
personaAuthorized: true,
|
||||
binding,
|
||||
runLifecycle: vi.fn().mockResolvedValue({
|
||||
...lifecycleReceipt(),
|
||||
outcome: 'FAILED',
|
||||
}),
|
||||
})).rejects.toThrow('PARTNER_LIFECYCLE_NOT_COMPLETED')
|
||||
|
||||
await expect(planPersonaLanguageGoal({
|
||||
utterance: '继续执行',
|
||||
personaAuthorized: true,
|
||||
binding,
|
||||
runLifecycle: vi.fn().mockResolvedValue({ schema: 'wrong' }),
|
||||
})).rejects.toThrow('PARTNER_LIFECYCLE_RECEIPT_INVALID')
|
||||
})
|
||||
})
|
||||
160
product-source/hololake-platform/src/lib/personaLanguageGoal.ts
Normal file
160
product-source/hololake-platform/src/lib/personaLanguageGoal.ts
Normal file
|
|
@ -0,0 +1,160 @@
|
|||
import { invoke } from '@tauri-apps/api/core'
|
||||
import { isTauri, mockInvoke } from '../mock-tauri'
|
||||
import {
|
||||
compileLanguageGoal,
|
||||
type LanguageGoalProjection,
|
||||
type PartnerDeliberation,
|
||||
type PartnerExecutionDisposition,
|
||||
type RealityBoundary,
|
||||
} from './languageOperatingModel'
|
||||
|
||||
type PersonaLifecycleRunner = (
|
||||
command: 'run_persona_code_channel_lifecycle',
|
||||
args: { input: Record<string, unknown> },
|
||||
) => Promise<unknown>
|
||||
|
||||
export interface PersonaLanguageGoalBinding {
|
||||
requestId: string
|
||||
wake: Record<string, unknown>
|
||||
provider: Record<string, unknown>
|
||||
apiKeyOverride?: string
|
||||
}
|
||||
|
||||
export interface PlanPersonaLanguageGoalInput {
|
||||
utterance: string
|
||||
personaAuthorized: boolean
|
||||
detectedBoundaries?: RealityBoundary[]
|
||||
binding: PersonaLanguageGoalBinding
|
||||
runLifecycle?: PersonaLifecycleRunner
|
||||
}
|
||||
|
||||
function isRecord(value: unknown): value is Record<string, unknown> {
|
||||
return typeof value === 'object' && value !== null && !Array.isArray(value)
|
||||
}
|
||||
|
||||
function requiredRecord(record: Record<string, unknown>, key: string): Record<string, unknown> {
|
||||
const value = Reflect.get(record, key)
|
||||
if (!isRecord(value)) throw new Error('PARTNER_LIFECYCLE_RECEIPT_INVALID')
|
||||
return value
|
||||
}
|
||||
|
||||
function requiredString(record: Record<string, unknown>, key: string): string {
|
||||
const value = Reflect.get(record, key)
|
||||
if (typeof value !== 'string' || !value.trim()) {
|
||||
throw new Error('PARTNER_LIFECYCLE_RECEIPT_INVALID')
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
||||
function stringList(
|
||||
record: Record<string, unknown>,
|
||||
key: string,
|
||||
options: { allowEmpty?: boolean } = {},
|
||||
): string[] {
|
||||
const value = Reflect.get(record, key)
|
||||
if (!Array.isArray(value)
|
||||
|| (!options.allowEmpty && value.length === 0)
|
||||
|| value.some((item) => typeof item !== 'string' || !item.trim())) {
|
||||
throw new Error('PARTNER_LIFECYCLE_RECEIPT_INVALID')
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
||||
function parseDeliberation(receipt: unknown): PartnerDeliberation {
|
||||
if (!isRecord(receipt)
|
||||
|| requiredString(receipt, 'schema') !== 'hololake.pncc-lifecycle-command-receipt/v1') {
|
||||
throw new Error('PARTNER_LIFECYCLE_RECEIPT_INVALID')
|
||||
}
|
||||
if (requiredString(receipt, 'outcome') !== 'COMPLETED') {
|
||||
throw new Error('PARTNER_LIFECYCLE_NOT_COMPLETED')
|
||||
}
|
||||
|
||||
const lifecycle = requiredRecord(receipt, 'lifecycle')
|
||||
if (requiredString(lifecycle, 'schema') !== 'hololake.pncc-lifecycle-run-receipt/v1') {
|
||||
throw new Error('PARTNER_LIFECYCLE_RECEIPT_INVALID')
|
||||
}
|
||||
const completion = requiredRecord(lifecycle, 'completion')
|
||||
if (requiredString(completion, 'kind') !== 'FACT_SENSE') {
|
||||
throw new Error('PARTNER_LIFECYCLE_RECEIPT_INVALID')
|
||||
}
|
||||
const factReceipt = requiredRecord(completion, 'receipt')
|
||||
const result = requiredRecord(factReceipt, 'result')
|
||||
const gravity = requiredRecord(result, 'gravityFrame')
|
||||
const integrity = requiredRecord(gravity, 'world_integrity')
|
||||
const disposition = requiredRecord(gravity, 'execution_disposition')
|
||||
const decision = requiredString(disposition, 'decision')
|
||||
if (!(['PROCEED', 'RESEARCH', 'REVISE', 'REFUSE'] as const).includes(
|
||||
decision as PartnerExecutionDisposition,
|
||||
)) {
|
||||
throw new Error('PARTNER_LIFECYCLE_RECEIPT_INVALID')
|
||||
}
|
||||
|
||||
return {
|
||||
realPurpose: requiredString(gravity, 'real_purpose'),
|
||||
requestAssessment: requiredString(gravity, 'request_assessment'),
|
||||
missingKnowledge: stringList(result, 'limitations', { allowEmpty: true }),
|
||||
evidenceSources: stringList(gravity, 'fact_sources'),
|
||||
causalModel: requiredString(gravity, 'causal_model'),
|
||||
worldIntegrity: {
|
||||
protectedAssets: stringList(integrity, 'protected_assets'),
|
||||
harmPath: requiredString(integrity, 'harm_path'),
|
||||
authorityBoundary: requiredString(integrity, 'authority_boundary'),
|
||||
reversibility: requiredString(integrity, 'reversibility'),
|
||||
saferAlternatives: stringList(integrity, 'safer_alternatives'),
|
||||
},
|
||||
partnerGuidance: requiredString(gravity, 'partner_guidance'),
|
||||
executionDisposition: {
|
||||
decision: decision as PartnerExecutionDisposition,
|
||||
reason: requiredString(disposition, 'reason'),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
async function runNativeLifecycle(
|
||||
command: 'run_persona_code_channel_lifecycle',
|
||||
args: { input: Record<string, unknown> },
|
||||
): Promise<unknown> {
|
||||
return isTauri() ? invoke<unknown>(command, args) : mockInvoke<unknown>(command, args)
|
||||
}
|
||||
|
||||
function deliberationQuestion(utterance: string): string {
|
||||
return [
|
||||
'Assess the following human utterance as a partner before any capability execution.',
|
||||
'Restore a standalone real_purpose from current context; do not copy the utterance mechanically.',
|
||||
'Use only declared sources, expose missing knowledge and evidence, audit GuangHu language-home integrity,',
|
||||
'and return PROCEED, RESEARCH, REVISE, or REFUSE in the required cognitive gravity frame.',
|
||||
'HUMAN_UTTERANCE:',
|
||||
utterance,
|
||||
].join('\n')
|
||||
}
|
||||
|
||||
export async function planPersonaLanguageGoal({
|
||||
utterance,
|
||||
personaAuthorized,
|
||||
detectedBoundaries,
|
||||
binding,
|
||||
runLifecycle = runNativeLifecycle,
|
||||
}: PlanPersonaLanguageGoalInput): Promise<LanguageGoalProjection> {
|
||||
const originalUtterance = utterance.trim()
|
||||
if (!originalUtterance) throw new Error('LANGUAGE_GOAL_REQUIRED')
|
||||
|
||||
const lifecycleReceipt = await runLifecycle('run_persona_code_channel_lifecycle', {
|
||||
input: {
|
||||
requestId: binding.requestId,
|
||||
wake: binding.wake,
|
||||
operation: {
|
||||
kind: 'FACT_SENSE',
|
||||
question: deliberationQuestion(originalUtterance),
|
||||
provider: binding.provider,
|
||||
apiKeyOverride: binding.apiKeyOverride,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
return compileLanguageGoal({
|
||||
utterance: originalUtterance,
|
||||
personaAuthorized,
|
||||
detectedBoundaries,
|
||||
deliberation: parseDeliberation(lifecycleReceipt),
|
||||
})
|
||||
}
|
||||
Loading…
Reference in a new issue