@athena-tracker/tracker 1.0.0 → 1.0.2

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.
@@ -1 +0,0 @@
1
- {"version":3,"file":"on-device.d.ts","sourceRoot":"","sources":["../../src/inference/on-device.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,gBAAgB,EAAS,MAAM,UAAU,CAAC;AAkBnD,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,OAAO,CAAoB;IACnC,OAAO,CAAC,WAAW,CAAkB;IAErC;;OAEG;IACG,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAsBlD;;OAEG;IACG,OAAO,CAAC,QAAQ,EAAE,YAAY,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAoChE;;OAEG;IACH,OAAO,CAAC,WAAW;IAsDnB;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAgD9B;;OAEG;IACH,OAAO,IAAI,OAAO;IAIlB;;OAEG;IACG,OAAO,IAAI,IAAI;CAatB"}
@@ -1,30 +0,0 @@
1
- /**
2
- * Server-Side Inference Module
3
- *
4
- * Fallback inference via HTTP API when on-device inference is not available
5
- * Target latency: <100ms P95
6
- */
7
- import { PredictionResult, Event } from '../types';
8
- export declare class ServerInference {
9
- private apiUrl;
10
- private appToken;
11
- private timeout;
12
- constructor(apiUrl: string, appToken: string, timeout?: number);
13
- /**
14
- * Make prediction request to server
15
- */
16
- predict(events: Event[], sessionId?: string, userId?: string): Promise<PredictionResult>;
17
- /**
18
- * Fetch with timeout
19
- */
20
- private fetchWithTimeout;
21
- /**
22
- * Test server connectivity
23
- */
24
- testConnection(): Promise<boolean>;
25
- /**
26
- * Update configuration
27
- */
28
- updateConfig(apiUrl?: string, appToken?: string, timeout?: number): void;
29
- }
30
- //# sourceMappingURL=server.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/inference/server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAmD,MAAM,UAAU,CAAC;AAEpG,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,OAAO,CAAS;gBAEZ,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,MAAa;IAMpE;;OAEG;IACG,OAAO,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAgD9F;;OAEG;YACW,gBAAgB;IAoB9B;;OAEG;IACG,cAAc,IAAI,OAAO,CAAC,OAAO,CAAC;IAaxC;;OAEG;IACH,YAAY,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI;CAKzE"}
@@ -1,26 +0,0 @@
1
- /**
2
- * ATHENA OTA Wrapper
3
- *
4
- * Wraps the React Native app and forces a reload on first launch after OTA update
5
- * This ensures the ATHENA tracker is loaded fresh after deployment
6
- *
7
- * Usage:
8
- * import { AthenaOTAWrapper } from '@athena/tracker';
9
- *
10
- * export default function App() {
11
- * return (
12
- * <AthenaOTAWrapper>
13
- * <YourAppContent />
14
- * </AthenaOTAWrapper>
15
- * );
16
- * }
17
- */
18
- import React, { ReactNode } from 'react';
19
- interface AthenaOTAWrapperProps {
20
- children: ReactNode;
21
- loadingMessage?: string;
22
- updateMessage?: string;
23
- }
24
- export declare function AthenaOTAWrapper({ children, loadingMessage, updateMessage }: AthenaOTAWrapperProps): React.JSX.Element;
25
- export default AthenaOTAWrapper;
26
- //# sourceMappingURL=ForcedReloadWrapper.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ForcedReloadWrapper.d.ts","sourceRoot":"","sources":["../../src/react-native/ForcedReloadWrapper.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,EAAuB,SAAS,EAAE,MAAM,OAAO,CAAC;AAgB9D,UAAU,qBAAqB;IAC7B,QAAQ,EAAE,SAAS,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,cAA6B,EAC7B,aAA6B,EAC9B,EAAE,qBAAqB,qBA4EvB;AAwBD,eAAe,gBAAgB,CAAC"}
package/dist/tracker.d.ts DELETED
@@ -1,82 +0,0 @@
1
- /**
2
- * ATHENA Tracker - Main Class
3
- *
4
- * Unified interface for behavioral tracking with dual-mode ML inference
5
- */
6
- import { AthenaConfig } from './types';
7
- export declare class AthenaTracker {
8
- private static instance;
9
- private config;
10
- private state;
11
- private onDeviceInference;
12
- private serverInference;
13
- private batchIntervalId;
14
- private constructor();
15
- /**
16
- * Get singleton instance
17
- */
18
- private static getInstance;
19
- /**
20
- * Initialize tracker
21
- */
22
- static init(config: AthenaConfig): Promise<void>;
23
- /**
24
- * Initialize on-device inference
25
- */
26
- private initializeOnDevice;
27
- /**
28
- * Initialize server-side inference
29
- */
30
- private initializeServer;
31
- /**
32
- * Identify a user
33
- */
34
- static identify(userId: string, traits?: Record<string, any>): void;
35
- /**
36
- * Track an event
37
- */
38
- static track(eventType: string, properties?: Record<string, any>): void;
39
- /**
40
- * Process event batch and run inference
41
- */
42
- private processBatch;
43
- /**
44
- * Run inference (delegates to on-device or server)
45
- */
46
- private runInference;
47
- /**
48
- * Extract features from events (placeholder)
49
- * In production, this would use proper feature engineering
50
- */
51
- private extractFeatures;
52
- /**
53
- * Send prediction to webhook
54
- */
55
- private sendWebhook;
56
- /**
57
- * Start event batching interval
58
- */
59
- private startBatching;
60
- /**
61
- * Get inference mode
62
- */
63
- static getInferenceMode(): 'on-device' | 'server' | null;
64
- /**
65
- * Get session ID
66
- */
67
- static getSessionId(): string | null;
68
- /**
69
- * Cleanup resources
70
- */
71
- static dispose(): Promise<void>;
72
- /**
73
- * Generate session ID
74
- */
75
- private generateSessionId;
76
- /**
77
- * Sleep utility
78
- */
79
- private sleep;
80
- }
81
- export default AthenaTracker;
82
- //# sourceMappingURL=tracker.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tracker.d.ts","sourceRoot":"","sources":["../src/tracker.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,EAAyC,MAAM,SAAS,CAAC;AAU9E,qBAAa,aAAa;IACxB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAA8B;IACrD,OAAO,CAAC,MAAM,CAA6B;IAC3C,OAAO,CAAC,KAAK,CAMX;IAEF,OAAO,CAAC,iBAAiB,CAAkC;IAC3D,OAAO,CAAC,eAAe,CAAgC;IACvD,OAAO,CAAC,eAAe,CAAa;IAEpC,OAAO;IAIP;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,WAAW;IAO1B;;OAEG;WACU,IAAI,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAyCtD;;OAEG;YACW,kBAAkB;IAahC;;OAEG;YACW,gBAAgB;IAe9B;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI;IAYnE;;OAEG;IACH,MAAM,CAAC,KAAK,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI;IA4BvE;;OAEG;YACW,YAAY;IAuB1B;;OAEG;YACW,YAAY;IAgB1B;;;OAGG;IACH,OAAO,CAAC,eAAe;IA+BvB;;OAEG;YACW,WAAW;IAyCzB;;OAEG;IACH,OAAO,CAAC,aAAa;IAMrB;;OAEG;IACH,MAAM,CAAC,gBAAgB,IAAI,WAAW,GAAG,QAAQ,GAAG,IAAI;IAIxD;;OAEG;IACH,MAAM,CAAC,YAAY,IAAI,MAAM,GAAG,IAAI;IAIpC;;OAEG;WACU,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAerC;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAIzB;;OAEG;IACH,OAAO,CAAC,KAAK;CAGd;AAED,eAAe,aAAa,CAAC"}
@@ -1,96 +0,0 @@
1
- /**
2
- * @athena/tracker Type Definitions
3
- */
4
- export type InferenceMode = 'auto' | 'on-device' | 'server';
5
- export type UserArchetype = 'fast_mover' | 'on_track' | 'slow_adopter' | 'at_risk' | 'different_path';
6
- export interface AthenaConfig {
7
- /** App token from ATHENA provisioning API */
8
- appToken: string;
9
- /** API base URL (default: https://tracker.pascal.cx) */
10
- apiUrl?: string;
11
- /** Inference mode: auto-detect, force on-device, or force server */
12
- inferenceMode?: InferenceMode;
13
- /** Path to ONNX model file (for on-device inference) */
14
- modelPath?: string;
15
- /** Server-side inference endpoint (default: /v1/predict) */
16
- serverInferenceUrl?: string;
17
- /** Webhook configuration */
18
- webhook?: WebhookConfig;
19
- /** Event batching configuration */
20
- batching?: BatchingConfig;
21
- /** Debug mode */
22
- debug?: boolean;
23
- }
24
- export interface WebhookConfig {
25
- /** Webhook URL to receive predictions */
26
- url: string;
27
- /** Enable webhook delivery */
28
- enabled?: boolean;
29
- /** Retry configuration */
30
- retry?: {
31
- maxAttempts?: number;
32
- backoffMs?: number;
33
- };
34
- }
35
- export interface BatchingConfig {
36
- /** Batch size (number of events) */
37
- size?: number;
38
- /** Batch interval (milliseconds) */
39
- intervalMs?: number;
40
- }
41
- export interface Event {
42
- event_type: string;
43
- timestamp: number;
44
- properties?: Record<string, any>;
45
- url?: string;
46
- selector?: string;
47
- session_id?: string;
48
- user_id?: string;
49
- }
50
- export interface PredictionResult {
51
- /** Predicted class label */
52
- predicted_class: string;
53
- /** Confidence score (0-1) */
54
- confidence: number;
55
- /** User archetype classification */
56
- archetype: UserArchetype;
57
- /** Purchase intent score (0-1) */
58
- purchase_intent: number;
59
- /** Cart abandonment risk (0-1) */
60
- cart_abandonment_risk?: number;
61
- /** Checkout abandonment risk (0-1) */
62
- checkout_abandonment_risk?: number;
63
- /** Recommended action for external systems */
64
- recommended_action?: string;
65
- /** Urgency level */
66
- urgency?: 'low' | 'medium' | 'high' | 'critical';
67
- /** Trigger reason (human-readable) */
68
- trigger_reason?: string;
69
- /** Inference latency (milliseconds) */
70
- inference_time_ms: number;
71
- /** Where inference occurred */
72
- inference_location: 'on-device' | 'server';
73
- /** Timestamp */
74
- timestamp?: string;
75
- }
76
- export interface ServerInferenceRequest {
77
- app_token: string;
78
- events: Event[];
79
- session_id?: string;
80
- user_id?: string;
81
- }
82
- export interface ServerInferenceResponse extends PredictionResult {
83
- }
84
- export interface FeatureVector {
85
- temporal: number[];
86
- session: number[];
87
- to_vector(): Float32Array;
88
- }
89
- export interface TrackerState {
90
- initialized: boolean;
91
- inferenceMode: 'on-device' | 'server' | null;
92
- sessionId: string | null;
93
- userId: string | null;
94
- events: Event[];
95
- }
96
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAC;AAE5D,MAAM,MAAM,aAAa,GACrB,YAAY,GACZ,UAAU,GACV,cAAc,GACd,SAAS,GACT,gBAAgB,CAAC;AAErB,MAAM,WAAW,YAAY;IAC3B,6CAA6C;IAC7C,QAAQ,EAAE,MAAM,CAAC;IAEjB,wDAAwD;IACxD,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,oEAAoE;IACpE,aAAa,CAAC,EAAE,aAAa,CAAC;IAE9B,wDAAwD;IACxD,SA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