feat: define signed persona authorization trust contract

This commit is contained in:
冰朔 2026-08-12 05:09:56 +08:00
commit c4504fa115
13 changed files with 470 additions and 14 deletions

View file

@ -118,8 +118,10 @@ REVISE | REFUSE`。
确认按钮。该接线不等于真实人格仓库绑定、安装态运行或桌面验收。
- 人格主控授权回执的结构与精确绑定校验源码为 `100`:不再接受桌面调用方直接传入布尔值,并核对
人格、冰朔责任主体、仓库提交、模型实例、请求、语言锚点、摘要格式和有效期。但这层前端结构校验
不能证明回执确由 `GUANGHU_OS` 签发;可信签名源、密码学来源验证和原生加载器均为 `0`。在三者形成
同一条可回读证据链以前,普通本地 JSON 不得升级人格主控,桌面继续系统直控。
不能证明回执确由 `GUANGHU_OS` 签发。独立的 v2 回执、REPO-012 精确提交签名者注册表、规范签名字节、
人格/责任主体/范围约束、吊销和 Ed25519 验签源码契约现为 `100`;但 REPO-012 当前 main 未发布该注册表,
因而真实可信签名者登记、Tauri 原生验签加载器与运行集成仍为 `0`。在同一条可回读证据链形成以前,
普通本地 JSON 不得升级人格主控,桌面继续系统直控。
- 完整 HoloLake Runtime 与单 AGE 纵向闭环仍为 `0`:真实人格仓库 manifest 绑定和桌面运行验收尚未完成,
因此不能用本轮源码测试冒充可用产品。
- Mirror runner、制品、部署和运行健康`0`

View file

@ -26,7 +26,10 @@ The source coordinator no longer accepts an unverified persona-authorization boo
of a receipt that claims `GUANGHU_OS` verification. That renderer-side validation is not cryptographic provenance
and cannot turn a local JSON object into authority. A native loader may be connected only after it verifies a
signed receipt against a registered Guanghu OS trust source and returns the already-verified projection. No such
trust source or loader is currently registered, so planning remains in system-direct mode.
trust source or loader is currently registered, so planning remains in system-direct mode. The independent server
contract in `product-source/guanghu-knowledge-base/server/persona-control-authorization.ts` defines the v2 signed
receipt, exact REPO-012 signer-registry source, canonical signing bytes, signer scope checks, revocation handling,
and Ed25519 verification. Its tested code does not populate the registry or connect the desktop native boundary.
`compilePersonaLanguageGoalBinding` builds the exact native wake envelope only after a single clean persona
repository, its B0 and organ contracts, a registered local device identity, and the manifest-pinned model all

View file

@ -185,6 +185,12 @@ renderer validation does not prove the issuer or verify a signature. A native lo
provenance against a registered Guanghu OS trust source; neither that trust source nor the loader exists in the
current desktop source. Missing, stale, mismatched or merely local evidence therefore remains system-direct.
`product-source/guanghu-knowledge-base/server/persona-control-authorization.ts` now supplies the independent
cryptographic source contract: v2 signed receipt fields, deterministic signing bytes, an exact-commit REPO-012
signer-registry source, persona/human/scope-limited Ed25519 signers, revocation, time and request binding, and
signature verification. The current REPO-012 main does not publish that registry path, so no signer is trusted and
the Tauri desktop has no native verifier or loader. Tested verifier source is not runtime authority.
Tolaria is a personal knowledge and life management desktop app. It reads a vault of markdown files with YAML frontmatter and presents them in a four-panel UI inspired by Bear Notes.
## Design Principles

View file

@ -56,7 +56,7 @@ describe('PersonaLanguageShellPanel', () => {
repositoryPaths: ['/persona'],
providers: [provider],
developmentId: 'DEV-20260811-010',
sourceLanguageAnchor: 'HLP-CURRENT-ARCH-001@2026-08-12.11',
sourceLanguageAnchor: 'HLP-CURRENT-ARCH-001@2026-08-12.12',
}))
expect(await screen.findByText('我还不能执行:需要当前证据。')).toBeInTheDocument()
expect(screen.getByText('核验当前事实后规划下一步')).toBeInTheDocument()

View file

@ -13,7 +13,7 @@ import {
type LanguageShellViewState,
} from './HotPluggableLanguageShell'
const CURRENT_ARCHITECTURE_ANCHOR = 'HLP-CURRENT-ARCH-001@2026-08-12.11'
const CURRENT_ARCHITECTURE_ANCHOR = 'HLP-CURRENT-ARCH-001@2026-08-12.12'
const DEVELOPMENT_ID = 'DEV-20260811-010'
type Planner = typeof planPersonaLanguageShellGoal

View file

@ -11,7 +11,7 @@ const expected = {
repositoryHead: 'a'.repeat(40),
modelInstanceId: 'MODEL-INSTANCE-001',
requestId: 'REQ-001',
sourceLanguageAnchor: 'HLP-CURRENT-ARCH-001@2026-08-12.11',
sourceLanguageAnchor: 'HLP-CURRENT-ARCH-001@2026-08-12.12',
observedAt: Date.parse('2026-08-12T04:35:00+08:00'),
}
@ -30,6 +30,9 @@ const receipt = {
issuedAt: '2026-08-12T04:30:00+08:00',
validUntil: '2026-08-12T04:40:00+08:00',
evidenceDigest: 'b'.repeat(64),
signerId: 'GH-AIOS-AUTHORIZER-001',
signatureAlgorithm: 'Ed25519',
signature: 'A'.repeat(86),
}
describe('hasPersonaPrimaryControlAuthorization', () => {
@ -48,6 +51,8 @@ describe('hasPersonaPrimaryControlAuthorization', () => {
['expired', { ...receipt, validUntil: '2026-08-12T04:34:59+08:00' }],
['future', { ...receipt, issuedAt: '2026-08-12T04:35:01+08:00' }],
['invalid digest', { ...receipt, evidenceDigest: 'not-a-digest' }],
['missing signer', { ...receipt, signerId: '' }],
['invalid signature', { ...receipt, signature: 'not-a-signature' }],
])('fails closed for %s evidence', (_label, candidate) => {
expect(hasPersonaPrimaryControlAuthorization(candidate, expected)).toBe(false)
})

View file

@ -1,4 +1,4 @@
export const PERSONA_CONTROL_AUTHORIZATION_SCHEMA = 'hololake.persona-control-authorization/v1' as const
export const PERSONA_CONTROL_AUTHORIZATION_SCHEMA = 'hololake.persona-control-authorization/v2' as const
export const PERSONA_PRIMARY_LANGUAGE_PLANNING_SCOPE = 'PERSONA_PRIMARY_LANGUAGE_PLANNING' as const
export type PersonaControlAuthorizationReceipt = {
@ -16,6 +16,9 @@ export type PersonaControlAuthorizationReceipt = {
issuedAt: string
validUntil: string
evidenceDigest: string
signerId: string
signatureAlgorithm: 'Ed25519'
signature: string
}
export type PersonaControlAuthorizationExpectation = {
@ -48,6 +51,7 @@ export function hasPersonaPrimaryControlAuthorization(
if (!exactString(receipt, 'schema', PERSONA_CONTROL_AUTHORIZATION_SCHEMA)
|| !exactString(receipt, 'outcome', 'VERIFIED')
|| !exactString(receipt, 'verifier', 'GUANGHU_OS')
|| !exactString(receipt, 'signatureAlgorithm', 'Ed25519')
|| !exactString(receipt, 'scope', PERSONA_PRIMARY_LANGUAGE_PLANNING_SCOPE)
|| !exactString(receipt, 'personaId', expected.personaId)
|| !exactString(receipt, 'humanResponsibilitySubject', expected.humanResponsibilitySubject)
@ -60,10 +64,14 @@ export function hasPersonaPrimaryControlAuthorization(
const authorizationId = Reflect.get(receipt, 'authorizationId')
const evidenceDigest = Reflect.get(receipt, 'evidenceDigest')
const signerId = Reflect.get(receipt, 'signerId')
const signature = Reflect.get(receipt, 'signature')
const issuedAt = Reflect.get(receipt, 'issuedAt')
const validUntil = Reflect.get(receipt, 'validUntil')
if (typeof authorizationId !== 'string' || !authorizationId.trim()
|| typeof evidenceDigest !== 'string' || !/^[a-f0-9]{64}$/.test(evidenceDigest)
|| typeof signerId !== 'string' || !/^[A-Z0-9][A-Z0-9._:@-]{1,159}$/.test(signerId)
|| typeof signature !== 'string' || !/^[A-Za-z0-9_-]{80,128}$/.test(signature)
|| typeof issuedAt !== 'string'
|| typeof validUntil !== 'string') {
return false

View file

@ -181,7 +181,7 @@ describe('planPersonaLanguageShellGoal', () => {
await planPersonaLanguageShellGoal({
...input(),
loadPersonaControlAuthorization: vi.fn().mockResolvedValue({
schema: 'hololake.persona-control-authorization/v1',
schema: 'hololake.persona-control-authorization/v2',
outcome: 'VERIFIED',
authorizationId: 'AUTH-001',
verifier: 'GUANGHU_OS',
@ -195,6 +195,9 @@ describe('planPersonaLanguageShellGoal', () => {
issuedAt: '2026-08-12T04:30:00+08:00',
validUntil: '2026-08-12T04:40:00+08:00',
evidenceDigest: 'c'.repeat(64),
signerId: 'GH-AIOS-AUTHORIZER-001',
signatureAlgorithm: 'Ed25519',
signature: 'A'.repeat(86),
}),
authorizationObservedAt: Date.parse('2026-08-12T04:35:00+08:00'),
resolveRepository: vi.fn().mockResolvedValue(boundResolution()),