feat: embed cross-platform HoloLake terminal link

This commit is contained in:
冰朔 2026-08-17 18:59:37 +08:00
commit ae7f883891
16 changed files with 808 additions and 122 deletions

View file

@ -61,6 +61,9 @@ interface HomeStatus {
updateState: string
releaseRecoveryState: string
mcpRole: string
terminalLinkProtocol: string
terminalLinkTransport: string
environmentFramePolicy: string
}
interface DevelopmentWriteLaneStatus {
state: 'AVAILABLE' | 'ACTIVE'
@ -207,7 +210,17 @@ interface CodeTreeSnapshot { channelId: string; path: string; entries: CodeTreeE
interface CodeFileProjection { channelId: string; path: string; format: string; source: string; humanMarkdown: string; sizeBytes: number }
interface ReceiptEvent { sequence: number; kind: string; observedAtUnixMs: number; eventHash: string }
interface ReceiptProjection { events: ReceiptEvent[] }
interface DiscoveryTicketReceipt { laneId: string; clientInstanceId: string; discoveryTicket: string }
interface DiscoveryTicketReceipt {
laneId: string
clientInstanceId: string
discoveryTicket: string
terminalTransport: string
connectorExecutable: string
connectorArguments: string[]
heartbeatIntervalMs: number
environmentRefreshIntervalMs: number
requiredBootstrapOperations: string[]
}
interface NearbyAiDiscoverySnapshot {
state: string
serviceName: string
@ -331,7 +344,7 @@ interface EnterpriseReceiptEnvelope {
repository_projection?: EnterpriseReceiptProjection
}
const previewStatus: HomeStatus = { directLocalBrokerState: 'UNVERIFIED', directConnectionCount: 0, resumableSessionCount: 0, codeRepositoryMountCount: 0, pnccReceiptCount: 0, updateState: 'READY_HUMAN_CONFIRMATION_REQUIRED', releaseRecoveryState: 'NONE', mcpRole: 'DISCOVERY_RECOVERY_COMPATIBILITY_ONLY' }
const previewStatus: HomeStatus = { directLocalBrokerState: 'UNVERIFIED', directConnectionCount: 0, resumableSessionCount: 0, codeRepositoryMountCount: 0, pnccReceiptCount: 0, updateState: 'READY_HUMAN_CONFIRMATION_REQUIRED', releaseRecoveryState: 'NONE', mcpRole: 'DISCOVERY_RECOVERY_COMPATIBILITY_ONLY', terminalLinkProtocol: 'HOLOLAKE_TERMINAL_LINK/2', terminalLinkTransport: 'UNVERIFIED', environmentFramePolicy: 'REQUIRED_AFTER_CONNECT_RESUME_AND_BEFORE_MUTATION' }
const previewPersonal: PersonalChannelSnapshot = { state: 'UNAVAILABLE', recentEvents: [], modules: [], integrity: { state: 'UNKNOWN', eventCount: 0, receiptCount: 0 } }
const previewKnowledge: KnowledgeSnapshot = { state: 'UNAVAILABLE', nativeRoot: '', legacyAvailable: false, documents: [], rawDocumentCount: 0, uniqueDocumentCount: 0, duplicateDocumentCount: 0, truncated: false }
const previewCode: CodeChannelSnapshot = { state: 'UNAVAILABLE', channels: [], authority: 'LOCAL_SOURCE_ACCESS_ONLY_NO_PUSH_OR_DEPLOY_AUTHORITY' }
@ -1189,8 +1202,18 @@ function HoloLakeApp() {
finally { setSystemBusy(false) }
}
const invitationText = ticket ? JSON.stringify({
schema: 'hololake.direct-local-invitation/v1',
connectorArgument: '--connector',
schema: 'hololake.direct-local-invitation/v2',
terminalTransport: ticket.terminalTransport,
connector: {
executable: ticket.connectorExecutable,
arguments: ticket.connectorArguments,
framing: 'JSON_LINES',
},
continuityOwner: 'HOLOLAKE',
mcpRole: 'DISCOVERY_RECOVERY_COMPATIBILITY_ONLY',
heartbeatIntervalMs: ticket.heartbeatIntervalMs,
environmentRefreshIntervalMs: ticket.environmentRefreshIntervalMs,
requiredBootstrapOperations: ticket.requiredBootstrapOperations,
openSession: {
operation: 'OPEN_SESSION',
input: {
@ -1200,6 +1223,12 @@ function HoloLakeApp() {
discoveryTicket: ticket.discoveryTicket,
},
},
afterOpen: [
'ACQUIRE_DEVELOPMENT_WRITE_LANE',
'GET_WORK_ENVIRONMENT',
],
beforeEveryMutation: 'GET_WORK_ENVIRONMENT',
protocolRestorationByModelRequired: false,
}, null, 2) : ''
const copyInvitation = async () => {
try {
@ -1381,7 +1410,7 @@ function HoloLakeApp() {
<div className="system-grid">
<section className="plain-panel connection-panel">
<header><div><h2></h2><p> AI HoloLakeMCP </p></div><span className={nearbyDiscovery?.automaticSameDeviceDiscovery ? 'status-chip online' : 'status-chip'}>{nearbyDiscovery?.automaticSameDeviceDiscovery ? '本机自动发现已开启' : '自动发现不可用'}</span></header>
<dl className="evidence-list"><div><dt></dt><dd>GLP/1.0 · </dd></div><div><dt> AI 访</dt><dd>{nearbyDiscovery?.genericAiVisitor === 'EXPRESSION_ONLY_READY' ? '可连接 · 仅语言表达' : '不可用'}</dd></div><div><dt></dt><dd>{nearbyDiscovery?.guanghuPersona === 'BINDING_EVIDENCE_REQUIRED' ? '等待人格绑定证据' : '可连接'}</dd></div><div><dt></dt><dd>{status.directConnectionCount}</dd></div><div><dt></dt><dd>{nearbyDiscovery?.localNetworkDiscovery === 'DEFERRED_UNTIL_ENCRYPTED_TRANSPORT_AND_APPROVAL' ? '等待加密传输与确认闭环' : '已开启'}</dd></div><div><dt>MCP</dt><dd> / </dd></div></dl>
<dl className="evidence-list"><div><dt></dt><dd>GLP/1.0 · </dd></div><div><dt> AI </dt><dd>{status.terminalLinkProtocol} · {status.directLocalBrokerState === 'READY' ? '原生通道就绪' : '等待账号登录'}</dd></div><div><dt></dt><dd>{status.terminalLinkTransport.includes('NAMED_PIPE') ? 'Windows 用户私有 Named Pipe' : 'macOS / Linux 用户私有 Unix Socket'}</dd></div><div><dt></dt><dd></dd></div><div><dt> AI 访</dt><dd>{nearbyDiscovery?.genericAiVisitor === 'EXPRESSION_ONLY_READY' ? '可连接 · 仅语言表达' : '不可用'}</dd></div><div><dt></dt><dd>{nearbyDiscovery?.guanghuPersona === 'BINDING_EVIDENCE_REQUIRED' ? '等待人格绑定证据' : '可连接'}</dd></div><div><dt></dt><dd>{status.directConnectionCount}</dd></div><div><dt></dt><dd>{status.resumableSessionCount}</dd></div><div><dt></dt><dd>{nearbyDiscovery?.localNetworkDiscovery === 'DEFERRED_UNTIL_ENCRYPTED_TRANSPORT_AND_APPROVAL' ? '等待加密传输与确认闭环' : '已开启'}</dd></div><div><dt>MCP</dt><dd> / / </dd></div></dl>
<p className="boundary-note">访</p>
{ticket ? <><button className="secondary-button" type="button" onClick={() => void copyInvitation()}><Icon name="copy"/></button><pre className="invitation-data">{invitationText}</pre></> : <button className="secondary-button" type="button" disabled={systemBusy} onClick={() => void issueInvitation()}></button>}
</section>
@ -1399,7 +1428,7 @@ function HoloLakeApp() {
</dl> : <p className="boundary-note">线</p>}
<button className="secondary-button" type="button" disabled={serverPnccBusy} onClick={() => void refreshServerPncc()}>{serverPnccBusy ? '正在读取…' : '重新读取主控状态'}</button>
</section>
<section className="plain-panel"><header><div><h2> GH-PNCC </h2><p></p></div></header><dl className="evidence-list"><div><dt></dt><dd>{status.codeRepositoryMountCount}</dd></div><div><dt></dt><dd>{status.pnccReceiptCount}</dd></div><div><dt></dt><dd>{developmentLane?.state === 'ACTIVE' ? '已切入 HoloLake' : '等待受控载体'}</dd></div><div><dt>线</dt><dd>{developmentLane?.laneId || '—'}</dd></div><div><dt></dt><dd>{developmentLane?.ownerInstanceId || '—'}</dd></div><div><dt></dt><dd>{developmentLane?.state === 'ACTIVE' ? '开发执行环境已由 HoloLake 持有单写通道' : status.codeRepositoryMountCount > 0 && status.pnccReceiptCount > 0 ? '已有可核验运行记录' : '接口已接入,尚无完整运行记录'}</dd></div></dl></section>
<section className="plain-panel"><header><div><h2>HoloLake </h2><p>HoloLake AI </p></div><span className={developmentLane?.state === 'ACTIVE' ? 'status-chip online' : 'status-chip'}>{developmentLane?.state === 'ACTIVE' ? '环境已锚定' : '等待直连写入者'}</span></header><dl className="evidence-list"><div><dt></dt><dd>{status.terminalLinkProtocol}</dd></div><div><dt></dt><dd>HoloLake · </dd></div><div><dt></dt><dd>{status.codeRepositoryMountCount}</dd></div><div><dt></dt><dd>{status.pnccReceiptCount}</dd></div><div><dt></dt><dd>{developmentLane?.state === 'ACTIVE' ? '已切入 HoloLake' : '等待受控载体'}</dd></div><div><dt>线</dt><dd>{developmentLane?.laneId || '—'}</dd></div><div><dt></dt><dd>{developmentLane?.ownerInstanceId || '—'}</dd></div><div><dt></dt><dd>{developmentLane?.state === 'ACTIVE' ? '每次写入前必须持有未过期事实帧' : '未取得单写通道,不允许变更'}</dd></div><div><dt>Agent Shell</dt><dd> · </dd></div></dl></section>
<section className="plain-panel"><header><div><h2>GLS </h2><p></p></div><span className={glsRuntime?.state === 'ACTIVE_EXPLICIT_PROJECTIONS_ONLY' && glsRuntime.authorityConflictCount === 0 && glsRuntime.discoveredUnreconciledCount === 0 ? 'status-chip online' : 'status-chip'}>{glsRuntime ? '运行清单 v2 已加载' : '失败关闭'}</span></header>{glsRuntime ? <dl className="evidence-list"><div><dt></dt><dd>{glsRuntime.sourceRepository} · {glsRuntime.sourceCommit.slice(0, 12)}</dd></div><div><dt></dt><dd>{glsRuntime.protocolCount}</dd></div><div><dt></dt><dd>{glsRuntime.protocolRegistryIdCount}</dd></div><div><dt></dt><dd>{glsRuntime.registeredDraftCount} · {glsRuntime.registeredDraftNotStartedCount} </dd></div><div><dt></dt><dd>{glsRuntime.executableProjectionCount} · P0P6 {glsRuntime.implementationStageCount} </dd></div><div><dt></dt><dd>{glsRuntime.inventoriedNotExecutableCount}</dd></div><div><dt></dt><dd>{glsRuntime.typedSourceDependencyCount} · {glsRuntime.unclassifiedSourceDependencyCount}</dd></div><div><dt></dt><dd>{glsRuntime.legacyDependencyCycleCount} · </dd></div><div><dt></dt><dd>{glsRuntime.dependencyGapCount}</dd></div><div><dt> / </dt><dd>{glsRuntime.authorityConflictCount} / {glsRuntime.discoveredUnreconciledCount}</dd></div><div><dt></dt><dd>{glsRuntime.rawProtocolTextExecuted ? '允许' : '禁止'}</dd></div><div><dt></dt><dd>{glsRuntime.arbitraryProtocolCodeAllowed ? '允许' : '禁止'}</dd></div></dl> : <p className="boundary-note">GLS </p>}</section>
<section className="plain-panel"><header><div><h2>HoloLake </h2><p></p></div><span className={glsKernel?.state === 'P1_TO_P6_NATIVE_P7_FAIL_CLOSED' ? 'status-chip online' : 'status-chip'}>{glsKernel ? '随软件运行' : '失败关闭'}</span></header>{glsKernel ? <dl className="evidence-list"><div><dt>P1P6 </dt><dd>{glsKernel.executableProtocolCount} · {glsKernel.implementedStageCount} </dd></div><div><dt></dt><dd>{glsKernel.decisionReceiptCount}</dd></div><div><dt> / </dt><dd>{glsKernel.allowCount} / {glsKernel.denyCount}</dd></div><div><dt> / </dt><dd>{glsKernel.ambiguousCount} / {glsKernel.unverifiedCount}</dd></div><div><dt>GLC </dt><dd>{glsKernel.bootstrapCompilerSelfCheck === 'PASS_DETERMINISTIC_DOUBLE_COMPILE' ? '双编译一致' : '失败关闭'}</dd></div><div><dt>P7 </dt><dd>{glsKernel.p7VerifiedPhysicalCapabilityCount} · {glsKernel.p7NodeAssemblies.length} </dd></div><div><dt></dt><dd>{glsKernel.modelCanOverrideDecision ? '允许' : '禁止'}</dd></div><div><dt></dt><dd>{glsKernel.lastReceiptSha256 === 'GENESIS' ? '尚无裁决' : glsKernel.lastReceiptSha256.slice(0, 16)}</dd></div></dl> : <p className="boundary-note"></p>}</section>
<section className="plain-panel"><header><div><h2></h2><p></p></div><span className={numberingKernel?.state === 'ACTIVE_PINNED_AUTHORITY_MAP' ? 'status-chip online' : 'status-chip'}>{numberingKernel ? '本机内核已加载' : '失败关闭'}</span></header>{numberingKernel ? <dl className="evidence-list"><div><dt></dt><dd>{numberingKernel.authorityMapId}</dd></div><div><dt></dt><dd>{numberingKernel.authorityMapVersion}</dd></div><div><dt></dt><dd>{numberingKernel.sourceCommit.slice(0, 12)}</dd></div><div><dt></dt><dd>{numberingKernel.humanRouteNamespaces.join(' · ')}</dd></div><div><dt></dt><dd>{numberingKernel.automaticIdentityIssuance ? '已开启' : '禁止'}</dd></div><div><dt></dt><dd>{numberingKernel.unknownNumber === 'FAIL_CLOSED' ? '失败关闭 · 不猜测' : numberingKernel.unknownNumber}</dd></div></dl> : <p className="boundary-note"></p>}</section>