feat: bind persona control to authorization receipts

This commit is contained in:
冰朔 2026-08-12 04:36:45 +08:00
commit 099ed036b2
12 changed files with 248 additions and 15 deletions

View file

@ -96,7 +96,6 @@ function input() {
personaId: 'ICE-P-ZY001',
repositoryPaths: ['/persona/zhuyuan'],
providers: [provider],
personaAuthorized: true,
requestId: 'REQ-001',
modelInstanceId: 'MODEL-INSTANCE-001',
developmentId: 'DEV-20260811-010',
@ -173,6 +172,41 @@ describe('planPersonaLanguageShellGoal', () => {
})
expect(loadDeviceIdentity).toHaveBeenCalledTimes(1)
expect(planGoal).toHaveBeenCalledTimes(1)
expect(planGoal).toHaveBeenCalledWith(expect.objectContaining({ personaAuthorized: false }))
})
it('enables persona-primary planning only for an exact request-bound authorization receipt', async () => {
const planGoal = vi.fn().mockResolvedValue(plannedGoal)
await planPersonaLanguageShellGoal({
...input(),
loadPersonaControlAuthorization: vi.fn().mockResolvedValue({
schema: 'hololake.persona-control-authorization/v1',
outcome: 'VERIFIED',
authorizationId: 'AUTH-001',
verifier: 'GUANGHU_OS',
scope: 'PERSONA_PRIMARY_LANGUAGE_PLANNING',
personaId: repositoryBinding.personaId,
humanResponsibilitySubject: repositoryBinding.humanResponsibilitySubject,
repositoryHead: repositoryBinding.gitHead,
modelInstanceId: 'MODEL-INSTANCE-001',
requestId: 'REQ-001',
sourceLanguageAnchor: 'current-human-utterance',
issuedAt: '2026-08-12T04:30:00+08:00',
validUntil: '2026-08-12T04:40:00+08:00',
evidenceDigest: 'c'.repeat(64),
}),
authorizationObservedAt: Date.parse('2026-08-12T04:35:00+08:00'),
resolveRepository: vi.fn().mockResolvedValue(boundResolution()),
loadDeviceIdentity: vi.fn().mockResolvedValue({
schema: 'guanghu.router-device/v1',
device_id: 'HL-DEVICE-001',
public_key: 'public-key',
}),
planGoal,
})
expect(planGoal).toHaveBeenCalledWith(expect.objectContaining({ personaAuthorized: true }))
})
it('returns a stable binding error and never invokes cognition for invalid device evidence', async () => {