empathai-core 0.1.8 → 0.2.1

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 CHANGED
@@ -1,4 +1,4 @@
1
- # empathai-core
1
+ # @empathai/core
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/empathai-core.svg)](https://www.npmjs.com/package/empathai-core)
4
4
  [![license: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
@@ -15,11 +15,133 @@ It is intentionally **privacy-first** — no camera/mic required.
15
15
 
16
16
  ---
17
17
 
18
- ## Install
18
+ ## What EmpathAI Core Does
19
+
20
+ - Captures **non-intrusive user behavior signals**
21
+ - Infers **basic emotional states** (deterministic v1)
22
+ - Emits **structured emotion data** with confidence & timestamp
23
+ - Works entirely **on the client**
24
+ - Stores **no personal data**
25
+ - Safe for **BFSI / SaaS / FinTech / enterprise / privacy-sensitive environments**
26
+
27
+ ---
28
+
29
+ ## What EmpathAI Core Does NOT Do
30
+
31
+ - No camera access
32
+ - No microphone access
33
+ - No personal data collection
34
+
35
+ EmpathAI Core provides **signals**, not decisions.
36
+
37
+ ---
38
+
39
+ ## React (Recommended for React Apps)
40
+
41
+ import { useEmpathAI } from 'empathai-core/hooks';
42
+
43
+ function App() {
44
+ const { emotion } = useEmpathAI({
45
+ enableMouseTracking: true,
46
+ enableKeyboardTracking: true,
47
+ });
48
+
49
+ return (
50
+ <div>
51
+ <h2>Current emotion</h2>
52
+ <p>{emotion.type}</p>
53
+ <p>Confidence: {emotion.confidence}</p>
54
+ </div>
55
+ );
56
+ }
57
+
58
+ export default App;
59
+
60
+ ---
61
+
62
+ ## JavaScript (Vanilla JS)
63
+
64
+ import { createEmpathAI } from 'empathai-core';
65
+
66
+ const empathAI = createEmpathAI({
67
+ onEmotionDetected: (emotion) => {
68
+ console.log('Emotion detected:', emotion);
69
+ }
70
+ });
71
+
72
+ empathAI.init();
73
+
74
+ // Optional cleanup
75
+ window.addEventListener('beforeunload', () => {
76
+ empathAI.destroy();
77
+ });
78
+
79
+ ---
80
+
81
+ ## Java Backend with Web Frontend
82
+
83
+ Frontend (JavaScript)
84
+ import { createEmpathAI } from 'empathai-core';
85
+
86
+ const empathAI = createEmpathAI({
87
+ onEmotionDetected: (emotion) => {
88
+ fetch('/api/emotion', {
89
+ method: 'POST',
90
+ headers: { 'Content-Type': 'application/json' },
91
+ body: JSON.stringify(emotion),
92
+ });
93
+ }
94
+ });
95
+
96
+ empathAI.init();
97
+
98
+ **Backend (Spring Boot example)**
99
+ @RestController
100
+ @RequestMapping("/api")
101
+ public class EmotionController {
102
+
103
+ @PostMapping("/emotion")
104
+ public ResponseEntity<Void> receiveEmotion(@RequestBody EmotionPayload payload) {
105
+ // Store, analyze, or react to emotion signal
106
+ return ResponseEntity.ok().build();
107
+ }
108
+ }
109
+
110
+ ---
111
+
112
+ ## Python Backend with Web Frontend
113
+
114
+ Frontend (JavaScript)
115
+ import { createEmpathAI } from 'empathai-core';
116
+
117
+ const empathAI = createEmpathAI({
118
+ onEmotionDetected: (emotion) => {
119
+ fetch('/emotion', {
120
+ method: 'POST',
121
+ headers: { 'Content-Type': 'application/json' },
122
+ body: JSON.stringify(emotion),
123
+ });
124
+ }
125
+ });
126
+
127
+ empathAI.init();
128
+
129
+ **Backend (Flask example)**
130
+ from flask import Flask, request
131
+
132
+ app = Flask(__name__)
133
+
134
+ @app.route("/emotion", methods=["POST"])
135
+ def receive_emotion():
136
+ data = request.json
137
+ # Process emotion signal
138
+ return "", 200
139
+
140
+ ---
141
+
142
+ ## Installation
19
143
 
20
144
  ```bash
21
- # npm
22
145
  npm install empathai-core
23
-
24
- # pnpm
146
+ # or
25
147
  pnpm add empathai-core
package/dist/index.d.ts CHANGED
@@ -1,16 +1,60 @@
1
- import { EmotionType, EmpathAIOptions } from './types';
1
+ import { EmotionData, EmpathAIOptions } from './types';
2
+ /**
3
+ * Core EmpathAI engine
4
+ * - Behavior-signal driven
5
+ * - Time-window aggregated
6
+ * - Privacy-first
7
+ * - Deterministic v1 (ML-ready)
8
+ */
2
9
  export declare class EmpathAI {
3
- private options?;
4
- private emotion;
5
- private listeners;
6
- constructor(options?: EmpathAIOptions | undefined);
10
+ private options;
11
+ private currentEmotion;
12
+ private currentConfidence;
13
+ private emotionListeners;
14
+ private mouseSignals;
15
+ private keySignals;
16
+ private readonly SIGNAL_WINDOW_MS;
17
+ private readonly ANALYSIS_INTERVAL_MS;
18
+ private analysisTimer?;
19
+ private initialized;
20
+ constructor(options?: EmpathAIOptions);
21
+ /**
22
+ * Initialize tracking (idempotent)
23
+ */
7
24
  init(): void;
25
+ /**
26
+ * Cleanup listeners & timers
27
+ */
8
28
  destroy(): void;
29
+ /**
30
+ * Mouse movement tracking
31
+ */
9
32
  private handleMouseMove;
33
+ /**
34
+ * Keyboard tracking
35
+ */
10
36
  private handleKeyDown;
11
- private updateEmotion;
12
- onEmotionChange(callback: (emotion: EmotionType) => void): void;
13
- getCurrentEmotion(): EmotionType;
37
+ /**
38
+ * Core emotion inference logic
39
+ * (deterministic, explainable, extendable)
40
+ */
41
+ private analyzeSignals;
42
+ /**
43
+ * Emit emotion change event
44
+ */
45
+ private emitEmotion;
46
+ /**
47
+ * Subscribe to emotion updates
48
+ * Returns unsubscribe function
49
+ */
50
+ onEmotionChange(callback: (data: EmotionData) => void): () => void;
51
+ /**
52
+ * Get current emotion snapshot
53
+ */
54
+ getCurrentEmotion(): EmotionData;
14
55
  }
15
- export declare const empathAI: EmpathAI;
56
+ /**
57
+ * Factory method (recommended usage)
58
+ */
59
+ export declare function createEmpathAI(options?: EmpathAIOptions): EmpathAI;
16
60
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAEvD,qBAAa,QAAQ;IAIP,OAAO,CAAC,OAAO,CAAC;IAH5B,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CAOjC;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,OAAO,CAAC,EAAE,eAAe,YAEvD"}
package/dist/index.js CHANGED
@@ -1,56 +1,148 @@
1
+ // packages/core/src/index.ts
2
+ /**
3
+ * Core EmpathAI engine
4
+ * - Behavior-signal driven
5
+ * - Time-window aggregated
6
+ * - Privacy-first
7
+ * - Deterministic v1 (ML-ready)
8
+ */
1
9
  export class EmpathAI {
2
- constructor(options) {
10
+ constructor(options = {}) {
3
11
  this.options = options;
4
- this.emotion = 'neutral';
5
- this.listeners = [];
12
+ this.currentEmotion = 'neutral';
13
+ this.currentConfidence = 0.5;
14
+ this.emotionListeners = [];
15
+ this.mouseSignals = [];
16
+ this.keySignals = [];
17
+ this.SIGNAL_WINDOW_MS = 3000;
18
+ this.ANALYSIS_INTERVAL_MS = 1000;
19
+ this.initialized = false;
20
+ /**
21
+ * Mouse movement tracking
22
+ */
6
23
  this.handleMouseMove = (e) => {
7
- // Sample rule: fast/erratic movement = frustration
8
24
  const speed = Math.abs(e.movementX) + Math.abs(e.movementY);
9
- if (speed > 50) {
10
- this.updateEmotion('frustrated');
11
- }
12
- else {
13
- this.updateEmotion('neutral');
14
- }
25
+ this.mouseSignals.push({
26
+ speed,
27
+ timestamp: Date.now(),
28
+ });
15
29
  };
30
+ /**
31
+ * Keyboard tracking
32
+ */
16
33
  this.handleKeyDown = (e) => {
17
- // Sample rule: fast typing = focus; delete spam = frustration
18
- if (e.key === 'Backspace') {
19
- this.updateEmotion('frustrated');
34
+ this.keySignals.push({
35
+ key: e.key,
36
+ timestamp: Date.now(),
37
+ });
38
+ };
39
+ /**
40
+ * Core emotion inference logic
41
+ * (deterministic, explainable, extendable)
42
+ */
43
+ this.analyzeSignals = () => {
44
+ const now = Date.now();
45
+ // Keep only recent signals
46
+ this.mouseSignals = this.mouseSignals.filter((s) => now - s.timestamp <= this.SIGNAL_WINDOW_MS);
47
+ this.keySignals = this.keySignals.filter((s) => now - s.timestamp <= this.SIGNAL_WINDOW_MS);
48
+ let nextEmotion = 'neutral';
49
+ let confidence = 0.3;
50
+ const avgMouseSpeed = this.mouseSignals.reduce((sum, s) => sum + s.speed, 0) /
51
+ (this.mouseSignals.length || 1);
52
+ const backspaceCount = this.keySignals.filter((k) => k.key === 'Backspace').length;
53
+ const typingCount = this.keySignals.length;
54
+ // --- Emotion inference rules (v1) ---
55
+ if (avgMouseSpeed > 60 && backspaceCount > 2) {
56
+ nextEmotion = 'frustrated';
57
+ confidence = 0.8;
20
58
  }
21
- else {
22
- this.updateEmotion('focused');
59
+ else if (typingCount > 15 && backspaceCount === 0) {
60
+ nextEmotion = 'focused';
61
+ confidence = 0.7;
23
62
  }
63
+ else if (typingCount === 0 && this.mouseSignals.length < 3) {
64
+ nextEmotion = 'bored';
65
+ confidence = 0.6;
66
+ }
67
+ this.emitEmotion(nextEmotion, confidence);
24
68
  };
25
69
  }
70
+ /**
71
+ * Initialize tracking (idempotent)
72
+ */
26
73
  init() {
27
- if (this.options?.enableMouseTracking !== false) {
74
+ if (typeof window === 'undefined')
75
+ return;
76
+ if (this.initialized)
77
+ return;
78
+ this.initialized = true;
79
+ if (this.options.enableMouseTracking !== false) {
28
80
  window.addEventListener('mousemove', this.handleMouseMove);
29
81
  }
30
- if (this.options?.enableKeyboardTracking !== false) {
82
+ if (this.options.enableKeyboardTracking !== false) {
31
83
  window.addEventListener('keydown', this.handleKeyDown);
32
84
  }
33
- if (this.options?.onInit) {
34
- this.options.onInit();
35
- }
85
+ this.analysisTimer = setInterval(this.analyzeSignals, this.ANALYSIS_INTERVAL_MS);
86
+ this.options.onInit?.();
36
87
  }
88
+ /**
89
+ * Cleanup listeners & timers
90
+ */
37
91
  destroy() {
92
+ if (typeof window === 'undefined')
93
+ return;
94
+ if (!this.initialized)
95
+ return;
38
96
  window.removeEventListener('mousemove', this.handleMouseMove);
39
97
  window.removeEventListener('keydown', this.handleKeyDown);
40
- }
41
- updateEmotion(newEmotion) {
42
- if (this.emotion !== newEmotion) {
43
- this.emotion = newEmotion;
44
- this.listeners.forEach((listener) => listener(this.emotion));
98
+ if (this.analysisTimer) {
99
+ clearInterval(this.analysisTimer);
45
100
  }
101
+ this.mouseSignals = [];
102
+ this.keySignals = [];
103
+ this.initialized = false;
46
104
  }
105
+ /**
106
+ * Emit emotion change event
107
+ */
108
+ emitEmotion(type, confidence) {
109
+ if (type === this.currentEmotion)
110
+ return;
111
+ this.currentEmotion = type;
112
+ this.currentConfidence = confidence;
113
+ const payload = {
114
+ type,
115
+ confidence,
116
+ timestamp: Date.now(),
117
+ };
118
+ this.emotionListeners.forEach((listener) => listener(payload));
119
+ this.options.onEmotionDetected?.(payload);
120
+ }
121
+ /**
122
+ * Subscribe to emotion updates
123
+ * Returns unsubscribe function
124
+ */
47
125
  onEmotionChange(callback) {
48
- this.listeners.push(callback);
126
+ this.emotionListeners.push(callback);
127
+ return () => {
128
+ this.emotionListeners = this.emotionListeners.filter((l) => l !== callback);
129
+ };
49
130
  }
131
+ /**
132
+ * Get current emotion snapshot
133
+ */
50
134
  getCurrentEmotion() {
51
- return this.emotion;
135
+ return {
136
+ type: this.currentEmotion,
137
+ confidence: this.currentConfidence,
138
+ timestamp: Date.now(),
139
+ };
52
140
  }
53
141
  }
54
- // ⚡️ Export reusable instance — import { empathAI } from '@empathai/core'
55
- export const empathAI = new EmpathAI();
142
+ /**
143
+ * Factory method (recommended usage)
144
+ */
145
+ export function createEmpathAI(options) {
146
+ return new EmpathAI(options);
147
+ }
56
148
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,QAAQ;IAInB,YAAoB,OAAyB;QAAzB,YAAO,GAAP,OAAO,CAAkB;QAHrC,YAAO,GAAgB,SAAS,CAAC;QACjC,cAAS,GAA0C,EAAE,CAAC;QAuBtD,oBAAe,GAAG,CAAC,CAAa,EAAE,EAAE;YAC1C,mDAA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;IAED;;OAEG;IACH,iBAAiB;QACf,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,cAAc;YACzB,UAAU,EAAE,IAAI,CAAC,iBAAiB;YAClC,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;SACtB,CAAC;IACJ,CAAC;CACF;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,OAAyB;IACtD,OAAO,IAAI,QAAQ,CAAC,OAAO,CAAC,CAAC;AAC/B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "empathai-core",
3
- "version": "0.1.8",
3
+ "version": "0.2.1",
4
4
  "description": "Non-intrusive behavior-based emotion detection SDK (keyboard & mouse) — EmpathAI core.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -31,10 +31,11 @@
31
31
  "react": "^17 || ^18 || ^19"
32
32
  },
33
33
  "devDependencies": {
34
- "typescript": "^5.4.5",
35
- "vitest": "^0.34.0",
34
+ "@types/node": "^20.0.0",
36
35
  "eslint": "^8.0.0",
37
- "@types/node": "^20.0.0"
36
+ "jsdom": "^24.1.3",
37
+ "typescript": "^5.4.5",
38
+ "vitest": "^1.6.1"
38
39
  },
39
40
  "publishConfig": {
40
41
  "access": "public"