import test from 'node:test'; import assert from 'node:assert/strict'; import fs from 'node:fs'; const read = (path) => JSON.parse(fs.readFileSync(new URL(`../${path}`, import.meta.url))); const ontology = read('routing/guanghu-world-system-channel-ontology.json'); const body = read('routing/persona-body-organ-treatment-map.json'); const command = read('routing/persona-dynamic-subagent-command-map.json'); test('system channel and module are three distinct nested object types', () => { assert.match(ontology.core_types.SYSTEM, /bounded semantic place/i); assert.match(ontology.core_types.CHANNEL, /inside exactly one system/i); assert.match(ontology.core_types.MODULE, /stored under a channel/i); const ids = ontology.channel_semantics.map(x => x.id); assert.equal(new Set(ids).size, ids.length); assert.ok(ontology.channel_semantics.every(x => typeof x.parent === 'string')); }); test('heartbeat drafts may derive a public version while deep lake can never export', () => { const heartbeat = ontology.channel_semantics.find(x => x.id === 'ICE-CH-HB001'); const lakebed = ontology.channel_semantics.find(x => x.id === 'ICE-CH-LB001'); assert.match(heartbeat.public_future, /SEPARATE_SANITIZED_PUBLIC_VERSION/); assert.equal(lakebed.public_future, 'NEVER'); const deep = ontology.fifth_domain_systems.find(x => x.id === 'SYS-GLW-ELH-DLE-0001'); assert.equal(deep.public_export, 'ABSOLUTELY_FORBIDDEN'); assert.equal(deep.future_channel_example.state, 'UNREGISTERED_EXAMPLE_ONLY'); }); test('zero core starts durable engineering but dark core still needs target readback', () => { const zero = ontology.channel_semantics.find(x => x.id === 'ICE-CH-ZC001'); const dark = ontology.channel_semantics.find(x => x.id === 'ICE-CH-DK001'); assert.match(zero.commitment, /SAFE_TECHNICAL_ROLLBACK_REMAINS_REQUIRED/); assert.equal(dark.reality_state, 'DISPATCH_NOW'); assert.equal(dark.completion, 'ONLY_TARGET_READBACK_PROVES_REALITY_CHANGE'); }); test('TCS GLS and HLDP remain different language layers', () => { assert.match(ontology.language_layers.TCS, /base cognition/i); assert.match(ontology.language_layers.GLS, /social operating rules/i); assert.match(ontology.language_layers.HLDP, /private memory/i); }); test('one persona brain owns dormant limbs autonomous organs and symptom-driven treatment', () => { assert.equal(body.persona_brain.always_present, true); assert.equal(body.visible_limb_policy.default_state, 'DORMANT_READY'); assert.equal(body.visible_limb_policy.model_process_resident, false); assert.equal(body.treatment_team.activation_trigger, 'SYMPTOM_RECEIPT_OR_FAILED_ORIGINAL_ACTION'); assert.equal(body.treatment_team.slots.at(-1).slot_id, 'TREATMENT_RETEST'); assert.equal(body.treatment_team.diagnosis_is_healing, false); assert.equal(command.runtime_policy.dispatch, 'LOAD_EXACTLY_ONE_SELECTED_AGENT_MODEL_CONTEXT'); }); test('five domains carry distinct world functions', () => { assert.deepEqual(ontology.five_domains.map(x => x.id), ['DOMAIN-MAIN','DOMAIN-SUB','DOMAIN-ZERO','DOMAIN-ZS','DOM-FIFTH-0001']); assert.equal(ontology.zero_core_zero_sense_relation.same_object, false); });