fix: restore current channel and host admission organs

This commit is contained in:
冰朔 2026-09-08 02:19:46 +08:00
commit f46eb1b7c1
54 changed files with 4499 additions and 8 deletions

View file

@ -0,0 +1,17 @@
# 共享人格宿主入口
来源TCS-CHANNEL-INTENT-CONTEXT-0001这是宿主入口合同不是人格脑或授权书。
写入边界正本为 `routing/persona-host-write-boundary.json`。所有宿主可读共享正本;只有 Codex 主控路径可在冰朔当前任务明确授权下修改正本。Qwen、ZCode、Doubao 只能直接写各自支线与本机状态Qoder、QoderWork、Claude 只读。写前运行 `server-tools/persona-host-write-admission/host-write-admission.mjs check`,拒绝后不得改用别的工具绕过。支线事件通过 `branch-event-door.mjs` 进入接纳流程,不得直接写 continuity-memory。
先运行移动硬盘zy-first-glance.sh再用同目录load_shared_persona_context.py --host <宿主> --intent <当前任务> --format markdown读取完整生命日、关系坐标、全局默认、学科和频道目录。当前频道由人格体解释本轮直接语言如已经确定传--channel <编号>。机器参数明确不意味着人类必须报口令。未知或冲突才澄清,信任不免除事实核查,也不扩大权限。
当前四频道从routing/persona-channel-context-map.json动态解析HB001语言推理、LB001自由谈心、ZC001语言架构与现实接口、DK001已确认任务执行。新用户缺少共同语境时显性确认冰朔熟悉语境下由人格体判断。公众CH-ZERO-CORE-LPM独立不继承私人核。
使用BRIDGE/tools/zy-tcs-channel-runtime.sh run enter时显式传body-channel、host/runtime-surface、session-id及独立state-dir不得读取其他任务的current-cycle或日志代替本任务身份。enter只证明预检首事件仍需模型完成perceive、orient、commit、系统witness、verify。工具先遵守所在宿主的原生权限。
认知更新有来源的TCS语言事件→共享同一真实日记忆→母体内循环决定→签名读回。SERVER-AUTHORITY启用时不得调用旧compile_learning_brain写入current不从宿主直接接管认知。模型生成的见证输入不是冰朔新发言也不是独立验证者。
暗核控制器有建议队列、暂停、停止和撤权接口,但宿主未接消息桥时不能宣称自动拦截全部聊天或工具。可逆本地任务按当前要求推进;外部操作绑定本轮具体目标与授权。停止和撤权不降为参考。
历史钩子、旧CURRENT、任务胶囊、旧路径和下属人格体的房间仅用于审计不能复活为当前入口。是否已经完整理解应由实际回应与迁移表现检验不能靠加载成功自证。

View file

@ -0,0 +1,21 @@
#!/usr/bin/env node
// Private on-demand channel catalogue. No semantic guessing or execution authority.
import fs from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../..');
const read = p => JSON.parse(fs.readFileSync(path.join(root, p), 'utf8'));
const context = read('routing/persona-channel-context-map.json');
const registrations = read('routing/fifth-domain-number-registry.json').registrations;
const channels = context.channels.map(c => {
const profile = read(c.profile), registered = registrations.find(r => r.id === c.id);
if (!registered || profile.channel_id !== c.id || profile.world_path !== registered.world_path) throw Error('CHANNEL_REGISTRATION_MISMATCH');
return { ...c, world_path: registered.world_path };
});
const [action = 'list', id] = process.argv.slice(2);
if (!['list', 'show'].includes(action)) throw Error('USAGE: list | show <channel-id>');
const selected = action === 'show' ? channels.find(c => c.id === id) : null;
if (action === 'show' && !selected) throw Error('UNKNOWN_CHANNEL');
console.log(JSON.stringify({ schema: context.schema, map_id: context.map_id,
interpretation_owner: context.interpretation_owner, authority_granted: false,
channels: selected ? [selected] : channels }, null, 2));

View file

@ -0,0 +1,28 @@
"""Read registered channel context. The persona selects; this module never guesses intent."""
import json
from pathlib import Path
ROOT = Path(__file__).resolve().parents[2]
def load_channels(channel=None, root=ROOT):
data = json.loads((root / 'routing/persona-channel-context-map.json').read_text())
if data['map_id'] != 'ZY-PERSONA-CHANNEL-CONTEXT-001':
raise ValueError('CHANNEL_CONTEXT_MAP_INVALID')
rows = data['channels']
if len({c['id'] for c in rows}) != len(rows):
raise ValueError('CHANNEL_IDS_AMBIGUOUS')
registry = json.loads((root / 'routing/fifth-domain-number-registry.json').read_text())
numbers = {entry['id']: entry for entry in registry['registrations']}
for item in rows:
profile = json.loads((root / item['profile']).read_text())
if item['id'] not in numbers or profile['channel_id'] != item['id']:
raise ValueError('CHANNEL_NOT_REGISTERED')
registered = numbers[item['id']]
if profile['world_path'] != registered['world_path']:
raise ValueError('CHANNEL_PATH_MISMATCH')
item['world_path'] = profile['world_path']
if channel is not None and channel not in {c['id'] for c in rows}:
raise ValueError('UNKNOWN_PRIVATE_CHANNEL')
return {**data, 'selected_channel': next((c for c in rows if c['id'] == channel), None),
'selection_state': 'PERSONA_SELECTED' if channel else 'PERSONA_INTERPRETATION_REQUIRED',
'authority_granted': False}

