feat: publish HoloLake model-native living system source

This commit is contained in:
冰朔 2026-08-03 10:04:41 +08:00
commit c395dd3a99
2467 changed files with 615073 additions and 0 deletions

View file

@ -0,0 +1,52 @@
export interface GuanghuShanghaiNodeStatus {
nodeId: 'BS-SH-005'
reachability: 'online' | 'unreachable'
region: 'shanghai'
runtime: 'guanghu_os_native' | 'hosted_maintenance' | 'unknown'
ttl: number | null
}
export interface GuanghuShanghaiNodeState {
checkedAt: number | null
error: string | null
phase: 'checking' | 'online' | 'error'
status: GuanghuShanghaiNodeStatus | null
}
export const INITIAL_GUANGHU_SHANGHAI_NODE_STATE: GuanghuShanghaiNodeState = {
checkedAt: null,
error: null,
phase: 'checking',
status: null,
}
function record(value: unknown): Record<string, unknown> | null {
return typeof value === 'object' && value !== null && !Array.isArray(value)
? value as Record<string, unknown>
: null
}
export function parseGuanghuShanghaiNodeStatus(
value: unknown,
): GuanghuShanghaiNodeStatus {
const status = record(value)
const runtime = status?.runtime
const reachability = status?.reachability
if (
status?.node_id !== 'BS-SH-005'
|| status.region !== 'shanghai'
|| (reachability !== 'online' && reachability !== 'unreachable')
|| !['guanghu_os_native', 'hosted_maintenance', 'unknown'].includes(
typeof runtime === 'string' ? runtime : '',
)
) {
throw new Error('guanghu_shanghai_node_receipt_invalid')
}
return {
nodeId: 'BS-SH-005',
reachability,
region: 'shanghai',
runtime: runtime as GuanghuShanghaiNodeStatus['runtime'],
ttl: typeof status.ttl === 'number' ? status.ttl : null,
}
}