Elffuss BraidHub

kikocis/osiris public

master · 5.7 KiBRawPermalink
1/**
2 * ╔══════════════════════════════════════════════════════════════════╗
3 * ║ POLYBOLOS SDK — Core Type System ║
4 * ║ Standardized Entity Model for Multi-Domain Intelligence ║
5 * ║ ║
6 * ║ Built on OSIRIS by Souleimen Mrad ║
7 * ╚══════════════════════════════════════════════════════════════════╝
8 */
9
10// ── Domain Classification ──────────────────────────────────────────
11
12export enum Domain {
13 AIR = 'AIR',
14 SEA = 'SEA',
15 LAND = 'LAND',
16 SPACE = 'SPACE',
17 CYBER = 'CYBER',
18 EW = 'EW', // Electronic Warfare (GPS jamming, SIGINT)
19 SUBSURFACE = 'SUBSURFACE',
20}
21
22export enum EntityType {
23 TRACK = 'TRACK', // Moving entity (aircraft, ship, satellite)
24 FACILITY = 'FACILITY', // Static installation (port, base, reactor)
25 EVENT = 'EVENT', // Temporal occurrence (earthquake, fire, conflict)
26 SENSOR = 'SENSOR', // Data collection point (CCTV, radiation monitor)
27 SIGNAL = 'SIGNAL', // Electronic emission (GPS jam, radar)
28 INTEL = 'INTEL', // Intelligence product (news, GDELT, CVE)
29}
30
31export enum ThreatLevel {
32 NONE = 'NONE',
33 LOW = 'LOW',
34 ELEVATED = 'ELEVATED',
35 HIGH = 'HIGH',
36 CRITICAL = 'CRITICAL',
37}
38
39export enum Classification {
40 UNCLASSIFIED = 'UNCLASSIFIED',
41 FOUO = 'FOUO',
42 CONFIDENTIAL = 'CONFIDENTIAL',
43 SECRET = 'SECRET',
44}
45
46// ── Core Entity Interface ──────────────────────────────────────────
47
48export interface PolybolosEntity {
49 /** Globally unique entity identifier */
50 id: string;
51 /** Human-readable name or callsign */
52 name: string;
53 /** Primary domain classification */
54 domain: Domain;
55 /** Entity type classification */
56 entityType: EntityType;
57 /** Geographic position (WGS84) */
58 position: {
59 lat: number;
60 lng: number;
61 alt?: number; // meters above sea level
62 heading?: number; // degrees true
63 speed?: number; // knots
64 };
65 /** Threat assessment */
66 threat: ThreatLevel;
67 /** Data classification */
68 classification: Classification;
69 /** Source attribution */
70 source: EntitySource;
71 /** ISO 8601 timestamp of last observation */
72 timestamp: string;
73 /** Extended properties (domain-specific) */
74 properties: Record<string, unknown>;
75 /** Visual rendering hints */
76 display: EntityDisplay;
77}
78
79export interface EntitySource {
80 /** Source system identifier */
81 provider: string;
82 /** Feed or sensor name */
83 feed: string;
84 /** Original provider entity ID */
85 originalId?: string;
86 /** Confidence score 0.0–1.0 */
87 confidence: number;
88}
89
90export interface EntityDisplay {
91 /** Primary color (hex) */
92 color: string;
93 /** Icon identifier */
94 icon: string;
95 /** MapLibre layer type hint */
96 layerType: 'circle' | 'symbol' | 'line';
97 /** Glow/pulse effect */
98 glow?: boolean;
99 /** Size multiplier */
100 scale?: number;
101}
102
103// ── Lattice Integration Types ──────────────────────────────────────
104
105export interface LatticeConfig {
106 /** Lattice endpoint URL */
107 endpoint: string;
108 /** Authentication token */
109 token: string;
110 /** Subscription filter */
111 entityFilter?: LatticeEntityFilter;
112 /** Connection status callback */
113 onStatusChange?: (status: LatticeConnectionStatus) => void;
114}
115
116export interface LatticeEntityFilter {
117 domains?: Domain[];
118 entityTypes?: EntityType[];
119 boundingBox?: {
120 north: number;
121 south: number;
122 east: number;
123 west: number;
124 };
125}
126
127export type LatticeConnectionStatus =
128 | 'disconnected'
129 | 'connecting'
130 | 'authenticated'
131 | 'streaming'
132 | 'error';
133
134// ── SDK Client Types ───────────────────────────────────────────────
135
136export interface PolybolosClientConfig {
137 /** Base URL for OSIRIS API endpoints */
138 osirisBaseUrl: string;
139 /** Optional Lattice configuration */
140 lattice?: LatticeConfig;
141 /** Entity update callback */
142 onEntityUpdate?: (entities: PolybolosEntity[]) => void;
143 /** Connection status callback */
144 onStatusChange?: (status: SDKStatus) => void;
145}
146
147export interface SDKStatus {
148 connected: boolean;
149 feedCount: number;
150 entityCount: number;
151 latticeStatus: LatticeConnectionStatus;
152 lastUpdate: string;
153 uptime: number;
154}
155
156// ── Stream Event Types ─────────────────────────────────────────────
157
158export type StreamEventType =
159 | 'entity_update'
160 | 'entity_remove'
161 | 'status'
162 | 'heartbeat'
163 | 'alert';
164
165export interface StreamEvent {
166 type: StreamEventType;
167 timestamp: string;
168 payload: PolybolosEntity[] | SDKStatus | { id: string }[];
169}
170
171// ── Ingestion Types (External Push) ────────────────────────────────
172
173export interface IngestPayload {
174 /** Source system identifier */
175 source: string;
176 /** Authentication key */
177 apiKey: string;
178 /** Entities to ingest */
179 entities: Partial<PolybolosEntity>[];
180}
181
182export interface IngestResult {
183 accepted: number;
184 rejected: number;
185 errors: string[];
186 timestamp: string;
187}