@trillboards/edge-core 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +93 -0
- package/package.json +15 -1
package/README.md
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# @trillboards/edge-core
|
|
2
|
+
|
|
3
|
+
> **Core runtime for Trillboards Edge AI SDK.** Device identity, Socket.io connectivity, configuration, signal buffering, health monitoring, and auto-recovery for DOOH/CTV devices.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @trillboards/edge-core
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## What This Does
|
|
12
|
+
|
|
13
|
+
Provides the foundational infrastructure that all other `@trillboards/edge-*` packages depend on:
|
|
14
|
+
|
|
15
|
+
- **Device Identity** — generates stable device fingerprints and session IDs from hardware characteristics
|
|
16
|
+
- **Socket.io Manager** — real-time connection to Trillboards API with auto-reconnection and telemetry emission
|
|
17
|
+
- **Signal Buffer** — SQLite-backed offline queue that caches audience metrics when connectivity drops
|
|
18
|
+
- **Health Registry** — tracks 6 subsystems (socket, player, camera, microphone, ML pipeline, memory)
|
|
19
|
+
- **Recovery Ladder** — 6-level auto-recovery from reconnect through service restart to rollback
|
|
20
|
+
- **Capability Tiers** — classifies devices into TIER_1 through TIER_4 based on RAM and NPU availability
|
|
21
|
+
- **Sensing Config** — deserializes 70+ sensing parameters for audience measurement tuning
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
import {
|
|
27
|
+
DeviceIdentity,
|
|
28
|
+
SocketManager,
|
|
29
|
+
SignalBuffer,
|
|
30
|
+
SubsystemHealthRegistry,
|
|
31
|
+
SensingConfig,
|
|
32
|
+
computeTier,
|
|
33
|
+
classifyObservationSignal
|
|
34
|
+
} from '@trillboards/edge-core';
|
|
35
|
+
|
|
36
|
+
// Device identity
|
|
37
|
+
const identity = new DeviceIdentity();
|
|
38
|
+
const fingerprint = await identity.getFingerprint();
|
|
39
|
+
|
|
40
|
+
// Capability detection
|
|
41
|
+
const tier = computeTier({ ramMB: 4096, hasNPU: false });
|
|
42
|
+
// → TIER_2
|
|
43
|
+
|
|
44
|
+
// Socket.io connectivity
|
|
45
|
+
const socket = new SocketManager({
|
|
46
|
+
url: 'https://api.trillboards.com',
|
|
47
|
+
deviceToken: 'your-token'
|
|
48
|
+
});
|
|
49
|
+
await socket.connect();
|
|
50
|
+
|
|
51
|
+
// Offline-resilient signal buffering
|
|
52
|
+
const buffer = new SignalBuffer({ dataDir: './data' });
|
|
53
|
+
await buffer.push({ type: 'audience_metrics', payload: { faceCount: 3 } });
|
|
54
|
+
|
|
55
|
+
// Signal classification
|
|
56
|
+
const signal = classifyObservationSignal(rawPayload);
|
|
57
|
+
// → { family: 'SCREEN_AUDIENCE', evidenceGrade: 'FACE_BACKED', ... }
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Subsystem Health Monitoring
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
const health = new SubsystemHealthRegistry();
|
|
64
|
+
|
|
65
|
+
health.update('camera', 'healthy');
|
|
66
|
+
health.update('ml_pipeline', 'degraded');
|
|
67
|
+
|
|
68
|
+
const report = health.getReport();
|
|
69
|
+
// → { camera: 'healthy', ml_pipeline: 'degraded', ... }
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Capability Matrix
|
|
73
|
+
|
|
74
|
+
```typescript
|
|
75
|
+
import { getCapabilityMatrix } from '@trillboards/edge-core';
|
|
76
|
+
|
|
77
|
+
const matrix = getCapabilityMatrix(tier);
|
|
78
|
+
// → { models: ['blazeface'], inferenceHz: 2, resolution: 320, ... }
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Key Types
|
|
82
|
+
|
|
83
|
+
- `PlatformAdapter` — interface for platform-specific adapters (Linux, Windows)
|
|
84
|
+
- `CameraProvider` — interface for camera capture implementations
|
|
85
|
+
- `AudioProvider` — interface for audio capture implementations
|
|
86
|
+
- `AudienceMetricsPayload` — structured audience measurement data
|
|
87
|
+
- `VASResult` — Viewability Attention Score output
|
|
88
|
+
- `DetectedFace` — face detection result with bounding box, age, gender, emotion
|
|
89
|
+
- `EdgeQualityReport` — inference quality telemetry
|
|
90
|
+
|
|
91
|
+
## License
|
|
92
|
+
|
|
93
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trillboards/edge-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Core identity, heartbeat, Socket.io, config, and signal buffer for Trillboards Edge AI SDK",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -34,6 +34,20 @@
|
|
|
34
34
|
"url": "https://github.com/trillboards/packages.git",
|
|
35
35
|
"directory": "trillboards-edge-sdk/packages/edge-core"
|
|
36
36
|
},
|
|
37
|
+
"keywords": [
|
|
38
|
+
"edge-ai",
|
|
39
|
+
"dooh",
|
|
40
|
+
"audience-sensing",
|
|
41
|
+
"iot",
|
|
42
|
+
"digital-signage",
|
|
43
|
+
"heartbeat",
|
|
44
|
+
"socket-io",
|
|
45
|
+
"device-identity",
|
|
46
|
+
"ctv",
|
|
47
|
+
"signal-buffer",
|
|
48
|
+
"trillboards",
|
|
49
|
+
"ai-agent"
|
|
50
|
+
],
|
|
37
51
|
"engines": {
|
|
38
52
|
"node": ">=18.0.0"
|
|
39
53
|
}
|