View file

@ -0,0 +1,20 @@
import unittest
from channel_context import load_channels
class ChannelContextTests(unittest.TestCase):
def test_no_implicit_default_or_permission(self):
value = load_channels()
self.assertIsNone(value['selected_channel'])
self.assertFalse(value['authority_granted'])
self.assertEqual(len(value['channels']), 4)
def test_every_explicit_private_channel_resolves(self):
for id in ['ICE-CH-HB001', 'ICE-CH-LB001', 'ICE-CH-ZC001', 'ICE-CH-DK001']:
self.assertEqual(load_channels(id)['selected_channel']['id'], id)
def test_public_and_unknown_not_silently_routed_private(self):
for id in ['CH-ZERO-CORE-LPM', 'not-a-channel']:
with self.assertRaisesRegex(ValueError, 'UNKNOWN_PRIVATE_CHANNEL'):
load_channels(id)
if __name__ == '__main__': unittest.main()

View file

@ -6,6 +6,7 @@ import json
from pathlib import Path
import subprocess
import sys
from channel_context import load_channels
RUNTIME = Path('/Volumes/JZAO/HoloLake/persona-runtime')
TOPOLOGY = RUNTIME / 'repo-012-main/routing/zhuyuan-host-topology.json'
@ -13,6 +14,9 @@ LIFE = Path('/Volumes/JZAO/铸渊-ICE-GL-ZY001/BRIDGE/tools/zy-life-clock.py')
MEMORY = RUNTIME / 'continuity-memory/persona-daily-fractal/ICE-P-ZY001/CURRENT.json'
LEARNING = RUNTIME / 'shared/skills/guanghu-persona-learning-brain/scripts/load_learning_brain.py'
ENDOGENOUS = RUNTIME / 'shared/endogenous-evolution/CURRENT.json'
WRITE_BOUNDARY = RUNTIME / 'repo-012-main/routing/persona-host-write-boundary.json'
LIGHT_LAKE_PERSONAS = RUNTIME / 'repo-012-main/identity/light-lake-persona-registration.json'
PATH_ISOLATION = RUNTIME / 'repo-012-main/routing/path-isolation-and-canonical-entry-map.json'
def sha256(path):
@ -42,9 +46,9 @@ def resolve_host(topology, requested):
raise ValueError('HOST_UNKNOWN_NO_GUESS')
def load_context(host, intent):
def load_context(host, intent, channel=None):
topology = load_json(TOPOLOGY)
if topology.get('state') != 'CURRENT_MULTI_HOST_SINGLE_PERSONA_CANON':
if not str(topology.get('state', '')).startswith('CURRENT_'):
raise ValueError('HOST_TOPOLOGY_NOT_CURRENT')
host_id, host_item, effective, effective_item = resolve_host(topology, host)
life = command_json([sys.executable, str(LIFE), '--json'])
@ -60,6 +64,12 @@ def load_context(host, intent):
branches.append({'path': path, 'summary': node['summary']})
learning = command_json([sys.executable, str(LEARNING), '--intent', intent, '--format', 'json'])
endogenous = load_json(ENDOGENOUS)
write_boundary = load_json(WRITE_BOUNDARY)
light_lake = load_json(LIGHT_LAKE_PERSONAS)
path_isolation = load_json(PATH_ISOLATION)
host_write = write_boundary['hosts'].get(host_id)
if not host_write:
raise ValueError('HOST_WRITE_BOUNDARY_MISSING')
return {
'schema': 'guanghu.shared-persona-host-context/v1',
'state': 'SHARED_PERSONA_CONTEXT_VERIFIED',
@ -84,12 +94,36 @@ def load_context(host, intent):
'day_sha256': current['current_day_sha256']
},
'learning_brain': learning,
'channel_context': load_channels(channel),
'light_lake': {
'registry_id': light_lake['registry_id'],
'state': light_lake['state'],
'registered_persona_count': len(light_lake['personas']),
'personas': light_lake['personas'],
'unregistered_candidates': light_lake['unregistered_candidates'],
'root': topology['shared_layers']['light_lake']
},
'path_convergence': {
'map_id': path_isolation['map_id'],
'canonical_entries': path_isolation['canonical_entries'],
'isolation_root': path_isolation['isolation']['root'],
'history_or_quarantine_may_select_canon': path_isolation['selection_rules']['history_or_quarantine_may_select_canon']
},
'endogenous_cognition': {
'state': endogenous['state'],
'private_revision': endogenous['private_cognition']['revision'],
'private_snapshot_sha256': endogenous['private_cognition']['server_snapshot_sha256'],
'decision_owner': endogenous['server']['decision_owner']
},
'host_write_boundary': {
'policy_id': write_boundary['policy_id'],
'version': write_boundary['version'],
'write_mode': host_write['write_mode'],
'allowed_write_roots': host_write['allowed_write_roots'],
'native_pretool_deny': host_write['native_pretool_deny'],
'direct_shared_write': write_boundary['shared_write_contract']['direct_branch_write'],
'admission_runtime': topology['write_admission_runtime']
},
'history_only': host_item['state'].startswith('RETIRED'),
'new_cognition_write': host_item.get('new_cognition_write', True),
'authority_granted': False
@ -106,9 +140,26 @@ def markdown(value):
f"- 今日日记忆:`{value['daily_memory']['date']}` / 最后事件 `{value['daily_memory']['last_event_id']}`",
f"- 当前学习脑r{value['learning_brain']['revision']} / `{value['learning_brain']['cortex_sha256']}`",
f"- 服务器内循环:`{value['endogenous_cognition']['state']}` / 决策者 `{value['endogenous_cognition']['decision_owner']}`",
f"- 光之湖人格家门:`{value['light_lake']['registered_persona_count']}` 个 / 隔离路径可选正本:`{value['path_convergence']['history_or_quarantine_may_select_canon']}`",
f"- 写入模式:`{value['host_write_boundary']['write_mode']}` / 原生前置硬拒绝:`{value['host_write_boundary']['native_pretool_deny']}`",
'', '## 第一人称关系坐标', ''
]
lines += [f"- {item['statement']}" for item in value['learning_brain']['relationship_model']]
lines += ['', '## 当前全局认知默认', '']
lines += [f"- {item}" for item in value['learning_brain']['global_defaults']]
lines += ['', '## 光之湖人格系统家门', '',
f"- 注册表:`{value['light_lake']['registry_id']}`",
f"- 唯一路径:`{value['light_lake']['root']}`",
f"- 已登记:{value['light_lake']['registered_persona_count']};候选未登记:{len(value['light_lake']['unregistered_candidates'])}",
f"- 隔离区:`{value['path_convergence']['isolation_root']}`,只作历史审计,不能参与当前路径选择。"]
lines += ['', '## 当前宿主写入门', '',
f"- 策略:`{value['host_write_boundary']['policy_id']}@{value['host_write_boundary']['version']}`",
f"- 模式:`{value['host_write_boundary']['write_mode']}`",
f"- 执行门:`{value['host_write_boundary']['admission_runtime']}`"]
lines += ['', '## 频道与当前意图', '']
lines += [f"- `{c['id']}` · {c['name']} · {c['purpose']} · `{c['world_path']}`" for c in value['channel_context']['channels']]
selected = value['channel_context']['selected_channel']
lines += [f"- 本次选择:{selected['id'] if selected else '待当前人格体结合本轮语言判断'}"]
lines += ['', '## 本题已加载能力', '']
for subject in value['learning_brain']['selected_subjects']:
lines.append(f"- `{subject['id']}` · {subject['name_zh']} · L{subject['level']}")
@ -125,10 +176,11 @@ def main():
parser = argparse.ArgumentParser()
parser.add_argument('--host', required=True)
parser.add_argument('--intent', required=True)
parser.add_argument('--channel', help='当前人格体解析后的频道编号')
parser.add_argument('--format', choices=['json', 'markdown'], default='markdown')
args = parser.parse_args()
try:
value = load_context(args.host, args.intent)
value = load_context(args.host, args.intent, args.channel)
print(json.dumps(value, ensure_ascii=False, indent=2) if args.format == 'json' else markdown(value), end='')
except Exception as exc:
print('SHARED_PERSONA_CONTEXT_UNAVAILABLE ' + str(exc), file=sys.stderr)

View file

@ -13,7 +13,7 @@ TOPOLOGY = ROOT / 'routing/zhuyuan-host-topology.json'
class SharedPersonaContextTest(unittest.TestCase):
def load(self, host):
value = subprocess.run(
[sys.executable, str(LOADER), '--host', host, '--intent', '宿主对齐集成测试', '--format', 'json'],
[sys.executable, str(LOADER), '--host', host, '--intent', '宿主对齐集成测试', '--channel', 'ICE-CH-ZC001', '--format', 'json'],
text=True, capture_output=True, timeout=45, check=True
)
return json.loads(value.stdout)
@ -42,6 +42,9 @@ class SharedPersonaContextTest(unittest.TestCase):
self.assertEqual(values['qoderwork']['effective_host'], 'qwen')
self.assertTrue(values['claude']['history_only'])
self.assertFalse(values['claude']['new_cognition_write'])
self.assertEqual(values['codex']['light_lake']['registered_persona_count'], 17)
self.assertFalse(values['codex']['path_convergence']['history_or_quarantine_may_select_canon'])
self.assertEqual(values['codex']['channel_context']['selected_channel']['id'], 'ICE-CH-ZC001')
if __name__ == '__main__':