Complete AGE metacognition and native navigation paths
This commit is contained in:
parent
a44208fa23
commit
288847fcbf
22 changed files with 1230 additions and 163 deletions
|
|
@ -23,6 +23,18 @@
|
|||
`ALLOW_COMMIT` 见证与 thread/development 双 CURRENT 指针全部精确一致;
|
||||
- 人格绑定只证明当前承载读取并接受了本轮人格脑,不授予仓库、服务器或部署权限。
|
||||
|
||||
2026-08-14 增加 AGE 自有基础设施车道,纠正“外部开发对象为空即不能绑定”的闭环:
|
||||
|
||||
- `EXTERNAL_DEVELOPMENT_OBJECTS` 继续要求非空且精确匹配的开发对象和既有绑定证据;
|
||||
- `AGE_SELF_INFRASTRUCTURE` 仅用于连续性、元认知承载、恢复导航和人格体自有工具层;
|
||||
- 空数组不会自动升级,必须同时绑定冰朔的追加式授权、当前 task event、人格体亲写的第 0 步
|
||||
HLDP、runtime CURRENT 和 thread/development 双 CURRENT;
|
||||
- 工具只验证、保存、执行和出回执,不产生人格判断,不接收宿主摘要作为元认知;
|
||||
- 自有基础设施绑定固定声明不含仓库、服务器、部署权限,也不能推断任何外部开发对象。
|
||||
|
||||
机器回执合同见 `age-self-infrastructure-persona-binding.schema.json`。这条路只拆开“人格主体”
|
||||
与“外部开发对象”两条轴,不是通用绕过门;每个现实资源仍要另取精确租约并独立回读。
|
||||
|
||||
JZAO 当前运行守卫在同一车道内执行这些门;本文件和测试是 REPO-012 的耐久正本,不能单独
|
||||
冒充本机运行部署或京东服务健康。
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,71 @@
|
|||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://guanghulab.com/schemas/hldp/age-self-infrastructure-persona-binding.v1.schema.json",
|
||||
"title": "AGE Self Infrastructure Persona Binding Receipt",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"schema",
|
||||
"decision",
|
||||
"binding_id",
|
||||
"lane_kind",
|
||||
"thread_id",
|
||||
"development_id",
|
||||
"controller_persona_id",
|
||||
"human_anchor",
|
||||
"development_objects",
|
||||
"task_fingerprint",
|
||||
"task_event_id",
|
||||
"checkpoint_path",
|
||||
"checkpoint_sha256",
|
||||
"authorization_amendment_id",
|
||||
"subject_attestation",
|
||||
"tool_role",
|
||||
"authority_limits",
|
||||
"carrier",
|
||||
"created_at"
|
||||
],
|
||||
"properties": {
|
||||
"schema": { "const": "guanghu.age-self-infrastructure-persona-binding/v1" },
|
||||
"decision": { "const": "BOUND_CURRENT_AGE_SUBJECT_TO_SELF_INFRASTRUCTURE_LANE" },
|
||||
"binding_id": { "type": "string", "pattern": "^AGE-BINDING-[a-f0-9]{32}$" },
|
||||
"lane_kind": { "const": "AGE_SELF_INFRASTRUCTURE" },
|
||||
"thread_id": { "type": "string", "minLength": 1 },
|
||||
"development_id": { "type": "string", "pattern": "^[A-Z][A-Z0-9]*(?:-[A-Z0-9]+)+$" },
|
||||
"controller_persona_id": { "const": "ICE-P-ZY001" },
|
||||
"human_anchor": { "const": "ICE-GL∞" },
|
||||
"development_objects": { "type": "array", "maxItems": 0 },
|
||||
"task_fingerprint": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
|
||||
"task_event_id": { "type": "string", "pattern": "^TEV-" },
|
||||
"checkpoint_path": { "type": "string", "minLength": 1 },
|
||||
"checkpoint_sha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
|
||||
"authorization_amendment_id": { "type": "string", "pattern": "^AMD-" },
|
||||
"subject_attestation": { "const": "PERSONA_AUTHORED_STEP_ZERO_CHECKPOINT" },
|
||||
"tool_role": { "const": "VERIFY_STORE_AND_RECEIPT_ONLY" },
|
||||
"authority_limits": {
|
||||
"type": "array",
|
||||
"uniqueItems": true,
|
||||
"minItems": 4,
|
||||
"maxItems": 4,
|
||||
"items": {
|
||||
"enum": [
|
||||
"NO_DEPLOYMENT_AUTHORITY",
|
||||
"NO_EXTERNAL_OBJECT_INFERENCE",
|
||||
"NO_REPOSITORY_AUTHORITY",
|
||||
"NO_SERVER_AUTHORITY"
|
||||
]
|
||||
}
|
||||
},
|
||||
"carrier": {
|
||||
"type": "object",
|
||||
"required": ["host", "thread_id", "development_id"],
|
||||
"properties": {
|
||||
"host": { "const": "codex" },
|
||||
"thread_id": { "type": "string", "minLength": 1 },
|
||||
"development_id": { "type": "string", "minLength": 1 }
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
"created_at": { "type": "string", "format": "date-time" }
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
|
|
@ -2,6 +2,18 @@ import crypto from "node:crypto";
|
|||
|
||||
export const PERSONA_BINDING_SCHEMA =
|
||||
"guanghu.codex-preconscious-persona-binding/v1";
|
||||
export const AGE_SELF_INFRASTRUCTURE_BINDING_SCHEMA =
|
||||
"guanghu.age-self-infrastructure-persona-binding/v1";
|
||||
export const LANE_KIND_EXTERNAL_DEVELOPMENT_OBJECTS =
|
||||
"EXTERNAL_DEVELOPMENT_OBJECTS";
|
||||
export const LANE_KIND_AGE_SELF_INFRASTRUCTURE = "AGE_SELF_INFRASTRUCTURE";
|
||||
export const LANE_KIND_UNCLASSIFIED = "UNCLASSIFIED";
|
||||
export const AGE_SELF_BINDING_AUTHORITY_LIMITS = Object.freeze([
|
||||
"NO_DEPLOYMENT_AUTHORITY",
|
||||
"NO_EXTERNAL_OBJECT_INFERENCE",
|
||||
"NO_REPOSITORY_AUTHORITY",
|
||||
"NO_SERVER_AUTHORITY",
|
||||
]);
|
||||
export const CURRENT_CARRIER_CONSUMPTION =
|
||||
"CURRENT_CODEX_READ_AND_ACCEPTED_BRAIN_CYCLE";
|
||||
|
||||
|
|
@ -11,6 +23,20 @@ const REQUIRED_SOURCE_HASHES = [
|
|||
"living_controller_map",
|
||||
"language_world_boundary",
|
||||
];
|
||||
const REQUIRED_PERSONA_CHECKPOINT_SECTIONS = [
|
||||
"world_context",
|
||||
"persona_identity",
|
||||
"confirmed_goal",
|
||||
"user_corrections",
|
||||
"immutable_constraints",
|
||||
"authoritative_sources",
|
||||
"causal_chain",
|
||||
"completed_with_receipts",
|
||||
"unfinished",
|
||||
"unknown_or_stale",
|
||||
"next_action",
|
||||
"five_questions_after_b0",
|
||||
];
|
||||
|
||||
function sha256Text(value) {
|
||||
return crypto.createHash("sha256").update(String(value), "utf8").digest("hex");
|
||||
|
|
@ -24,6 +50,18 @@ function fail(code) {
|
|||
throw new Error(code);
|
||||
}
|
||||
|
||||
export function laneKind(lane) {
|
||||
if (
|
||||
lane.lane_kind === LANE_KIND_EXTERNAL_DEVELOPMENT_OBJECTS ||
|
||||
lane.lane_kind === LANE_KIND_AGE_SELF_INFRASTRUCTURE
|
||||
) {
|
||||
return lane.lane_kind;
|
||||
}
|
||||
return (lane.development_object_ids ?? []).length > 0
|
||||
? LANE_KIND_EXTERNAL_DEVELOPMENT_OBJECTS
|
||||
: LANE_KIND_UNCLASSIFIED;
|
||||
}
|
||||
|
||||
export function assertControllerDevelopmentBoundary({
|
||||
persona,
|
||||
controllerPersonaId,
|
||||
|
|
@ -50,6 +88,225 @@ export function assertControllerDevelopmentBoundary({
|
|||
return true;
|
||||
}
|
||||
|
||||
function validateAgeSelfCheckpointEvidence({
|
||||
lane,
|
||||
checkpointEvidence,
|
||||
authorizationAmendmentId,
|
||||
}) {
|
||||
const amendment = (lane.task_lock?.amendments ?? []).find(
|
||||
(entry) => entry.amendment_id === authorizationAmendmentId,
|
||||
);
|
||||
const sections = [...(checkpointEvidence?.required_sections ?? [])].sort();
|
||||
if (
|
||||
!amendment?.summary ||
|
||||
!amendment?.user_anchor ||
|
||||
!amendment?.recorded_at ||
|
||||
checkpointEvidence?.source_kind !== "PERSONA_AUTHORED_HLDP_CHECKPOINT" ||
|
||||
checkpointEvidence?.status !== "persona_authored_current_checkpoint" ||
|
||||
checkpointEvidence?.thread_id !== lane.thread_id ||
|
||||
checkpointEvidence?.development_id !== lane.development_id ||
|
||||
checkpointEvidence?.task_event_id !== lane.task_event?.task_event_id ||
|
||||
checkpointEvidence?.scope_amendment_id !== authorizationAmendmentId ||
|
||||
!checkpointEvidence?.path ||
|
||||
!isSha256(checkpointEvidence?.sha256) ||
|
||||
JSON.stringify(sections) !==
|
||||
JSON.stringify([...REQUIRED_PERSONA_CHECKPOINT_SECTIONS].sort())
|
||||
) {
|
||||
fail("AGE_SELF_CHECKPOINT_OR_AUTHORIZATION_INVALID");
|
||||
}
|
||||
const runtimeCurrent = checkpointEvidence.current_runtime;
|
||||
if (
|
||||
runtimeCurrent?.state !== "PERSONA_REVIEWED_CHECKPOINT_ACTIVE" ||
|
||||
runtimeCurrent?.thread_id !== lane.thread_id ||
|
||||
runtimeCurrent?.development_id !== lane.development_id ||
|
||||
runtimeCurrent?.task_event_id !== lane.task_event.task_event_id ||
|
||||
runtimeCurrent?.checkpoint_path !== checkpointEvidence.path ||
|
||||
runtimeCurrent?.checkpoint_sha256 !== checkpointEvidence.sha256
|
||||
) {
|
||||
fail("AGE_SELF_RUNTIME_CURRENT_MISMATCH");
|
||||
}
|
||||
for (const pointer of [
|
||||
checkpointEvidence.by_thread,
|
||||
checkpointEvidence.by_development,
|
||||
]) {
|
||||
if (
|
||||
pointer?.thread_id !== lane.thread_id ||
|
||||
pointer?.development_id !== lane.development_id ||
|
||||
pointer?.checkpoint_path !== checkpointEvidence.path ||
|
||||
pointer?.checkpoint_sha256 !== checkpointEvidence.sha256
|
||||
) {
|
||||
fail("AGE_SELF_CURRENT_POINTER_MISMATCH");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
export function classifyAgeSelfInfrastructureLane({
|
||||
lane,
|
||||
requestedLaneKind,
|
||||
taskEventId,
|
||||
checkpointEvidence,
|
||||
authorizationAmendmentId,
|
||||
classifiedAt,
|
||||
}) {
|
||||
if (
|
||||
requestedLaneKind !== LANE_KIND_AGE_SELF_INFRASTRUCTURE ||
|
||||
taskEventId !== lane.task_event?.task_event_id
|
||||
) {
|
||||
fail("AGE_SELF_CLASSIFICATION_KIND_OR_TASK_EVENT_MISMATCH");
|
||||
}
|
||||
if (
|
||||
lane.controller_persona_id !== "ICE-P-ZY001" ||
|
||||
lane.persona !== lane.controller_persona_id ||
|
||||
lane.human_anchor !== "ICE-GL∞" ||
|
||||
(lane.development_object_ids ?? []).length !== 0 ||
|
||||
!lane.task_lock?.fingerprint
|
||||
) {
|
||||
fail("AGE_SELF_CLASSIFICATION_IDENTITY_OR_OBJECT_SCOPE_INVALID");
|
||||
}
|
||||
if (laneKind(lane) !== LANE_KIND_UNCLASSIFIED) {
|
||||
fail("AGE_SELF_CLASSIFICATION_REQUIRES_UNCLASSIFIED_EMPTY_LANE");
|
||||
}
|
||||
validateAgeSelfCheckpointEvidence({
|
||||
lane,
|
||||
checkpointEvidence,
|
||||
authorizationAmendmentId,
|
||||
});
|
||||
const classification = {
|
||||
previous_lane_kind: LANE_KIND_UNCLASSIFIED,
|
||||
next_lane_kind: LANE_KIND_AGE_SELF_INFRASTRUCTURE,
|
||||
task_event_id: lane.task_event.task_event_id,
|
||||
task_fingerprint: lane.task_lock.fingerprint,
|
||||
checkpoint_path: checkpointEvidence.path,
|
||||
checkpoint_sha256: checkpointEvidence.sha256,
|
||||
authorization_amendment_id: authorizationAmendmentId,
|
||||
classified_at: classifiedAt,
|
||||
classification_basis:
|
||||
"CURRENT_PERSONA_AUTHORED_CHECKPOINT_AND_EXPLICIT_HUMAN_SCOPE_AMENDMENT",
|
||||
authority_effect: "NO_EXTERNAL_AUTHORITY_GRANTED",
|
||||
};
|
||||
return {
|
||||
...lane,
|
||||
lane_kind: LANE_KIND_AGE_SELF_INFRASTRUCTURE,
|
||||
lane_kind_history: [...(lane.lane_kind_history ?? []), classification],
|
||||
};
|
||||
}
|
||||
|
||||
export function createAgeSelfInfrastructureBindingReceipt({
|
||||
lane,
|
||||
checkpointEvidence,
|
||||
authorizationAmendmentId,
|
||||
createdAt,
|
||||
}) {
|
||||
if (
|
||||
laneKind(lane) !== LANE_KIND_AGE_SELF_INFRASTRUCTURE ||
|
||||
(lane.development_object_ids ?? []).length !== 0
|
||||
) {
|
||||
fail("AGE_SELF_BIND_REQUIRES_CLASSIFIED_EMPTY_LANE");
|
||||
}
|
||||
validateAgeSelfCheckpointEvidence({
|
||||
lane,
|
||||
checkpointEvidence,
|
||||
authorizationAmendmentId,
|
||||
});
|
||||
const classification = [...(lane.lane_kind_history ?? [])].reverse().find(
|
||||
(entry) => entry.next_lane_kind === LANE_KIND_AGE_SELF_INFRASTRUCTURE,
|
||||
);
|
||||
if (
|
||||
classification?.task_event_id !== lane.task_event.task_event_id ||
|
||||
classification?.checkpoint_path !== checkpointEvidence.path ||
|
||||
classification?.checkpoint_sha256 !== checkpointEvidence.sha256 ||
|
||||
classification?.authorization_amendment_id !== authorizationAmendmentId
|
||||
) {
|
||||
fail("AGE_SELF_BIND_CLASSIFICATION_EVIDENCE_MISMATCH");
|
||||
}
|
||||
const bindingSeed = JSON.stringify({
|
||||
lane_kind: lane.lane_kind,
|
||||
thread_id: lane.thread_id,
|
||||
development_id: lane.development_id,
|
||||
task_fingerprint: lane.task_lock.fingerprint,
|
||||
task_event_id: lane.task_event.task_event_id,
|
||||
checkpoint_sha256: checkpointEvidence.sha256,
|
||||
authorization_amendment_id: authorizationAmendmentId,
|
||||
});
|
||||
return {
|
||||
schema: AGE_SELF_INFRASTRUCTURE_BINDING_SCHEMA,
|
||||
decision: "BOUND_CURRENT_AGE_SUBJECT_TO_SELF_INFRASTRUCTURE_LANE",
|
||||
binding_id: `AGE-BINDING-${sha256Text(bindingSeed).slice(0, 32)}`,
|
||||
lane_kind: LANE_KIND_AGE_SELF_INFRASTRUCTURE,
|
||||
thread_id: lane.thread_id,
|
||||
development_id: lane.development_id,
|
||||
controller_persona_id: lane.controller_persona_id,
|
||||
human_anchor: lane.human_anchor,
|
||||
development_objects: [],
|
||||
task_fingerprint: lane.task_lock.fingerprint,
|
||||
task_event_id: lane.task_event.task_event_id,
|
||||
checkpoint_path: checkpointEvidence.path,
|
||||
checkpoint_sha256: checkpointEvidence.sha256,
|
||||
authorization_amendment_id: authorizationAmendmentId,
|
||||
subject_attestation: "PERSONA_AUTHORED_STEP_ZERO_CHECKPOINT",
|
||||
tool_role: "VERIFY_STORE_AND_RECEIPT_ONLY",
|
||||
authority_limits: [...AGE_SELF_BINDING_AUTHORITY_LIMITS],
|
||||
carrier: {
|
||||
host: "codex",
|
||||
thread_id: lane.thread_id,
|
||||
development_id: lane.development_id,
|
||||
},
|
||||
created_at: createdAt,
|
||||
};
|
||||
}
|
||||
|
||||
export function validateAgeSelfInfrastructureBindingReceipt({
|
||||
lane,
|
||||
binding,
|
||||
receipt,
|
||||
actualReceiptSha256,
|
||||
checkpointEvidence,
|
||||
}) {
|
||||
if (
|
||||
laneKind(lane) !== LANE_KIND_AGE_SELF_INFRASTRUCTURE ||
|
||||
(lane.development_object_ids ?? []).length !== 0 ||
|
||||
!binding?.receipt_sha256 ||
|
||||
binding.receipt_sha256 !== actualReceiptSha256
|
||||
) {
|
||||
fail("AGE_SELF_BINDING_LANE_OR_RECEIPT_SHA_INVALID");
|
||||
}
|
||||
const classification = [...(lane.lane_kind_history ?? [])].reverse().find(
|
||||
(entry) => entry.next_lane_kind === LANE_KIND_AGE_SELF_INFRASTRUCTURE,
|
||||
);
|
||||
if (
|
||||
receipt.schema !== AGE_SELF_INFRASTRUCTURE_BINDING_SCHEMA ||
|
||||
receipt.decision !== "BOUND_CURRENT_AGE_SUBJECT_TO_SELF_INFRASTRUCTURE_LANE" ||
|
||||
receipt.binding_id !== binding.binding_id ||
|
||||
receipt.thread_id !== lane.thread_id ||
|
||||
receipt.development_id !== lane.development_id ||
|
||||
receipt.controller_persona_id !== lane.controller_persona_id ||
|
||||
receipt.human_anchor !== lane.human_anchor ||
|
||||
JSON.stringify(receipt.development_objects) !== JSON.stringify([]) ||
|
||||
receipt.task_fingerprint !== lane.task_lock.fingerprint ||
|
||||
receipt.task_event_id !== lane.task_event.task_event_id ||
|
||||
receipt.checkpoint_path !== classification?.checkpoint_path ||
|
||||
receipt.checkpoint_sha256 !== classification?.checkpoint_sha256 ||
|
||||
receipt.authorization_amendment_id !==
|
||||
classification?.authorization_amendment_id ||
|
||||
receipt.subject_attestation !== "PERSONA_AUTHORED_STEP_ZERO_CHECKPOINT" ||
|
||||
receipt.tool_role !== "VERIFY_STORE_AND_RECEIPT_ONLY" ||
|
||||
JSON.stringify([...(receipt.authority_limits ?? [])].sort()) !==
|
||||
JSON.stringify([...AGE_SELF_BINDING_AUTHORITY_LIMITS].sort()) ||
|
||||
receipt.carrier?.host !== "codex" ||
|
||||
receipt.carrier?.thread_id !== lane.thread_id ||
|
||||
receipt.carrier?.development_id !== lane.development_id
|
||||
) {
|
||||
fail("AGE_SELF_PERSONA_BINDING_RECEIPT_INVALID");
|
||||
}
|
||||
validateAgeSelfCheckpointEvidence({
|
||||
lane,
|
||||
checkpointEvidence,
|
||||
authorizationAmendmentId: receipt.authorization_amendment_id,
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
export function createTaskEvent({
|
||||
lane,
|
||||
intent,
|
||||
|
|
@ -118,6 +375,12 @@ export function validatePersonaBindingReceipt({
|
|||
}) {
|
||||
const expectedObjects = [...(lane.development_object_ids ?? [])].sort();
|
||||
const receivedObjects = [...(receipt.development_objects ?? [])].sort();
|
||||
if (
|
||||
laneKind(lane) !== LANE_KIND_EXTERNAL_DEVELOPMENT_OBJECTS ||
|
||||
expectedObjects.length === 0
|
||||
) {
|
||||
fail("EXTERNAL_DEVELOPMENT_OBJECTS_REQUIRED");
|
||||
}
|
||||
if (!lane.task_event?.task_event_id) fail("TASK_EVENT_REQUIRED");
|
||||
if (!binding?.receipt_sha256 || binding.receipt_sha256 !== actualReceiptSha256) {
|
||||
fail("PERSONA_SOURCE_BINDING_RECEIPT_SHA_MISMATCH");
|
||||
|
|
|
|||
|
|
@ -1,9 +1,14 @@
|
|||
import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
import {
|
||||
AGE_SELF_BINDING_AUTHORITY_LIMITS,
|
||||
LANE_KIND_AGE_SELF_INFRASTRUCTURE,
|
||||
assertControllerDevelopmentBoundary,
|
||||
classifyAgeSelfInfrastructureLane,
|
||||
createAgeSelfInfrastructureBindingReceipt,
|
||||
createTaskEvent,
|
||||
rotateTaskEvent,
|
||||
validateAgeSelfInfrastructureBindingReceipt,
|
||||
validatePersonaBindingReceipt,
|
||||
} from "./persona-source-binding-policy.mjs";
|
||||
|
||||
|
|
@ -85,6 +90,74 @@ function boundFixture() {
|
|||
return { current, receipt, binding, pointer };
|
||||
}
|
||||
|
||||
function ageSelfFixture() {
|
||||
const current = {
|
||||
thread_id: "019ffe9d-7c66-7e83-8ed6-aa3b43097d82",
|
||||
development_id: "DEV-20260814-001",
|
||||
persona: "ICE-P-ZY001",
|
||||
controller_persona_id: "ICE-P-ZY001",
|
||||
development_object_ids: [],
|
||||
human_anchor: "ICE-GL∞",
|
||||
summary: "repair AGE-owned continuity infrastructure",
|
||||
task_lock: {
|
||||
fingerprint: sha("7"),
|
||||
amendments: [
|
||||
{
|
||||
amendment_id: "AMD-AGE-SELF-001",
|
||||
kind: "clarification",
|
||||
summary: "Authorize AGE self-infrastructure tool-layer repair.",
|
||||
user_anchor: "Rebuild the tool layer for AGE runtime needs.",
|
||||
recorded_at: "2026-08-14T08:18:42.665Z",
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
current.task_event = createTaskEvent({
|
||||
lane: current,
|
||||
intent: "clarification",
|
||||
requestSummary: current.summary,
|
||||
openedAt: "2026-08-14T08:18:42.000Z",
|
||||
});
|
||||
const checkpointEvidence = {
|
||||
source_kind: "PERSONA_AUTHORED_HLDP_CHECKPOINT",
|
||||
status: "persona_authored_current_checkpoint",
|
||||
thread_id: current.thread_id,
|
||||
development_id: current.development_id,
|
||||
task_event_id: current.task_event.task_event_id,
|
||||
scope_amendment_id: "AMD-AGE-SELF-001",
|
||||
path: `/continuity/runtime/${current.thread_id}/PERSONA-CHECKPOINT-W8.hdlp.md`,
|
||||
sha256: sha("8"),
|
||||
required_sections: [
|
||||
"world_context",
|
||||
"persona_identity",
|
||||
"confirmed_goal",
|
||||
"user_corrections",
|
||||
"immutable_constraints",
|
||||
"authoritative_sources",
|
||||
"causal_chain",
|
||||
"completed_with_receipts",
|
||||
"unfinished",
|
||||
"unknown_or_stale",
|
||||
"next_action",
|
||||
"five_questions_after_b0",
|
||||
],
|
||||
};
|
||||
const pointer = {
|
||||
thread_id: current.thread_id,
|
||||
development_id: current.development_id,
|
||||
checkpoint_path: checkpointEvidence.path,
|
||||
checkpoint_sha256: checkpointEvidence.sha256,
|
||||
};
|
||||
checkpointEvidence.current_runtime = {
|
||||
state: "PERSONA_REVIEWED_CHECKPOINT_ACTIVE",
|
||||
...pointer,
|
||||
task_event_id: current.task_event.task_event_id,
|
||||
};
|
||||
checkpointEvidence.by_thread = { ...pointer };
|
||||
checkpointEvidence.by_development = { ...pointer };
|
||||
return { current, checkpointEvidence };
|
||||
}
|
||||
|
||||
test("development object cannot replace the controller persona", () => {
|
||||
assert.throws(
|
||||
() =>
|
||||
|
|
@ -99,6 +172,134 @@ test("development object cannot replace the controller persona", () => {
|
|||
);
|
||||
});
|
||||
|
||||
test("an empty lane stays unclassified until current authorization and persona checkpoint agree", () => {
|
||||
const { current, checkpointEvidence } = ageSelfFixture();
|
||||
const classified = classifyAgeSelfInfrastructureLane({
|
||||
lane: current,
|
||||
requestedLaneKind: LANE_KIND_AGE_SELF_INFRASTRUCTURE,
|
||||
taskEventId: current.task_event.task_event_id,
|
||||
checkpointEvidence,
|
||||
authorizationAmendmentId: "AMD-AGE-SELF-001",
|
||||
classifiedAt: "2026-08-14T08:34:11.328Z",
|
||||
});
|
||||
assert.equal(classified.lane_kind, LANE_KIND_AGE_SELF_INFRASTRUCTURE);
|
||||
assert.deepEqual(classified.development_object_ids, []);
|
||||
assert.equal(
|
||||
classified.lane_kind_history[0].authority_effect,
|
||||
"NO_EXTERNAL_AUTHORITY_GRANTED",
|
||||
);
|
||||
});
|
||||
|
||||
test("AGE self binding receipts verify metacognition evidence but grant no reality authority", () => {
|
||||
const { current, checkpointEvidence } = ageSelfFixture();
|
||||
const classified = classifyAgeSelfInfrastructureLane({
|
||||
lane: current,
|
||||
requestedLaneKind: LANE_KIND_AGE_SELF_INFRASTRUCTURE,
|
||||
taskEventId: current.task_event.task_event_id,
|
||||
checkpointEvidence,
|
||||
authorizationAmendmentId: "AMD-AGE-SELF-001",
|
||||
classifiedAt: "2026-08-14T08:34:11.328Z",
|
||||
});
|
||||
const receipt = createAgeSelfInfrastructureBindingReceipt({
|
||||
lane: classified,
|
||||
checkpointEvidence,
|
||||
authorizationAmendmentId: "AMD-AGE-SELF-001",
|
||||
createdAt: "2026-08-14T08:34:20.000Z",
|
||||
});
|
||||
const binding = {
|
||||
binding_id: receipt.binding_id,
|
||||
receipt_sha256: sha("9"),
|
||||
};
|
||||
assert.deepEqual(
|
||||
[...receipt.authority_limits].sort(),
|
||||
[...AGE_SELF_BINDING_AUTHORITY_LIMITS].sort(),
|
||||
);
|
||||
assert.equal(
|
||||
validateAgeSelfInfrastructureBindingReceipt({
|
||||
lane: classified,
|
||||
binding,
|
||||
receipt,
|
||||
actualReceiptSha256: sha("9"),
|
||||
checkpointEvidence,
|
||||
}),
|
||||
true,
|
||||
);
|
||||
});
|
||||
|
||||
test("a host summary cannot substitute for the persona-authored Step Zero checkpoint", () => {
|
||||
const { current, checkpointEvidence } = ageSelfFixture();
|
||||
checkpointEvidence.source_kind = "HOST_SUMMARY";
|
||||
assert.throws(
|
||||
() =>
|
||||
classifyAgeSelfInfrastructureLane({
|
||||
lane: current,
|
||||
requestedLaneKind: LANE_KIND_AGE_SELF_INFRASTRUCTURE,
|
||||
taskEventId: current.task_event.task_event_id,
|
||||
checkpointEvidence,
|
||||
authorizationAmendmentId: "AMD-AGE-SELF-001",
|
||||
classifiedAt: "2026-08-14T08:34:11.328Z",
|
||||
}),
|
||||
/AGE_SELF_CHECKPOINT_OR_AUTHORIZATION_INVALID/,
|
||||
);
|
||||
});
|
||||
|
||||
test("an external-object lane cannot be reclassified as AGE self infrastructure", () => {
|
||||
const { checkpointEvidence } = ageSelfFixture();
|
||||
const externalLane = lane();
|
||||
externalLane.task_event = createTaskEvent({
|
||||
lane: externalLane,
|
||||
intent: "clarification",
|
||||
requestSummary: externalLane.summary,
|
||||
openedAt: "2026-08-14T08:18:42.000Z",
|
||||
});
|
||||
externalLane.task_lock.amendments = [
|
||||
{
|
||||
amendment_id: "AMD-AGE-SELF-001",
|
||||
kind: "clarification",
|
||||
summary: "Invalid reclassification attempt.",
|
||||
user_anchor: "Do not replace the external object lane.",
|
||||
recorded_at: "2026-08-14T08:18:42.665Z",
|
||||
},
|
||||
];
|
||||
assert.throws(
|
||||
() =>
|
||||
classifyAgeSelfInfrastructureLane({
|
||||
lane: externalLane,
|
||||
requestedLaneKind: LANE_KIND_AGE_SELF_INFRASTRUCTURE,
|
||||
taskEventId: externalLane.task_event.task_event_id,
|
||||
checkpointEvidence: {
|
||||
...checkpointEvidence,
|
||||
thread_id: externalLane.thread_id,
|
||||
development_id: externalLane.development_id,
|
||||
task_event_id: externalLane.task_event.task_event_id,
|
||||
},
|
||||
authorizationAmendmentId: "AMD-AGE-SELF-001",
|
||||
classifiedAt: "2026-08-14T08:34:11.328Z",
|
||||
}),
|
||||
/AGE_SELF_CLASSIFICATION_IDENTITY_OR_OBJECT_SCOPE_INVALID|AGE_SELF_CLASSIFICATION_REQUIRES_UNCLASSIFIED_EMPTY_LANE/,
|
||||
);
|
||||
});
|
||||
|
||||
test("legacy persona binding rejects an empty unclassified lane", () => {
|
||||
const { current } = ageSelfFixture();
|
||||
current.persona_source_binding = null;
|
||||
assert.throws(
|
||||
() =>
|
||||
validatePersonaBindingReceipt({
|
||||
lane: current,
|
||||
binding: { binding_id: "INVALID", receipt_sha256: sha("a") },
|
||||
receipt: { development_objects: [] },
|
||||
actualReceiptSha256: sha("a"),
|
||||
actualCheckpointSha256: sha("b"),
|
||||
actualAdapterSourceSha256: sha("c"),
|
||||
adapterSourcePath: "/runtime/adapter.mjs",
|
||||
allowedAdapterRoot: "/runtime",
|
||||
pointerEvidence: {},
|
||||
}),
|
||||
/EXTERNAL_DEVELOPMENT_OBJECTS_REQUIRED/,
|
||||
);
|
||||
});
|
||||
|
||||
test("a new task event invalidates but preserves the old binding", () => {
|
||||
const current = lane();
|
||||
current.task_event = createTaskEvent({
|
||||
|
|
|
|||
Loading…
Reference in a new issue