feat: preserve native channel and task continuity

This commit is contained in:
冰朔 2026-08-21 11:00:10 +08:00
commit 30865321a8
31 changed files with 2138 additions and 171 deletions

View file

@ -11,9 +11,9 @@ test('the external local broker accepts only complete numbered coordinates', ()
assert.equal(registry.runtime.legacy_string_operation_allowed, false)
assert.equal(registry.runtime.unknown_or_mismatched_coordinate, 'FAIL_CLOSED')
assert.equal(registry.runtime.transport_is_authority, false)
assert.equal(registry.operations.length, 25)
assert.equal(new Set(registry.operations.map((route) => route.operation_number)).size, 25)
assert.equal(new Set(registry.operations.map((route) => route.alias)).size, 25)
assert.equal(registry.operations.length, 27)
assert.equal(new Set(registry.operations.map((route) => route.operation_number)).size, 27)
assert.equal(new Set(registry.operations.map((route) => route.alias)).size, 27)
for (const route of registry.operations) {
assert.match(route.operation_number, /^HLP-NBROKER-OP-\d{4}$/)
assert.match(route.channel_number, /^HLP-NBROKER-CH-\d{4}$/)

View file

@ -8,9 +8,13 @@ test('external programming AI gateway is human-gated and fails closed', () => {
const contract = JSON.parse(read('contracts/external-ai-gateway.json'))
assert.equal(contract.default_exposure, 'CLOSED')
assert.equal(contract.human_authorization_required, true)
assert.equal(contract.mcp.role, 'DISCOVERY_AND_CAPABILITY_CATALOG')
assert.equal(contract.direct_protocol.protocol, 'HOLOLAKE_TERMINAL_LINK/3')
assert.equal(contract.direct_protocol.continuity_owner, 'HOLOLAKE')
assert.equal(contract.mcp.role, 'EXTERNAL_CONNECTION_ENTRY_AND_NATIVE_PROTOCOL_HANDOFF')
assert.equal(contract.native_runtime.protocol, 'GUANGHU_LANGUAGE_PROTOCOL/1')
assert.equal(contract.native_runtime.wire_transport_protocol, 'HOLOLAKE_TERMINAL_LINK/3')
assert.equal(contract.native_runtime.continuity_owner, 'HOLOLAKE')
assert.equal(contract.native_runtime.switch_after_mcp_connection, true)
assert.equal(contract.boundaries.mcp_is_continuity_owner, false)
assert.equal(contract.boundaries.fixed_handoff, 'MCP_EXTERNAL_ENTRY_TO_GUANGHU_NATIVE_PROTOCOL_RUNTIME')
assert.equal(contract.boundaries.supervised_shell_execution, false)
assert.equal(contract.boundaries.transport_is_authority, false)
})

View file

@ -45,6 +45,7 @@ test('knowledge-embedded Agent keeps one channel body with human-managed convers
test('Agent receives a real HoloLake environment frame and autonomously calls numbered knowledge tools', () => {
const contract = JSON.parse(read('contracts/persona-agent-runtime.json'))
const runtime = read('src-tauri/src/persona_agent_runtime.rs')
const hostRuntime = read('src-tauri/src/channel_host_runtime.rs')
assert.equal(contract.knowledge.embedding, 'NATIVE_KNOWLEDGE_WORKSPACE')
assert.equal(contract.agent_loop.model_decides_tool_use, true)
@ -122,6 +123,7 @@ test('Token Plan qwen3.8-max is a first-class provider and long work emits real
test('channel core, local skills and typed tools run before optional models', () => {
const contract = JSON.parse(read('contracts/persona-agent-runtime.json'))
const runtime = read('src-tauri/src/persona_agent_runtime.rs')
const hostRuntime = read('src-tauri/src/channel_host_runtime.rs')
const binding = read('src-tauri/src/persona_binding.rs')
assert.equal(contract.channel.channel_entry_creates_persona_orientation, false)
@ -137,9 +139,9 @@ test('channel core, local skills and typed tools run before optional models', ()
'ACCOUNT_CHANNEL_SCOPED_PERSONAL_SKILL_BRAIN_ZERO_MODEL',
'LOCAL_TYPED_TOOL_EXECUTION_ZERO_MODEL',
])
assert.match(runtime, /fast_channel_system_reply/)
assert.match(runtime, /频道系统本体是该频道持续存在的认知调度与交流主体/)
assert.match(runtime, /不得把字段清单当作频道本体的说话方式/)
assert.doesNotMatch(runtime, /fast_channel_system_reply/)
assert.match(hostRuntime, /承载当前频道系统本体的这一轮语言/)
assert.match(hostRuntime, /不要扮演任何单一人格/)
assert.match(runtime, /deterministic_tool_route/)
assert.match(runtime, /模型调用0/)
assert.match(runtime, /FLAGSHIP_CHANNEL_SYSTEM_COGNITION/)

View file

@ -0,0 +1,22 @@
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('Bingshuo natural-language anchor is a mandatory development and acceptance gate', () => {
const agents = read('AGENTS.md')
const anchor = read('docs/product-intent/BINGSHUO-HOLOLAKE-NATURAL-LANGUAGE-DEVELOPMENT-ANCHOR.md')
const terminal = JSON.parse(read('contracts/programming-ai-terminal-link.json'))
const gateway = JSON.parse(read('contracts/external-ai-gateway.json'))
assert.match(agents, /必须完整读取/)
assert.match(agents, /测试通过只证明实现没有触发已知工程回归,不能替代逐条自然语言验收/)
assert.match(anchor, /MCP 外部连接入口 → HoloLake 握手与门禁 → 切换为光湖原生协议运行时/)
assert.match(anchor, /MCP 断开时只允许暂停运输/)
assert.match(anchor, /不能退回通用 AI 层/)
assert.match(anchor, /结果未知的现实动作先读回再继续/)
assert.equal(gateway.native_runtime.continuity_owner, 'HOLOLAKE')
assert.equal(terminal.continuity.mcp_disconnect_never_falls_back_to_generic_runtime, true)
assert.equal(terminal.native_runtime_checkpoint.transport_disconnect_effect, 'PAUSE_TRANSPORT_KEEP_NATIVE_ENVIRONMENT')
})

View file

@ -27,7 +27,10 @@ test('HoloLake owns continuity and supplies a bounded work-environment fact fram
assert.equal(contract.environment_frame.protocol_restoration_by_model_required, false)
assert.equal(contract.environment_frame.required_before_mutation, true)
assert.match(broker, /VERIFIED_HOLOLAKE_WORK_ENVIRONMENT/)
assert.match(broker, /GLS_RUNTIME_MANIFEST_V2_AND_NATIVE_KERNEL/)
assert.match(broker, /GUANGHU_LANGUAGE_PROTOCOL\/1/)
assert.match(broker, /native_runtime_checkpoint/)
assert.equal(contract.continuity.native_runtime_checkpoint_persists_task_and_tool_state, true)
assert.equal(contract.continuity.mcp_disconnect_never_falls_back_to_generic_runtime, true)
assert.match(broker, /refresh_before_mutation_required/)
assert.match(broker, /protocol_restoration_by_model_required: false/)
})
@ -43,6 +46,8 @@ test('heartbeats refresh the session and environment without granting a shell',
test('transport recovery never blindly replays an uncertain mutation', () => {
assert.equal(contract.continuity.uncertain_mutation_is_never_blindly_replayed, true)
assert.equal(contract.native_runtime_checkpoint.uncertain_reality_mutation, 'REQUIRE_REALITY_READBACK_BEFORE_CONTINUE')
assert.match(session, /REQUIRE_REALITY_READBACK_BEFORE_CONTINUE/)
assert.match(broker, /HOLOLAKE_TERMINAL_LINK_RESPONSE_UNCERTAIN/)
assert.match(broker, /safeToRetryAfterStatusRead/)
})

View file

@ -25,8 +25,10 @@ test('stage one embeds one knowledge persona channel without transferring person
assert.equal(foundation.stage_one_model_api_configuration, true)
})
test('HoloLake owns continuity and MCP remains an optional adapter', () => {
test('MCP is the external entry and HoloLake native runtime owns continuity after handoff', () => {
assert.equal(contract.mcp_is_continuity_root, false)
assert.equal(bridge.external_ai_entry.mcp_is_external_connection_entry, true)
assert.equal(bridge.external_ai_entry.guanghu_native_protocol_required_after_handshake, true)
assert.equal(bridge.primary_transport.owner, 'HOLOLAKE_NATIVE_LOCAL_BROKER')
assert.equal(bridge.primary_transport.network_required_for_local_work, false)
assert.equal(bridge.continuity.active_writer_auto_released_on_disconnect, false)

View file

@ -8,13 +8,13 @@ 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, 312)
assert.equal(generated.routeCount, 209)
assert.equal(generated.coordinateCount, 322)
assert.equal(generated.routeCount, 219)
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, 209)
assert.equal(new Set([...generated.identityNodes, ...generated.protocolNodes, ...generated.routes].map((node) => node.path)).size, 312)
assert.equal(new Set(generated.routes.map((route) => route.path)).size, 219)
assert.equal(new Set([...generated.identityNodes, ...generated.protocolNodes, ...generated.routes].map((node) => node.path)).size, 322)
assert.equal(generated.invariants.everyPhysicalCallHasNumberedRoute, true)
assert.equal(generated.invariants.everyAcceptedCallHasEvidenceClass, true)
assert.equal(generated.invariants.everyProtocolReferenceHasNumberCoordinate, true)