export type SpaceIntegrityCode = /** 트윈이 없는 공간을 가리킨다 — 그 트윈은 무대가 사라졌다. */ 'twin-space-missing' /** 레지스트리와 model 의 공간이 다르다 — 어느 쪽이 사실인지 알 수 없다. */ | 'twin-space-mismatch' /** 폴리곤이 이 공간에 없는 구역을 가리킨다. */ | 'polygon-area-missing' /** 폴리곤이 이 공간에 사는 어느 트윈에도 없는 로케이션·설비를 가리킨다. */ | 'polygon-target-missing' /** 로케이션이 이 공간에 없는 구역에 소속되어 있다. */ | 'location-area-missing' /** 대표 표현이 이 공간의 표현이 아니다. */ | 'primary-representation-missing' /** 보드 표현이 보드를 가리키지 않는다(또는 없는 보드를 가리킨다). */ | 'board-representation-unbound' /** 표현이 하나도 없는 공간에 트윈이 산다 — 볼 화면이 없다. */ | 'space-without-representation' /** 어느 공간에도 속하지 않은 트윈 — 뗀 결과일 수 있다(사실이면 정상). */ | 'twin-without-space' /** * 이 트윈이 **담을 줄 모르는 어휘**를 받고 있다 — 리비전은 오르는데 상태가 채워지지 않는다. * * 커널은 모르는 `eventType` 을 버리고(전방 호환) 종류별로 센다(`state.unhandled`). 그 수가 0이 * 아니면 둘 중 하나다: 커넥터가 엉뚱한 트윈에 붙었거나(예: `energy.*` 가 창고 트윈으로), 커널이 * 낡아 새 어휘를 모른다. 둘 다 사람이 손봐야 하는 것이고, 알리지 않고 두면 「정상인데 빈」 트윈이 된다. */ | 'twin-unhandled-vocabulary'; export type SpaceIntegritySeverity = 'broken' | 'warn'; export interface SpaceIntegrityFinding { code: SpaceIntegrityCode; severity: SpaceIntegritySeverity; /** 어디의 문제인가 — 화면이 그 자리로 데려갈 수 있게. */ spaceId?: string; instanceId?: string; representationId?: string; params?: Record; /** 영어 canonical — 로그·폴백. */ message: string; } export interface IntegritySpace { spaceId: string; primaryRepresentationId?: string | null; } export interface IntegrityInstance { instanceId: string; /** 레지스트리 컬럼. */ spaceId?: string | null; /** 저장된 model 의 공간 — 레지스트리와 같아야 한다. */ modelSpaceId?: string | null; purpose?: string | null; /** 이 트윈의 로케이션 id 들. */ locationIds?: readonly string[]; /** 이 트윈의 설비 id 들. */ equipmentIds?: readonly string[]; /** 로케이션의 소속 구역 id 들(중복 가능). */ areaRefs?: readonly (string | undefined | null)[]; /** * 커널이 담을 줄 몰라 버린 사건들 — 실행 중인 트윈의 상태에서 온다(`state.unhandled`). * * 정지한 트윈에서는 알 수 없으므로 `undefined` 다 — **없는 것과 모르는 것을 구별한다**(빈 배열을 * 넣으면 「받은 것이 없다」는 사실 주장이 되고, 그것은 우리가 확인한 바가 아니다). */ unhandled?: readonly { eventType: string; count: number; }[]; } export interface IntegrityRepresentation { id: string; spaceId: string; type: string; /** 보드 표현이면 보드 id. */ boardId?: string | null; /** 폴리곤 바인딩들. */ polygons?: readonly IntegrityPolygon[]; } export interface IntegrityPolygon { id?: string; /** 논리 구역 바인딩(그룹). */ groupId?: string | null; /** 개체 바인딩 — 로케이션 또는 설비. */ targetKind?: 'location' | 'equipment' | null; targetId?: string | null; } export interface SpaceIntegrityInput { spaces: readonly IntegritySpace[]; instances: readonly IntegrityInstance[]; representations: readonly IntegrityRepresentation[]; /** 공간별 구역 id 들. */ areasBySpace: Readonly>; /** 존재하는 보드 id 들 — 보드 표현이 실제 보드를 가리키는지 본다. */ boardIds?: readonly string[]; } /** 세 축을 맞대어 어긋난 자리를 모두 낸다. 비어 있으면 정합하다. */ export declare function checkSpaceIntegrity(input: SpaceIntegrityInput): SpaceIntegrityFinding[]; /** 심각한 것부터 — 화면이 정렬을 다시 정하지 않게 한 곳에서 정한다. */ export declare function sortFindings(findings: readonly SpaceIntegrityFinding[]): SpaceIntegrityFinding[];