hololake-system-architecture/product-source/hololake-native-desktop/scripts/personal-skill-runtime.test.mjs

42 lines
2.3 KiB
JavaScript
Raw Normal View History

import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'
import test from 'node:test'
const read = (path) => readFileSync(new URL(`../${path}`, import.meta.url), 'utf8')
test('personal skill algorithm is native while every pack remains private and channel scoped', () => {
const contract = JSON.parse(read('contracts/personal-skill-runtime.json'))
const runtime = read('src-tauri/src/personal_skill_runtime.rs')
const channel = read('src-tauri/src/personal_channel.rs')
assert.equal(contract.source.remote_canonical_state, 'LOCAL_COMMIT_VERIFIED_NOT_REMOTE_CANON')
assert.equal(contract.privacy.default_visibility, 'PRIVATE')
assert.equal(contract.privacy.share_state, 'NOT_AUTHORIZED')
assert.equal(contract.privacy.marketplace_state, 'NOT_AUTHORIZED')
assert.equal(contract.brain_boundaries.deterministic_algorithm_is_hololake_native, true)
assert.equal(contract.brain_boundaries.model_output_is_candidate_only, true)
assert.equal(contract.brain_boundaries.skill_success_may_mutate_persona_self_kernel, false)
assert.equal(contract.brain_boundaries.external_write_route, 'GH-CHANNEL-RECEIPT-0001')
assert.match(runtime, /HOLOLAKE_NATIVE_PERSONAL_SKILL_PLANNER/)
assert.match(runtime, /registered_initial_identity/)
assert.match(runtime, /INSTALLED_AND_BYTE_READBACK_VERIFIED/)
assert.match(channel, /personal_skill_runtime::ensure_current_channel/)
})
test('only provisioned channels receive current packs and Shiyu Yaochu stays deferred', () => {
const contract = JSON.parse(read('contracts/personal-skill-runtime.json'))
const runtime = read('src-tauri/src/personal_skill_runtime.rs')
const installed = Object.values(contract.initialized_channels).flat()
assert.equal(installed.length, 9)
assert.equal(contract.deferred['SYS-SY'].state, 'DEFERRED_SERVER_AND_INITIAL_CHANNEL_NOT_PROVISIONED')
assert.doesNotMatch(runtime, /skill!\("SY-YC-METRIC-CALIBER-001\.json"/)
assert.match(runtime, /"channelNumber": "SYS-SY"/)
})
test('the worker UI presents personal skill brain separately from persona worker and tool executor', () => {
const panel = read('src/modules/knowledge-agent/LocalWorkerPanel.tsx')
assert.match(panel, /本频道私有技能脑/)
assert.match(panel, /模型只给语义候选/)
assert.match(panel, /现实写入仍走频道回执和目标读回/)
})