import { type CAELTrace } from './CAELTrace'; import { type HashMode } from './sha256'; export type TwinPropertyValue = string | number | boolean | null | TwinPropertyValue[] | { [key: string]: TwinPropertyValue; }; export interface TwinDtdlContent { '@type': string | readonly string[]; name: string; schema?: unknown; target?: string; writable?: boolean; properties?: readonly TwinDtdlContent[]; } export interface TwinDtdlInterface { '@context': string; '@type': 'Interface'; '@id': string; displayName?: string; description?: string; contents?: readonly TwinDtdlContent[]; } export interface TwinDtdlBridgeSource { compiler: 'DTDLCompiler'; sourceComposition: string; sourceCompositionHash?: string; dtdlVersion: 'v3'; bridgeVersion?: string; } export interface TwinNodeInput { id: string; modelId: string; displayName?: string; properties?: Record; } export interface TwinNode { id: string; modelId: string; displayName?: string; properties: Record; telemetry: Record; createdAt: string; updatedAt: string; } export interface TwinRelationshipInput { id: string; name: string; sourceId: string; targetId: string; properties?: Record; } export interface TwinRelationship { id: string; name: string; sourceId: string; targetId: string; properties: Record; createdAt: string; updatedAt: string; } export interface TwinTelemetrySample { name: string; value: TwinPropertyValue; timestamp: string; unit?: string; } export interface TwinTelemetryBatch { twinId: string; source: string; protocol: 'mqtt-simulator' | 'opcua-simulator' | 'manual'; receivedAt?: string; samples: TwinTelemetrySample[]; } export interface TwinPropertyPredicate { name: string; operator: 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte'; value: TwinPropertyValue; } export interface TwinRelationshipPredicate { twinId?: string; direction?: 'out' | 'in' | 'either'; name?: string; sourceId?: string; targetId?: string; } export interface TwinGraphQuery { select: 'twins' | 'relationships' | 'properties' | 'telemetry'; where?: { twinId?: string; modelId?: string; relationship?: TwinRelationshipPredicate; property?: TwinPropertyPredicate; telemetryName?: string; }; limit?: number; } export interface TwinPropertyRecord { twinId: string; name: string; value: TwinPropertyValue; } export interface TwinTelemetryRecord { twinId: string; source: string; protocol: TwinTelemetryBatch['protocol']; sample: TwinTelemetrySample; } export interface TwinGraphQueryResult { twins: TwinNode[]; relationships: TwinRelationship[]; properties: TwinPropertyRecord[]; telemetry: TwinTelemetryRecord[]; queryReceipt: TwinHistoryReceipt; } export interface TwinGraphSnapshot { models: TwinDtdlInterface[]; twins: TwinNode[]; relationships: TwinRelationship[]; } export type TwinGraphOperationAction = 'register-models' | 'upsert-twin' | 'relationship-upsert' | 'property-update' | 'telemetry-ingress' | 'query'; export type TwinGraphOperation = { action: 'register-models'; dtdlInterfaces: TwinDtdlInterface[]; source: TwinDtdlBridgeSource; } | { action: 'upsert-twin'; twin: TwinNodeInput; at: string; } | { action: 'relationship-upsert'; relationship: TwinRelationshipInput; at: string; } | { action: 'property-update'; twinId: string; name: string; value: TwinPropertyValue; source: string; at: string; } | { action: 'telemetry-ingress'; batch: TwinTelemetryBatch; at: string; } | { action: 'query'; query: TwinGraphQuery; resultSummary: { twins: number; relationships: number; properties: number; telemetry: number; }; at: string; }; export interface TwinReceiptTriad { semanticReceiptId: string; provenanceReceiptId: string; replayReceiptId: string; } export interface TwinCustodyReceipt { holokey: string; docsUmbrella: 'HoloGate'; docsUmbrellaRole: 'umbrella term in docs, not an executable tool'; umbrellaRoute: string; concreteTools: readonly string[]; } export interface TwinHistoryReceipt { receiptId: string; operation: TwinGraphOperationAction; traceIndex: number; traceHash: string; prevHash: string; graphHash: string; dtdlInterfaceIds: string[]; triad: TwinReceiptTriad; custody: TwinCustodyReceipt; } export interface TwinReplayVerification { success: boolean; hashChainValid: boolean; replayValid: boolean; totalEvents: number; graphHash: string; replayGraphHash?: string; brokenAt?: number; reason?: string; replayReceiptId: string; } export interface TwinGraphServiceOptions { runId?: string; hashMode?: HashMode; holokey?: string; umbrellaRoute?: string; clock?: () => number; } export interface IndustrialLineTwinDemoResult { service: TwinGraphService; receipts: TwinHistoryReceipt[]; queryResult: TwinGraphQueryResult; verification: TwinReplayVerification; } export declare class TwinGraphService { private readonly runId; private readonly hashMode; private readonly holokey; private readonly umbrellaRoute; private readonly clock; private readonly state; private readonly trace; private lastHash; constructor(options?: TwinGraphServiceOptions); registerDtdlInterfaces(dtdlInterfaces: readonly TwinDtdlInterface[], source: TwinDtdlBridgeSource): TwinHistoryReceipt; upsertTwin(input: TwinNodeInput): TwinHistoryReceipt; upsertRelationship(input: TwinRelationshipInput): TwinHistoryReceipt; updateProperty(twinId: string, name: string, value: TwinPropertyValue, options: { source: string; at?: string; }): TwinHistoryReceipt; ingestTelemetry(batch: TwinTelemetryBatch): TwinHistoryReceipt; query(query: TwinGraphQuery): TwinGraphQueryResult; getSnapshot(): TwinGraphSnapshot; getGraphHash(): string; getTrace(): CAELTrace; toReplayJSONL(): string; verifyReplay(): TwinReplayVerification; private requireTwin; private selectTwins; private selectRelationships; private selectProperties; private selectTelemetry; private recordOperation; private appendTrace; private receiptForEntry; private replayReceiptId; private custody; private dtdlInterfaceIds; private graphHash; private isoNow; } export declare function runIndustrialLineTwinGraphDemo(options: { dtdlInterfaces: readonly TwinDtdlInterface[]; clock?: () => number; holokey?: string; }): IndustrialLineTwinDemoResult; //# sourceMappingURL=TwinGraphService.d.ts.map