feat: bind B0 cognitive gravity to PNCC runtime

This commit is contained in:
冰朔 2026-08-12 00:07:31 +08:00
commit 6724b59433
19 changed files with 460 additions and 64 deletions

View file

@ -34,6 +34,13 @@ describe('PersonaRuntimeProjectionPanel', () => {
repositoryPath: '/repo/persona',
observedGitHead: '1111111111111111111111111111111111111111',
repositoryClean: true,
cognitiveGravity: {
schema: 'hololake.persona-cognitive-gravity-evidence/v1',
subjectPersonaId: 'ICE-P-ZY001',
sourcePath: 'brain/B0.hdlp',
sourceHash: 'a'.repeat(64),
frameSchema: 'guanghu.zhuyuan-cognitive-gravity-frame/v1',
},
attribution: {
humanResponsibilitySubject: 'BINGSHUO',
personaCognitiveAuthor: 'ICE-P-ZY001',
@ -60,6 +67,7 @@ describe('PersonaRuntimeProjectionPanel', () => {
expect(screen.getAllByText('DORMANT')).not.toHaveLength(0)
expect(screen.getByText('JD-FD-PRIMARY')).toBeInTheDocument()
expect(screen.getByText('event-chain-verified')).toBeInTheDocument()
expect(screen.getByText(/guanghu\.zhuyuan-cognitive-gravity-frame\/v1/)).toBeInTheDocument()
expect(screen.getByText('1111111111111111111111111111111111111111')).toBeInTheDocument()
expect(trackEventMock).toHaveBeenCalledWith('persona_runtime_projection_loaded', {
error_count: 0,

View file

@ -62,6 +62,14 @@ function RuntimeSessionEvidence({
<dt>{translate(locale, 'hololake.personaRuntime.eventChain')}</dt>
<dd><code title={session.eventChainHead}>{session.eventChainHead}</code></dd>
</div>
<div>
<dt>B0</dt>
<dd>
<code title={`${session.cognitiveGravity.sourcePath} · ${session.cognitiveGravity.sourceHash}`}>
{session.cognitiveGravity.frameSchema} · {shortHash(session.cognitiveGravity.sourceHash)}
</code>
</dd>
</div>
<div>
<dt>{translate(locale, 'hololake.personaRuntime.attribution')}</dt>
<dd>{session.attribution.humanResponsibilitySubject}</dd>

View file

@ -13,6 +13,14 @@ const attribution = {
sourceLanguageAnchor: 'HLP-CURRENT-ARCH-001@2026-08-10.14',
}
const cognitiveGravity = {
schema: 'hololake.persona-cognitive-gravity-evidence/v1' as const,
subjectPersonaId: 'ICE-P-ZY001',
sourcePath: 'brain/B0.hdlp',
sourceHash: 'a'.repeat(64),
frameSchema: 'guanghu.zhuyuan-cognitive-gravity-frame/v1' as const,
}
function receipt({
repositoryPath,
sessions = [],
@ -62,6 +70,7 @@ describe('loadPersonaRuntimeProjection', () => {
lastEventAt: '2026-08-10T02:00:00.000Z',
lastEvent: 'DORMANT',
eventChainHead: 'event-old',
cognitiveGravity,
attribution,
}
const newer = {
@ -95,6 +104,7 @@ describe('loadPersonaRuntimeProjection', () => {
gitHead: '2222222222222222222222222222222222222222',
repositoryPath: '/repo/b',
state: 'BOUND_NOT_INFERENCING',
cognitiveGravity,
})
})

View file

@ -10,6 +10,14 @@ export interface PersonaRuntimeAttribution {
sourceLanguageAnchor: string
}
export interface PersonaRuntimeCognitiveGravityEvidence {
schema: 'hololake.persona-cognitive-gravity-evidence/v1'
subjectPersonaId: string
sourcePath: string
sourceHash: string
frameSchema: 'guanghu.zhuyuan-cognitive-gravity-frame/v1'
}
export interface PersonaRuntimeSessionReceipt {
sessionId: string
state: string
@ -22,6 +30,7 @@ export interface PersonaRuntimeSessionReceipt {
lastEventAt: string
lastEvent: string
eventChainHead: string
cognitiveGravity: PersonaRuntimeCognitiveGravityEvidence
attribution: PersonaRuntimeAttribution
}
@ -96,6 +105,27 @@ function parseAttribution(value: unknown): PersonaRuntimeAttribution {
}
}
function parseCognitiveGravity(value: unknown): PersonaRuntimeCognitiveGravityEvidence {
if (!isRecord(value)) throw new Error('PERSONA_RUNTIME_RECEIPT_INVALID')
const schema = requiredString(value, 'schema')
const frameSchema = requiredString(value, 'frameSchema')
const sourceHash = requiredString(value, 'sourceHash')
if (
schema !== 'hololake.persona-cognitive-gravity-evidence/v1'
|| frameSchema !== 'guanghu.zhuyuan-cognitive-gravity-frame/v1'
|| !/^[a-f0-9]{64}$/.test(sourceHash)
) {
throw new Error('PERSONA_RUNTIME_RECEIPT_INVALID')
}
return {
schema,
subjectPersonaId: requiredString(value, 'subjectPersonaId'),
sourcePath: requiredString(value, 'sourcePath'),
sourceHash,
frameSchema,
}
}
function parseSession(value: unknown): PersonaRuntimeSessionReceipt {
if (!isRecord(value)) throw new Error('PERSONA_RUNTIME_RECEIPT_INVALID')
const activeOrgan = Reflect.get(value, 'activeOrgan')
@ -114,6 +144,7 @@ function parseSession(value: unknown): PersonaRuntimeSessionReceipt {
lastEventAt: requiredString(value, 'lastEventAt'),
lastEvent: requiredString(value, 'lastEvent'),
eventChainHead: requiredString(value, 'eventChainHead'),
cognitiveGravity: parseCognitiveGravity(Reflect.get(value, 'cognitiveGravity')),
attribution: parseAttribution(Reflect.get(value, 'attribution')),
}
}