部署:接通三套人格系统每日第五域巡游

This commit is contained in:
冰朔 2026-08-06 17:54:19 +08:00
commit f7ef839ced
20 changed files with 1413 additions and 275 deletions

View file

@ -48,6 +48,7 @@ function fixture() {
apiKey: "fixture-secret",
apiUrl: "https://api.deepseek.com/v1",
model: "deepseek-chat",
controllerToken: "fixture-controller-token",
},
};
}
@ -118,6 +119,92 @@ test("member runtime binds model acknowledgement to repository and signature", a
}
});
test("member runtime forms and signs a bounded Fifth Domain role update", async () => {
const { root, config } = fixture();
try {
const runtime = createMemberRuntime(config, {
fetchImpl: async (_url, request) => {
const body = JSON.parse(request.body);
const input = JSON.parse(body.messages[1].content);
return {
ok: true,
async json() {
return {
choices: [
{
message: {
content: JSON.stringify({
schema:
"guanghu.fifth-domain-persona-observation/v1",
persona_id: config.personaId,
team_controller_id: "ICE-P-ZY001",
caller_nonce: input.exact_contract.caller_nonce,
source_to_sha: "b".repeat(40),
summary: "第五域的部署边界发生了可审核更新。",
role_findings: ["新增路径需要在部署前核验。"],
self_updates: ["以后优先读取唯一公共锚点。"],
recommended_actions: ["保留精确来源提交。"],
questions: [],
boundary_note: "本次只形成岗位理解,不取得写权限。",
}),
},
},
],
};
},
};
},
});
const response = await runtime.observeFifthDomain({
schema: "guanghu.fifth-domain-persona-observation-event/v1",
team_controller_id: "ICE-P-ZY001",
caller_nonce: "daily-observation-0001",
source: {
repository_id: "REPO-012",
branch: "main",
from_sha: "a".repeat(40),
to_sha: "b".repeat(40),
},
changed_commits: [`${"b".repeat(40)}\tupdate`],
changed_files: ["routing/example.json"],
change_excerpts: "FILE routing/example.json\n{}",
prior_persona_context: "",
scoped_duties: ["核验路径"],
});
assert.equal(response.ok, true);
assert.equal(response.persona_id, config.personaId);
assert.equal(
response.capability_state,
"FIFTH_DOMAIN_OBSERVATION_SIGNED_REPOSITORY_WRITE_NOT_GRANTED",
);
assert.equal(
response.payload.observation.source_to_sha,
"b".repeat(40),
);
assert.equal(response.signature_algorithm, "Ed25519");
} finally {
fs.rmSync(root, { recursive: true, force: true });
}
});
test("Fifth Domain observation endpoint rejects a caller without the controller token", async () => {
const { root, config } = fixture();
try {
const runtime = createMemberRuntime(config, {
fetchImpl: async () => {
throw new Error("must_not_call_model");
},
});
assert.equal(runtime.authorizeControllerToken("wrong"), false);
assert.equal(
runtime.authorizeControllerToken("fixture-controller-token"),
true,
);
} finally {
fs.rmSync(root, { recursive: true, force: true });
}
});
test("member runtime rejects an unscoped or wrong-controller challenge", async () => {
const { root, config } = fixture();
try {