backup: preserve pre-native-foundation runtime work

This commit is contained in:
冰朔 2026-08-21 14:10:13 +08:00
commit 71dbcd62ec
23 changed files with 3647 additions and 196 deletions

View file

@ -66,6 +66,29 @@ export function compileUnifiedNumberTree() {
if (routes.length !== uniquePaths.size || routes.length !== uniqueOperations.size) {
throw new Error('HOLOLAKE_UNIFIED_NUMBER_TREE_DUPLICATE_COORDINATE')
}
const moduleRoutes = new Map()
for (const route of routes) {
const existing = moduleRoutes.get(route.moduleNumber) ?? []
existing.push(route)
moduleRoutes.set(route.moduleNumber, existing)
}
const moduleNodes = [...moduleRoutes.entries()].map(([moduleNumber, members]) => ({
nodeKind: 'EXECUTION_MODULE',
nodeNumber: moduleNumber,
moduleNumber,
transport: [...new Set(members.map((route) => route.transport))].join('+'),
operationCount: members.length,
operationNumbers: members.map((route) => route.operationNumber).sort((left, right) => left.localeCompare(right, 'en')),
schedulingPolicy: 'ONE_MODULE_ONE_NUMBER_PATH_SERIAL',
executionState: 'RUNTIME_NUMBER_DATABASE_INDEXED',
evidence: 'UNIFIED_NUMBER_ROUTE_MEMBERSHIP',
path: `HLP-NUMBER-WORLD-ROOT-001/MODULE/${moduleNumber}`,
})).sort((left, right) => left.path.localeCompare(right.path, 'en'))
if (new Set(moduleNodes.map((node) => node.moduleNumber)).size !== moduleNodes.length
|| new Set(moduleNodes.map((node) => node.path)).size !== moduleNodes.length
|| moduleNodes.some((node) => node.operationCount === 0)) {
throw new Error('HOLOLAKE_UNIFIED_NUMBER_TREE_MODULE_ROOT_COLLISION')
}
const identityNodes = identity.value.namespaces.map((namespace) => ({
nodeKind: 'IDENTITY_NAMESPACE',
nodeNumber: `HLP-IDENTITY-NS-${namespace.id}`,
@ -99,7 +122,7 @@ export function compileUnifiedNumberTree() {
path: `HLP-NUMBER-WORLD-ROOT-001/GLS/REFERENCE/${reference.node_number}`,
})),
].sort((left, right) => left.path.localeCompare(right.path, 'en'))
const allPaths = [...routes.map((route) => route.path), ...identityNodes.map((node) => node.path), ...protocolNodes.map((node) => node.path)]
const allPaths = [...moduleNodes.map((node) => node.path), ...routes.map((route) => route.path), ...identityNodes.map((node) => node.path), ...protocolNodes.map((node) => node.path)]
if (new Set(allPaths).size !== allPaths.length
|| gls.value.reconciliation.unresolved_number_reference_count !== 0
|| gls.value.reconciliation.every_dependency_has_number_coordinate !== true
@ -136,14 +159,17 @@ export function compileUnifiedNumberTree() {
everyAcceptedCallHasEvidenceClass: true,
everyProtocolReferenceHasNumberCoordinate: true,
referenceOnlyNodesNeverExecutable: true,
oneModuleOneRuntimeRootPath: true,
unresolvedNumberReferenceCount: 0,
mismatchedCoordinate: 'FAIL_CLOSED',
},
coordinateCount: routes.length + identityNodes.length + protocolNodes.length,
coordinateCount: moduleNodes.length + routes.length + identityNodes.length + protocolNodes.length,
moduleNodeCount: moduleNodes.length,
routeCount: routes.length,
identityNodeCount: identityNodes.length,
protocolNodeCount: protocolNodes.length,
referenceOnlyNodeCount: protocolNodes.filter((node) => node.nodeKind === 'GLS_REFERENCE_ONLY').length,
moduleNodes,
identityNodes,
protocolNodes,
routes,

View file

@ -14,6 +14,8 @@ test('light lake exposes a first-class human conversation entrance', () => {
assert.match(main, /<PersonaChannelBody/)
assert.match(channel, /<textarea[\s\S]*?form\?\.requestSubmit\(\)/)
assert.match(channel, /\{sending \? '正在回应…' : '发送'\}/)
assert.match(channel, /markdownHtml\(item\.content\)/)
assert.match(channel, /persona-message-markdown/)
})
test('knowledge workspace keeps the chat visible and binds the exact active page', () => {
@ -31,7 +33,8 @@ test('knowledge workspace keeps the chat visible and binds the exact active page
test('model configuration remains secondary to the conversation surface', () => {
assert.match(channel, /const \[settingsOpen, setSettingsOpen\] = useState\(false\)/)
assert.match(channel, /直接输入消息开始对话;知识引用、模型设置和运行回执按需展开/)
assert.match(channel, /ZERO CORE · LANGUAGE PERSONA CHANNEL/)
assert.match(channel, /persona-chat-status/)
assert.match(channel, /\{settingsOpen && <aside className="persona-chat-settings">/)
assert.match(channel, /API 密钥 · 只进钥匙串/)
})
@ -42,4 +45,7 @@ test('the chosen model route survives restart and prefers explicit user configur
assert.match(channel, /item\.source === 'EXPLICIT_USER_CONFIG'/)
assert.match(channel, /rememberProvider\(nextProviderId\)/)
assert.match(channel, /onChange=\{\(event\) => selectProvider\(event\.target\.value\)\}/)
assert.match(channel, /selectedProvider\?\.source === 'EXPLICIT_USER_CONFIG'/)
assert.match(channel, /providerId: existingProviderId/)
assert.match(channel, /setModel\(saved\?\.selectedModel \|\| configModel\.trim\(\)\)/)
})

View file

@ -0,0 +1,49 @@
import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'
import test from 'node:test'
const frontend = readFileSync(new URL('../src/modules/persona-channel-body/index.tsx', import.meta.url), 'utf8')
const main = readFileSync(new URL('../src/main.tsx', import.meta.url), 'utf8')
const runtime = readFileSync(new URL('../src-tauri/src/persona_language_channel.rs', import.meta.url), 'utf8')
const routes = JSON.parse(readFileSync(new URL('../contracts/numbered-ipc-registry.json', import.meta.url), 'utf8'))
test('human conversations are real numbered entities with create switch and delete controls', () => {
for (const alias of ['list_conversations', 'create_conversation', 'delete_conversation']) {
assert.match(frontend, new RegExp(`invoke<[^>]+>\\('${alias}'`))
assert.ok(routes.operations.some((route) => route.alias === alias && route.module_number === 'HLP-NIPC-MOD-0035'))
}
assert.match(frontend, /conversationId,\s*providerId/)
assert.match(frontend, /setConversationId\(item\.conversationId\)/)
assert.match(frontend, /删除对话/)
assert.match(main, /setPersonaNewConversationRequest\(\(value\) => value \+ 1\)/)
assert.match(main, /newConversationRequest=\{personaNewConversationRequest\}/)
})
test('legacy history migrates without loss and deletion preserves the local receipt chain', () => {
assert.match(runtime, /ALTER TABLE messages ADD COLUMN conversation_id/)
assert.match(runtime, /migrate_legacy_conversations/)
assert.match(runtime, /HLP-CONV-LEGACY-/)
assert.match(runtime, /SOFT_DELETE_TOMBSTONE_MESSAGES_RETAINED_FOR_LOCAL_RECEIPT_CHAIN/)
assert.match(runtime, /legacy_messages_migrate_into_one_numbered_conversation_without_loss/)
assert.match(runtime, /conversations_are_isolated_and_delete_keeps_local_receipt_history/)
})
test('model receives machine environment facts instead of a hard-coded unknown response', () => {
assert.match(runtime, /\[ZERO_CORE_CHANNEL_RUNTIME\]/)
assert.match(runtime, /human_anchor=\{human_name\} · \{human_id\}/)
assert.match(runtime, /知识库工具仍然可用/)
assert.match(runtime, /hololake_search_knowledge/)
assert.match(runtime, /hololake_read_knowledge_document/)
assert.doesNotMatch(runtime, /没有证据就明确说不知道/)
assert.match(runtime, /REGISTERED_AGE_PERSONA_BRAIN_DRIVES_REPLACEABLE_MODEL_AND_CODEX_LIMBS/)
})
test('persona tool forge compiles typed HLDP through its own numbered preview route', () => {
assert.match(frontend, /preview_hldp_tool_program/)
assert.match(frontend, /HLDP NATIVE TOOL FORGE/)
assert.match(frontend, /确定性 GIR/)
assert.ok(routes.operations.some((route) => route.alias === 'preview_hldp_tool_program'
&& route.operation_number === 'HLP-NIPC-OP-0168'
&& route.module_number === 'HLP-NIPC-MOD-0035'))
assert.match(runtime, /compile_hldp_program\(input\)/)
})

View file

@ -22,6 +22,7 @@ test('release center records every shipped HoloLake line from 0.4.0 through curr
test('one engine exposes Guanghu and standard workbench projections with a human default', async () => {
const source = await read('src/main.tsx')
const styles = await read('src/styles.css')
assert.match(source, /type PresentationMode = 'guanghu' \| 'workbench'/)
assert.match(source, /type AudienceLayer = 'human' \| 'execution'/)
assert.match(source, /hololake-presentation-mode/)
@ -33,6 +34,12 @@ test('one engine exposes Guanghu and standard workbench projections with a human
assert.match(source, /renderWorkbenchHuman()/)
assert.match(source, /renderExecutionProjection\(\)/)
assert.match(source, /人格体结构化执行界面/)
assert.match(source, /presentationMode !== 'workbench' \|\| view !== 'persona'/)
assert.match(source, /void refreshPersonaBodyModule\(\)/)
assert.match(source, /<PersonaChannelBody onBack=\{\(\) => \{ setView\('overview'\); setWorldStage\(toolReturnStage\) \}\}/)
assert.match(styles, /\.standard-workbench\s*\{[^}]*display:\s*grid;[^}]*grid-template-columns:\s*52px 244px minmax\(0, 1fr\);/s)
assert.match(styles, /@media \(max-width: 640px\)\s*\{[^}]*\.standard-workbench\s*\{[^}]*grid-template-columns:\s*46px minmax\(0, 1fr\);/s)
assert.ok(styles.indexOf('.workbench-sidebar { display: none; }') > styles.indexOf('@media (max-width: 640px)'))
})
test('main domain routes to the public release center instead of a descriptive popup', async () => {
@ -45,7 +52,8 @@ test('main domain routes to the public release center instead of a descriptive p
test('public language persona copy is formal and keeps a visible human composer', async () => {
const source = await read('src/modules/persona-channel-body/index.tsx')
assert.match(source, /<h1>\{embedded \? '对话与知识协作' : '语言人格频道'\}<\/h1>/)
assert.match(source, /<h1>\{conversation\?\.title \|\| \(embedded \? '对话与知识协作' : '语言人格频道'\)\}<\/h1>/)
assert.match(source, /冰朔 · ICE-GL∞/)
assert.match(source, /输入消息;需要知识时可直接提问。/)
assert.match(source, /<textarea/)
assert.match(source, /send_message/)

View file

@ -23,6 +23,7 @@ test('number verification is an unknown star abyss and the world stays veiled un
assert.match(styles, /\.starlake-scene\.world-veiled \.domains/)
assert.match(styles, /\.starlake-scene\.world-veiled \.masthead/)
assert.match(styles, /\.starlake-scene \.star-abyss-entry\s*\{/)
assert.match(styles, /\.starlake-scene \.world-channel-return\s*\{[^}]*pointer-events:\s*auto;/s)
assert.match(styles, /left:50%/)
assert.match(styles, /@keyframes sl-domain-rise/)
assert.match(styles, /@keyframes sl-abyss-open/)

View file

@ -8,18 +8,23 @@ test('identity, webview and direct broker numbers compile into one unique eviden
assert.deepEqual(generated, compileUnifiedNumberTree())
assert.equal(generated.schema, 'hololake.unified-number-coordinate-tree/v2')
assert.equal(generated.recordId, 'HLP-UNIFIED-NUMBER-TREE-001')
assert.equal(generated.coordinateCount, 273)
assert.equal(generated.routeCount, 170)
assert.equal(generated.coordinateCount, 324)
assert.equal(generated.moduleNodeCount, 46)
assert.equal(generated.routeCount, 175)
assert.equal(generated.identityNodeCount, 4)
assert.equal(generated.protocolNodeCount, 99)
assert.equal(generated.referenceOnlyNodeCount, 16)
assert.equal(new Set(generated.routes.map((route) => route.path)).size, 170)
assert.equal(new Set([...generated.identityNodes, ...generated.protocolNodes, ...generated.routes].map((node) => node.path)).size, 273)
assert.equal(new Set(generated.moduleNodes.map((node) => node.path)).size, 46)
assert.equal(new Set(generated.routes.map((route) => route.path)).size, 175)
assert.equal(new Set([...generated.moduleNodes, ...generated.identityNodes, ...generated.protocolNodes, ...generated.routes].map((node) => node.path)).size, 324)
assert.equal(generated.invariants.everyPhysicalCallHasNumberedRoute, true)
assert.equal(generated.invariants.everyAcceptedCallHasEvidenceClass, true)
assert.equal(generated.invariants.everyProtocolReferenceHasNumberCoordinate, true)
assert.equal(generated.invariants.referenceOnlyNodesNeverExecutable, true)
assert.equal(generated.invariants.oneModuleOneRuntimeRootPath, true)
assert.equal(generated.invariants.unresolvedNumberReferenceCount, 0)
assert.ok(generated.protocolNodes.filter((node) => node.nodeKind === 'GLS_REFERENCE_ONLY').every((node) => node.executionState === 'REFERENCE_ONLY_NOT_EXECUTABLE'))
assert.ok(generated.routes.every((route) => route.admission && route.evidence))
assert.ok(generated.moduleNodes.every((node) => node.path === `${generated.rootNumber}/MODULE/${node.moduleNumber}`))
assert.ok(generated.moduleNodes.every((node) => node.schedulingPolicy === 'ONE_MODULE_ONE_NUMBER_PATH_SERIAL'))
})